56#define QF_MAX_ACTIVE 32U
60#if (QF_MAX_ACTIVE > 64U)
61#error QF_MAX_ACTIVE exceeds the maximum of 64U;
65#ifndef QF_MAX_TICK_RATE
69#define QF_MAX_TICK_RATE 1U
73#if (QF_MAX_TICK_RATE > 15U)
74#error QF_MAX_TICK_RATE exceeds the maximum of 15U;
86#define QF_MAX_EPOOL 3U
90#if (QF_MAX_EPOOL > 15U)
91#error QF_MAX_EPOOL exceeds the maximum of 15U;
95#ifndef QF_TIMEEVT_CTR_SIZE
99#define QF_TIMEEVT_CTR_SIZE 4U
103#if (QF_TIMEEVT_CTR_SIZE != 1U) && (QF_TIMEEVT_CTR_SIZE != 2U) && (QF_TIMEEVT_CTR_SIZE != 4U)
104#error QF_TIMEEVT_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U;
108#ifndef QF_EVENT_SIZ_SIZE
112#define QF_EVENT_SIZ_SIZE 2U
116#if (QF_EVENT_SIZ_SIZE != 1U) && (QF_EVENT_SIZ_SIZE != 2U) && (QF_EVENT_SIZ_SIZE != 4U)
117#error QF_EVENT_SIZ_SIZE defined incorrectly, expected 1U, 2U, or 4U;
125#if (8U < QF_MAX_ACTIVE) && (QF_MAX_ACTIVE <= 16U)
131#if (16 < QF_MAX_ACTIVE)
136#if (QF_MAX_ACTIVE <= 8U)
141#if (QF_TIMEEVT_CTR_SIZE == 2U)
153#if (QF_TIMEEVT_CTR_SIZE == 4U)
158#if (QF_TIMEEVT_CTR_SIZE == 1U)
248 #if (QF_MAX_ACTIVE > 32)
257 #if (QF_MAX_ACTIVE <= 32U)
258 return (me->
bits[0] == 0U);
260 return (me->
bits[0] == 0U) ? (me->
bits[1] == 0U) :
false;
268 #if (QF_MAX_ACTIVE <= 32U)
269 return (me->
bits[0] != 0U);
271 return (me->
bits[0] != 0U) ? true : (me->
bits[1] != 0U);
279 uint_fast8_t
const n)
281 #if (QF_MAX_ACTIVE <= 32U)
282 return (me->
bits[0] & (1U << (n - 1U))) != 0U;
285 ? ((me->
bits[0] & ((uint32_t)1U << (n - 1U))) != 0U)
286 : ((me->
bits[1] & ((uint32_t)1U << (n - 33U))) != 0U);
294 uint_fast8_t
const n)
296 #if (QF_MAX_ACTIVE <= 32U)
297 me->
bits[0] = (me->
bits[0] | (1U << (n - 1U)));
300 me->
bits[0] = (me->
bits[0] | ((uint32_t)1U << (n - 1U)));
303 me->
bits[1] = (me->
bits[1] | ((uint32_t)1U << (n - 33U)));
312 uint_fast8_t
const n)
314 #if (QF_MAX_ACTIVE <= 32U)
319 (me->
bits[0] = (me->
bits[0] & ~((uint32_t)1U << (n - 1U))));
322 (me->
bits[1] = (me->
bits[1] & ~((uint32_t)1U << (n - 33U))));
331 #if (QF_MAX_ACTIVE <= 32U)
334 return (me->
bits[1] != 0U)
352 rmc->
bits[0] = ~me->bits[0];
353 #if (QF_MAX_ACTIVE > 32U)
354 rmc->
bits[1] = ~me->bits[1];
370 QPSet const *
const rmc)
372 #if (QF_MAX_ACTIVE <= 32U)
449#ifdef QF_OS_OBJECT_TYPE
502void QActive_ctor(
QActive *
const me,
533 QEvt const * *
const qSto,
534 uint_fast16_t
const qLen,
536 uint_fast16_t
const stkSize,
537 void const *
const par);
600 QEvt const *
const e,
601 uint_fast16_t
const margin,
602 void const *
const sender);
626void QActive_postLIFO_(
QActive *
const me,
627 QEvt const *
const e);
679void QActive_subscribe(
QActive const *
const me,
714void QActive_unsubscribe(
QActive const *
const me,
745void QActive_unsubscribeAll(
QActive const *
const me);
794void QActive_publish_(
795 QEvt const *
const e,
796 void const *
const sender,
797 uint_fast8_t
const qs_id);
829 QEvt const *
const e);
855bool QActive_recall(
QActive *
const me,
875uint_fast16_t QActive_flushDeferred(
QActive const *
const me,
918void QActive_register_(
QActive *
const me);
941void QActive_unregister_(
QActive *
const me);
949bool QActive_postFromISR_(
QActive *
const me,
950 QEvt const *
const e,
951 uint_fast16_t
const margin,
953 void const *
const sender);
962void QActive_publishFromISR_(
965 void const * sender);
999 QEvt const * *
const qSto, uint_fast16_t
const qLen,
1000 void *
const stkSto, uint_fast16_t
const stkSize,
1001 void const *
const par);
1008 uint_fast16_t
const margin,
void const *
const sender);
1067void QMActive_ctor(
QMActive *
const me,
1196 uint_fast8_t
const tickRate);
1370 uint_fast8_t
const tickRate,
1371 void const *
const sender);
1378 uint_fast8_t
const tickRate,
1379 void const *
const sender);
1434void QTicker_ctor(
QTicker *
const me,
1435 uint_fast8_t
const tickRate);
1444 void const *
const par,
1445 uint_fast8_t
const qs_id);
1450void QTicker_dispatch_(
1452 QEvt const *
const e,
1453 uint_fast8_t
const qs_id);
1462 QEvt const *
const e,
1463 uint_fast16_t
const margin,
1464 void const *
const sender);
1472void QTicker_postLIFO_(
1474 QEvt const *
const e);
1483typedef struct QF_Attr {
1563 QActive_psInit(subscrSto, maxSignal);
1588uint_fast16_t QF_getQueueMin(uint_fast8_t
const prio);
1662 void *
const poolSto,
1663 uint_fast32_t
const poolSize,
1664 uint_fast16_t
const evtSize);
1673uint_fast16_t QF_poolGetMaxBlockSize(
void);
1690uint_fast16_t QF_getPoolMin(uint_fast8_t
const poolId);
1722 uint_fast16_t
const evtSize,
1723 uint_fast16_t
const margin,
1755void QF_gc(
QEvt const *
const e);
1774QEvt const * QF_newRef_(
1775 QEvt const *
const e,
1776 void const *
const evtRef);
1794void QF_deleteRef_(
void const *
const evtRef);
1799#ifdef QF_ON_CONTEXT_SW
1834#define QF_NO_MARGIN ((uint_fast16_t)0xFFFFU)
1838#define Q_PRIO(prio_, pthre_) ((QPrioSpec)((prio_) | ((pthre_) << 8U)))
1869#define Q_NEW(evtT_, sig_) ((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1870 QF_NO_MARGIN, (enum_t)(sig_)))
1878#define Q_NEW(evtT_, sig_, ...) \
1879 (evtT_##_ctor((evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1880 QF_NO_MARGIN, (sig_)), (enum_t)(sig_), ##__VA_ARGS__))
1917#define Q_NEW_X(e_, evtT_, margin_, sig_) ((e_) = \
1918 (evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1919 (margin_), (enum_t)(sig_)))
1927#define Q_NEW_X(e_, evtT_, margin_, sig_, ...) do { \
1928 (e_) = (evtT_ *)QF_newX_((uint_fast16_t)sizeof(evtT_), \
1929 (margin_), (enum_t)(sig_));\
1930 if ((e_) != (evtT_ *)0) { \
1931 evtT_##_ctor((e_), (enum_t)(sig_), ##__VA_ARGS__); \
1957#define Q_NEW_REF(evtRef_, evtT_) \
1958 ((evtRef_) = (evtT_ const *)QF_newRef_(e, (evtRef_)))
1976#define Q_DELETE_REF(evtRef_) do { \
1977 QF_deleteRef_((evtRef_)); \
1978 (evtRef_) = (void *)0; \
2000#define QACTIVE_START(me_, prioSpec_, qSto_, qLen_, stkSto_, stkSize_, par_) do { \
2001 Q_ASSERT((Q_HSM_UPCAST(me_))->vptr); \
2002 (*((QActiveVtable const *)((Q_HSM_UPCAST(me_))->vptr))->start)( \
2003 (QActive *)(me_), (prioSpec_), \
2004 (qSto_), (qLen_), (stkSto_), (stkSize_), (par_)); \
2036#define QACTIVE_POST(me_, e_, sender_) \
2037 ((void)(*((QActiveVtable const *)((Q_HSM_UPCAST(me_))->vptr))->post)(\
2038 (me_), (e_), QF_NO_MARGIN, (sender_)))
2043#define QACTIVE_POST(me_, e_, dummy) \
2044 ((void)(*((QActiveVtable const *)((Q_HSM_UPCAST(me_))->vptr))->post)(\
2045 (me_), (e_), QF_NO_MARGIN, (void *)0))
2089#define QACTIVE_POST_X(me_, e_, margin_, sender_) \
2090 ((*((QActiveVtable const *)((Q_HSM_UPCAST(me_))->vptr))->post)((me_),\
2091 (e_), (margin_), (sender_)))
2096#define QACTIVE_POST_X(me_, e_, margin_, dummy) \
2097 ((*((QActiveVtable const *)((Q_HSM_UPCAST(me_))->vptr))->post)((me_),\
2098 (e_), (margin_), (void *)0))
2112#define QACTIVE_POST_LIFO(me_, e_) \
2113 ((*((QActiveVtable const *)((Q_HSM_UPCAST(me_))->vptr))->postLIFO)( \
2137#define QACTIVE_PUBLISH(e_, sender_) \
2138 (QActive_publish_((e_), (void const *)(sender_), (sender_)->prio))
2143#define QACTIVE_PUBLISH(e_, dummy) (QActive_publish_((e_), (void *)0, 0U))
2172#define QTIMEEVT_TICK_X(tickRate_, sender_) \
2173 (QTimeEvt_tick_((tickRate_), (sender_)))
2178#define QTIMEEVT_TICK_X(tickRate_, dummy) \
2179 (QTimeEvt_tick_((tickRate_), (void *)0))
2186#define QTIMEEVT_TICK(sender_) QTIMEEVT_TICK_X(0U, (sender_))
2189#ifndef QF_CRIT_EXIT_NOP
2201#define QF_CRIT_EXIT_NOP() ((void)0)
2210#define QF_TICK_X(tickRate_, sender_) QTIMEEVT_TICK_X((tickRate_), (sender_))
2218#define QF_TICK(sender_) QTIMEEVT_TICK(sender_)
2226#define QF_PUBLISH(e_, sender_) QACTIVE_PUBLISH((e_), (sender_))
QState(* QStateHandler)(void *const me, QEvt const *const e)
QActiveVtable QMActiveVtable
Virtual Table for the QMActive class (inherited from QActiveVtable)
uint_fast16_t QSchedStatus
QTimeEvt QTimeEvt_timeEvtHead_[QF_MAX_TICK_RATE]
static void QF_psInit(QSubscrList *const subscrSto, enum_t const maxSignal)
void QTimeEvt_tick1_(uint_fast8_t const tickRate, void const *const sender)
void QActive_stop(QActive *const me)
void QActive_start_(QActive *const me, QPrioSpec const prioSpec, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
#define QF_OS_OBJECT_TYPE
Active object class (based on the QHsm implementation strategy)
QF_OS_OBJECT_TYPE osObject
QSubscrList * QActive_subscrList_
bool QActive_post_(QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender)
void QActive_thread_(QActive *act)
void QActive_setAttr(QActive *const me, uint32_t attr1, void const *attr2)
bool QActive_defer(QActive const *const me, QEQueue *const eq, QEvt const *const e)
enum_t QActive_maxPubSignal_
void QActive_psInit(QSubscrList *const subscrSto, enum_t const maxSignal)
Virtual table for the QActive class.
void(* start)(QActive *const me, QPrioSpec prio, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
bool(* post)(QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender)
void(* postLIFO)(QActive *const me, QEvt const *const e)
QF active object framework.
uint_fast8_t volatile QF_intLock_
void QF_poolInit(void *const poolSto, uint_fast32_t const poolSize, uint_fast16_t const evtSize)
void QF_onContextSw(QActive *prev, QActive *next)
uint_fast8_t volatile QF_intNest_
Hierarchical State Machine class.
Virtual table for the QHsm class.
Active object class (based on QMsm implementation strategy)
Priority Set of up to QF_MAX_ACTIVE elements.
static uint_fast8_t QPSet_findMax(QPSet const *const me)
static bool QPSet_notEmpty(QPSet const *const me)
static void QPSet_update(QPSet const *const me, QPSet *const rmc)
static bool QPSet_verify(QPSet const *const me, QPSet const *const rmc)
static bool QPSet_hasElement(QPSet const *const me, uint_fast8_t const n)
static void QPSet_setEmpty(QPSet *const me)
static void QPSet_insert(QPSet *const me, uint_fast8_t const n)
static void QPSet_remove(QPSet *const me, uint_fast8_t const n)
QPSetBits volatile bits[(QF_MAX_ACTIVE+31U)/32U]
static bool QPSet_isEmpty(QPSet const *const me)
"Ticker" Active Object class
void QTimeEvt_ctorX(QTimeEvt *const me, QActive *const act, enum_t const sig, uint_fast8_t const tickRate)
struct QTimeEvt *volatile next
bool QTimeEvt_noActive(uint_fast8_t const tickRate)
bool QTimeEvt_rearm(QTimeEvt *const me, QTimeEvtCtr const nTicks)
void QTimeEvt_tick_(uint_fast8_t const tickRate, void const *const sender)
QTimeEvtCtr QTimeEvt_currCtr(QTimeEvt const *const me)
bool QTimeEvt_wasDisarmed(QTimeEvt *const me)
void QTimeEvt_armX(QTimeEvt *const me, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval)
bool QTimeEvt_disarm(QTimeEvt *const me)