38#ifndef QF_MPOOL_SIZ_SIZE
39 #define QF_MPOOL_SIZ_SIZE 2U
41#ifndef QF_MPOOL_CTR_SIZE
42 #define QF_MPOOL_CTR_SIZE 2U
45#if (QF_MPOOL_SIZ_SIZE == 1U)
47#elif (QF_MPOOL_SIZ_SIZE == 2U)
49#elif (QF_MPOOL_SIZ_SIZE == 4U)
52 #error "QF_MPOOL_SIZ_SIZE defined incorrectly, expected 1U, 2U, or 4U"
55#if (QF_MPOOL_CTR_SIZE == 1U)
57#elif (QF_MPOOL_CTR_SIZE == 2U)
59#elif (QF_MPOOL_CTR_SIZE == 4U)
62 #error "QF_MPOOL_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U"
65#define QF_MPOOL_EL(evType_) struct { \
66 QFreeBlock sto_[((sizeof(evType_) - 1U) / (2U * sizeof(void *))) + 1U]; \
131 void *
const poolSto,
132 uint_fast32_t
const poolSize,
133 uint_fast16_t
const blockSize);
136void * QMPool_get(
QMPool *
const me,
137 uint_fast16_t
const margin,
138 uint_fast8_t
const qsId);
141void QMPool_put(
QMPool *
const me,
143 uint_fast8_t
const qsId);
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.
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.
void QMPool_init(QMPool *const me, void *const poolSto, uint_fast32_t const poolSize, uint_fast16_t const blockSize)
Initializes the native QF memory pool.
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.