48Q_DEFINE_THIS_MODULE(
"qf_time")
53#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
54#error qpcpp version 7.3.0 or higher required
71 std::uint_fast8_t
const tickRate) noexcept
99 std::uint32_t
const nTicks,
100 std::uint32_t
const interval)
noexcept
107 #if (QF_TIMEEVT_CTR_SIZE == 1U)
109 #elif (QF_TIMEEVT_CTR_SIZE == 2U)
116 std::uint8_t
const tickRate = m_tickRate;
118 std::uint_fast8_t
const qsId =
119 static_cast<QActive const *
>(m_act)->m_prio;
123 && (m_act !=
nullptr)
154 static_cast<std::uintptr_t
>(~m_next_dis));
157 static_cast<std::uintptr_t
>(~timeEvtHead_dis_[tickRate].m_ptr_dis));
159 m_next = timeEvtHead_[tickRate].toTimeEvt();
160 timeEvtHead_[tickRate].m_act =
this;
163 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(m_next));
164 timeEvtHead_dis_[tickRate].m_ptr_dis =
165 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(
this));
196 std::uint_fast8_t
const qsId =
static_cast<QActive *
>(
m_act)->m_prio;
220 m_flags &=
static_cast<std::uint8_t
>(~QTE_FLAG_WAS_DISARMED);
243 #if (QF_TIMEEVT_CTR_SIZE == 1U)
245 #elif (QF_TIMEEVT_CTR_SIZE == 2U)
252 std::uint8_t
const tickRate = m_tickRate;
254 std::uint_fast8_t
const qsId =
static_cast<QActive *
>(m_act)->m_prio;
291 static_cast<std::uintptr_t
>(~m_next_dis));
294 static_cast<std::uintptr_t
>(~timeEvtHead_dis_[tickRate].m_ptr_dis));
296 m_next = timeEvtHead_[tickRate].toTimeEvt();
297 timeEvtHead_[tickRate].m_act =
this;
300 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(m_next));
301 timeEvtHead_dis_[tickRate].m_ptr_dis =
302 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(
this));
342 std::uint_fast8_t
const tickRate,
343 void const *
const sender)
noexcept
355 QTimeEvt *prev = &timeEvtHead_[tickRate];
365 for (; lbound > 0U; --lbound) {
372 static_cast<std::uintptr_t
>(~prev->
m_next_dis));
378 if (timeEvtHead_[tickRate].m_act !=
nullptr) {
382 static_cast<std::uintptr_t
>(
383 ~timeEvtHead_dis_[tickRate].m_ptr_dis));
386 timeEvtHead_[tickRate].
m_act =
nullptr;
389 static_cast<std::uintptr_t
>(
390 ~Q_PTR2UINT_CAST_(prev->
m_next));
391 timeEvtHead_dis_[tickRate].m_ptr_dis =
392 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(
nullptr));
416 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(te->
m_next));
420 te->
m_flags &=
static_cast<std::uint8_t
>(~QTE_FLAG_IS_LINKED);
436 else if (ctr == 1U) {
450 static_cast<QTimeEvtCtr>(~static_cast<QTimeEvtCtr>(0U));
452 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(te->
m_next));
457 static_cast<std::uint8_t
>(~QTE_FLAG_IS_LINKED);
477 QXThread::timeout_(act);
486 act->POST(te, sender);
493 act->POST(te, sender);
528 if (timeEvtHead_[tickRate].m_next !=
nullptr) {
531 else if (timeEvtHead_[tickRate].m_act !=
nullptr) {
Active object class (based on the QHsm implementation strategy)
QSignal sig
Signal of the event (see Event Signal)
bool verify_() const noexcept
Internal function to verify the internal integrity of the event instance (QP FuSa Subsystem)
static void tick(std::uint_fast8_t const tickRate, void const *const sender) noexcept
QTimeEvt * toTimeEvt() noexcept
static QTimeEvt timeEvtHead_[QF_MAX_TICK_RATE]
static QPtrDis timeEvtHead_dis_[QF_MAX_TICK_RATE]
std::uintptr_t m_next_dis
static bool noActive(std::uint_fast8_t const tickRate) noexcept
void * m_act
Active object that receives the time events.
QTimeEvt *volatile m_next
Link to the next time event in the list.
QActive * toActive() noexcept
void armX(std::uint32_t const nTicks, std::uint32_t const interval=0U) noexcept
bool rearm(std::uint32_t const nTicks) noexcept
QTimeEvtCtr volatile 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
constexpr enum_t Q_USER_SIG
std::uint32_t QTimeEvtCtr
Data type to store the block-size defined based on the macro QF_TIMEEVT_CTR_SIZE.
constexpr std::uint8_t QTE_FLAG_WAS_DISARMED
std::uint16_t QSignal
The signal of event QP::QEvt.
constexpr std::uint8_t QTE_FLAG_IS_LINKED
#define Q_UNUSED_PAR(par_)
Helper macro to clearly mark unused parameters of functions.
#define QF_CRIT_EXIT_NOP()
#define QF_MAX_TICK_RATE
Maximum # clock tick rates in the system (0..15)
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64)
Internal (package scope) QP/C++ interface.
#define Q_PTR2UINT_CAST_(ptr_)
Internal helper macro to cast pointers to integers.
#define QS_2U8_PRE(data1_, data2_)
#define QS_BEGIN_PRE(rec_, qsId_)
QS/C++ port to a 32-bit CPU, generic C++ compiler.
QP Functional Safety (FuSa) Subsystem.
#define Q_ASSERT_INCRIT(id_, expr_)
#define Q_INVARIANT_INCRIT(id_, expr_)
#define Q_ENSURE_INCRIT(id_, expr_)
#define Q_REQUIRE_INCRIT(id_, expr_)