48Q_DEFINE_THIS_MODULE(
"qf_mem")
53#if (QP_VERSION < 730U) || (QP_VERSION != ((QP_RELEASE^4294967295U)%0x2710U))
54#error qpcpp version 7.3.0 or higher required
65 std::uint_fast32_t
const poolSize,
66 std::uint_fast16_t
const blockSize)
noexcept
74 poolSize >=
static_cast<std::uint_fast32_t
>(
sizeof(
QFreeBlock)));
76 static_cast<std::uint_fast16_t
>(blockSize +
sizeof(
QFreeBlock))
79 m_free_head =
static_cast<QFreeBlock *
>(poolSto);
82 m_blockSize =
static_cast<QMPoolSize>(2U *
sizeof(
void *));
83 std::uint_fast16_t nblocks = 1U;
84 while (m_blockSize <
static_cast<QMPoolSize>(blockSize)) {
94 std::uint32_t nTot = 1U;
97 for (std::uint_fast32_t size = poolSize - m_blockSize;
98 size >=
static_cast<std::uint_fast32_t
>(m_blockSize);
99 size -=
static_cast<std::uint_fast32_t
>(m_blockSize))
101 fb->
m_next = &fb[nblocks];
110 #if (QF_MPOOL_CTR_SIZE == 1U)
112 #elif (QF_MPOOL_CTR_SIZE == 2U)
125 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(m_free_head));
126 m_nFree_dis =
static_cast<QMPoolCtr>(~m_nFree);
137 std::uint_fast16_t
const margin,
138 std::uint_fast8_t
const qsId)
noexcept
154 ==
static_cast<std::uintptr_t
>(~m_free_head_dis));
159 if (nFree >
static_cast<QMPoolCtr>(margin)) {
167 ==
static_cast<std::uintptr_t
>(~fb->
m_next_dis));
177 m_nFree_dis =
static_cast<QMPoolCtr>(~m_nFree);
184 m_nFree_dis =
static_cast<QMPoolCtr>(~nFree);
192 if (m_nMin > nFree) {
198 m_free_head = fb_next;
201 static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(fb_next));
235 std::uint_fast8_t
const qsId)
noexcept
253 ==
static_cast<std::uintptr_t
>(~m_free_head_dis));
261 !=
static_cast<std::uintptr_t
>(~fb->
m_next_dis));
270 m_free_head_dis =
static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(fb));
271 m_nFree_dis =
static_cast<QMPoolCtr>(~nFree);
272 fb->
m_next_dis =
static_cast<std::uintptr_t
>(~Q_PTR2UINT_CAST_(free_head));
Structure representing a free block in QP::QMPool.
std::uintptr_t m_next_dis
void * get(std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
void init(void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const blockSize) noexcept
QMPoolSize getBlockSize() const noexcept
void put(void *const block, std::uint_fast8_t const qsId) noexcept
#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_)
Internal helper macro to cast pointers to integers.
#define QF_PTR_RANGE_(x_, min_, max_)
#define QS_BEGIN_PRE(rec_, qsId_)
QS/C++ port to a 32-bit CPU, generic C++ compiler.
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_)