54Q_DEFINE_THIS_MODULE(
"qep_hsm")
58#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
59#error qpc version 7.3.0 or higher required
85 QHSM_MAX_NEST_DEPTH_ = 6
89#define QHSM_RESERVED_EVT_(state_, sig_) \
90 ((*(state_))(me, &QEvt_reserved_[(sig_)]))
93#define QS_STATE_ENTRY_(state_, qsId_) \
96 QS_BEGIN_PRE_(QS_QEP_STATE_ENTRY, (qsId_)) \
98 QS_FUN_PRE_(state_); \
104#define QS_STATE_EXIT_(state_, qsId_) \
107 QS_BEGIN_PRE_(QS_QEP_STATE_EXIT, (qsId_)) \
109 QS_FUN_PRE_(state_); \
122void QHsm_ctor(
QHsm *
const me,
130 ,&QHsm_getStateHandler_
143 void const *
const e,
144 uint_fast8_t
const qsId)
151 if ((QS_priv_.flags & 0x01U) == 0U) {
152 QS_priv_.flags |= 0x01U;
191 int_fast8_t limit = QHSM_MAX_NEST_DEPTH_;
198 while ((me->
temp.
fun != t) && (ip < (QHSM_MAX_NEST_DEPTH_ - 1))) {
217 QS_STATE_ENTRY_(path[ip], qsId);
268 QEvt const *
const e,
269 uint_fast8_t
const qsId)
298 int_fast8_t limit = QHSM_MAX_NEST_DEPTH_;
333 limit = QHSM_MAX_NEST_DEPTH_;
334 for (; (t != s) && (limit > 0); t = me->
temp.
fun) {
337 QS_STATE_EXIT_(t, qsId);
347 int_fast8_t ip = QHsm_tran_(me, path, qsId);
356 QS_FUN_PRE_(path[0]);
364 for (; ip >= 0; --ip) {
369 QS_STATE_ENTRY_(path[ip], qsId);
394 while ((me->
temp.
fun != t) && (ip < (QHSM_MAX_NEST_DEPTH_ - 1))) {
414 QS_STATE_ENTRY_(path[ip], qsId);
488 bool inState =
false;
492 int_fast8_t limit = QHSM_MAX_NEST_DEPTH_ + 1;
522 bool isFound =
false;
553int_fast8_t QHsm_tran_(
556 uint_fast8_t
const qsId)
571 QS_STATE_EXIT_(s, qsId);
593 QS_STATE_EXIT_(s, qsId);
602 QS_STATE_EXIT_(s, qsId);
616 && (ip < (QHSM_MAX_NEST_DEPTH_ - 1)))
641 QS_STATE_EXIT_(s, qsId);
664 int_fast8_t limit = QHSM_MAX_NEST_DEPTH_;
670 QS_STATE_EXIT_(t, qsId);
708 QEvt const *
const e)
@ Q_RET_HANDLED
event handled (internal transition)
@ Q_RET_IGNORED
event silently ignored (bubbled up to top)
@ 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_TRAN_HIST
transition to history of a given state
QEvt const QEvt_reserved_[4]
#define Q_UNUSED_PAR(par_)
QState(* QStateHandler)(void *const me, QEvt const *const e)
char const QP_versionStr[8]
the current QP version number string in ROM, based on QP_VERSION_STR
#define Q_STATE_CAST(handler_)
#define Q_EVT_CAST(class_)
@ Q_INIT_SIG
signal for coding initial transitions
@ Q_EMPTY_SIG
signal to execute the default case
@ Q_EXIT_SIG
signal for coding exit actions
@ Q_ENTRY_SIG
signal for coding entry actions
#define QEVT_INITIALIZER(sig_)
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
#define QS_FUN_DICTIONARY(fun_)
@ QS_QEP_INIT_TRAN
the top-most initial transition was taken
@ QS_QEP_INTERN_TRAN
an internal transition was taken
@ 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.
Hierarchical State Machine class (QHsm-style state machine implementation strategy)