37 #include "qs_dummy.hpp"
41#if (QF_MAX_TICK_RATE > 0U)
45Q_DEFINE_THIS_MODULE(
"qf_time")
57 std::uint_fast8_t
const tickRate) noexcept
63 m_tickRate(
static_cast<std::uint8_t
>(tickRate)),
81 std::uint32_t
const nTicks,
82 std::uint32_t
const interval)
noexcept
88#if (QF_TIMEEVT_CTR_SIZE == 1U)
91#elif (QF_TIMEEVT_CTR_SIZE == 2U)
100 std::uint8_t
const tickRate = m_tickRate;
121 if ((m_flags & QTE_FLAG_IS_LINKED) == 0U) {
129 m_flags |= QTE_FLAG_IS_LINKED;
155 std::uint_fast8_t
const qsId =
static_cast<QActive *
>(
m_act)->m_prio;
159 bool wasArmed =
false;
162 m_flags |= QTE_FLAG_WAS_DISARMED;
175 m_flags &=
static_cast<std::uint8_t
>(~QTE_FLAG_WAS_DISARMED);
196#if (QF_TIMEEVT_CTR_SIZE == 1U)
198#elif (QF_TIMEEVT_CTR_SIZE == 2U)
202 std::uint8_t
const tickRate = m_tickRate;
215 std::uint_fast8_t
const qsId =
static_cast<QActive *
>(
m_act)->m_prio;
221 bool wasArmed =
false;
229 if ((m_flags & QTE_FLAG_IS_LINKED) == 0U) {
237 m_flags |= QTE_FLAG_IS_LINKED;
266 bool const wasDisarmed = (m_flags & QTE_FLAG_WAS_DISARMED) != 0U;
268 m_flags |= QTE_FLAG_WAS_DISARMED;
277 std::uint_fast8_t
const tickRate,
278 void const *
const sender)
noexcept
321 te->m_flags &=
static_cast<std::uint8_t
>(~QTE_FLAG_IS_LINKED);
325 else if (ctr == 1U) {
326 QActive *
const act = te->toActive();
327 prev = te->expire_(prev, act, tickRate);
330 if (te->
sig < Q_USER_SIG) {
338 act->POST(te, sender);
344 act->POST(te, sender);
366 (head.
m_next ==
nullptr) && (head.
m_act ==
nullptr);
384QTimeEvt *QTimeEvt::expire_(
385 QTimeEvt *
const prev_link,
386 QActive
const *
const act,
387 std::uint_fast8_t
const tickRate)
noexcept
395 QTimeEvt *prev = prev_link;
396 if (m_interval != 0U) {
402 prev->m_next = m_next;
405 m_flags &=
static_cast<std::uint8_t
>(~QTE_FLAG_IS_LINKED);
Active Object class (based on the QP::QHsm implementation strategy).
std::uint32_t refCtr_
Event reference counter.
QEvt()=delete
Disallowed default event constructor.
std::uint32_t sig
Signal of the event (see Event Signal).
static void tick(std::uint_fast8_t const tickRate, void const *const sender) noexcept
Processes all armed time events at every clock tick.
QTimeEvt * m_next
Link to the next time event in the list \clearpage .
bool disarm() noexcept
Disarm a time event.
QTimeEvt(QActive *const act, QSignal const sig, std::uint_fast8_t const tickRate=0U) noexcept
The "extended" constructor to initialize a Time Event.
static bool noActive(std::uint_fast8_t const tickRate) noexcept
Check if any time events are active at a given clock tick rate.
void * m_act
Active object that receives the time events \clearpage .
void armX(std::uint32_t const nTicks, std::uint32_t const interval=0U) noexcept
Arm a time event (extended version for one-shot or periodic time event).
bool rearm(std::uint32_t const nTicks) noexcept
Rearm a time event.
QTimeEvtCtr m_ctr
Down-counter of the time event.
QTimeEvtCtr m_interval
Interval for periodic time event (zero for one-shot time event).
bool wasDisarmed() noexcept
Check the "was disarmed" status of a time event.
static void timeout_(QActive *const act)
Process timeout in QXThread (either delay or during blocking).
QP/C++ Framework namespace \clearpage .
std::uint32_t QTimeEvtCtr
Data type to store the block-size defined based on the macro QF_TIMEEVT_CTR_SIZE.
@ QS_QF_TICK
QTimeEvt tick was called.
@ QS_QF_TIMEEVT_ARM
a time event was armed
@ QS_QF_TIMEEVT_POST
a time event posted itself directly to an AO
@ QS_QF_TIMEEVT_AUTO_DISARM
a time event expired and was disarmed
@ QS_QF_TIMEEVT_REARM
rearming of a time event
@ QS_QF_TIMEEVT_DISARM
true disarming of an armed time event
@ QS_QF_TIMEEVT_DISARM_ATTEMPT
attempt to disarm a disarmed QTimeEvt
std::uint16_t QSignal
The signal of event QP::QEvt.
std::array< QTimeEvt, QF_MAX_TICK_RATE > QTimeEvt_head_
Internal heads of the time-event linked-lists (by clock-tick rate).
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
#define QF_MAX_TICK_RATE
Maximum # clock tick rates in the system (0..15).
QP/C++ Framework in C++ internal (package-scope) interface.
#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 (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.
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section).