Mem_SegCreate()
Creates a memory segment.
Files
lib_mem.h/lib_mem.c
Prototype
void Mem_SegCreate (const CPU_CHAR *p_name, MEM_SEG *p_seg, CPU_ADDR seg_base_addr, CPU_SIZE_T size, CPU_SIZE_T padding_align, LIB_ERR *p_err);
Arguments
p_name
Pointer to segment name.
p_seg
Pointer to segment data. Must be allocated by caller.
seg_base_addr
Address of segment's first byte.
size
Total size of segment, in bytes.
padding_align
Padding alignment, in bytes, that will be added to buffers allocated from this memory segment using Mem_SegAllocHW() function or hardware dynamic memory pools. MUST be a power of 2. LIB_MEM_PADDING_ALIGN_NONE
means no padding.
p_err
Pointer to variable that will receive the return error code from this function.
LIB_MEM_ERR_NONE
LIB_MEM_ERR_INVALID_SEG_SIZE
LIB_MEM_ERR_INVALID_MEM_ALIGN
LIB_MEM_ERR_NULL_PTR
LIB_MEM_ERR_INVALID_SEG_OVERLAP
LIB_MEM_ERR_INVALID_SEG_EXISTS
Returned Value
None.
Required Configuration
None.
Notes / Warnings
- For an usage example of this function, refer to Memory Segments page.