Mem_DynPoolCreate()

Creates a dynamic memory pool.

Files

lib_mem.h/lib_mem.c

Prototype

void  Mem_DynPoolCreate (const  CPU_CHAR      *p_name,
                                MEM_DYN_POOL  *p_pool,
                                MEM_SEG       *p_seg,
                                CPU_SIZE_T     blk_size,
                                CPU_SIZE_T     blk_align,
                                CPU_SIZE_T     blk_qty_init,
                                CPU_SIZE_T     blk_qty_max,
                                LIB_ERR       *p_err)

Arguments

p_name

Pointer to pool name.

p_pool

Pointer to pool data.

p_seg

Pointer to segment from which to allocate memory. Passing DEF_NULL will allocate memory from the general-purpose heap.

blk_size

Size of memory block to allocate from pool, in bytes. See Note #1.

blk_align

Required alignment of memory block, in bytes. MUST be a power of 2.

blk_qty_init

Initial number of elements to be allocated in pool.

blk_qty_max

Maximum number of elements that can be allocated from this pool. Set to LIB_MEM_BLK_QTY_UNLIMITED if no limit.

p_err

Pointer to variable that will receive the return error code from this function.

LIB_MEM_ERR_NONE

LIB_MEM_ERR_INVALID_BLK_ALIGN

LIB_MEM_ERR_INVALID_BLK_SIZE

LIB_MEM_ERR_INVALID_BLK_NBR

LIB_MEM_ERR_NULL_PTR

LIB_MEM_ERR_INVALID_MEM_ALIGN

LIB_MEM_ERR_INVALID_MEM_SIZE

LIB_MEM_ERR_NULL_PTR

LIB_MEM_ERR_SEG_OVF

Returned Value

None.

Required Configuration

None.

Notes / Warnings

  1. An usage example of this function is available on Dynamic Memory Pools page.

Related pages