39Q_DEFINE_THIS_MODULE(
"qep_msm")
41#define QMSM_MAX_ENTRY_DEPTH_ ((int_fast8_t)4)
46static struct QMState const l_msm_top_s = {
56#define QS_STATE_ACT_(rec_, state_) \
58 QS_BEGIN_PRE((rec_), qsId) \
65#define QS_TOP_INIT_(rec_, trg_) \
67 QS_BEGIN_PRE((rec_), qsId) \
75#define QS_TRAN_SEG_(rec_, src_, trg_) \
77 QS_BEGIN_PRE((rec_), qsId) \
85#define QS_TRAN0_(rec_, trg_) \
87 QS_BEGIN_PRE((rec_), qsId) \
96#define QS_TRAN_END_(rec_, src_, trg_) \
98 QS_BEGIN_PRE((rec_), qsId) \
100 QS_SIG_PRE(e->sig); \
108#define QS_STATE_ACT_(rec_, state_) ((void)0)
109#define QS_TOP_INIT_(rec_, trg_) ((void)0)
110#define QS_TRAN_SEG_(rec_, src_, trg_) ((void)0)
111#define QS_TRAN0_(rec_, trg_) ((void)0)
112#define QS_TRAN_END_(rec_, src_, trg_) ((void)0)
119static QState QMsm_execTatbl_(
122 uint_fast8_t
const qsId);
125static void QMsm_exitToTranSource_(
129 uint_fast8_t
const qsId);
132static QState QMsm_enterHistory_(
135 uint_fast8_t
const qsId);
139void QMsm_ctor(
QMsm *
const me,
147 ,&QMsm_getStateHandler_
160 void const *
const e,
161 uint_fast8_t
const qsId)
171 && (me->
state.
obj == &l_msm_top_s));
182 QS_TRAN_SEG_(QS_QEP_STATE_INIT,
201 QEvt const *
const e,
202 uint_fast8_t
const qsId)
256 QS_TRAN_SEG_(QS_QEP_TRAN_HIST,
304 bool inState =
false;
333 bool isFound =
false;
360 uint_fast8_t
const qsId)
386 QS_TRAN_SEG_(QS_QEP_STATE_INIT,
411 uint_fast8_t
const qsId)
424 (void)(*s->exitAction)(me);
437 uint_fast8_t
const qsId)
461 for (i = i - 1; i >= 0; --i) {
463 (void)(*epath[i]->entryAction)(me);
465 QS_STATE_ACT_(QS_QEP_STATE_ENTRY, epath[i]->stateHandler);
475 QS_TRAN_SEG_(QS_QEP_STATE_INIT,
#define QMSM_MAX_ENTRY_DEPTH_
maximum depth of entry levels in a MSM for tran. to history
#define Q_UNUSED_PAR(par_)
Helper macro to clearly mark unused parameters of functions.
#define Q_STATE_CAST(handler_)
Perform cast to QStateHandler.
QState(* QStateHandler)(void *const me, QEvt const *const e)
Pointer to a state-handler function.
#define Q_ACTION_CAST(action_)
Perform cast to QActionHandler.
#define Q_EVT_CAST(class_)
Perform downcast of an event onto a subclass of QEvt class_
uint_fast8_t QState
Type returned from state-handler functions.
QState(* QActionHandler)(void *const me)
Pointer to an action-handler function.
QS/C dummy public interface.
#define QS_BEGIN_PRE(rec_, qsId_)
QP Functional Safety (FuSa) Subsystem.
#define Q_ASSERT_INCRIT(id_, expr_)
General-purpose assertion with user-specified ID number (in critical section)
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section)
Abstract State Machine class (state machine interface)
struct QAsmVtable const * vptr
Virtual pointer inherited by all QAsm subclasses (see also SAS_QP_OO)
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)
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)
static QState QMsm_enterHistory_(QAsm *const me, QMState const *const hist, uint_fast8_t const qsId)
Enter history of a composite state.
static void QMsm_exitToTranSource_(QAsm *const me, QMState const *const cs, QMState const *const ts, uint_fast8_t const qsId)
Exit the current state up to the explicit transition source.
void QMsm_init_(QAsm *const me, void const *const e, uint_fast8_t const qsId)
Implementation of the top-most initial transition in QMsm.
static QState QMsm_execTatbl_(QAsm *const me, QMTranActTable const *const tatbl, uint_fast8_t const qsId)
Execute transition-action table.
bool QMsm_isIn_(QAsm *const me, QStateHandler const stateHndl)
Tests if a given state is part of the current active state configuration.
QStateHandler QMsm_getStateHandler_(QAsm *const me)
Implementation of getting the state handler in a QMsm subclass.
QMState const * QMsm_childStateObj(QMsm const *const me, QMState const *const parent)
Obtain the current active child state of a given parent in QMsm.
void QMsm_dispatch_(QAsm *const me, QEvt const *const e, uint_fast8_t const qsId)
Implementation of dispatching events to a QMsm.
QMTranActTable const * tatbl
struct QMState const * obj