37 #include "qs_dummy.hpp"
42Q_DEFINE_THIS_MODULE(
"qf_qeq")
59 QEvt const * *
const qSto,
60 std::uint_fast16_t
const qLen)
noexcept
65#if (QF_EQUEUE_CTR_SIZE == 1U)
86 std::uint_fast16_t
const margin,
87 std::uint_fast8_t
const qsId)
noexcept
101 bool status = (nFree > 0U);
107 status = (nFree >
static_cast<QEQueueCtr>(margin));
112#if (QF_MAX_EPOOL > 0U)
113 if (e->poolNum_ != 0U) {
169 QEvt const *
const e,
170 std::uint_fast8_t
const qsId)
noexcept
187 if (e->poolNum_ != 0U) {
209 if (frontEvt !=
nullptr) {
239 if (nFree <=
m_end) {
288 std::uint16_t nUse = 0U;
290 nUse =
static_cast<std::uint16_t
>(
291 static_cast<std::uint16_t
>(
m_end) + 1U
292 -
static_cast<std::uint16_t
>(
m_nFree));
std::uint16_t getUse() const noexcept
Obtain the number of entries in use in the queue.
QEQueueCtr m_nFree
Number of free events in the ring buffer.
QEQueue() noexcept
Default constructor of QP::QEQueue.
QEvt const * get(std::uint_fast8_t const qsId) noexcept
Obtain an event from the "raw" thread-safe queue.
QEvt const * peekFront() const &
bool isEmpty() const noexcept
Find out if the queue is empty.
QEvt const ** m_ring
Pointer to the start of the ring buffer.
void init(QEvt const **const qSto, std::uint_fast16_t const qLen) noexcept
Initialize the native QF event queue.
QEQueueCtr m_nMin
Minimum number of free events ever in the ring buffer.
std::uint16_t getMin() const noexcept
Obtain the minimum number of free entries ever in the queue (a.k.a. "low-watermark").
bool post(QEvt const *const e, std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
Post an event to the "raw" thread-safe event queue (FIFO).
QEvt const * m_frontEvt
Pointer to event at the front of the queue.
QEQueueCtr m_head
Offset to where next event will be inserted into the buffer.
std::uint16_t getFree() const noexcept
Obtain the number of free entries still available in the queue.
QEQueueCtr m_end
Offset of the end of the ring buffer from the start of the buffer.
void postLIFO(QEvt const *const e, std::uint_fast8_t const qsId) noexcept
Post an event to the "raw" thread-safe event queue (LIFO).
QEQueueCtr m_tail
Offset of where next event will be extracted from the buffer.
std::uint32_t poolNum_
Event pool number of this event.
std::uint32_t refCtr_
Event reference counter.
std::uint32_t sig
Signal of the event (see Event Signal).
constexpr std::uint_fast16_t NO_MARGIN
Special value of margin that causes asserting failure in case event allocation or event posting fails...
QP/C++ Framework namespace.
@ QS_QF_EQUEUE_POST_ATTEMPT
attempt to post evt to QEQueue failed
@ QS_QF_EQUEUE_GET_LAST
get the last event from the queue
@ QS_QF_EQUEUE_GET
get an event and queue still not empty
@ QS_QF_EQUEUE_POST_LIFO
an event was posted (LIFO) to a raw queue
@ QS_QF_EQUEUE_POST
an event was posted (FIFO) to a raw queue
void QEvt_refCtr_inc_(QEvt const *const me) noexcept
Internal function to increment the refCtr of a const event.
std::uint16_t QEQueueCtr
The data type to store the ring-buffer counters.
#define Q_UNUSED_PAR(par_)
Helper macro to clearly mark unused parameters of functions.
QP Framework in C++ internal (package-scope) interface
QS (QP/Spy software tracing) internal (package-scope) interface.
#define QS_OBJ_PRE(obj_)
Output pre-formatted object pointer element.
#define QS_EQC_PRE(ctr_)
Output pre-formatted event queue 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_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_ASSERT_INCRIT(id_, expr_)
General-purpose assertion with user-specified ID number (in critical section).
#define Q_INVARIANT_INCRIT(id_, expr_)
Assertion for checking a postcondition (in critical section).
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section).