#include <rtl.h>
int _init_box (
void* box_mem, /* Start address of the memory pool */
U32 box_size, /* Number of bytes in the memory pool */
U32 blk_size ); /* Number of bytes in each block of the pool */
Description
The _init_box function initializes a fixed block size
memory pool. When the memory pool is initialized, the RTX kernel
handles memory requests by allocating a block of memory from the
memory pool.
The box_mem specifies the start address of the memory pool,
and this address must be 4-byte aligned.
The box_size argument specifies the size of the memory
pool, in bytes.
The blk_size argument specifies the size, in bytes, of the
blocks in the memory pool. You can set the block size to any value
from 1 to box_size-12. However, the blk_size is rounded
up to the next multiple of 4 to maintain 4-byte address alignment of
the blocks. For example if you initialize a memory pool for 10-byte
blocks, the _init_box function actually initializes the memory
pool for 12-byte blocks.
The _init_box function is in the RL-RTX library. The
prototype is defined in rtl.h.
Note
The first 12 bytes from the memory pool are reserved for
storing pointers and size information that can be used by the
functions that handle the memory pool. The box_size must
therefore be more than 12 bytes long.
If the start address is not 4-byte aligned, the memory pool
handling functions might fail.
Return Value
The _init_box function returns 0 if the memory pool was
initialized without any problem. If there was an initialization
error, it returns 1.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.