46Q_DEFINE_THIS_MODULE(
"qf_mem")
50#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
51#error qpc version 7.3.0 or higher required
60void QMPool_init(
QMPool *
const me,
62 uint_fast32_t
const poolSize,
63 uint_fast16_t
const blockSize)
78 uint_fast16_t nblocks = 1U;
92 for (uint_fast32_t size = poolSize - me->
blockSize;
96 fb->
next = &fb[nblocks];
105 #if (QF_MPOOL_CTR_SIZE == 1U)
107 #elif (QF_MPOOL_CTR_SIZE == 2U)
132 uint_fast16_t
const margin,
133 uint_fast8_t
const qsId)
185 (me->
start <= fb_next) && (fb_next <= me->end));
188 if (me->
nMin > nFree) {
231 uint_fast8_t
const qsId)
265 fb->
next = free_head;
uint16_t QMPoolSize
The data type to store the block-size based on the macro QF_MPOOL_SIZ_SIZE.
uint16_t QMPoolCtr
The data type to store the block-counter based on the macro QF_MPOOL_CTR_SIZE.
#define Q_UNUSED_PAR(par_)
Helper macro to clearly mark unused parameters of functions.
Internal (package scope) QP/C interface.
#define Q_PTR2UINT_CAST_(ptr_)
#define QS_BEGIN_PRE(rec_, qsId_)
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_)
Structure representing a free block in QMPool.
uintptr_t next_dis
Duplicate inverse storage for the next pointer (QP FuSa Subsystem)
struct QFreeBlock * next
Link to the next memory block.
QMPoolCtr volatile nFree
Number of free memory blocks remaining in the pool at this point.
QMPoolSize blockSize
Memory block size [bytes] held by this fixed-size pool.
QFreeBlock * end
End of the memory managed by this memory pool.
QMPoolCtr nMin
Minimum number of free blocks ever present in this pool.
QFreeBlock *volatile free_head
Head of linked list of free memory blocks.
QFreeBlock * start
Start of the memory managed by this memory pool.
QMPoolCtr nTot
Total number of memory blocks in this pool.