AM62x MCU+ SDK  10.01.00
APIs for Heap management

Introduction

For more details and example usage, see Heap

Data Structures

struct  HeapP_MemStats
 Structure used to pass information about the heap out of HeapP_getHeapStats(). More...
 
struct  HeapP_Object
 Opaque heap object used with the heap APIs. More...
 

Functions

void HeapP_construct (HeapP_Object *heap, void *heapAddr, size_t heapSize)
 Create a user defined heap. More...
 
void HeapP_destruct (HeapP_Object *heap)
 Delete the user defined heap. More...
 
void * HeapP_alloc (HeapP_Object *heap, size_t allocSize)
 Alloc memory from user defined heap. More...
 
void HeapP_free (HeapP_Object *heap, void *ptr)
 Free memory from user defined heap. More...
 
size_t HeapP_getFreeHeapSize (HeapP_Object *heap)
 Get free heap size, in bytes. More...
 
size_t HeapP_getMinimumEverFreeHeapSize (HeapP_Object *heap)
 Get lowest ever free heap size, in bytes. More...
 
void HeapP_getHeapStats (HeapP_Object *heap, HeapP_MemStats *pHeapStats)
 Get detailed heap statistics. More...
 

Macros

#define HeapP_BYTE_ALIGNMENT   (64u)
 Minimum alignment for heap allocations, in units of bytes. More...
 
#define HeapP_OBJECT_SIZE_MAX   (128U)
 Max size of heap object across no-RTOS and all OS's. More...
 

Macro Definition Documentation

◆ HeapP_BYTE_ALIGNMENT

#define HeapP_BYTE_ALIGNMENT   (64u)

Minimum alignment for heap allocations, in units of bytes.

◆ HeapP_OBJECT_SIZE_MAX

#define HeapP_OBJECT_SIZE_MAX   (128U)

Max size of heap object across no-RTOS and all OS's.

Function Documentation

◆ HeapP_construct()

void HeapP_construct ( HeapP_Object heap,
void *  heapAddr,
size_t  heapSize 
)

Create a user defined heap.

The actual heap start address and size will be adjusted to satisfy HeapP_BYTE_ALIGNMENT.

Parameters
heap[out] Intialized heap handle to be used for subsequent API calls
heapAddr[in] Base address of memory to be used as heap
heapSize[in] Size of memory block that is to be used as heap

◆ HeapP_destruct()

void HeapP_destruct ( HeapP_Object heap)

Delete the user defined heap.

Parameters
heap[in] Heap handle

◆ HeapP_alloc()

void* HeapP_alloc ( HeapP_Object heap,
size_t  allocSize 
)

Alloc memory from user defined heap.

Parameters
heap[in] Heap handle
allocSize[in] Size of memory to allocate
Returns
pointer to allcoated memory
NULL memory could not be allocated since a free block of required size could not be found

◆ HeapP_free()

void HeapP_free ( HeapP_Object heap,
void *  ptr 
)

Free memory from user defined heap.

Parameters
heap[in] Heap handle
ptr[in] Pointer to memory allocated using HeapP_alloc

◆ HeapP_getFreeHeapSize()

size_t HeapP_getFreeHeapSize ( HeapP_Object heap)

Get free heap size, in bytes.

Parameters
heap[in] Heap handle
Returns
Free memory size in this heap, in bytes

◆ HeapP_getMinimumEverFreeHeapSize()

size_t HeapP_getMinimumEverFreeHeapSize ( HeapP_Object heap)

Get lowest ever free heap size, in bytes.

Parameters
heap[in] Heap handle
Returns
Lowest ever free heap size, in bytes

◆ HeapP_getHeapStats()

void HeapP_getHeapStats ( HeapP_Object heap,
HeapP_MemStats pHeapStats 
)

Get detailed heap statistics.

Parameters
heap[in] Heap handle
pHeapStats[out] Returned heap statistics