54Q_DEFINE_THIS_MODULE(
"qep_hsm")
58#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
59#error qpc version 7.3.0 or higher required
82#define QHSM_RESERVED_EVT_(state_, sig_) \
83 ((*(state_))(me, &QEvt_reserved_[(sig_)]))
86#define QS_STATE_ENTRY_(state_, qsId_) \
89 QS_BEGIN_PRE_(QS_QEP_STATE_ENTRY, (qsId_)) \
91 QS_FUN_PRE_(state_); \
97#define QS_STATE_EXIT_(state_, qsId_) \
100 QS_BEGIN_PRE_(QS_QEP_STATE_EXIT, (qsId_)) \
102 QS_FUN_PRE_(state_); \
112 QHSM_MAX_NEST_DEPTH_ = 6
129 ,&QHsm_getStateHandler_
142 void const *
const e,
143 uint_fast8_t
const qsId)
150 if ((QS_priv_.flags & 0x01U) == 0U) {
151 QS_priv_.flags |= 0x01U;
197 while ((me->
temp.
fun != t) && (ip < (QHSM_MAX_NEST_DEPTH_ - 1))) {
216 QS_STATE_ENTRY_(path[ip], qsId);
262 QEvt const *
const e,
263 uint_fast8_t
const qsId)
292 int_fast8_t ip = QHSM_MAX_NEST_DEPTH_;
327 ip = QHSM_MAX_NEST_DEPTH_;
328 for (; (t != s) && (ip > 0); t = me->
temp.
fun) {
331 QS_STATE_EXIT_(t, qsId);
341 ip = QHsm_tran_(me, path, qsId);
350 QS_FUN_PRE_(path[0]);
359 for (; ip >= 0; --ip) {
364 QS_STATE_ENTRY_(path[ip], qsId);
390 while ((me->
temp.
fun != t) && (ip < (QHSM_MAX_NEST_DEPTH_ - 1))) {
410 QS_STATE_ENTRY_(path[ip], qsId);
484 bool inState =
false;
488 int_fast8_t lbound = QHSM_MAX_NEST_DEPTH_ + 1;
518 bool isFound =
false;
523 int_fast8_t lbound = QHSM_MAX_NEST_DEPTH_;
556int_fast8_t QHsm_tran_(
559 uint_fast8_t
const qsId)
574 QS_STATE_EXIT_(s, qsId);
596 QS_STATE_EXIT_(s, qsId);
605 QS_STATE_EXIT_(s, qsId);
620 && (ip < (QHSM_MAX_NEST_DEPTH_ - 1)))
646 QS_STATE_EXIT_(s, qsId);
670 int_fast8_t lbound = QHSM_MAX_NEST_DEPTH_;
676 QS_STATE_EXIT_(t, qsId);
714 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]
char const QP_versionStr[16]
the current QP version number string in ROM, based on QP_VERSION_STR
#define Q_UNUSED_PAR(par_)
Helper macro to clearly mark unused parameters of functions.
#define QP_VERSION_STR
Version string complying with Semantic Versioning
#define Q_STATE_CAST(handler_)
Perform cast to QStateHandler.
QState(* QStateHandler)(void *const me, QEvt const *const e)
Pointer to a state-handler function.
enum QStateRet QState
Type returned from state-handler functions.
#define Q_EVT_CAST(class_)
Perform downcast of an event onto a subclass of QEvt 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_)
Initializer for immutable (constant) QEvt instances.
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_INVARIANT_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 pointer inherited by all QAsm subclasses (see also Object Orientation)
union QAsmAttr state
Current state (pointer to the current state-handler function)
union QAsmAttr temp
Temporary storage for target/act-table etc.
Virtual table for the QAsm class.
QSignal sig
Signal of the event (see Event Signal)
Hierarchical State Machine class (QHsm-style state machine implementation strategy)