41#if (QF_MAX_TICK_RATE > 0U)
43Q_DEFINE_THIS_MODULE(
"qf_time")
53 uint_fast8_t const tickRate)
67 me->super.refCtr_ = 0U;
72 me->tickRate = (uint8_t)tickRate;
79 uint32_t
const nTicks,
86#if (QF_TIMEEVT_CTR_SIZE == 1U)
89#elif (QF_TIMEEVT_CTR_SIZE == 2U)
98 uint8_t
const tickRate = me->tickRate;
119 if ((me->flags & QTE_FLAG_IS_LINKED) == 0U) {
127 me->flags |= QTE_FLAG_IS_LINKED;
157 bool wasArmed =
false;
160 me->flags |= QTE_FLAG_WAS_DISARMED;
173 me->flags &= (uint8_t)(~QTE_FLAG_WAS_DISARMED & 0xFFU);
195#if (QF_TIMEEVT_CTR_SIZE == 1U)
197#elif (QF_TIMEEVT_CTR_SIZE == 2U)
201 uint8_t
const tickRate = me->tickRate;
214 uint_fast8_t
const qsId = ((
QActive *)(me->
act))->prio;
220 bool wasArmed =
false;
228 if ((me->flags & QTE_FLAG_IS_LINKED) == 0U) {
237 me->flags |= QTE_FLAG_IS_LINKED;
267 bool const wasDisarmed = (me->flags & QTE_FLAG_WAS_DISARMED) != 0U;
269 me->flags |= QTE_FLAG_WAS_DISARMED;
279 uint_fast8_t
const tickRate,
280 void const *
const sender)
309 if (te == (
void *)0) {
323 te->flags &= (uint8_t)(~QTE_FLAG_IS_LINKED & 0xFFU);
327 else if (
ctr == 1U) {
329 prev = QTimeEvt_expire_(te, prev,
act, tickRate);
333 QXThread_timeout_(
act);
368 bool const noActive =
384void QTimeEvt_init(
void) {
386 for (uint_fast8_t tickRate = 0U;
387 tickRate <
Q_DIM(QTimeEvt_timeEvtHead_);
391 QTimeEvt_ctorX(&QTimeEvt_timeEvtHead_[tickRate],
401 uint_fast8_t
const tickRate)
419 me->flags &= (uint8_t)(~QTE_FLAG_IS_LINKED & 0xFFU);
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
#define Q_USER_SIG
Offset for the user signals (QP/C Application).
uint32_t QTimeEvtCtr
Data type to store the block-size defined based on the macro QF_TIMEEVT_CTR_SIZE.
#define QACTIVE_POST(me_, e_, sender_)
Invoke the direct event posting facility QActive_post_().
#define Q_DIM(array_)
Helper macro to calculate static dimension of a 1-dim array.
#define QF_MAX_TICK_RATE
Maximum # clock tick rates in the system (0..15).
QP/C Framework in C internal (package-scope) interface.
#define QACTIVE_CAST_(ptr_)
Internal helper macro to encapsulate MISRA deviation.
#define QF_CRIT_ENTRY()
Port-specific critical section entry.
#define QF_CRIT_EXIT()
Port-specific critical section exit.
#define QF_CRIT_STAT
Define the critical section status that was present before entering the critical section.
@ QS_QF_TIMEEVT_AUTO_DISARM
a time event expired and was disarmed
@ QS_QF_TIMEEVT_DISARM
true disarming of an armed time event
@ QS_QF_TIMEEVT_REARM
rearming of a time event
@ QS_QF_TIMEEVT_POST
a time event posted itself directly to an AO
@ QS_QF_TIMEEVT_DISARM_ATTEMPT
attempt to disarm a disarmed QTimeEvt
@ QS_QF_TICK
QTimeEvt tick was called.
@ QS_QF_TIMEEVT_ARM
a time event was armed
QS (QP/Spy software tracing) internal (package-scope) interface. \clearpage .
#define QS_OBJ_PRE(obj_)
Output pre-formatted object pointer element.
#define QS_TEC_PRE(ctr_)
Output pre-formatted time event counter data element.
#define QS_SIG_PRE(sig_)
Output pre-formatted event signal data element.
#define QS_2U8_PRE(data1_, data2_)
Output two pre-formatted unsigned 8-bit integer data elements.
#define QS_U8_PRE(data_)
Output pre-formatted unsigned 8-bit integer data element.
#define QS_END_PRE()
Pre-formatted QS trace record end.
#define QS_BEGIN_PRE(rec_, qsId_)
Pre-formatted QS trace record begin.
QP Functional Safety (FuSa) Subsystem (fault detection).
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section).
Active Object class (based on the QHsm implementation strategy).
uint8_t prio
QF-priority [1..QF_MAX_ACTIVE] of this AO.
void QEvt_ctor(QEvt *const me, enum_t const sig)
QEvt constructor
uint32_t sig
Event signal (see Event Signal).
void QTimeEvt_ctorX(QTimeEvt *const me, QActive *const act, enum_t const sig, uint_fast8_t const tickRate)
The "extended" constructor to initialize a Time Event.
QTimeEvtCtr ctr
Down-counter of the time event.
bool QTimeEvt_noActive(uint_fast8_t const tickRate)
Check if any time events are active at a given clock tick rate.
void QTimeEvt_armX(QTimeEvt *const me, uint32_t const nTicks, uint32_t const interval)
Arm a time event (extended version for one-shot or periodic time event).
void QTimeEvt_tick_(uint_fast8_t const tickRate, void const *const sender)
Processes all armed time events at every clock tick.
QTimeEvtCtr interval
Interval for periodic time event (zero for one-shot time event).
QTimeEvt QTimeEvt_timeEvtHead_[QF_MAX_TICK_RATE]
Static array of heads of linked lists of time events (one for every clock tick rate).
bool QTimeEvt_rearm(QTimeEvt *const me, uint32_t const nTicks)
Rearm a time event.
QTimeEvtCtr QTimeEvt_getCtr(QTimeEvt const *const me)
Get the current value of the down-counter of a time event.
bool QTimeEvt_wasDisarmed(QTimeEvt *const me)
Check the "was disarmed" status of a time event.
bool QTimeEvt_disarm(QTimeEvt *const me)
Disarm a time event.
struct QTimeEvt * next
Link to the next time event in the list \clearpage .
void * act
Active object that receives the time events \clearpage .