51 #include "qs_dummy.hpp"
56Q_DEFINE_THIS_MODULE(
"qf_mem")
61#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
62#error qpcpp version 7.3.0 or higher required
74 std::uint_fast32_t
const poolSize,
75 std::uint_fast16_t
const blockSize)
noexcept
82 && (poolSize >=
static_cast<std::uint_fast32_t
>(
sizeof(
QFreeBlock)))
83 && (
static_cast<std::uint_fast16_t
>(blockSize +
sizeof(
QFreeBlock))
86 m_free_head =
static_cast<QFreeBlock *
>(poolSto);
90 std::uint_fast16_t nblocks = 1U;
91 while (m_blockSize <
static_cast<QMPoolSize>(blockSize)) {
104 for (std::uint_fast32_t size = poolSize - m_blockSize;
105 size >=
static_cast<std::uint_fast32_t
>(m_blockSize);
106 size -=
static_cast<std::uint_fast32_t
>(m_blockSize))
108 fb->
m_next = &fb[nblocks];
133 std::uint_fast16_t
const margin,
134 std::uint_fast8_t
const qsId)
noexcept
146 if (m_nFree >
static_cast<QMPoolCtr>(margin)) {
156 ==
static_cast<std::uintptr_t
>(~fb->
m_next_dis));
158 m_nFree = (m_nFree - 1U);
177 if (m_nMin > m_nFree) {
182 m_free_head = fb_next;
187 QS_MPC_PRE_(m_nFree);
197 QS_MPC_PRE_(m_nFree);
211 std::uint_fast8_t
const qsId)
noexcept
229 ~Q_UINTPTR_CAST_(fb->
m_next));
233 m_free_head =
static_cast<QFreeBlock *
>(block);
235 m_nFree = m_nFree + 1U;
240 QS_MPC_PRE_(m_nFree);
Structure representing a free block in QP::QMPool.
std::uintptr_t m_next_dis
void put(void *const block, std::uint_fast8_t const qsId) noexcept
QMPoolSize getBlockSize() const noexcept
void init(void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const blockSize) noexcept
void * get(std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
@ QS_QF_MPOOL_GET
a memory block was removed from memory pool
@ QS_QF_MPOOL_GET_ATTEMPT
attempt to get a memory block failed
@ QS_QF_MPOOL_PUT
a memory block was returned to memory pool
#define Q_UNUSED_PAR(par_)
Internal (package scope) QP/C++ interface.
#define Q_UINTPTR_CAST_(ptr_)
Internal helper macro to cast pointers to integers.
#define QF_PTR_RANGE_(x_, min_, max_)
QS/C++ package-scope interface.
QS/C++ port to a 32-bit CPU, generic C++ compiler.
QP Functional Safety (FuSa) Subsystem.
#define Q_ASSERT_INCRIT(id_, expr_)
#define Q_REQUIRE_INCRIT(id_, expr_)