39Q_DEFINE_THIS_MODULE(
"qep_msm")
41#define QMSM_MAX_NEST_DEPTH_ ((int_fast8_t)6)
42#define QMSM_MAX_TRAN_LENGTH_ ((int_fast8_t)(2*QMSM_MAX_NEST_DEPTH_))
47static struct QMState const l_msm_top_s = {
57#define QS_STATE_ACT_(rec_, state_) \
59 QS_BEGIN_PRE((rec_), qsId) \
66#define QS_TOP_INIT_(rec_, trg_) \
68 QS_BEGIN_PRE((rec_), qsId) \
76#define QS_TRAN_SEG_(rec_, src_, trg_) \
78 QS_BEGIN_PRE((rec_), qsId) \
86#define QS_TRAN0_(rec_, trg_) \
88 QS_BEGIN_PRE((rec_), qsId) \
97#define QS_TRAN_END_(rec_, src_, trg_) \
99 QS_BEGIN_PRE((rec_), qsId) \
101 QS_SIG_PRE(e->sig); \
109#define QS_STATE_ACT_(rec_, state_) ((void)0)
110#define QS_TOP_INIT_(rec_, trg_) ((void)0)
111#define QS_TRAN_SEG_(rec_, src_, trg_) ((void)0)
112#define QS_TRAN0_(rec_, trg_) ((void)0)
113#define QS_TRAN_END_(rec_, src_, trg_) ((void)0)
119static QState QMsm_execTatbl_(
122 uint_fast8_t
const qsId);
124static void QMsm_exitToTranSource_(
126 QMState const *
const curr_state,
127 QMState const *
const tran_source,
128 uint_fast8_t
const qsId);
130static QState QMsm_enterHistory_(
133 uint_fast8_t
const qsId);
137void QMsm_ctor(
QMsm *
const me,
145 ,&QMsm_getStateHandler_
158 void const *
const e,
159 uint_fast8_t
const qsId)
202 QEvt const *
const e,
203 uint_fast8_t
const qsId)
315 uint_fast8_t
const qsId)
362 QMState const *
const curr_state,
363 QMState const *
const tran_source,
364 uint_fast8_t
const qsId)
374 while (s != tran_source) {
376 (void)(*s->exitAction)(me);
391 uint_fast8_t
const qsId)
417 for (; i >= 0; --i) {
418 (void)(*epath[i]->entryAction)(me);
440 bool inState =
false;
472 bool isFound =
false;
#define QMSM_MAX_TRAN_LENGTH_
maximum length of transition-action array
#define QMSM_MAX_NEST_DEPTH_
maximum depth of state nesting in a QMsm (including the top level)
#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_QEP_STATE_INIT
an initial transition was taken in a state
@ QS_QEP_TRAN_HIST
a tran. to history was taken
@ 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_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_REQUIRE_LOCAL(id_, expr_)
#define Q_ENSURE_LOCAL(id_, expr_)
#define Q_ASSERT_LOCAL(id_, expr_)
#define Q_INVARIANT_LOCAL(id_, expr_)
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 curr_state, QMState const *const tran_source, 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