QP/C  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qep_msm.c
Go to the documentation of this file.
1//$file${src::qf::qep_msm.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpc.qm
4// File: ${src::qf::qep_msm.c}
5//
6// This code has been generated by QM 6.1.1 <www.state-machine.com/qm>.
7// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8//
9// This code is covered by the following QP license:
10// License # : LicenseRef-QL-dual
11// Issued to : Any user of the QP/C real-time embedded framework
12// Framework(s) : qpc
13// Support ends : 2024-12-31
14// License scope:
15//
16// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
17//
18// Q u a n t u m L e a P s
19// ------------------------
20// Modern Embedded Software
21//
22// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
23//
24// This software is dual-licensed under the terms of the open source GNU
25// General Public License version 3 (or any later version), or alternatively,
26// under the terms of one of the closed source Quantum Leaps commercial
27// licenses.
28//
29// The terms of the open source GNU General Public License version 3
30// can be found at: <www.gnu.org/licenses/gpl-3.0>
31//
32// The terms of the closed source Quantum Leaps commercial licenses
33// can be found at: <www.state-machine.com/licensing>
34//
35// Redistributions in source code must retain this top-level comment block.
36// Plagiarizing this software to sidestep the license obligations is illegal.
37//
38// Contact information:
39// <www.state-machine.com/licensing>
40// <info@state-machine.com>
41//
42//$endhead${src::qf::qep_msm.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#define QP_IMPL // this is QP implementation
44#include "qp_port.h" // QP port
45#include "qp_pkg.h" // QP package-scope interface
46#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
47#ifdef Q_SPY // QS software tracing enabled?
48 #include "qs_port.h" // QS port
49 #include "qs_pkg.h" // QS facilities for pre-defined trace records
50#else
51 #include "qs_dummy.h" // disable the QS software tracing
52#endif // Q_SPY
53
54//============================================================================
55//! @cond INTERNAL
56
57Q_DEFINE_THIS_MODULE("qep_msm")
58
59enum {
60 // maximum depth of state nesting in a QMsm (including the top level)
61 QMSM_MAX_NEST_DEPTH_ = 6,
62
63 // maximum length of transition-action array
64 QMSM_MAX_TRAN_LENGTH_ = 3*QMSM_MAX_NEST_DEPTH_,
65
66 // maximum depth of entry levels in a MSM for tran. to history.
67 QMSM_MAX_ENTRY_DEPTH_ = 4
68};
69
70// top-state object for QMsm-style state machines
71static struct QMState const l_msm_top_s = {
72 (struct QMState *)0,
73 Q_STATE_CAST(0),
77};
78
79//! @endcond
80//============================================================================
81
82//$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
83// Check for the minimum required QP version
84#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
85#error qpc version 7.3.0 or higher required
86#endif
87//$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89//$define${QEP::QMsm} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
90
91//${QEP::QMsm} ...............................................................
92
93//${QEP::QMsm::ctor} .........................................................
94//! @protected @memberof QMsm
95void QMsm_ctor(QMsm * const me,
96 QStateHandler const initial)
97{
98 static struct QAsmVtable const vtable = { // QAsm virtual table
99 &QMsm_init_,
100 &QMsm_dispatch_,
101 &QMsm_isIn_
102 #ifdef Q_SPY
103 ,&QMsm_getStateHandler_
104 #endif
105 };
106 // do not call the QAsm_ctor() here
107 me->super.vptr = &vtable;
108 me->super.state.obj = &l_msm_top_s; // the current state (top)
109 me->super.temp.fun = initial; // the initial tran. handler
110}
111
112//${QEP::QMsm::init_} ........................................................
113//! @private @memberof QMsm
114void QMsm_init_(
115 QAsm * const me,
116 void const * const e,
117 uint_fast8_t const qsId)
118{
119 #ifndef Q_SPY
120 Q_UNUSED_PAR(qsId);
121 #endif
122
125 Q_REQUIRE_INCRIT(200, (me->vptr != (struct QAsmVtable *)0)
126 && (me->temp.fun != Q_STATE_CAST(0))
127 && (me->state.obj == &l_msm_top_s));
128 QF_CRIT_EXIT();
129
130 // execute the top-most initial tran.
131 QState r = (*me->temp.fun)(me, Q_EVT_CAST(QEvt));
132
134 // the top-most initial tran. must be taken
136
137 QS_MEM_SYS();
138 QS_BEGIN_PRE_(QS_QEP_STATE_INIT, qsId)
139 QS_OBJ_PRE_(me); // this state machine object
140 QS_FUN_PRE_(me->state.obj->stateHandler); // source state
141 QS_FUN_PRE_(me->temp.tatbl->target->stateHandler); // target state
142 QS_END_PRE_()
143 QS_MEM_APP();
144
145 QF_CRIT_EXIT();
146
147 // set state to the last tran. target
148 me->state.obj = me->temp.tatbl->target;
149
150 // drill down into the state hierarchy with initial transitions...
151 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
152 do {
153 // execute the tran. table
154 r = QMsm_execTatbl_(me, me->temp.tatbl, qsId);
155 --limit;
156 } while ((r >= Q_RET_TRAN_INIT) && (limit > 0));
157
159 Q_ENSURE_INCRIT(290, limit > 0);
160
161 QS_MEM_SYS();
162 QS_BEGIN_PRE_(QS_QEP_INIT_TRAN, qsId)
163 QS_TIME_PRE_(); // time stamp
164 QS_OBJ_PRE_(me); // this state machine object
165 QS_FUN_PRE_(me->state.obj->stateHandler); // the new current state
166 QS_END_PRE_()
167 QS_MEM_APP();
168
169 QF_CRIT_EXIT();
170
171 #ifndef Q_UNSAFE
172 me->temp.uint = ~me->state.uint;
173 #endif
174}
175
176//${QEP::QMsm::dispatch_} ....................................................
177//! @private @memberof QMsm
178void QMsm_dispatch_(
179 QAsm * const me,
180 QEvt const * const e,
181 uint_fast8_t const qsId)
182{
183 #ifndef Q_SPY
184 Q_UNUSED_PAR(qsId);
185 #endif
186
187 QMState const *s = me->state.obj; // store the current state
188 QMState const *t = s;
189
192 Q_REQUIRE_INCRIT(300, (s != (QMState *)0)
193 && (me->state.uint == (uintptr_t)(~me->temp.uint)));
194 Q_REQUIRE_INCRIT(302, QEvt_verify_(e));
195
196 QS_MEM_SYS();
197 QS_BEGIN_PRE_(QS_QEP_DISPATCH, qsId)
198 QS_TIME_PRE_(); // time stamp
199 QS_SIG_PRE_(e->sig); // the signal of the event
200 QS_OBJ_PRE_(me); // this state machine object
201 QS_FUN_PRE_(s->stateHandler); // the current state handler
202 QS_END_PRE_()
203 QS_MEM_APP();
204
205 QF_CRIT_EXIT();
206
207 // scan the state hierarchy up to the top state...
208 QState r;
209 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
210 do {
211 r = (*t->stateHandler)(me, e); // call state handler function
212
213 // event handled? (the most frequent case)
214 if (r >= Q_RET_HANDLED) {
215 break; // done scanning the state hierarchy
216 }
217 // event unhandled and passed to the superstate?
218 else if (r == Q_RET_SUPER) {
219 t = t->superstate; // advance to the superstate
220 }
221 // event unhandled and passed to a submachine superstate?
222 else if (r == Q_RET_SUPER_SUB) {
223 t = me->temp.obj; // current host state of the submachie
224 }
225 else { // event unhandled due to a guard?
227 // event must be unhandled due to a guard evaluating to 'false'
229
230 QS_MEM_SYS();
231 QS_BEGIN_PRE_(QS_QEP_UNHANDLED, qsId)
232 QS_SIG_PRE_(e->sig); // the signal of the event
233 QS_OBJ_PRE_(me); // this state machine object
234 QS_FUN_PRE_(t->stateHandler); // the current state
235 QS_END_PRE_()
236 QS_MEM_APP();
237
238 QF_CRIT_EXIT();
239
240 t = t->superstate; // advance to the superstate
241 }
242 --limit;
243 } while ((t != (QMState *)0) && (limit > 0));
245 Q_ASSERT_INCRIT(310, limit > 0);
246 QF_CRIT_EXIT();
247
248 if (r >= Q_RET_TRAN) { // any kind of tran. taken?
249 #ifdef Q_SPY
250 QMState const * const ts = t; // tran. source for QS tracing
251
253 // the tran. source state must not be NULL
254 Q_ASSERT_INCRIT(320, ts != (QMState *)0);
255 QF_CRIT_EXIT();
256 #endif // Q_SPY
257
258 limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
259 do {
260 // save the tran-action table before it gets clobbered
261 struct QMTranActTable const * const tatbl = me->temp.tatbl;
262 union QAsmAttr tmp; // temporary to save intermediate values
263
264 // was TRAN, TRAN_INIT, or TRAN_EP taken?
265 if (r <= Q_RET_TRAN_EP) {
266 me->temp.obj = (QMState *)0; // clear
267 QMsm_exitToTranSource_(me, s, t, qsId);
268 r = QMsm_execTatbl_(me, tatbl, qsId);
269 s = me->state.obj;
270 }
271 // was a tran. segment to history taken?
272 else if (r == Q_RET_TRAN_HIST) {
273 tmp.obj = me->state.obj; // save history
274 me->state.obj = s; // restore the original state
275 QMsm_exitToTranSource_(me, s, t, qsId);
276 (void)QMsm_execTatbl_(me, tatbl, qsId);
277 r = QMsm_enterHistory_(me, tmp.obj, qsId);
278 s = me->state.obj;
279 }
280 else {
282 // must be tran. to exit point
284 QF_CRIT_EXIT();
285
286 tmp.act = me->state.act; // save XP action
287 me->state.obj = s; // restore the original state
288 r = (*tmp.act)(me); // execute the XP action
289 if (r == Q_RET_TRAN) { // XP -> TRAN ?
290 #ifdef Q_SPY
291 tmp.tatbl = me->temp.tatbl; // save me->temp
292 #endif // Q_SPY
293 QMsm_exitToTranSource_(me, s, t, qsId);
294 // take the tran-to-XP segment inside submachine
295 (void)QMsm_execTatbl_(me, tatbl, qsId);
296 s = me->state.obj;
297 #ifdef Q_SPY
298 me->temp.tatbl = tmp.tatbl; // restore me->temp
299 #endif // Q_SPY
300 }
301 else if (r == Q_RET_TRAN_HIST) { // XP -> HIST ?
302 tmp.obj = me->state.obj; // save the history
303 me->state.obj = s; // restore the original state
304 s = me->temp.obj; // save me->temp
305 QMsm_exitToTranSource_(me, me->state.obj, t, qsId);
306 // take the tran-to-XP segment inside submachine
307 (void)QMsm_execTatbl_(me, tatbl, qsId);
308 #ifdef Q_SPY
309 me->temp.obj = s; // restore me->temp
310 #endif // Q_SPY
311 s = me->state.obj;
312 me->state.obj = tmp.obj; // restore the history
313 }
314 else {
316 // TRAN_XP must NOT be followed by any other tran type
317 Q_ASSERT_INCRIT(330, r < Q_RET_TRAN);
318 QF_CRIT_EXIT();
319 }
320 }
321
322 t = s; // set target to the current state
323 --limit;
324 } while ((r >= Q_RET_TRAN) && (limit > 0));
325
327 Q_ASSERT_INCRIT(320, limit > 0);
328
329 QS_MEM_SYS();
330 QS_BEGIN_PRE_(QS_QEP_TRAN, qsId)
331 QS_TIME_PRE_(); // time stamp
332 QS_SIG_PRE_(e->sig); // the signal of the event
333 QS_OBJ_PRE_(me); // this state machine object
334 QS_FUN_PRE_(ts->stateHandler); // the tran. source
335 QS_FUN_PRE_(s->stateHandler); // the new active state
336 QS_END_PRE_()
337 QS_MEM_APP();
338
339 QF_CRIT_EXIT();
340 }
341
342 #ifdef Q_SPY
343 // was the event handled?
344 else if (r == Q_RET_HANDLED) {
346 // internal tran. source can't be NULL
347 Q_ASSERT_INCRIT(340, t != (QMState *)0);
348
349 QS_MEM_SYS();
350 QS_BEGIN_PRE_(QS_QEP_INTERN_TRAN, qsId)
351 QS_TIME_PRE_(); // time stamp
352 QS_SIG_PRE_(e->sig); // the signal of the event
353 QS_OBJ_PRE_(me); // this state machine object
354 QS_FUN_PRE_(t->stateHandler); // the source state
355 QS_END_PRE_()
356 QS_MEM_APP();
357
358 QF_CRIT_EXIT();
359 }
360 // event bubbled to the 'top' state?
361 else if (t == (QMState *)0) {
363 QS_MEM_SYS();
364 QS_BEGIN_PRE_(QS_QEP_IGNORED, qsId)
365 QS_TIME_PRE_(); // time stamp
366 QS_SIG_PRE_(e->sig); // the signal of the event
367 QS_OBJ_PRE_(me); // this state machine object
368 QS_FUN_PRE_(s->stateHandler); // the current state
369 QS_END_PRE_()
370 QS_MEM_APP();
371 QS_CRIT_EXIT();
372 }
373 #endif // Q_SPY
374 else {
375 // empty
376 }
377
378 #ifndef Q_UNSAFE
379 me->temp.uint = ~me->state.uint;
380 #endif
381}
382
383//${QEP::QMsm::isIn_} ........................................................
384//! @private @memberof QMsm
385bool QMsm_isIn_(
386 QAsm * const me,
387 QStateHandler const state)
388{
389 bool inState = false; // assume that this SM is not in 'state'
390
391 QMState const *s = me->state.obj;
392 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
393 for (; (s != (QMState *)0) && (limit > 0); --limit) {
394 if (s->stateHandler == state) { // match found?
395 inState = true;
396 break;
397 }
398 else {
399 s = s->superstate; // advance to the superstate
400 }
401 }
402
405 Q_ENSURE_INCRIT(490, limit > 0);
406 QF_CRIT_EXIT();
407
408 return inState;
409}
410
411//${QEP::QMsm::isInState} ....................................................
412bool QMsm_isInState(QMsm const * const me,
413 QMState const * const stateObj)
414{
415 bool inState = false; // assume that this SM is not in 'state'
416
417 QMState const *s = me->super.state.obj;
418 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
419 for (; (s != (QMState *)0) && (limit > 0); --limit) {
420 if (s == stateObj) { // match found?
421 inState = true;
422 break;
423 }
424 else {
425 s = s->superstate; // advance to the superstate
426 }
427 }
428
431 Q_ENSURE_INCRIT(590, limit > 0);
432 QF_CRIT_EXIT();
433
434 return inState;
435}
436
437//${QEP::QMsm::childStateObj} ................................................
438//! @public @memberof QMsm
439QMState const * QMsm_childStateObj(QMsm const * const me,
440 QMState const * const parent)
441{
442 QMState const *child = me->super.state.obj;
443 bool isFound = false; // start with the child not found
444 QMState const *s;
445
446 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
447 for (s = me->super.state.obj;
448 (s != (QMState *)0) && (limit > 0);
449 s = s->superstate)
450 {
451 if (s == parent) {
452 isFound = true; // child is found
453 break;
454 }
455 else {
456 child = s;
457 }
458 --limit;
459 }
462 Q_ASSERT_INCRIT(610, limit > 0);
463 QF_CRIT_EXIT();
464
465 if (!isFound) { // still not found?
466 limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
467 for (s = me->super.temp.obj;
468 (s != (QMState *)0) && (limit > 0);
469 s = s->superstate)
470 {
471 if (s == parent) {
472 isFound = true; // child is found
473 break;
474 }
475 else {
476 child = s;
477 }
478 --limit;
479 }
480 }
481
483 Q_ENSURE_INCRIT(690, isFound && (limit > 0));
484 QF_CRIT_EXIT();
485
486 return child; // return the child
487}
488
489//${QEP::QMsm::execTatbl_} ...................................................
490//! @private @memberof QMsm
491QState QMsm_execTatbl_(
492 QAsm * const me,
493 QMTranActTable const * const tatbl,
494 uint_fast8_t const qsId)
495{
496 #ifndef Q_SPY
497 Q_UNUSED_PAR(qsId);
498 #endif
499
502 // precondition:
503 // - the tran-action table pointer must not be NULL
504 Q_REQUIRE_INCRIT(700, tatbl != (struct QMTranActTable *)0);
505 QF_CRIT_EXIT();
506
507 QState r = Q_RET_NULL;
508 int_fast8_t limit = QMSM_MAX_TRAN_LENGTH_; // loop hard limit
509 QActionHandler const *a = &tatbl->act[0];
510 for (; (*a != Q_ACTION_CAST(0)) && (limit > 0); ++a) {
511 r = (*(*a))(me); // call the action through the 'a' pointer
512 #ifdef Q_SPY
514 QS_MEM_SYS();
515 if (r == Q_RET_ENTRY) {
516 QS_BEGIN_PRE_(QS_QEP_STATE_ENTRY, qsId)
517 QS_OBJ_PRE_(me); // this state machine object
518 QS_FUN_PRE_(me->temp.obj->stateHandler); // entered state
519 QS_END_PRE_()
520 }
521 else if (r == Q_RET_EXIT) {
522 QS_BEGIN_PRE_(QS_QEP_STATE_EXIT, qsId)
523 QS_OBJ_PRE_(me); // this state machine object
524 QS_FUN_PRE_(me->temp.obj->stateHandler); // exited state
525 QS_END_PRE_()
526 }
527 else if (r == Q_RET_TRAN_INIT) {
528 QS_BEGIN_PRE_(QS_QEP_STATE_INIT, qsId)
529 QS_OBJ_PRE_(me); // this state machine object
530 QS_FUN_PRE_(tatbl->target->stateHandler); // source
531 QS_FUN_PRE_(me->temp.tatbl->target->stateHandler); // target
532 QS_END_PRE_()
533 }
534 else if (r == Q_RET_TRAN_EP) {
535 QS_BEGIN_PRE_(QS_QEP_TRAN_EP, qsId)
536 QS_OBJ_PRE_(me); // this state machine object
537 QS_FUN_PRE_(tatbl->target->stateHandler); // source
538 QS_FUN_PRE_(me->temp.tatbl->target->stateHandler); // target
539 QS_END_PRE_()
540 }
541 else if (r == Q_RET_TRAN_XP) {
542 QS_BEGIN_PRE_(QS_QEP_TRAN_XP, qsId)
543 QS_OBJ_PRE_(me); // this state machine object
544 QS_FUN_PRE_(tatbl->target->stateHandler); // source
545 QS_FUN_PRE_(me->temp.tatbl->target->stateHandler); // target
546 QS_END_PRE_()
547 }
548 else {
549 // empty
550 }
551 QS_MEM_APP();
552 QS_CRIT_EXIT();
553 #endif // Q_SPY
554 --limit;
555 }
557 Q_ENSURE_INCRIT(790, *a == Q_ACTION_CAST(0));
558 QF_CRIT_EXIT();
559
560 me->state.obj = (r >= Q_RET_TRAN)
561 ? me->temp.tatbl->target
562 : tatbl->target;
563 return r;
564}
565
566//${QEP::QMsm::exitToTranSource_} ............................................
567//! @private @memberof QMsm
568void QMsm_exitToTranSource_(
569 QAsm * const me,
570 QMState const * const cs,
571 QMState const * const ts,
572 uint_fast8_t const qsId)
573{
574 #ifndef Q_SPY
575 Q_UNUSED_PAR(qsId);
576 #endif
577
579
580 // exit states from the current state to the tran. source state
581 QMState const *s = cs;
582 int_fast8_t limit = QMSM_MAX_NEST_DEPTH_; // loop hard limit
583 for (; (s != ts) && (limit > 0); --limit) {
584 // exit action provided in state 's'?
585 if (s->exitAction != Q_ACTION_CAST(0)) {
586 // execute the exit action
587 (void)(*s->exitAction)(me);
588
590 QS_MEM_SYS();
591 QS_BEGIN_PRE_(QS_QEP_STATE_EXIT, qsId)
592 QS_OBJ_PRE_(me); // this state machine object
593 QS_FUN_PRE_(s->stateHandler); // the exited state handler
594 QS_END_PRE_()
595 QS_MEM_APP();
596 QS_CRIT_EXIT();
597 }
598
599 s = s->superstate; // advance to the superstate
600
601 if (s == (QMState *)0) { // reached the top of a submachine?
602 s = me->temp.obj; // the superstate from QM_SM_EXIT()
604 Q_ASSERT_INCRIT(810, s != (QMState *)0); // must be valid
605 QF_CRIT_EXIT();
606 }
607 }
609 Q_ENSURE_INCRIT(890, limit > 0);
610 QF_CRIT_EXIT();
611}
612
613//${QEP::QMsm::enterHistory_} ................................................
614//! @private @memberof QMsm
615QState QMsm_enterHistory_(
616 QAsm * const me,
617 QMState const *const hist,
618 uint_fast8_t const qsId)
619{
620 #ifndef Q_SPY
621 Q_UNUSED_PAR(qsId);
622 #endif
623
624 QMState const *s = hist;
625 QMState const *ts = me->state.obj; // tran. source
626 QMState const *epath[QMSM_MAX_ENTRY_DEPTH_];
627
629
631 QS_MEM_SYS();
632 QS_BEGIN_PRE_(QS_QEP_TRAN_HIST, qsId)
633 QS_OBJ_PRE_(me); // this state machine object
634 QS_FUN_PRE_(ts->stateHandler); // source state handler
635 QS_FUN_PRE_(hist->stateHandler); // target state handler
636 QS_END_PRE_()
637 QS_MEM_APP();
638 QS_CRIT_EXIT();
639
640 int_fast8_t i = 0; // tran. entry path index
641 while ((s != ts) && (i < QMSM_MAX_ENTRY_DEPTH_)) {
642 if (s->entryAction != Q_ACTION_CAST(0)) {
643 epath[i] = s;
644 ++i;
645 }
646 s = s->superstate;
647 if (s == (QMState *)0) {
648 ts = s; // force exit from the for-loop
649 }
650 }
652 Q_ASSERT_INCRIT(910, s == ts);
653 QF_CRIT_EXIT();
654
655 // retrace the entry path in reverse (desired) order...
656 while (i > 0) {
657 --i;
658 (void)(*epath[i]->entryAction)(me); // run entry action in epath[i]
659
661 QS_MEM_SYS();
662 QS_BEGIN_PRE_(QS_QEP_STATE_ENTRY, qsId)
663 QS_OBJ_PRE_(me);
664 QS_FUN_PRE_(epath[i]->stateHandler); // entered state handler
665 QS_END_PRE_()
666 QS_MEM_APP();
667 QS_CRIT_EXIT();
668 }
669
670 me->state.obj = hist; // set current state to the tran. target
671
672 // initial tran. present?
673 QState r;
674 if (hist->initAction != Q_ACTION_CAST(0)) {
675 r = (*hist->initAction)(me); // execute the tran. action
676 }
677 else {
678 r = Q_RET_NULL;
679 }
680
681 return r;
682}
683//$enddef${QEP::QMsm} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bool QMsm_isInState(QMsm const *const me, QMState const *const stateObj)
Definition qep_msm.c:412
@ Q_RET_ENTRY
state entry action executed
Definition qp.h:206
@ Q_RET_HANDLED
event handled (internal transition)
Definition qp.h:202
@ Q_RET_TRAN_XP
exit-point transition out of a submachine
Definition qp.h:219
@ Q_RET_TRAN_INIT
initial transition in a state or submachine
Definition qp.h:214
@ Q_RET_TRAN
regular transition
Definition qp.h:213
@ Q_RET_UNHANDLED
event unhandled due to a guard
Definition qp.h:199
@ Q_RET_SUPER
event passed to superstate to handle
Definition qp.h:197
@ Q_RET_NULL
return value without any effect
Definition qp.h:210
@ Q_RET_TRAN_HIST
transition to history of a given state
Definition qp.h:218
@ Q_RET_SUPER_SUB
event passed to submachine superstate
Definition qp.h:198
@ Q_RET_TRAN_EP
entry-point transition into a submachine
Definition qp.h:215
@ Q_RET_EXIT
state exit action executed
Definition qp.h:207
#define Q_UNUSED_PAR(par_)
Definition qp.h:532
QState(* QStateHandler)(void *const me, QEvt const *const e)
Definition qp.h:226
#define Q_STATE_CAST(handler_)
Definition qp.h:526
#define Q_ACTION_CAST(action_)
Definition qp.h:529
QState(* QActionHandler)(void *const me)
Definition qp.h:229
#define Q_EVT_CAST(class_)
Definition qp.h:523
enum QStateRet QState
Definition qp.h:223
Internal (package scope) QP/C interface.
Sample QP/C port.
@ QS_QEP_STATE_INIT
an initial transition was taken in a state
Definition qs.h:84
@ QS_QEP_TRAN_HIST
a tran to history was taken
Definition qs.h:162
#define QS_TIME_PRE_()
Definition qs.h:450
@ QS_QEP_TRAN_EP
a tran to entry point into a submachine
Definition qs.h:163
@ QS_QEP_STATE_EXIT
a state was exited
Definition qs.h:83
@ QS_QEP_INIT_TRAN
the top-most initial transition was taken
Definition qs.h:85
#define QS_MEM_APP()
Definition qs.h:588
@ QS_QEP_INTERN_TRAN
an internal transition was taken
Definition qs.h:86
@ QS_QEP_TRAN_XP
a tran to exit point out of a submachine
Definition qs.h:164
@ QS_QEP_STATE_ENTRY
a state was entered
Definition qs.h:82
@ QS_QEP_UNHANDLED
an event was un-handled due to a guard
Definition qs.h:90
@ QS_QEP_TRAN
a regular transition was taken
Definition qs.h:87
@ QS_QEP_DISPATCH
an event was dispatched (begin of RTC step)
Definition qs.h:89
@ QS_QEP_IGNORED
an event was ignored (silently discarded)
Definition qs.h:88
#define QS_CRIT_EXIT()
Definition qs.h:578
#define QS_MEM_SYS()
Definition qs.h:583
#define QS_CRIT_ENTRY()
Definition qs.h:573
QS/C package-scope interface.
Sample QS/C port.
QP Functional Safety (FuSa) Subsystem.
#define QF_CRIT_ENTRY()
Definition qsafe.h:58
#define Q_ASSERT_INCRIT(id_, expr_)
Definition qsafe.h:72
#define Q_ENSURE_INCRIT(id_, expr_)
Definition qsafe.h:145
#define QF_CRIT_EXIT()
Definition qsafe.h:62
#define Q_REQUIRE_INCRIT(id_, expr_)
Definition qsafe.h:136
#define QF_CRIT_STAT
Definition qsafe.h:54
Abstract State Machine class (state machine interface)
Definition qp.h:277
struct QAsmVtable const * vptr
Definition qp.h:281
union QAsmAttr temp
Definition qp.h:289
union QAsmAttr state
Definition qp.h:286
Virtual table for the QAsm class.
Definition qp.h:298
Event class.
Definition qp.h:147
QSignal sig
Definition qp.h:151
State object for the QMsm class (QM State Machine).
Definition qp.h:239
struct QMState const * superstate
Definition qp.h:240
QActionHandler const entryAction
Definition qp.h:242
QActionHandler const initAction
Definition qp.h:244
QStateHandler const stateHandler
Definition qp.h:241
Transition-Action Table for the QMsm State Machine.
Definition qp.h:248
QActionHandler const act[1]
Definition qp.h:250
QMState const * target
Definition qp.h:249
Hierarchical State Machine class (QMsm-style state machine implementation strategy)
Definition qp.h:376
QAsm super
Definition qp.h:378
Attribute of for the QAsm class (Abstract State Machine).
Definition qp.h:264
uintptr_t uint
Definition qp.h:271
QMTranActTable const * tatbl
Definition qp.h:268
QStateHandler fun
Definition qp.h:265
struct QMState const * obj
Definition qp.h:269
QActionHandler act
Definition qp.h:266