37 #include "qs_dummy.hpp"
40#if (QF_MAX_EPOOL > 0U)
44Q_DEFINE_THIS_MODULE(
"qf_dyn")
53 std::uint_fast32_t
const poolSize,
54 std::uint_fast16_t
const evtSize)
noexcept
56 std::uint_fast8_t
const poolNum = priv_.maxPool_;
70 QF_EPOOL_EVENT_SIZE_(priv_.ePool_[poolNum - 1U]) < evtSize);
73 priv_.maxPool_ =
static_cast<std::uint8_t
>(poolNum + 1U);
78 QF_EPOOL_INIT_(priv_.ePool_[poolNum], poolSto, poolSize, evtSize);
83 std::array<std::uint8_t, 9U> obj_name =
84 {
'E',
'v',
't',
'P',
'o',
'o',
'l',
'?',
'\0' };
86 obj_name[7] =
static_cast<std::uint8_t
>(
87 static_cast<std::uint8_t
>(
'0') + priv_.maxPool_);
88 QS::obj_dict_pre_(&priv_.ePool_[poolNum],
89 reinterpret_cast<char *
>(&obj_name[0]));
99 std::uint8_t
const maxPool = priv_.maxPool_;
105 std::uint16_t
const maxSize =
106 QF_EPOOL_EVENT_SIZE_(priv_.ePool_[maxPool - 1U]);
115std::uint16_t getPoolUse(std::uint_fast8_t
const poolNum)
noexcept {
120 std::uint8_t
const maxPool = priv_.
maxPool_;
128 std::uint16_t nUse = 0U;
131 nUse = QF_EPOOL_USE_(&priv_.
ePool_[poolNum - 1U]);
135 for (std::uint_fast8_t pool = priv_.
maxPool_; pool > 0U; --pool) {
137 nUse += QF_EPOOL_USE_(&priv_.
ePool_[pool - 1U]);
150std::uint16_t getPoolFree(std::uint_fast8_t
const poolNum)
noexcept {
155 std::uint8_t
const maxPool = priv_.maxPool_;
163 std::uint16_t
const nFree = QF_EPOOL_FREE_(&priv_.ePool_[poolNum - 1U]);
174std::uint16_t
getPoolMin(std::uint_fast8_t
const poolNum)
noexcept {
179 std::uint8_t
const maxPool = priv_.maxPool_;
188 std::uint16_t
const nMin = QF_EPOOL_MIN_(&priv_.ePool_[poolNum - 1U]);
198 std::uint_fast16_t
const evtSize,
199 std::uint_fast16_t
const margin,
205 std::uint8_t
const maxPool = priv_.maxPool_;
211 std::uint8_t poolNum = 0U;
212 for (; poolNum < maxPool; ++poolNum) {
214 if (evtSize <= QF_EPOOL_EVENT_SIZE_(priv_.ePool_[poolNum])) {
230 QF_EPOOL_GET_(priv_.ePool_[poolNum - 1U], e,
232 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum);
234 QF_EPOOL_GET_(priv_.ePool_[poolNum - 1U], e,
235 ((margin !=
NO_MARGIN) ? margin : 0U), 0U);
239 e->sig =
static_cast<QSignal>(sig);
240 e->poolNum_ = poolNum;
245 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum)
261 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum)
283 std::uint8_t
const poolNum =
static_cast<std::uint8_t
>(e->poolNum_);
286 if (e->refCtr_ > 1U) {
289 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum)
301 std::uint8_t
const maxPool = priv_.maxPool_;
310 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum)
321 QF_EPOOL_PUT_(priv_.ePool_[poolNum - 1U],
322 const_cast<QEvt*
>(e),
323 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum);
325 QF_EPOOL_PUT_(priv_.ePool_[poolNum - 1U],
326 const_cast<QEvt*
>(e), 0U);
337 QEvt const *
const e,
338 QEvt const *
const evtRef)
noexcept
357 std::uint_fast8_t
const poolNum = e->poolNum_;
365 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum)
378void deleteRef_(
QEvt const * const evtRef) noexcept {
382 QEvt const *
const e = evtRef;
388 std::uint8_t
const poolNum = e->poolNum_;
391 static_cast<std::uint_fast8_t
>(QS_ID_EP) + poolNum)
400#if (QF_MAX_EPOOL > 0U)
std::array< QF_EPOOL_TYPE_, QF_MAX_EPOOL > ePool_
Array of event pools sized for the maximum allowed number of pools.
std::uint8_t maxPool_
Number of event pools managed by the QF Framework.
QF Active Object Framework namespace \clearpage .
std::uint16_t poolGetMaxBlockSize() noexcept
Obtain the block size of any registered event pools.
void gc(QEvt const *const e) noexcept
Recycle a mutable (mutable) event.
void poolInit(void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const evtSize) noexcept
Event pool initialization for dynamic allocation of events.
constexpr std::uint_fast16_t NO_MARGIN
Special value of margin that causes asserting failure in case event allocation or event posting fails...
std::uint16_t getPoolMin(std::uint_fast8_t const poolNum) noexcept
Obtain the minimum of free entries of the given event pool.
QP/C++ Framework namespace \clearpage .
@ QS_QF_NEW
new event was created
@ QS_QF_GC
garbage collection
@ QS_QF_DELETE_REF
an event reference is about to be deleted
@ QS_QF_NEW_ATTEMPT
an attempt to allocate an event failed
@ QS_QF_GC_ATTEMPT
garbage collection attempt
@ QS_QF_NEW_REF
new event reference was created
void QEvt_refCtr_inc_(QEvt const *const me) noexcept
Internal function to increment the refCtr of a const event.
void QEvt_refCtr_dec_(QEvt const *const me) noexcept
Internal function to decrement the refCtr of a const event.
std::uint16_t QSignal
The signal of event QP::QEvt.
#define Q_UNUSED_PAR(par_)
Helper macro to mark unused parameters of functions.
#define QF_MAX_ACTIVE
Maximum # Active Objects in the system (1..64).
#define QF_MAX_EPOOL
Maximum # event pools 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.
#define QS_CRIT_EXIT()
Internal macro for exiting a critical section \clearpage .
#define QS_CRIT_ENTRY()
Internal macro for entering a critical section \clearpage .
QS (QP/Spy software tracing) internal (package-scope) interface. \clearpage .
#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_EVS_PRE(size_)
Output pre-formatted event queue size 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_ASSERT_INCRIT(id_, expr_)
General-purpose assertion with user-specified ID number (in critical section).
#define Q_REQUIRE_INCRIT(id_, expr_)
Assertion for checking a precondition (in critical section).