57Q_DEFINE_THIS_MODULE(
"qep_msm")
61 QMSM_MAX_NEST_DEPTH_ = 6,
64 QMSM_MAX_TRAN_LENGTH_ = 3*QMSM_MAX_NEST_DEPTH_,
67 QMSM_MAX_ENTRY_DEPTH_ = 4
71static struct QMState const l_msm_top_s = {
84#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
85#error qpc version 7.3.0 or higher required
95void QMsm_ctor(
QMsm *
const me,
103 ,&QMsm_getStateHandler_
116 void const *
const e,
117 uint_fast8_t
const qsId)
127 && (me->
state.
obj == &l_msm_top_s));
151 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_;
154 r = QMsm_execTatbl_(me, me->
temp.
tatbl, qsId);
180 QEvt const *
const e,
181 uint_fast8_t
const qsId)
209 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_;
243 }
while ((t != (
QMState *)0) && (limit > 0));
258 limit = QMSM_MAX_NEST_DEPTH_;
267 QMsm_exitToTranSource_(me, s, t, qsId);
268 r = QMsm_execTatbl_(me,
tatbl, qsId);
275 QMsm_exitToTranSource_(me, s, t, qsId);
276 (void)QMsm_execTatbl_(me,
tatbl, qsId);
277 r = QMsm_enterHistory_(me, tmp.
obj, qsId);
293 QMsm_exitToTranSource_(me, s, t, qsId);
295 (void)QMsm_execTatbl_(me,
tatbl, qsId);
305 QMsm_exitToTranSource_(me, me->
state.
obj, t, qsId);
307 (void)QMsm_execTatbl_(me,
tatbl, qsId);
389 bool inState =
false;
392 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_;
393 for (; (s != (
QMState *)0) && (limit > 0); --limit) {
413 QMState const *
const stateObj)
415 bool inState =
false;
418 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_;
419 for (; (s != (
QMState *)0) && (limit > 0); --limit) {
443 bool isFound =
false;
446 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_;
448 (s != (
QMState *)0) && (limit > 0);
466 limit = QMSM_MAX_NEST_DEPTH_;
468 (s != (
QMState *)0) && (limit > 0);
494 uint_fast8_t
const qsId)
508 int_fast8_t limit = QMSM_MAX_TRAN_LENGTH_;
568void QMsm_exitToTranSource_(
572 uint_fast8_t
const qsId)
582 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_;
583 for (; (s != ts) && (limit > 0); --limit) {
587 (void)(*s->exitAction)(me);
593 QS_FUN_PRE_(s->stateHandler);
618 uint_fast8_t
const qsId)
626 QMState const *epath[QMSM_MAX_ENTRY_DEPTH_];
641 while ((s != ts) && (i < QMSM_MAX_ENTRY_DEPTH_)) {
658 (void)(*epath[i]->entryAction)(me);
664 QS_FUN_PRE_(epath[i]->stateHandler);
bool QMsm_isInState(QMsm const *const me, QMState const *const stateObj)
@ Q_RET_ENTRY
state entry action executed
@ Q_RET_HANDLED
event handled (internal transition)
@ Q_RET_TRAN_XP
exit-point transition out of a submachine
@ Q_RET_TRAN_INIT
initial transition in a state or submachine
@ Q_RET_TRAN
regular transition
@ Q_RET_UNHANDLED
event unhandled due to a guard
@ Q_RET_SUPER
event passed to superstate to handle
@ Q_RET_NULL
return value without any effect
@ Q_RET_TRAN_HIST
transition to history of a given state
@ Q_RET_SUPER_SUB
event passed to submachine superstate
@ Q_RET_TRAN_EP
entry-point transition into a submachine
@ Q_RET_EXIT
state exit action executed
#define Q_UNUSED_PAR(par_)
QState(* QStateHandler)(void *const me, QEvt const *const e)
#define Q_STATE_CAST(handler_)
#define Q_ACTION_CAST(action_)
QState(* QActionHandler)(void *const me)
#define Q_EVT_CAST(class_)
Internal (package scope) QP/C interface.
@ QS_QEP_STATE_INIT
an initial transition was taken in a state
@ QS_QEP_TRAN_HIST
a tran to history was taken
@ QS_QEP_TRAN_EP
a tran to entry point into a submachine
@ QS_QEP_STATE_EXIT
a state was exited
@ QS_QEP_INIT_TRAN
the top-most initial transition was taken
@ QS_QEP_INTERN_TRAN
an internal transition was taken
@ QS_QEP_TRAN_XP
a tran to exit point out of a submachine
@ QS_QEP_STATE_ENTRY
a state was entered
@ QS_QEP_UNHANDLED
an event was un-handled due to a guard
@ QS_QEP_TRAN
a regular transition was taken
@ QS_QEP_DISPATCH
an event was dispatched (begin of RTC step)
@ QS_QEP_IGNORED
an event was ignored (silently discarded)
QS/C package-scope interface.
QP Functional Safety (FuSa) Subsystem.
#define Q_ASSERT_INCRIT(id_, expr_)
#define Q_ENSURE_INCRIT(id_, expr_)
#define Q_REQUIRE_INCRIT(id_, expr_)
Abstract State Machine class (state machine interface)
struct QAsmVtable const * vptr
Virtual table for the QAsm class.
State object for the QMsm class (QM State Machine).
struct QMState const * superstate
QActionHandler const entryAction
QActionHandler const initAction
QStateHandler const stateHandler
Transition-Action Table for the QMsm State Machine.
QActionHandler const act[1]
Hierarchical State Machine class (QMsm-style state machine implementation strategy)
Attribute of for the QAsm class (Abstract State Machine).
QMTranActTable const * tatbl
struct QMState const * obj