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)]; }
46#if (QF_MPOOL_SIZ_SIZE == 1U)
48#elif (QF_MPOOL_SIZ_SIZE == 2U)
50#elif (QF_MPOOL_SIZ_SIZE == 4U)
53 #error QF_MPOOL_SIZ_SIZE defined incorrectly, expected 1U, 2U, or 4U
56#if (QF_MPOOL_CTR_SIZE == 1U)
58#elif (QF_MPOOL_CTR_SIZE == 2U)
60#elif (QF_MPOOL_CTR_SIZE == 4U)
63 #error QF_MPOOL_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U
81 std::uint_fast32_t const poolSize,
82 std::uint_fast16_t const blockSize) noexcept;
84 std::uint_fast16_t const margin,
85 std::uint_fast8_t const qsId) noexcept;
88 std::uint_fast8_t const qsId) noexcept;
90 std::uint16_t
getUse() const noexcept;
91 std::uint16_t
getFree() const noexcept;
92 std::uint16_t
getMin() const noexcept;
96 std::uint_fast16_t
const margin,
97 std::uint_fast8_t
const qsId)
noexcept;
100 std::uint_fast8_t
const qsId)
noexcept;
void * get(std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
Obtain a memory block from a memory pool.
void init(void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const blockSize) noexcept
Initializes the native QF memory pool.
QMPoolSize m_blockSize
Memory block size [bytes] held by this fixed-size pool.
QMPoolSize getBlockSize() const noexcept
QMPool() noexcept
Default constructor of QP::QMPool.
QMPoolCtr m_nFree
Number of free memory blocks remaining in the pool at this point.
void putFromISR(void *const b, std::uint_fast8_t const qsId) noexcept
void put(void *const block, std::uint_fast8_t const qsId) noexcept
Recycles a memory block back to a memory pool.
std::uint16_t getMin() const noexcept
void * getFromISR(std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
std::uint16_t getFree() const noexcept
QMPoolCtr m_nMin
Minimum number of free blocks ever present in this pool.
void ** m_end
End of the memory managed by this memory pool.
std::uint16_t getUse() const noexcept
void ** m_start
Start of the memory managed by this memory pool.
QMPoolCtr m_nTot
Total number of memory blocks in this pool.
QP/C++ Framework namespace.
std::uint16_t QMPoolSize
The data type to store the block-size based on the macro QF_MPOOL_SIZ_SIZE.
std::uint16_t QMPoolCtr
The data type to store the block-counter based on the macro QF_MPOOL_CTR_SIZE.