#include <rtl.h>
int _init_box8 (
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_box8 function initializes a fixed block size
memory pool with 8-byte alignment. 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 8-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-16. However, the blk_size is rounded
up to the next multiple of 8, to maintain 8-byte alignment of the
blocks. For example if you initialize a memory pool for 10-byte
blocks, the _init_box8 function actually initializes the
memory pool for 16-byte blocks.
The _init_box8 function is implemented as a macro and is
part of RL-RTX. The definition is in rtl.h.
Note
The first 16 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 16 bytes long.
If the start address is not 8-byte aligned, the memory pool
handling functions might fail.
Return Value
The _init_box8 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.