32#ifndef QF_MPOOL_SIZ_SIZE
33 #define QF_MPOOL_SIZ_SIZE 2U
35#ifndef QF_MPOOL_CTR_SIZE
36 #define QF_MPOOL_CTR_SIZE 2U
39#define QF_MPOOL_EL(evType_) struct { \
40 void * sto_[((sizeof(evType_) - 1U) / sizeof(void *)) + \
41 (sizeof(evType_) < (2U * sizeof(void *)) ? 2U : 1U)]; \
44#if (QF_MPOOL_SIZ_SIZE == 1U)
46#elif (QF_MPOOL_SIZ_SIZE == 2U)
48#elif (QF_MPOOL_SIZ_SIZE == 4U)
51 #error QF_MPOOL_SIZ_SIZE defined incorrectly, expected 1U, 2U, or 4U
54#if (QF_MPOOL_CTR_SIZE == 1U)
56#elif (QF_MPOOL_CTR_SIZE == 2U)
58#elif (QF_MPOOL_CTR_SIZE == 4U)
61 #error QF_MPOOL_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U
79 uint_fast32_t
const poolSize,
84 uint_fast16_t
const margin,
85 uint_fast8_t
const qsId);
90 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.
void ** end
End of the memory managed by this memory pool.
void QMPool_put(QMPool *const me, void *const block, uint_fast8_t const qsId)
Recycles a memory block back to a memory pool.
void * QMPool_get(QMPool *const me, uint_fast16_t const margin, uint_fast8_t const qsId)
Obtain a memory block from a memory pool.
void ** start
Start of the memory managed by this memory pool.
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.
QMPoolCtr nMin
Minimum number of free blocks ever present in this pool.
QMPoolCtr nTot
Total number of memory blocks in this pool.