41 #include "qs_port.hpp"
44 #include "qs_dummy.hpp"
61 std::uint_fast16_t
const margin,
62 void const *
const sender)
noexcept
65 std::uint_fast16_t
const margin)
noexcept
91 else if (nFree >
static_cast<QEQueueCtr>(margin)) {
99 if (e->poolId_ != 0U) {
106 m_eQueue.m_nFree = nFree;
107 if (m_eQueue.m_nMin > nFree) {
108 m_eQueue.m_nMin = nFree;
131 if (m_eQueue.m_frontEvt ==
nullptr) {
132 m_eQueue.m_frontEvt = e;
138 m_eQueue.m_ring[m_eQueue.m_head] = e;
141 if (m_eQueue.m_head == 0U) {
142 m_eQueue.m_head = m_eQueue.m_end;
145 m_eQueue.m_head = (m_eQueue.m_head - 1U);
195 if (e->poolId_ != 0U) {
200 m_eQueue.m_nFree = nFree;
201 if (m_eQueue.m_nMin > nFree) {
202 m_eQueue.m_nMin = nFree;
225 QEvt const *
const frontEvt = m_eQueue.m_frontEvt;
226 m_eQueue.m_frontEvt = e;
229 if (frontEvt ==
nullptr) {
234 m_eQueue.m_tail = (m_eQueue.m_tail + 1U);
235 if (m_eQueue.m_tail == m_eQueue.m_end) {
236 m_eQueue.m_tail = 0U;
239 m_eQueue.m_ring[m_eQueue.m_tail] = frontEvt;
252 QEvt const *
const e = m_eQueue.m_frontEvt;
253 QEQueueCtr const nFree = m_eQueue.m_nFree + 1U;
254 m_eQueue.m_nFree = nFree;
257 if (nFree <= m_eQueue.m_end) {
260 m_eQueue.m_frontEvt = m_eQueue.m_ring[m_eQueue.m_tail];
261 if (m_eQueue.m_tail == 0U) {
262 m_eQueue.m_tail = m_eQueue.m_end;
264 m_eQueue.m_tail = (m_eQueue.m_tail - 1U);
276 m_eQueue.m_frontEvt =
nullptr;
296 && (active_[prio] !=
nullptr));
300 std::uint_fast16_t
const min =
301 static_cast<std::uint_fast16_t
>(active_[prio]->m_eQueue.m_nMin);
312 m_eQueue.m_head =
static_cast<QEQueueCtr>(tickRate);
316 std::uint_fast8_t
const qs_id)
noexcept
318 static_cast<void>(e);
319 static_cast<void>(qs_id);
320 m_eQueue.m_tail = 0U;
324 std::uint_fast8_t
const qs_id)
noexcept
326 static_cast<void>(e);
327 static_cast<void>(qs_id);
332 m_eQueue.m_tail = 0U;
335 for (; nTicks > 0U; --nTicks) {
336 QF::TICK_X(
static_cast<std::uint_fast8_t
>(m_eQueue.m_head),
this);
349 void const *
const sender)
noexcept
355 static_cast<void>(e);
356 static_cast<void>(margin);
360 if (m_eQueue.m_frontEvt ==
nullptr) {
363 static QEvt const tickEvt(0U, QEvt::STATIC_EVT);
365 static QEvt const tickEvt = { 0U, 0U, 0U };
368 m_eQueue.m_frontEvt = &tickEvt;
369 m_eQueue.m_nFree = (m_eQueue.m_nFree - 1U);
375 m_eQueue.m_tail = (m_eQueue.m_tail + 1U);
394 static_cast<void>(e);
QActive active object class (based on QP::QHsm implementation strategy)
virtual void postLIFO(QEvt const *const e) noexcept
Posts an event directly to the event queue of the active object using the Last-In-First-Out (LIFO) po...
virtual bool post_(QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept
QEvt const * get_(void) noexcept
Get an event from the event queue of an active object.
static std::uint_fast16_t getQueueMin(std::uint_fast8_t const prio) noexcept
This function returns the minimum of free entries of the given event queue of an active object (indic...
static void gc(QEvt const *const e) noexcept
Recycle a dynamic event.
static void onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status)
void init(void const *const e, std::uint_fast8_t const qs_id) noexcept override
executes the top-most initial transition in QP::QHsm
void postLIFO(QEvt const *const e) noexcept override
Posts an event directly to the event queue of the active object using the Last-In-First-Out (LIFO) po...
bool post_(QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept override
void dispatch(QEvt const *const e, std::uint_fast8_t const qs_id) noexcept override
Dispatches an event to QHsm.
namespace associated with the QP/C++ framework
std::uint_fast16_t const QF_NO_MARGIN
special value of margin that causes asserting failure in case event allocation or event posting fails
@ QS_QF_ACTIVE_POST_LIFO
an event was posted (LIFO) directly to AO
@ QS_QF_ACTIVE_GET
AO got an event and its queue is not empty.
@ QS_QF_ACTIVE_POST_ATTEMPT
attempt to post an evt to AO failed
@ QS_QF_ACTIVE_POST
an event was posted (FIFO) directly to AO
@ QS_QF_ACTIVE_GET_LAST
AO got an event and its queue is empty.
void QF_EVT_REF_CTR_INC_(QEvt const *const e) noexcept
increment the refCtr_ of an event e
Customizable and memory-efficient assertions for embedded systems.
#define Q_DEFINE_THIS_MODULE(name_)
#define Q_REQUIRE_ID(id_, test_)
#define TICK_X(tickRate_, sender_)
Invoke the system clock tick processing QP::QF::tickX_()
Internal (package scope) QF/C++ interface.
#define QF_CRIT_STAT_
This is an internal macro for defining the critical section status type.
#define Q_ASSERT_CRIT_(id_, test_)
#define QF_CRIT_X_()
This is an internal macro for exiting a critical section.
#define QF_CRIT_E_()
This is an internal macro for entering a critical section.
#define Q_ERROR_CRIT_(id_)
#define QS_TIME_PRE_()
Internal macro to output time stamp to a QS record.
#define QS_TEST_PROBE_DEF(fun_)
QS macro to define the Test-Probe for a given fun_.
#define QS_LOC_CHECK_(qs_id_)
helper macro for checking the local QS filter
#define QS_TEST_PROBE_ID(id_, code_)
QS macro to apply a Test-Probe.
Internal (package scope) QS/C++ interface.
#define QS_BEGIN_NOCRIT_PRE_(rec_, qs_id_)
Internal QS macro to begin a predefined QS record without critical section.
#define QS_OBJ_PRE_(obj_)
Internal QS macro to output object pointer data element.
#define QS_END_NOCRIT_PRE_()
Internal QS macro to end a predefiend QS record without critical section.
#define QS_2U8_PRE_(data1_, data2_)
Internal QS macro to output 2 unformatted uint8_t data elements.
#define QS_EQC_PRE_(ctr_)
#define QACTIVE_EQUEUE_SIGNAL_(me_)
#define QACTIVE_EQUEUE_WAIT_(me_)
QSignal sig
signal of the event instance
std::uint8_t volatile refCtr_
reference counter
std::uint8_t poolId_
pool ID (0 for static event)