PDK API Guide for J721E
|
HeapP interface
Files | |
file | HeapP.h |
Heap management module for the RTOS Porting Interface. | |
Data Structures | |
struct | HeapP_Params |
Basic HeapP Parameters. More... | |
struct | HeapP_MemStats |
Structure used to pass information about the heap out of HeapP_getHeapStats(). More... | |
Functions | |
void | HeapP_Params_init (HeapP_Params *params) |
Initialize params structure to default values. More... | |
HeapP_Handle | HeapP_create (const HeapP_Params *params) |
Create a user defined heap. More... | |
HeapP_Status | HeapP_delete (HeapP_Handle handle) |
Delete the user defined heap. More... | |
void * | HeapP_alloc (HeapP_Handle handle, uint32_t allocSize) |
Alloc memory from user defined heap. More... | |
HeapP_Status | HeapP_free (HeapP_Handle handle, void *ptr, uint32_t size) |
Free memory from user defined heap. More... | |
HeapP_Status | HeapP_getHeapStats (HeapP_Handle handle, HeapP_MemStats *stats) |
Get detailed heap statistics. More... | |
Typedefs | |
typedef void * | HeapP_Handle |
Opaque client reference to an instance of a HeapP. More... | |
Enumerations | |
enum | HeapP_Status { HeapP_OK = 0, HeapP_FAILURE = (-(int32_t)1) } |
Status codes for HeapP APIs. More... | |
Macros | |
#define | HeapP_BYTE_ALIGNMENT (256U) |
Minimum alignment for heap allocations, in units of bytes. More... | |
#define HeapP_BYTE_ALIGNMENT (256U) |
Minimum alignment for heap allocations, in units of bytes.
typedef void* HeapP_Handle |
Opaque client reference to an instance of a HeapP.
A HeapP_Handle returned from the HeapP_create represents that instance and is used in the other instance based functions
enum HeapP_Status |
void HeapP_Params_init | ( | HeapP_Params * | params | ) |
Initialize params structure to default values.
params | Pointer to the instance configuration parameters. |
HeapP_Handle HeapP_create | ( | const HeapP_Params * | params | ) |
Create a user defined heap.
The actual heap start address and size will be adjusted to satisfy HeapP_BYTE_ALIGNMENT.
params | Pointer to the instance configuration parameters. |
HeapP_Status HeapP_delete | ( | HeapP_Handle | handle | ) |
Delete the user defined heap.
handle | [in] Heap handle |
void* HeapP_alloc | ( | HeapP_Handle | handle, |
uint32_t | allocSize | ||
) |
Alloc memory from user defined heap.
handle | [in] Heap handle |
allocSize | [in] Size of memory to allocate |
NOTE: Application should make sure that there is no buffer overflow. i.e., writing to memory beyond allocated size for this heap chunk would potentially cause unexpected failures. Specifically the heap implementation stores relevant software book-keeping parameters in the unallocated/free heap regions. Overflow of a previous allocated buffer could corrupt this and could cause issues with successive heap allocations. Similarly this could also corrupt the contents of successive allocated buffers as well.
HeapP_Status HeapP_free | ( | HeapP_Handle | handle, |
void * | ptr, | ||
uint32_t | size | ||
) |
Free memory from user defined heap.
handle | [in] Heap handle |
ptr | [in] Pointer to memory allocated using HeapP_alloc |
size | [in] Size of the block of memory to free |
HeapP_Status HeapP_getHeapStats | ( | HeapP_Handle | handle, |
HeapP_MemStats * | stats | ||
) |
Get detailed heap statistics.
handle | [in] Heap handle |
stats | [out] Returned heap statistics |