platform-independent memory pool interface. More...
Go to the source code of this file.
Data Structures | |
| struct | QMPool |
| Native QF Memory Pool. More... | |
Defines | |
| #define | QF_MPOOL_SIZ_SIZE 2 |
| macro to override the default QMPoolSize size. Valid values 1, 2, or 4; default 2 | |
| #define | QF_MPOOL_CTR_SIZE 2 |
| macro to override the default QMPoolCtr size. Valid values 1, 2, or 4; default 2 | |
Functions | |
| void | QMPool_init (QMPool *me, void *poolSto, uint32_t poolSize, QMPoolSize blockSize) |
| Initializes the native QF event pool. | |
| void * | QMPool_get (QMPool *me) |
| Obtains a memory block from a memory pool. | |
| void | QMPool_put (QMPool *me, void *b) |
| Returns a memory block back to a memory pool. | |
platform-independent memory pool interface.
This header file must be included in all QF ports that use native QF memory pool implementation.
Definition in file qmpool.h.
| void* QMPool_get | ( | QMPool * | me | ) |
Obtains a memory block from a memory pool.
The only parameter me is a pointer to the QMPool from which the block is requested. The function returns a pointer to the allocated memory block or NULL if no free blocks are available.
A allocated block must be returned to the same pool from which it has been allocated.
This function can be called from any task level or ISR level.
Definition at line 40 of file qmp_get.c.
References QS_BEGIN_NOLOCK_, QS_END_NOLOCK_, QS_mpObj_, QS_OBJ_, and QS_QF_MPOOL_GET.
Initializes the native QF event pool.
The parameters are as follows: me points to the QMPool struct to be initialized, poolSto is the pool storage, poolSize is the size of the pool storage in bytes, and blockSize is the block size of this pool.
The caller of this method must make sure that the poolSto pointer is properly aligned. In particular, it must be possible to efficiently store a pointer at the location pointed to by poolSto. Internally, the QMPool_init() function rounds up the block size blockSize so that it can fit an integer number of pointers. This is done to achieve proper alignment of the blocks within the pool.
Definition at line 40 of file qmp_init.c.
References Q_ASSERT, Q_REQUIRE, QS_BEGIN_, QS_END_, QS_INT_LOCK_KEY_, QS_mpObj_, QS_OBJ_, and QS_QF_MPOOL_INIT.
| void QMPool_put | ( | QMPool * | me, | |
| void * | b | |||
| ) |
Returns a memory block back to a memory pool.
The first parameter me is a pointer to the QMPool to which the block is returned. The second parameter is the pointer to the returned memory block.
This function can be called from any task level or ISR level.
Definition at line 40 of file qmp_put.c.
References Q_REQUIRE, QS_BEGIN_NOLOCK_, QS_END_NOLOCK_, QS_mpObj_, QS_OBJ_, and QS_QF_MPOOL_PUT.
1.6.3