qf_pool.c File Reference

QF_pool_[] definition and QF_poolInit() implementation. More...

#include "qf_pkg.h"
#include "qassert.h"

Go to the source code of this file.

Functions

void QF_poolInit (void *poolSto, uint32_t poolSize, QEventSize evtSize)
 Event pool initialization for dynamic allocation of events.

Variables

QF_EPOOL_TYPE_ QF_pool_ [3]
uint8_t QF_maxPool_

Detailed Description

QF_pool_[] definition and QF_poolInit() implementation.

Definition in file qf_pool.c.


Function Documentation

void QF_poolInit ( void *  poolSto,
uint32_t  poolSize,
QEventSize  evtSize 
)

Event pool initialization for dynamic allocation of events.

This function initializes one event pool at a time and must be called exactly once for each event pool before the pool can be used. The arguments are as follows: poolSto is a pointer to the memory block for the events. poolSize is the size of the memory block in bytes. evtSize is the block-size of the pool in bytes, which determines the maximum size of events that can be allocated from the pool.

You might initialize one, two, and up to three event pools by making one, two, or three calls to the QF_poolInit() function. However, for the simplicity of the internal implementation, you must initialize event pools in the ascending order of the event size.

Many RTOSes provide fixed block-size heaps, a.k.a. memory pools that can be adapted for QF event pools. In case such support is missing, QF provides a native QF event pool implementation. The macro QF_EPOOL_TYPE_ determines the type of event pool used by a particular QF port. See structure QMPool for more information.

Note:
The actual number of events available in the pool might be actually less than (poolSize / evtSize) due to the internal alignment of the blocks that the pool might perform. You can always check the capacity of the pool by calling QF_getPoolMargin().
The dynamic allocation of events is optional, meaning that you might choose not to use dynamic events. In that case calling QF_poolInit() and using up memory for the memory blocks is unnecessary.
See also:
QF initialization example for QF_init()

Definition at line 44 of file qf_pool.c.

References Q_DIM, Q_REQUIRE, QF_EPOOL_EVENT_SIZE_, and QF_EPOOL_INIT_.


Variable Documentation

# of initialized event pools

Definition at line 41 of file qf_pool.c.

Referenced by QF_gc(), QF_getPoolMargin(), and QF_new_().

QF_EPOOL_TYPE_ QF_pool_[3]

allocate 3 event pools

Definition at line 40 of file qf_pool.c.

Referenced by QF_gc(), QF_getPoolMargin(), and QF_new_().

Generated on Tue Mar 16 19:38:10 2010 for QP/C by  doxygen 1.6.3