POOL Module
2-288
The following table describes the fields in this structure:
The following figure shows how the fields in STATICPOOL_Params
define the layout of the buffer:
Figure 2-9.
Buffer Layout as Defined by STATICPOOL_Params
Since the STATICPOOL buffer is generally used in static systems, the
application must provide the memory for the STATICPOOL_Obj. So the
object field of the POOL_Obj must be set to STATICPOOL_Obj instead
of NULL.
The following is an example of an application that has two allocators (two
instances of the STATICPOOL implementation).
#define NUMMSGS 8 /* Number of msgs per allocator */
/* Size of messages in the two allocators. Must be a
* multiple of 8 as required by static allocator. */
#define MSGSIZE0 64
#define MSGSIZE1 128
enum { /* Allocator ID and number of allocators */
MQASTATICID0 = 0,
MQASTATICID1,
NUMALLOCATORS
};
Field
Type
Description
addr
Ptr
User supplied block of memory for allocating messages from.
The address will be aligned on an 8 MADU boundary for correct
structure alignment on all ISAs. If there is a chance the buffer is
not aligned, allow at least 7 extra MADUs of space to allow room
for the alignment. You can use the DATA_ALIGN pragma to
force alignment yourself.
length
size_t
Size of the block of memory pointed to by addr.
bufferSize
size_t
Size of the buffers in the block of memory. The bufferSize must
be a multiple of 8 to allow correct structure alignment.
m e s s a g e
. . .
m e s s a g e
length (in M ADUs)
bufferSize
addr