370 lines
11 KiB
C
Raw Normal View History

2012-08-14 18:07:04 -04:00
/*****************************************************************************
* Model: qhsmtst.qm
2013-09-23 14:34:35 -04:00
* File: ./qhsmtst.c
2012-08-14 18:07:04 -04:00
*
2013-09-23 14:34:35 -04:00
* This code has been generated by QM tool (see state-machine.com/qm).
* DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
2012-08-14 18:07:04 -04:00
*
2013-09-23 14:34:35 -04:00
* This program is open source software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
2012-08-14 18:07:04 -04:00
*****************************************************************************/
2014-04-06 11:43:13 -04:00
/*${.::qhsmtst.c} ..........................................................*/
2012-08-14 18:07:04 -04:00
#include "qep_port.h"
#include "qhsmtst.h"
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst} .........................................................*/
typedef struct {
2012-08-14 18:07:04 -04:00
/* protected: */
QHsm super;
/* private: */
uint8_t foo;
} QHsmTst;
/* protected: */
static QState QHsmTst_initial(QHsmTst * const me, QEvt const * const e);
static QState QHsmTst_s(QHsmTst * const me, QEvt const * const e);
static QState QHsmTst_s1(QHsmTst * const me, QEvt const * const e);
static QState QHsmTst_s11(QHsmTst * const me, QEvt const * const e);
static QState QHsmTst_s2(QHsmTst * const me, QEvt const * const e);
static QState QHsmTst_s21(QHsmTst * const me, QEvt const * const e);
static QState QHsmTst_s211(QHsmTst * const me, QEvt const * const e);
static QHsmTst l_hsmtst; /* the only instance of the QHsmTst class */
/* global-scope definitions ---------------------------------------*/
QHsm * const the_hsm = (QHsm *)&l_hsmtst; /* the opaque pointer */
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst_ctor} ....................................................*/
2012-08-14 18:07:04 -04:00
void QHsmTst_ctor(void) {
QHsmTst *me = &l_hsmtst;
QHsm_ctor(&me->super, Q_STATE_CAST(&QHsmTst_initial));
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst} .........................................................*/
/*${HSMs::QHsmTst::SM} .....................................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_initial(QHsmTst * const me, QEvt const * const e) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::initial} */
2012-08-14 18:07:04 -04:00
(void)e; /* avoid compiler warning */
me->foo = 0U;
BSP_display("top-INIT;");
return Q_TRAN(&QHsmTst_s2);
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst::SM::s} ..................................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_s(QHsmTst * const me, QEvt const * const e) {
2013-09-23 14:34:35 -04:00
QState status_;
2012-08-14 18:07:04 -04:00
switch (e->sig) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s} */
2012-08-14 18:07:04 -04:00
case Q_ENTRY_SIG: {
BSP_display("s-ENTRY;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s} */
2012-08-14 18:07:04 -04:00
case Q_EXIT_SIG: {
BSP_display("s-EXIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::initial} */
2012-08-14 18:07:04 -04:00
case Q_INIT_SIG: {
BSP_display("s-INIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s11);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::I} */
2012-08-14 18:07:04 -04:00
case I_SIG: {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::I::[me->foo]} */
2012-08-14 18:07:04 -04:00
if (me->foo) {
me->foo = 0U;
BSP_display("s-I;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
}
else {
2013-09-23 14:34:35 -04:00
status_ = Q_UNHANDLED();
2012-08-14 18:07:04 -04:00
}
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::E} */
2012-08-14 18:07:04 -04:00
case E_SIG: {
BSP_display("s-E;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s11);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::TERMINATE} */
2012-08-14 18:07:04 -04:00
case TERMINATE_SIG: {
BSP_exit();
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
default: {
2013-09-23 14:34:35 -04:00
status_ = Q_SUPER(&QHsm_top);
2012-08-14 18:07:04 -04:00
break;
}
}
2013-09-23 14:34:35 -04:00
return status_;
2012-08-14 18:07:04 -04:00
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst::SM::s::s1} ..............................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_s1(QHsmTst * const me, QEvt const * const e) {
2013-09-23 14:34:35 -04:00
QState status_;
2012-08-14 18:07:04 -04:00
switch (e->sig) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1} */
2012-08-14 18:07:04 -04:00
case Q_ENTRY_SIG: {
BSP_display("s1-ENTRY;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1} */
2012-08-14 18:07:04 -04:00
case Q_EXIT_SIG: {
BSP_display("s1-EXIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::initial} */
2012-08-14 18:07:04 -04:00
case Q_INIT_SIG: {
BSP_display("s1-INIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s11);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::I} */
2012-08-14 18:07:04 -04:00
case I_SIG: {
BSP_display("s1-I;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::D} */
2012-08-14 18:07:04 -04:00
case D_SIG: {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::D::[!me->foo]} */
2012-08-14 18:07:04 -04:00
if (!me->foo) {
me->foo = 1U;
BSP_display("s1-D;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s);
2012-08-14 18:07:04 -04:00
}
else {
2013-09-23 14:34:35 -04:00
status_ = Q_UNHANDLED();
2012-08-14 18:07:04 -04:00
}
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::A} */
2012-08-14 18:07:04 -04:00
case A_SIG: {
BSP_display("s1-A;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s1);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::B} */
2012-08-14 18:07:04 -04:00
case B_SIG: {
BSP_display("s1-B;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s11);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::F} */
2012-08-14 18:07:04 -04:00
case F_SIG: {
BSP_display("s1-F;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s211);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::C} */
2012-08-14 18:07:04 -04:00
case C_SIG: {
BSP_display("s1-C;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s2);
2012-08-14 18:07:04 -04:00
break;
}
default: {
2013-09-23 14:34:35 -04:00
status_ = Q_SUPER(&QHsmTst_s);
2012-08-14 18:07:04 -04:00
break;
}
}
2013-09-23 14:34:35 -04:00
return status_;
2012-08-14 18:07:04 -04:00
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst::SM::s::s1::s11} .........................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_s11(QHsmTst * const me, QEvt const * const e) {
2013-09-23 14:34:35 -04:00
QState status_;
2012-08-14 18:07:04 -04:00
switch (e->sig) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::s11} */
2012-08-14 18:07:04 -04:00
case Q_ENTRY_SIG: {
BSP_display("s11-ENTRY;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::s11} */
2012-08-14 18:07:04 -04:00
case Q_EXIT_SIG: {
BSP_display("s11-EXIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::s11::H} */
2012-08-14 18:07:04 -04:00
case H_SIG: {
BSP_display("s11-H;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::s11::D} */
2012-08-14 18:07:04 -04:00
case D_SIG: {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::s11::D::[me->foo]} */
2012-08-14 18:07:04 -04:00
if (me->foo) {
me->foo = 0U;
BSP_display("s11-D;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s1);
2012-08-14 18:07:04 -04:00
}
else {
2013-09-23 14:34:35 -04:00
status_ = Q_UNHANDLED();
2012-08-14 18:07:04 -04:00
}
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s1::s11::G} */
2012-08-14 18:07:04 -04:00
case G_SIG: {
BSP_display("s11-G;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s211);
2012-08-14 18:07:04 -04:00
break;
}
default: {
2013-09-23 14:34:35 -04:00
status_ = Q_SUPER(&QHsmTst_s1);
2012-08-14 18:07:04 -04:00
break;
}
}
2013-09-23 14:34:35 -04:00
return status_;
2012-08-14 18:07:04 -04:00
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst::SM::s::s2} ..............................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_s2(QHsmTst * const me, QEvt const * const e) {
2013-09-23 14:34:35 -04:00
QState status_;
2012-08-14 18:07:04 -04:00
switch (e->sig) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2} */
2012-08-14 18:07:04 -04:00
case Q_ENTRY_SIG: {
BSP_display("s2-ENTRY;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2} */
2012-08-14 18:07:04 -04:00
case Q_EXIT_SIG: {
BSP_display("s2-EXIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::initial} */
2012-08-14 18:07:04 -04:00
case Q_INIT_SIG: {
BSP_display("s2-INIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s211);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::I} */
2012-08-14 18:07:04 -04:00
case I_SIG: {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::I::[!me->foo]} */
2012-08-14 18:07:04 -04:00
if (!me->foo) {
me->foo = 1U;
BSP_display("s2-I;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
}
else {
2013-09-23 14:34:35 -04:00
status_ = Q_UNHANDLED();
2012-08-14 18:07:04 -04:00
}
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::F} */
2012-08-14 18:07:04 -04:00
case F_SIG: {
BSP_display("s2-F;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s11);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::C} */
2012-08-14 18:07:04 -04:00
case C_SIG: {
BSP_display("s2-C;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s1);
2012-08-14 18:07:04 -04:00
break;
}
default: {
2013-09-23 14:34:35 -04:00
status_ = Q_SUPER(&QHsmTst_s);
2012-08-14 18:07:04 -04:00
break;
}
}
2013-09-23 14:34:35 -04:00
return status_;
2012-08-14 18:07:04 -04:00
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst::SM::s::s2::s21} .........................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_s21(QHsmTst * const me, QEvt const * const e) {
2013-09-23 14:34:35 -04:00
QState status_;
2012-08-14 18:07:04 -04:00
switch (e->sig) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21} */
2012-08-14 18:07:04 -04:00
case Q_ENTRY_SIG: {
BSP_display("s21-ENTRY;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21} */
2012-08-14 18:07:04 -04:00
case Q_EXIT_SIG: {
BSP_display("s21-EXIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::initial} */
2012-08-14 18:07:04 -04:00
case Q_INIT_SIG: {
BSP_display("s21-INIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s211);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::G} */
2012-08-14 18:07:04 -04:00
case G_SIG: {
BSP_display("s21-G;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s1);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::A} */
2012-08-14 18:07:04 -04:00
case A_SIG: {
BSP_display("s21-A;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s21);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::B} */
2012-08-14 18:07:04 -04:00
case B_SIG: {
BSP_display("s21-B;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s211);
2012-08-14 18:07:04 -04:00
break;
}
default: {
2013-09-23 14:34:35 -04:00
status_ = Q_SUPER(&QHsmTst_s2);
2012-08-14 18:07:04 -04:00
break;
}
}
2013-09-23 14:34:35 -04:00
return status_;
2012-08-14 18:07:04 -04:00
}
2014-04-06 11:43:13 -04:00
/*${HSMs::QHsmTst::SM::s::s2::s21::s211} ...................................*/
2012-08-14 18:07:04 -04:00
static QState QHsmTst_s211(QHsmTst * const me, QEvt const * const e) {
2013-09-23 14:34:35 -04:00
QState status_;
2012-08-14 18:07:04 -04:00
switch (e->sig) {
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::s211} */
2012-08-14 18:07:04 -04:00
case Q_ENTRY_SIG: {
BSP_display("s211-ENTRY;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::s211} */
2012-08-14 18:07:04 -04:00
case Q_EXIT_SIG: {
BSP_display("s211-EXIT;");
2013-09-23 14:34:35 -04:00
status_ = Q_HANDLED();
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::s211::H} */
2012-08-14 18:07:04 -04:00
case H_SIG: {
BSP_display("s211-H;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s);
2012-08-14 18:07:04 -04:00
break;
}
2014-04-06 11:43:13 -04:00
/* ${HSMs::QHsmTst::SM::s::s2::s21::s211::D} */
2012-08-14 18:07:04 -04:00
case D_SIG: {
BSP_display("s211-D;");
2013-09-23 14:34:35 -04:00
status_ = Q_TRAN(&QHsmTst_s21);
2012-08-14 18:07:04 -04:00
break;
}
default: {
2013-09-23 14:34:35 -04:00
status_ = Q_SUPER(&QHsmTst_s21);
2012-08-14 18:07:04 -04:00
break;
}
}
2013-09-23 14:34:35 -04:00
return status_;
2012-08-14 18:07:04 -04:00
}