#include <qmpool.h>
Public Member Functions | |
| void | init (void *poolSto, uint32_t poolSize, QMPoolSize blockSize) |
| Initializes the native QF event pool. | |
| void * | get (void) |
| Obtains a memory block from a memory pool. | |
| void | put (void *b) |
| Returns a memory block back to a memory pool. | |
| QMPoolSize | getBlockSize (void) const |
| return the fixed block-size of the blocks managed by this pool | |
Friends | |
| class | QF |
This class describes the native QF memory pool, which can be used as the event pool for dynamic event allocation, or as a fast, deterministic fixed block-size heap for any other objects in your application.
The QMPool structure contains only data members for managing a memory pool, but does not contain the pool storage, which must be provided externally during the pool initialization.
The native QF event pool is configured by defining the macro QF_EPOOL_TYPE_ as QEQueue in the specific QF port header file.
Definition at line 96 of file qmpool.h.
| void QMPool::init | ( | void * | poolSto, | |
| uint32_t | poolSize, | |||
| QMPoolSize | blockSize | |||
| ) |
Initializes the native QF event pool.
The parameters are as follows: 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 38 of file qmp_init.cpp.
References QFreeBlock::m_next, QS::mpObj_, Q_ASSERT, Q_REQUIRE, QS_BEGIN_, QS_END_, QS_INT_LOCK_KEY_, QS_OBJ_, and QS_QF_MPOOL_INIT.
| void * QMPool::get | ( | void | ) |
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 38 of file qmp_get.cpp.
References QFreeBlock::m_next, QS::mpObj_, QS_BEGIN_NOLOCK_, QS_END_NOLOCK_, QS_OBJ_, QS_QF_MPOOL_GET, and QS_TIME_.
| void QMPool::put | ( | void * | b | ) |
Returns a memory block back to a memory pool.
This function can be called from any task level or ISR level.
Definition at line 38 of file qmp_put.cpp.
References QS::mpObj_, Q_REQUIRE, QS_BEGIN_NOLOCK_, QS_END_NOLOCK_, QS_OBJ_, QS_QF_MPOOL_PUT, and QS_TIME_.
1.5.4