QP/C  7.3.3
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qp.h
Go to the documentation of this file.
1//$file${include::qp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpc.qm
4// File: ${include::qp.h}
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${include::qp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QP_H_
44#define QP_H_
45
46//============================================================================
47#define QP_VERSION 733U
48#define QP_VERSION_STR "7.3.3"
49
50//! Encrypted current QP release (7.3.3) and date (2024-03-01)
51#define QP_RELEASE 0x70C4F752U
52
53//============================================================================
54//! @cond INTERNAL
55
56#ifndef Q_SIGNAL_SIZE
57#define Q_SIGNAL_SIZE 2U
58#endif
59
60#ifndef QF_MAX_ACTIVE
61#define QF_MAX_ACTIVE 32U
62#endif
63
64#if (QF_MAX_ACTIVE > 64U)
65#error QF_MAX_ACTIVE exceeds the maximum of 64U;
66#endif
67
68#ifndef QF_MAX_TICK_RATE
69#define QF_MAX_TICK_RATE 1U
70#endif
71
72#if (QF_MAX_TICK_RATE > 15U)
73#error QF_MAX_TICK_RATE exceeds the maximum of 15U;
74#endif
75
76#ifndef QF_MAX_EPOOL
77#define QF_MAX_EPOOL 3U
78#endif
79
80#if (QF_MAX_EPOOL > 15U)
81#error QF_MAX_EPOOL exceeds the maximum of 15U;
82#endif
83
84#ifndef QF_TIMEEVT_CTR_SIZE
85#define QF_TIMEEVT_CTR_SIZE 4U
86#endif
87
88#if (QF_TIMEEVT_CTR_SIZE > 4U)
89#error QF_TIMEEVT_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U;
90#endif
91
92#ifndef QF_EVENT_SIZ_SIZE
93#define QF_EVENT_SIZ_SIZE 2U
94#endif
95
96#if (QF_EVENT_SIZ_SIZE > 4U)
97#error QF_EVENT_SIZ_SIZE defined incorrectly, expected 1U, 2U, or 4U;
98#endif
99
100//! @endcond
101//============================================================================
102
103//$declare${glob-types} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
104
105//${glob-types::int_t} .......................................................
106typedef int int_t;
107
108//${glob-types::enum_t} ......................................................
109typedef int enum_t;
110
111//${glob-types::float32_t} ...................................................
112typedef float float32_t;
113
114//${glob-types::float64_t} ...................................................
115typedef double float64_t;
116//$enddecl${glob-types} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
118//$declare${QEP} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
119
120//${QEP::QP_versionStr[8]} ...................................................
121//! the current QP version number string in ROM, based on #QP_VERSION_STR
122extern char const QP_versionStr[8];
123
124//${QEP::QSignal} ............................................................
125#if (Q_SIGNAL_SIZE == 1U)
126typedef uint8_t QSignal;
127#endif // (Q_SIGNAL_SIZE == 1U)
128
129//${QEP::QSignal} ............................................................
130#if (Q_SIGNAL_SIZE == 2U)
131typedef uint16_t QSignal;
132#endif // (Q_SIGNAL_SIZE == 2U)
133
134//${QEP::QSignal} ............................................................
135#if (Q_SIGNAL_SIZE == 4U)
136typedef uint32_t QSignal;
137#endif // (Q_SIGNAL_SIZE == 4U)
138
139//${QEP::QEVT_MARKER} ........................................................
140#define QEVT_MARKER 0xE0U
141
142//${QEP::QEVT_DYNAMIC} .......................................................
143#define QEVT_DYNAMIC 0U
144
145//${QEP::QEvt} ...............................................................
146//! @class QEvt
147typedef struct QEvt {
148// public:
149
150 //! @public @memberof QEvt
152
153// private:
154
155 //! @private @memberof QEvt
156 uint8_t volatile refCtr_;
157
158 //! @private @memberof QEvt
159 uint8_t evtTag_;
160} QEvt;
161
162extern QEvt const QEvt_reserved_[4];
163
164// public:
165
166//! @public @memberof QEvt
167static inline QEvt * QEvt_ctor(QEvt * const me,
168 enum_t const sig)
169{
170 if (sig != QEVT_DYNAMIC) {
171 me->sig = (QSignal)sig;
172 me->refCtr_ = 0U;
173 me->evtTag_ = QEVT_MARKER;
174 }
175 return me;
176}
177
178// private:
179
180//! @private @memberof QEvt
181static inline bool QEvt_verify_(QEvt const * const me) {
182 return (me != (QEvt const *)0)
183 && ((me->evtTag_ & 0xF0U) == QEVT_MARKER);
184}
185
186//! @private @memberof QEvt
187static inline uint_fast8_t QEvt_getPoolNum_(QEvt const * const me) {
188 return (uint_fast8_t)me->evtTag_ & 0x0FU;
189}
190
191//${QEP::QStateRet} ..........................................................
192//! All possible values returned from state/action handlers
193//! @note
194//! The order of enumeration matters for algorithmic correctness.
196 // unhandled and need to "bubble up"
197 Q_RET_SUPER, //!< event passed to superstate to handle
198 Q_RET_SUPER_SUB, //!< event passed to submachine superstate
199 Q_RET_UNHANDLED, //!< event unhandled due to a guard
200
201 // handled and do not need to "bubble up"
202 Q_RET_HANDLED, //!< event handled (internal transition)
203 Q_RET_IGNORED, //!< event silently ignored (bubbled up to top)
204
205 // entry/exit
206 Q_RET_ENTRY, //!< state entry action executed
207 Q_RET_EXIT, //!< state exit action executed
208
209 // no side effects
210 Q_RET_NULL, //!< return value without any effect
211
212 // transitions need to execute transition-action table in ::QMsm
213 Q_RET_TRAN, //!< regular transition
214 Q_RET_TRAN_INIT, //!< initial transition in a state or submachine
215 Q_RET_TRAN_EP, //!< entry-point transition into a submachine
216
217 // transitions that additionally clobber me->state
218 Q_RET_TRAN_HIST, //!< transition to history of a given state
219 Q_RET_TRAN_XP //!< exit-point transition out of a submachine
221
222//${QEP::QState} .............................................................
223typedef enum QStateRet QState;
224
225//${QEP::QStateHandler} ......................................................
226typedef QState (* QStateHandler )(void * const me, QEvt const * const e);
227
228//${QEP::QActionHandler} .....................................................
229typedef QState (* QActionHandler )(void * const me);
230
231//${QEP::QXThread} ...........................................................
232// forward declaration
233struct QXThread;
234
235//${QEP::QXThreadHandler} ....................................................
236typedef void (* QXThreadHandler )(struct QXThread * const me);
237
238//${QEP::QMState} ............................................................
239typedef struct QMState {
240 struct QMState const *superstate; //!< @private @memberof QMState
241 QStateHandler const stateHandler; //!< @private @memberof QMState
242 QActionHandler const entryAction; //!< @private @memberof QMState
243 QActionHandler const exitAction; //!< @private @memberof QMState
244 QActionHandler const initAction; //!< @private @memberof QMState
245} QMState;
246
247//${QEP::QMTranActTable} .....................................................
248typedef struct QMTranActTable {
249 QMState const *target; //!< @private @memberof QMTranActTable
250 QActionHandler const act[1]; //!< @private @memberof QMTranActTable
252
253//${QEP::QReservedSig} .......................................................
254//! Reserved signals by the QHsm-style state machine implementation
256 Q_EMPTY_SIG, //!< signal to execute the default case
257 Q_ENTRY_SIG, //!< signal for coding entry actions
258 Q_EXIT_SIG, //!< signal for coding exit actions
259 Q_INIT_SIG, //!< signal for coding initial transitions
260 Q_USER_SIG //!< offset for the user signals (QP Application)
262
263//${QEP::QAsmAttr} ...........................................................
264union QAsmAttr {
265 QStateHandler fun; //!< @private @memberof QAsmAttr
266 QActionHandler act; //!< @private @memberof QAsmAttr
267 QXThreadHandler thr; //!< @private @memberof QAsmAttr
268 QMTranActTable const *tatbl; //!< @private @memberof QAsmAttr
269 struct QMState const *obj; //!< @private @memberof QAsmAttr
270#ifndef Q_UNSAFE
271 uintptr_t uint; //!< @private @memberof QAsmAttr
272#endif
273};
274
275//${QEP::QAsm} ...............................................................
276//! @class QAsm
277typedef struct {
278// private:
279
280 //! @protected @memberof QAsm
281 struct QAsmVtable const * vptr;
282
283// protected:
284
285 //! @protected @memberof QAsm
286 union QAsmAttr state;
287
288 //! @protected @memberof QAsm
289 union QAsmAttr temp;
290} QAsm;
291
292// protected:
293
294//! @protected @memberof QAsm
295void QAsm_ctor(QAsm * const me);
296
297//${QEP::QAsmVtable} .........................................................
299 void (*init)(QAsm * const me, void const * const e,
300 uint_fast8_t const qsId);
301 void (*dispatch)(QAsm * const me, QEvt const * const e,
302 uint_fast8_t const qsId);
303 bool (*isIn)(QAsm * const me, QStateHandler const s);
304
305#ifdef Q_SPY
307#endif // Q_SPY
308};
309
310//${QEP::QHsm} ...............................................................
311//! @class QHsm
312//! @extends QAsm
313typedef struct {
314// protected:
316} QHsm;
317
318// protected:
319
320//! @protected @memberof QHsm
321void QHsm_ctor(QHsm * const me,
322 QStateHandler const initial);
323
324// private:
325
326//! @private @memberof QHsm
327void QHsm_init_(
328 QAsm * const me,
329 void const * const e,
330 uint_fast8_t const qsId);
331
332//! @private @memberof QHsm
333void QHsm_dispatch_(
334 QAsm * const me,
335 QEvt const * const e,
336 uint_fast8_t const qsId);
337
338#ifdef Q_SPY
339//! @private @memberof QHsm
340QStateHandler QHsm_getStateHandler_(QAsm * const me);
341#endif // def Q_SPY
342
343// public:
344
345//! @private @memberof QHsm
346bool QHsm_isIn_(
347 QAsm * const me,
348 QStateHandler const state);
349
350//! @public @memberof QHsm
351static inline QStateHandler QHsm_state(QHsm const * const me) {
352 return me->super.state.fun;
353}
354
355//! @public @memberof QHsm
356QStateHandler QHsm_childState(QHsm * const me,
357 QStateHandler const parent);
358
359// private:
360
361//! @private @memberof QHsm
362int_fast8_t QHsm_tran_(
363 QAsm * const me,
364 QStateHandler * const path,
365 uint_fast8_t const qsId);
366
367// protected:
368
369//! @protected @memberof QAsm
370QState QHsm_top(QHsm const * const me,
371 QEvt const * const e);
372
373//${QEP::QMsm} ...............................................................
374//! @class QMsm
375//! @extends QAsm
376typedef struct {
377// protected:
379} QMsm;
380
381// protected:
382
383//! @protected @memberof QMsm
384void QMsm_ctor(QMsm * const me,
385 QStateHandler const initial);
386
387// public:
388
389//! @private @memberof QMsm
390void QMsm_init_(
391 QAsm * const me,
392 void const * const e,
393 uint_fast8_t const qsId);
394
395// private:
396
397//! @private @memberof QMsm
398void QMsm_dispatch_(
399 QAsm * const me,
400 QEvt const * const e,
401 uint_fast8_t const qsId);
402
403// public:
404
405#ifdef Q_SPY
406//! @public @memberof QMsm
407static inline QStateHandler QMsm_getStateHandler_(QAsm * const me) {
408 return me->state.obj->stateHandler;
409}
410#endif // def Q_SPY
411
412//! @private @memberof QMsm
413bool QMsm_isIn_(
414 QAsm * const me,
415 QStateHandler const state);
416
417//! @deprecated instead use: QASM_IS_IN()
418bool QMsm_isInState(QMsm const * const me,
419 QMState const * const stateObj);
420
421//! @public @memberof QMsm
422static inline QMState const * QMsm_stateObj(QMsm * const me) {
423 return me->super.state.obj;
424}
425
426//! @public @memberof QMsm
427QMState const * QMsm_childStateObj(QMsm const * const me,
428 QMState const * const parent);
429
430// private:
431
432//! @private @memberof QMsm
433QState QMsm_execTatbl_(
434 QAsm * const me,
435 QMTranActTable const * const tatbl,
436 uint_fast8_t const qsId);
437
438//! @private @memberof QMsm
439void QMsm_exitToTranSource_(
440 QAsm * const me,
441 QMState const * const cs,
442 QMState const * const ts,
443 uint_fast8_t const qsId);
444
445//! @private @memberof QMsm
446QState QMsm_enterHistory_(
447 QAsm * const me,
448 QMState const *const hist,
449 uint_fast8_t const qsId);
450//$enddecl${QEP} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
451
452//$declare${QEP-macros} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
453
454//${QEP-macros::QEVT_INITIALIZER} ............................................
455#define QEVT_INITIALIZER(sig_) { (QSignal)(sig_), 0U, QEVT_MARKER }
456
457//${QEP-macros::QASM_INIT} ...................................................
458#ifdef Q_SPY
459#define QASM_INIT(me_, par_, qsId_) do { \
460 Q_ASSERT(((QAsm *)(me_))->vptr); \
461 (*((QAsm *)(me_))->vptr->init)((QAsm *)(me_), (par_), (qsId_)); \
462} while (false)
463#endif // def Q_SPY
464
465//${QEP-macros::QASM_INIT} ...................................................
466#ifndef Q_SPY
467#define QASM_INIT(me_, par_, dummy) do { \
468 Q_ASSERT(((QAsm *)(me_))->vptr); \
469 (*((QAsm *)(me_))->vptr->init)((QAsm *)(me_), (par_), 0); \
470} while (false)
471#endif // ndef Q_SPY
472
473//${QEP-macros::QASM_DISPATCH} ...............................................
474#ifdef Q_SPY
475#define QASM_DISPATCH(me_, e_, qsId_) \
476 (*((QAsm *)(me_))->vptr->dispatch)((QAsm *)(me_), (e_), (qsId_))
477#endif // def Q_SPY
478
479//${QEP-macros::QASM_DISPATCH} ...............................................
480#ifndef Q_SPY
481#define QASM_DISPATCH(me_, e_, dummy) \
482 (*((QAsm *)(me_))->vptr->dispatch)((QAsm *)(me_), (e_), 0U)
483#endif // ndef Q_SPY
484
485//${QEP-macros::QASM_IS_IN} ..................................................
486#define QASM_IS_IN(me_, state_) \
487 (*((QAsm *)(me_))->vptr->isIn)((QAsm *)(me_), (state_))
488
489//${QEP-macros::Q_ASM_UPCAST} ................................................
490#define Q_ASM_UPCAST(ptr_) ((QAsm *)(ptr_))
491
492//${QEP-macros::Q_HSM_UPCAST} ................................................
493#define Q_HSM_UPCAST(ptr_) ((QHsm *)(ptr_))
494
495//${QEP-macros::Q_MSM_UPCAST} ................................................
496#define Q_MSM_UPCAST(ptr_) ((QMsm *)(ptr_))
497
498//${QEP-macros::Q_TRAN} ......................................................
499#define Q_TRAN(target_) \
500 ((Q_ASM_UPCAST(me))->temp.fun = Q_STATE_CAST(target_), \
501 (QState)Q_RET_TRAN)
502
503//${QEP-macros::Q_TRAN_HIST} .................................................
504#define Q_TRAN_HIST(hist_) \
505 ((Q_ASM_UPCAST(me))->temp.fun = (hist_), \
506 (QState)Q_RET_TRAN_HIST)
507
508//${QEP-macros::Q_SUPER} .....................................................
509#define Q_SUPER(super_) \
510 ((Q_ASM_UPCAST(me))->temp.fun = Q_STATE_CAST(super_), \
511 (QState)Q_RET_SUPER)
512
513//${QEP-macros::Q_HANDLED} ...................................................
514#define Q_HANDLED() ((QState)Q_RET_HANDLED)
515
516//${QEP-macros::Q_UNHANDLED} .................................................
517#define Q_UNHANDLED() ((QState)Q_RET_UNHANDLED)
518
519//${QEP-macros::Q_ACTION_NULL} ...............................................
520#define Q_ACTION_NULL ((QActionHandler)0)
521
522//${QEP-macros::Q_EVT_CAST} ..................................................
523#define Q_EVT_CAST(class_) ((class_ const *)(e))
524
525//${QEP-macros::Q_STATE_CAST} ................................................
526#define Q_STATE_CAST(handler_) ((QStateHandler)(handler_))
527
528//${QEP-macros::Q_ACTION_CAST} ...............................................
529#define Q_ACTION_CAST(action_) ((QActionHandler)(action_))
530
531//${QEP-macros::Q_UNUSED_PAR} ................................................
532#define Q_UNUSED_PAR(par_) ((void)(par_))
533
534//${QEP-macros::Q_DIM} .......................................................
535#define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0U]))
536
537//${QEP-macros::Q_UINT2PTR_CAST} .............................................
538#define Q_UINT2PTR_CAST(type_, uint_) ((type_ *)(uint_))
539
540//${QEP-macros::QM_ENTRY} ....................................................
541#ifdef Q_SPY
542#define QM_ENTRY(state_) \
543 ((Q_ASM_UPCAST(me))->temp.obj = (state_), \
544 (QState)Q_RET_ENTRY)
545#endif // def Q_SPY
546
547//${QEP-macros::QM_ENTRY} ....................................................
548#ifndef Q_SPY
549#define QM_ENTRY(dummy) ((QState)Q_RET_ENTRY)
550#endif // ndef Q_SPY
551
552//${QEP-macros::QM_EXIT} .....................................................
553#ifdef Q_SPY
554#define QM_EXIT(state_) \
555 ((Q_ASM_UPCAST(me))->temp.obj = (state_), \
556 (QState)Q_RET_EXIT)
557#endif // def Q_SPY
558
559//${QEP-macros::QM_EXIT} .....................................................
560#ifndef Q_SPY
561#define QM_EXIT(dummy) ((QState)Q_RET_EXIT)
562#endif // ndef Q_SPY
563
564//${QEP-macros::QM_SM_EXIT} ..................................................
565#define QM_SM_EXIT(state_) \
566 ((Q_ASM_UPCAST(me))->temp.obj = (state_), \
567 (QState)Q_RET_EXIT)
568
569//${QEP-macros::QM_TRAN} .....................................................
570#define QM_TRAN(tatbl_) ((Q_ASM_UPCAST(me))->temp.tatbl \
571 = (struct QMTranActTable const *)(tatbl_), \
572 (QState)Q_RET_TRAN)
573
574//${QEP-macros::QM_TRAN_INIT} ................................................
575#define QM_TRAN_INIT(tatbl_) ((Q_ASM_UPCAST(me))->temp.tatbl \
576 = (struct QMTranActTable const *)(tatbl_), \
577 (QState)Q_RET_TRAN_INIT)
578
579//${QEP-macros::QM_TRAN_HIST} ................................................
580#define QM_TRAN_HIST(history_, tatbl_) \
581 ((((Q_ASM_UPCAST(me))->state.obj = (history_)), \
582 ((Q_ASM_UPCAST(me))->temp.tatbl = \
583 (struct QMTranActTable const *)(tatbl_))), \
584 (QState)Q_RET_TRAN_HIST)
585
586//${QEP-macros::QM_TRAN_EP} ..................................................
587#define QM_TRAN_EP(tatbl_) ((Q_ASM_UPCAST(me))->temp.tatbl \
588 = (struct QMTranActTable const *)(tatbl_), \
589 (QState)Q_RET_TRAN_EP)
590
591//${QEP-macros::QM_TRAN_XP} ..................................................
592#define QM_TRAN_XP(xp_, tatbl_) \
593 ((((Q_ASM_UPCAST(me))->state.act = (xp_)), \
594 ((Q_ASM_UPCAST(me))->temp.tatbl = \
595 (struct QMTranActTable const *)(tatbl_))), \
596 (QState)Q_RET_TRAN_XP)
597
598//${QEP-macros::QM_HANDLED} ..................................................
599#define QM_HANDLED() ((QState)Q_RET_HANDLED)
600
601//${QEP-macros::QM_UNHANDLED} ................................................
602#define QM_UNHANDLED() ((QState)Q_RET_UNHANDLED)
603
604//${QEP-macros::QM_SUPER} ....................................................
605#define QM_SUPER() ((QState)Q_RET_SUPER)
606
607//${QEP-macros::QM_SUPER_SUB} ................................................
608#define QM_SUPER_SUB(host_) \
609 ((Q_ASM_UPCAST(me))->temp.obj = (host_), \
610 (QState)Q_RET_SUPER_SUB)
611
612//${QEP-macros::QM_STATE_NULL} ...............................................
613#define QM_STATE_NULL ((QMState *)0)
614//$enddecl${QEP-macros} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
615
616//$declare${QF::types} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
617
618//${QF::types::QPrioSpec} ....................................................
619typedef uint16_t QPrioSpec;
620
621//${QF::types::QTimeEvtCtr} ..................................................
622#if (QF_TIMEEVT_CTR_SIZE == 1U)
623typedef uint8_t QTimeEvtCtr;
624#endif // (QF_TIMEEVT_CTR_SIZE == 1U)
625
626//${QF::types::QTimeEvtCtr} ..................................................
627#if (QF_TIMEEVT_CTR_SIZE == 2U)
628typedef uint16_t QTimeEvtCtr;
629#endif // (QF_TIMEEVT_CTR_SIZE == 2U)
630
631//${QF::types::QTimeEvtCtr} ..................................................
632#if (QF_TIMEEVT_CTR_SIZE == 4U)
633typedef uint32_t QTimeEvtCtr;
634#endif // (QF_TIMEEVT_CTR_SIZE == 4U)
635
636//${QF::types::QPSetBits} ....................................................
637#if (QF_MAX_ACTIVE <= 8U)
638typedef uint8_t QPSetBits;
639#endif // (QF_MAX_ACTIVE <= 8U)
640
641//${QF::types::QPSetBits} ....................................................
642#if (8U < QF_MAX_ACTIVE) && (QF_MAX_ACTIVE <= 16U)
643typedef uint16_t QPSetBits;
644#endif // (8U < QF_MAX_ACTIVE) && (QF_MAX_ACTIVE <= 16U)
645
646//${QF::types::QPSetBits} ....................................................
647#if (16U < QF_MAX_ACTIVE)
648typedef uint32_t QPSetBits;
649#endif // (16U < QF_MAX_ACTIVE)
650
651//${QF::types::QF_LOG2} ......................................................
652#ifndef QF_LOG2
653uint_fast8_t QF_LOG2(QPSetBits const bitmask);
654#endif // ndef QF_LOG2
655
656//${QF::types::QPSet} ........................................................
657//! @class QPSet
658typedef struct {
659// private:
660
661 //! @private @memberof QPSet
662 QPSetBits bits[((QF_MAX_ACTIVE + (8U*sizeof(QPSetBits))) - 1U)/(8U*sizeof(QPSetBits))];
663} QPSet;
664
665// public:
666
667//! @public @memberof QPSet
668static inline void QPSet_setEmpty(QPSet * const me) {
669 me->bits[0] = 0U;
670 #if (QF_MAX_ACTIVE > 32)
671 me->bits[1] = 0U;
672 #endif
673}
674
675//! @public @memberof QPSet
676static inline bool QPSet_isEmpty(QPSet const * const me) {
677 #if (QF_MAX_ACTIVE <= 32U)
678 return (me->bits[0] == 0U);
679 #else
680 return (me->bits[0] == 0U) ? (me->bits[1] == 0U) : false;
681 #endif
682}
683
684//! @public @memberof QPSet
685static inline bool QPSet_notEmpty(QPSet const * const me) {
686 #if (QF_MAX_ACTIVE <= 32U)
687 return (me->bits[0] != 0U);
688 #else
689 return (me->bits[0] != 0U) ? true : (me->bits[1] != 0U);
690 #endif
691}
692
693//! @public @memberof QPSet
694static inline bool QPSet_hasElement(QPSet const * const me,
695 uint_fast8_t const n)
696{
697 #if (QF_MAX_ACTIVE <= 32U)
698 return (me->bits[0] & ((QPSetBits)1U << (n - 1U))) != 0U;
699 #else
700 return (n <= 32U)
701 ? ((me->bits[0] & ((QPSetBits)1U << (n - 1U))) != 0U)
702 : ((me->bits[1] & ((QPSetBits)1U << (n - 33U))) != 0U);
703 #endif
704}
705
706//! @public @memberof QPSet
707static inline void QPSet_insert(QPSet * const me,
708 uint_fast8_t const n)
709{
710 #if (QF_MAX_ACTIVE <= 32U)
711 me->bits[0] = (me->bits[0] | ((QPSetBits)1U << (n - 1U)));
712 #else
713 if (n <= 32U) {
714 me->bits[0] = (me->bits[0] | ((QPSetBits)1U << (n - 1U)));
715 }
716 else {
717 me->bits[1] = (me->bits[1] | ((QPSetBits)1U << (n - 33U)));
718 }
719 #endif
720}
721
722//! @public @memberof QPSet
723static inline void QPSet_remove(QPSet * const me,
724 uint_fast8_t const n)
725{
726 #if (QF_MAX_ACTIVE <= 32U)
727 me->bits[0] = (me->bits[0] & (QPSetBits)(~((QPSetBits)1U << (n - 1U))));
728 #else
729 if (n <= 32U) {
730 (me->bits[0] = (me->bits[0] & ~((QPSetBits)1U << (n - 1U))));
731 }
732 else {
733 (me->bits[1] = (me->bits[1] & ~((QPSetBits)1U << (n - 33U))));
734 }
735 #endif
736}
737
738//! @public @memberof QPSet
739static inline uint_fast8_t QPSet_findMax(QPSet const * const me) {
740 #if (QF_MAX_ACTIVE <= 32U)
741 return QF_LOG2(me->bits[0]);
742 #else
743 return (me->bits[1] != 0U)
744 ? (QF_LOG2(me->bits[1]) + 32U)
745 : (QF_LOG2(me->bits[0]));
746 #endif
747}
748
749// private:
750
751#ifndef Q_UNSAFE
752//! @private @memberof QPSet
753static inline void QPSet_update_(QPSet const * const me,
754 QPSet * const dis)
755{
756 dis->bits[0] = ~me->bits[0];
757 #if (QF_MAX_ACTIVE > 32U)
758 dis->bits[1] = ~me->bits[1];
759 #endif
760}
761#endif // ndef Q_UNSAFE
762
763#ifndef Q_UNSAFE
764//! @private @memberof QPSet
765static inline bool QPSet_verify_(QPSet const * const me,
766 QPSet const * const dis)
767{
768 #if (QF_MAX_ACTIVE <= 32U)
769 return me->bits[0] == (QPSetBits)(~dis->bits[0]);
770 #else
771 return (me->bits[0] == (QPSetBits)(~dis->bits[0]))
772 && (me->bits[1] == (QPSetBits)(~dis->bits[1]));
773 #endif
774}
775#endif // ndef Q_UNSAFE
776
777//${QF::types::QSubscrList} ..................................................
778// @struct QSubscrList
779typedef struct {
780// private:
781
782 //! @private @memberof QSubscrList
784
785#ifndef Q_UNSAFE
786 //! @private @memberof QSubscrList
788#endif // ndef Q_UNSAFE
790
791//${QF::types::QEQueue} ......................................................
792struct QEQueue;
793//$enddecl${QF::types} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
794
795//$declare${QF::QActive} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
796
797//${QF::QActive} .............................................................
798//! @class QActive
799//! @extends QAsm
800typedef struct QActive {
801// protected:
803
804 //! @protected @memberof QActive
805 uint8_t prio;
806
807 //! @protected @memberof QActive
808 uint8_t pthre;
809
810#ifdef QACTIVE_THREAD_TYPE
811 //! @protected @memberof QActive
813#endif // def QACTIVE_THREAD_TYPE
814
815#ifdef QACTIVE_OS_OBJ_TYPE
816 //! @protected @memberof QActive
818#endif // def QACTIVE_OS_OBJ_TYPE
819
820#ifdef QACTIVE_EQUEUE_TYPE
821 //! @protected @memberof QActive
823#endif // def QACTIVE_EQUEUE_TYPE
824
825#ifndef Q_UNSAFE
826 //! @protected @memberof QActive
827 uint8_t prio_dis;
828#endif // ndef Q_UNSAFE
829
830#ifndef Q_UNSAFE
831 //! @protected @memberof QActive
832 uint8_t pthre_dis;
833#endif // ndef Q_UNSAFE
834
835// private:
836} QActive;
837
838//! @static @private @memberof QActive
840
841//! @static @private @memberof QActive
843
844//! @static @private @memberof QActive
846
847// protected:
848
849//! @protected @memberof QActive
850void QActive_ctor(QActive * const me,
851 QStateHandler const initial);
852
853// public:
854
855//! @public @memberof QActive
856void QActive_setAttr(QActive * const me,
857 uint32_t attr1,
858 void const * attr2);
859
860// private:
861
862//! @private @memberof QActive
863void QActive_start_(QActive * const me,
864 QPrioSpec const prioSpec,
865 QEvt const * * const qSto,
866 uint_fast16_t const qLen,
867 void * const stkSto,
868 uint_fast16_t const stkSize,
869 void const * const par);
870
871// protected:
872
873#ifdef QACTIVE_CAN_STOP
874//! @protected @memberof QActive
875void QActive_stop(QActive * const me);
876#endif // def QACTIVE_CAN_STOP
877
878// private:
879
880//! @private @memberof QActive
881void QActive_register_(QActive * const me);
882
883//! @private @memberof QActive
884void QActive_unregister_(QActive * const me);
885
886//! @private @memberof QActive
887bool QActive_post_(QActive * const me,
888 QEvt const * const e,
889 uint_fast16_t const margin,
890 void const * const sender);
891
892//! @private @memberof QActive
893void QActive_postLIFO_(QActive * const me,
894 QEvt const * const e);
895
896//! @private @memberof QActive
897QEvt const * QActive_get_(QActive * const me);
898
899// public:
900
901//! @static @public @memberof QActive
903 QSubscrList * const subscrSto,
904 enum_t const maxSignal);
905
906// private:
907
908//! @static @private @memberof QActive
909void QActive_publish_(
910 QEvt const * const e,
911 void const * const sender,
912 uint_fast8_t const qsId);
913
914// protected:
915
916//! @protected @memberof QActive
917void QActive_subscribe(QActive const * const me,
918 enum_t const sig);
919
920//! @protected @memberof QActive
921void QActive_unsubscribe(QActive const * const me,
922 enum_t const sig);
923
924//! @protected @memberof QActive
925void QActive_unsubscribeAll(QActive const * const me);
926
927//! @protected @memberof QActive
928bool QActive_defer(QActive const * const me,
929 struct QEQueue * const eq,
930 QEvt const * const e);
931
932//! @protected @memberof QActive
933bool QActive_recall(QActive * const me,
934 struct QEQueue * const eq);
935
936//! @protected @memberof QActive
937uint_fast16_t QActive_flushDeferred(QActive const * const me,
938 struct QEQueue * const eq,
939 uint_fast16_t const num);
940
941// private:
942
943//! @private @memberof QActive
944void QActive_evtLoop_(QActive * const me);
945//$enddecl${QF::QActive} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
946
947//$declare${QF::QMActive} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
948
949//${QF::QMActive} ............................................................
950//! @class QMActive
951//! @extends QActive
952typedef struct {
953// protected:
955} QMActive;
956
957// protected:
958
959//! @protected @memberof QMActive
960void QMActive_ctor(QMActive * const me,
961 QStateHandler const initial);
962//$enddecl${QF::QMActive} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
963
964//$declare${QF::QTimeEvt} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
965
966//${QF::QTimeEvt} ............................................................
967//! @class QTimeEvt
968//! @extends QEvt
969typedef struct QTimeEvt {
970// protected:
972
973// private:
974
975 //! @private @memberof QTimeEvt
976 struct QTimeEvt * volatile next;
977
978 //! @private @memberof QTimeEvt
979 void * volatile act;
980
981 //! @private @memberof QTimeEvt
982 QTimeEvtCtr volatile ctr;
983
984 //! @private @memberof QTimeEvt
986} QTimeEvt;
987
988//! @static @private @memberof QTimeEvt
990
991// public:
992
993//! @public @memberof QTimeEvt
994void QTimeEvt_ctorX(QTimeEvt * const me,
995 QActive * const act,
996 enum_t const sig,
997 uint_fast8_t const tickRate);
998
999//! @public @memberof QTimeEvt
1000void QTimeEvt_armX(QTimeEvt * const me,
1001 QTimeEvtCtr const nTicks,
1002 QTimeEvtCtr const interval);
1003
1004//! @public @memberof QTimeEvt
1005bool QTimeEvt_disarm(QTimeEvt * const me);
1006
1007//! @public @memberof QTimeEvt
1008bool QTimeEvt_rearm(QTimeEvt * const me,
1009 QTimeEvtCtr const nTicks);
1010
1011//! @public @memberof QTimeEvt
1012bool QTimeEvt_wasDisarmed(QTimeEvt * const me);
1013
1014//! @public @memberof QTimeEvt
1015QTimeEvtCtr QTimeEvt_currCtr(QTimeEvt const * const me);
1016
1017//! @static @private @memberof QTimeEvt
1018void QTimeEvt_tick_(
1019 uint_fast8_t const tickRate,
1020 void const * const sender);
1021
1022// private:
1023
1024#ifdef Q_UTEST
1025//! @static @private @memberof QTimeEvt
1026void QTimeEvt_tick1_(
1027 uint_fast8_t const tickRate,
1028 void const * const sender);
1029#endif // def Q_UTEST
1030
1031// public:
1032
1033//! @static @public @memberof QTimeEvt
1034bool QTimeEvt_noActive(uint_fast8_t const tickRate);
1035//$enddecl${QF::QTimeEvt} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1036
1037//$declare${QF::QTicker} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
1038
1039//${QF::QTicker} .............................................................
1040//! @class QTicker
1041//! @extends QActive
1042typedef struct {
1043// protected:
1045} QTicker;
1046
1047// public:
1048
1049//! @public @memberof QTicker
1050void QTicker_ctor(QTicker * const me,
1051 uint_fast8_t const tickRate);
1052
1053// private:
1054
1055//! @private @memberof QTicker
1056void QTicker_init_(
1057 QAsm * const me,
1058 void const * const par,
1059 uint_fast8_t const qsId);
1060
1061//! @private @memberof QTicker
1062void QTicker_dispatch_(
1063 QAsm * const me,
1064 QEvt const * const e,
1065 uint_fast8_t const qsId);
1066
1067//! @private @memberof QTicker
1068void QTicker_trig_(
1069 QActive * const me,
1070 void const * const sender);
1071//$enddecl${QF::QTicker} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1072
1073//$declare${QF::QF-base} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
1074
1075//${QF::QF-base::init} .......................................................
1076//! @static @public @memberof QF
1077void QF_init(void);
1078
1079//${QF::QF-base::stop} .......................................................
1080//! @static @public @memberof QF
1081void QF_stop(void);
1082
1083//${QF::QF-base::run} ........................................................
1084//! @static @public @memberof QF
1085int_t QF_run(void);
1086
1087//${QF::QF-base::getQueueMin} ................................................
1088//! @static @public @memberof QF
1089uint_fast16_t QF_getQueueMin(uint_fast8_t const prio);
1090
1091//${QF::QF-base::onStartup} ..................................................
1092//! @static @public @memberof QF
1093void QF_onStartup(void);
1094
1095//${QF::QF-base::onCleanup} ..................................................
1096//! @static @public @memberof QF
1097void QF_onCleanup(void);
1098
1099//${QF::QF-base::onContextSw} ................................................
1100#ifdef QF_ON_CONTEXT_SW
1101//! @static @public @memberof QF
1103 QActive * prev,
1104 QActive * next);
1105#endif // def QF_ON_CONTEXT_SW
1106//$enddecl${QF::QF-base} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1107
1108//$declare${QF::QF-dyn} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
1109
1110//${QF::QF-dyn::poolInit} ....................................................
1111//! @static @public @memberof QF
1113 void * const poolSto,
1114 uint_fast32_t const poolSize,
1115 uint_fast16_t const evtSize);
1116
1117//${QF::QF-dyn::poolGetMaxBlockSize} .........................................
1118//! @static @public @memberof QF
1119uint_fast16_t QF_poolGetMaxBlockSize(void);
1120
1121//${QF::QF-dyn::getPoolMin} ..................................................
1122//! @static @public @memberof QF
1123uint_fast16_t QF_getPoolMin(uint_fast8_t const poolNum);
1124
1125//${QF::QF-dyn::newX_} .......................................................
1126//! @static @private @memberof QF
1127QEvt * QF_newX_(
1128 uint_fast16_t const evtSize,
1129 uint_fast16_t const margin,
1130 enum_t const sig);
1131
1132//${QF::QF-dyn::gc} ..........................................................
1133//! @static @public @memberof QF
1134void QF_gc(QEvt const * const e);
1135
1136//${QF::QF-dyn::newRef_} .....................................................
1137//! @static @private @memberof QF
1138QEvt const * QF_newRef_(
1139 QEvt const * const e,
1140 void const * const evtRef);
1141
1142//${QF::QF-dyn::deleteRef_} ..................................................
1143//! @static @private @memberof QF
1144void QF_deleteRef_(void const * const evtRef);
1145
1146//${QF::QF-dyn::gcFromISR} ...................................................
1147//! @static @public @memberof QF
1148void QF_gcFromISR(QEvt const * const e);
1149//$enddecl${QF::QF-dyn} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1150
1151//$declare${QF-macros} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
1152
1153//${QF-macros::QF_NO_MARGIN} .................................................
1154#define QF_NO_MARGIN ((uint_fast16_t)0xFFFFU)
1155
1156//${QF-macros::Q_PRIO} .......................................................
1157#define Q_PRIO(prio_, pthre_) ((QPrioSpec)((prio_) | ((pthre_) << 8U)))
1158
1159//${QF-macros::Q_NEW} ........................................................
1160#ifndef QEVT_DYN_CTOR
1161#define Q_NEW(evtT_, sig_) ((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1162 QF_NO_MARGIN, (enum_t)(sig_)))
1163#endif // ndef QEVT_DYN_CTOR
1164
1165//${QF-macros::Q_NEW} ........................................................
1166#ifdef QEVT_DYN_CTOR
1167#define Q_NEW(evtT_, sig_, ...) \
1168 (evtT_##_ctor((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1169 QF_NO_MARGIN, (sig_)), __VA_ARGS__))
1170#endif // def QEVT_DYN_CTOR
1171
1172//${QF-macros::Q_NEW_X} ......................................................
1173#ifndef QEVT_DYN_CTOR
1174#define Q_NEW_X(evtT_, margin_, sig_) \
1175 ((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1176 (margin_), (enum_t)(sig_)))
1177#endif // ndef QEVT_DYN_CTOR
1178
1179//${QF-macros::Q_NEW_X} ......................................................
1180#ifdef QEVT_DYN_CTOR
1181#define Q_NEW_X(evtT_, margin_, sig_, ...) \
1182 (evtT_##_ctor((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1183 (margin_), (sig_)), __VA_ARGS__))
1184#endif // def QEVT_DYN_CTOR
1185
1186//${QF-macros::Q_NEW_REF} ....................................................
1187#define Q_NEW_REF(evtRef_, evtT_) \
1188 ((evtRef_) = (evtT_ const *)QF_newRef_(e, (evtRef_)))
1189
1190//${QF-macros::Q_DELETE_REF} .................................................
1191#define Q_DELETE_REF(evtRef_) do { \
1192 QF_deleteRef_((evtRef_)); \
1193 (evtRef_) = (void *)0; \
1194} while (false)
1195
1196//${QF-macros::QACTIVE_START} ................................................
1197#define QACTIVE_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_) \
1198 (QActive_start_((QActive *)(me_), (prioSpec_), \
1199 (qSto_), (qLen_), (stkSto_), (stkSize_), (par_)))
1200
1201//${QF-macros::QACTIVE_POST} .................................................
1202#ifdef Q_SPY
1203#define QACTIVE_POST(me_, e_, sender_) \
1204 ((void)QActive_post_((me_), (e_), QF_NO_MARGIN, (sender_)))
1205#endif // def Q_SPY
1206
1207//${QF-macros::QACTIVE_POST} .................................................
1208#ifndef Q_SPY
1209#define QACTIVE_POST(me_, e_, dummy) \
1210 ((void)QActive_post_((me_), (e_), QF_NO_MARGIN, (void *)0))
1211#endif // ndef Q_SPY
1212
1213//${QF-macros::QACTIVE_POST_X} ...............................................
1214#ifdef Q_SPY
1215#define QACTIVE_POST_X(me_, e_, margin_, sender_) \
1216 (QActive_post_((me_), (e_), (margin_), (sender_)))
1217#endif // def Q_SPY
1218
1219//${QF-macros::QACTIVE_POST_X} ...............................................
1220#ifndef Q_SPY
1221#define QACTIVE_POST_X(me_, e_, margin_, dummy) \
1222 (QActive_post_((me_), (e_), (margin_), (void *)0))
1223#endif // ndef Q_SPY
1224
1225//${QF-macros::QACTIVE_POST_LIFO} ............................................
1226#define QACTIVE_POST_LIFO(me_, e_) \
1227 (QActive_postLIFO_((me_), (e_)))
1228
1229//${QF-macros::QACTIVE_PUBLISH} ..............................................
1230#ifdef Q_SPY
1231#define QACTIVE_PUBLISH(e_, sender_) \
1232 (QActive_publish_((e_), (void const *)(sender_), (sender_)->prio))
1233#endif // def Q_SPY
1234
1235//${QF-macros::QACTIVE_PUBLISH} ..............................................
1236#ifndef Q_SPY
1237#define QACTIVE_PUBLISH(e_, dummy) (QActive_publish_((e_), (void *)0, 0U))
1238#endif // ndef Q_SPY
1239
1240//${QF-macros::QTIMEEVT_TICK_X} ..............................................
1241#ifdef Q_SPY
1242#define QTIMEEVT_TICK_X(tickRate_, sender_) (QTimeEvt_tick_((tickRate_), (sender_)))
1243#endif // def Q_SPY
1244
1245//${QF-macros::QTIMEEVT_TICK_X} ..............................................
1246#ifndef Q_SPY
1247#define QTIMEEVT_TICK_X(tickRate_, dummy) (QTimeEvt_tick_((tickRate_), (void *)0))
1248#endif // ndef Q_SPY
1249
1250//${QF-macros::QTIMEEVT_TICK} ................................................
1251#define QTIMEEVT_TICK(sender_) QTIMEEVT_TICK_X(0U, (sender_))
1252
1253//${QF-macros::QTICKER_TRIG} .................................................
1254#ifdef Q_SPY
1255#define QTICKER_TRIG(ticker_, sender_) (QTicker_trig_((ticker_), (sender_)))
1256#endif // def Q_SPY
1257
1258//${QF-macros::QTICKER_TRIG} .................................................
1259#ifndef Q_SPY
1260#define QTICKER_TRIG(ticker_, sender_) (QTicker_trig_((ticker_), (void *)0))
1261#endif // ndef Q_SPY
1262
1263//${QF-macros::QF_CRIT_EXIT_NOP} .............................................
1264#ifndef QF_CRIT_EXIT_NOP
1265#define QF_CRIT_EXIT_NOP() ((void)0)
1266#endif // ndef QF_CRIT_EXIT_NOP
1267
1268//${QF-macros::QF_TICK_X} ....................................................
1269#define QF_TICK_X(tickRate_, sender_) QTIMEEVT_TICK_X((tickRate_), (sender_))
1270
1271//${QF-macros::QF_TICK} ......................................................
1272#define QF_TICK(sender_) QTIMEEVT_TICK(sender_)
1273
1274//${QF-macros::QF_PUBLISH} ...................................................
1275#define QF_PUBLISH(e_, sender_) QACTIVE_PUBLISH((e_), (sender_))
1276
1277//${QF-macros::QF_MEM_SYS} ...................................................
1278#ifndef QF_MEM_SYS
1279#define QF_MEM_SYS() ((void)0)
1280#endif // ndef QF_MEM_SYS
1281
1282//${QF-macros::QF_MEM_APP} ...................................................
1283#ifndef QF_MEM_APP
1284#define QF_MEM_APP() ((void)0)
1285#endif // ndef QF_MEM_APP
1286//$enddecl${QF-macros} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1287
1288#endif // QP_H_
void QF_onStartup(void)
void QF_poolInit(void *const poolSto, uint_fast32_t const poolSize, uint_fast16_t const evtSize)
void QF_onContextSw(QActive *prev, QActive *next)
void QF_onCleanup(void)
void QF_gcFromISR(QEvt const *const e)
QActive * QActive_registry_[QF_MAX_ACTIVE+1U]
Definition qf_act.c:64
bool QMsm_isInState(QMsm const *const me, QMState const *const stateObj)
Definition qep_msm.c:412
uint_fast8_t QF_LOG2(QPSetBits const bitmask)
Definition qf_act.c:90
int int_t
Definition qp.h:106
QStateRet
Definition qp.h:195
@ 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_IGNORED
event silently ignored (bubbled up to top)
Definition qp.h:203
@ 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
QEvt const QEvt_reserved_[4]
uint16_t QSignal
Definition qp.h:131
QState(* QStateHandler)(void *const me, QEvt const *const e)
Definition qp.h:226
char const QP_versionStr[8]
the current QP version number string in ROM, based on QP_VERSION_STR
#define QEVT_MARKER
Definition qp.h:140
float float32_t
Definition qp.h:112
QState(* QActionHandler)(void *const me)
Definition qp.h:229
uint32_t QTimeEvtCtr
Definition qp.h:633
QReservedSig
Reserved signals by the QHsm-style state machine implementation.
Definition qp.h:255
@ Q_INIT_SIG
signal for coding initial transitions
Definition qp.h:259
@ Q_EMPTY_SIG
signal to execute the default case
Definition qp.h:256
@ Q_USER_SIG
offset for the user signals (QP Application)
Definition qp.h:260
@ Q_EXIT_SIG
signal for coding exit actions
Definition qp.h:258
@ Q_ENTRY_SIG
signal for coding entry actions
Definition qp.h:257
uint32_t QPSetBits
Definition qp.h:648
enum QStateRet QState
Definition qp.h:223
int enum_t
Definition qp.h:109
double float64_t
Definition qp.h:115
uint16_t QPrioSpec
Definition qp.h:619
#define QEVT_DYNAMIC
Definition qp.h:143
void(* QXThreadHandler)(struct QXThread *const me)
Definition qp.h:236
#define QF_MAX_TICK_RATE
Definition qp_config.h:130
#define QF_MAX_ACTIVE
Definition qp_config.h:112
#define QACTIVE_OS_OBJ_TYPE
QActive "OS-object" type used in various QP/C ports.
Definition qp_port.h:30
#define QACTIVE_EQUEUE_TYPE
QActive event queue type used in various QP/C ports.
Definition qp_port.h:27
#define QACTIVE_THREAD_TYPE
QActive "thread" type used in various QP/C ports.
Definition qp_port.h:33
int_t QF_run(void)
Definition qutest.c:191
void QF_init(void)
Definition qutest.c:172
void QF_stop(void)
Definition qutest.c:186
Active object class (based on the QHsm implementation strategy)
Definition qp.h:800
uint8_t prio
Definition qp.h:805
QSubscrList * QActive_subscrList_
Definition qp.h:842
uint8_t pthre
Definition qp.h:808
uint8_t pthre_dis
Definition qp.h:832
QACTIVE_OS_OBJ_TYPE osObject
Definition qp.h:817
QACTIVE_THREAD_TYPE thread
Definition qp.h:812
void QActive_psInit(QSubscrList *const subscrSto, enum_t const maxSignal)
uint8_t prio_dis
Definition qp.h:827
QACTIVE_EQUEUE_TYPE eQueue
Definition qp.h:822
bool QActive_post_(QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender)
enum_t QActive_maxPubSignal_
Definition qp.h:845
bool QActive_defer(QActive const *const me, struct QEQueue *const eq, QEvt const *const e)
void QActive_ctor(QActive *const me, QStateHandler const initial)
QAsm super
Definition qp.h:802
void QActive_setAttr(QActive *const me, uint32_t attr1, void const *attr2)
void QActive_evtLoop_(QActive *const me)
Abstract State Machine class (state machine interface)
Definition qp.h:277
struct QAsmVtable const * vptr
Definition qp.h:281
void QAsm_ctor(QAsm *const me)
union QAsmAttr state
Definition qp.h:286
Virtual table for the QAsm class.
Definition qp.h:298
QStateHandler(* getStateHandler)(QAsm *const me)
Definition qp.h:306
void(* init)(QAsm *const me, void const *const e, uint_fast8_t const qsId)
Definition qp.h:299
void(* dispatch)(QAsm *const me, QEvt const *const e, uint_fast8_t const qsId)
Definition qp.h:301
bool(* isIn)(QAsm *const me, QStateHandler const s)
Definition qp.h:303
Native QF Event Queue.
Definition qequeue.h:66
Event class.
Definition qp.h:147
static bool QEvt_verify_(QEvt const *const me)
Definition qp.h:181
uint8_t evtTag_
Definition qp.h:159
static QEvt * QEvt_ctor(QEvt *const me, enum_t const sig)
Definition qp.h:167
static uint_fast8_t QEvt_getPoolNum_(QEvt const *const me)
Definition qp.h:187
uint8_t volatile refCtr_
Definition qp.h:156
QSignal sig
Definition qp.h:151
Hierarchical State Machine class (QHsm-style state machine implementation strategy)
Definition qp.h:313
static QStateHandler QHsm_state(QHsm const *const me)
Definition qp.h:351
void QHsm_ctor(QHsm *const me, QStateHandler const initial)
QAsm super
Definition qp.h:315
Active object class (based on QMsm implementation strategy)
Definition qp.h:952
QActive super
Definition qp.h:954
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
QActionHandler const exitAction
Definition qp.h:243
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
static QMState const * QMsm_stateObj(QMsm *const me)
Definition qp.h:422
QAsm super
Definition qp.h:378
static QStateHandler QMsm_getStateHandler_(QAsm *const me)
Definition qp.h:407
Set of Active Objects of up to QF_MAX_ACTIVE elements.
Definition qp.h:658
static void QPSet_remove(QPSet *const me, uint_fast8_t const n)
Definition qp.h:723
static uint_fast8_t QPSet_findMax(QPSet const *const me)
Definition qp.h:739
QPSetBits bits[((QF_MAX_ACTIVE+(8U *sizeof(QPSetBits))) - 1U)/(8U *sizeof(QPSetBits))]
Definition qp.h:662
static bool QPSet_verify_(QPSet const *const me, QPSet const *const dis)
Definition qp.h:765
static bool QPSet_isEmpty(QPSet const *const me)
Definition qp.h:676
static void QPSet_setEmpty(QPSet *const me)
Definition qp.h:668
static void QPSet_update_(QPSet const *const me, QPSet *const dis)
Definition qp.h:753
static void QPSet_insert(QPSet *const me, uint_fast8_t const n)
Definition qp.h:707
static bool QPSet_notEmpty(QPSet const *const me)
Definition qp.h:685
static bool QPSet_hasElement(QPSet const *const me, uint_fast8_t const n)
Definition qp.h:694
Subscriber List (for publish-subscribe)
Definition qp.h:779
QPSet set_dis
Definition qp.h:787
QPSet set
Definition qp.h:783
"Ticker" Active Object class
Definition qp.h:1042
QActive super
Definition qp.h:1044
Time Event class.
Definition qp.h:969
QTimeEvtCtr QTimeEvt_currCtr(QTimeEvt const *const me)
Definition qf_time.c:285
bool QTimeEvt_disarm(QTimeEvt *const me)
Definition qf_time.c:157
bool QTimeEvt_rearm(QTimeEvt *const me, QTimeEvtCtr const nTicks)
Definition qf_time.c:203
void QTimeEvt_armX(QTimeEvt *const me, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval)
Definition qf_time.c:97
void QTimeEvt_ctorX(QTimeEvt *const me, QActive *const act, enum_t const sig, uint_fast8_t const tickRate)
struct QTimeEvt *volatile next
Definition qp.h:976
QTimeEvt QTimeEvt_timeEvtHead_[QF_MAX_TICK_RATE]
Definition qp.h:989
void *volatile act
Definition qp.h:979
QEvt super
Definition qp.h:971
void QTimeEvt_tick_(uint_fast8_t const tickRate, void const *const sender)
Definition qf_time.c:296
QTimeEvtCtr interval
Definition qp.h:985
QTimeEvtCtr volatile ctr
Definition qp.h:982
bool QTimeEvt_wasDisarmed(QTimeEvt *const me)
Definition qf_time.c:269
void QTimeEvt_tick1_(uint_fast8_t const tickRate, void const *const sender)
Definition qutest.c:252
bool QTimeEvt_noActive(uint_fast8_t const tickRate)
Definition qf_time.c:434
eXtended (blocking) thread of the QXK preemptive kernel
Definition qxk.h:145
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
QXThreadHandler thr
Definition qp.h:267
QStateHandler fun
Definition qp.h:265
struct QMState const * obj
Definition qp.h:269
QActionHandler act
Definition qp.h:266