33 #ifndef LEGATO_FIXEDHEAP_H 34 #define LEGATO_FIXEDHEAP_H 38 #if LE_MEMORY_MANAGER_ENABLE == 1 40 #if LE_FIXEDHEAP_ENABLE == 1 42 #if LE_USE_DEBUG_ALLOCATOR == 1 43 #define LE_FHEAP_ALLOC(heap) leFixedHeap_Alloc(heap, __LINE__, __FUNCTION__, __FILE__) 44 #define LE_FHEAP_REALLOC(heap, ptr) leFixedHeap_Realloc(heap, ptr, __LINE__, __FUNCTION__, __FILE__) 46 #define LE_FHEAP_ALLOC(heap) leFixedHeap_Alloc(heap) 47 #define LE_FHEAP_REALLOC(heap, ptr) leFixedHeap_Realloc(ptr) 50 #if LE_FIXEDHEAP_DEBUG == 1 51 #define LE_FIXEDHEAP_HEADER_SIZE sizeof(leFixedHeapDebugHeader) 52 #define LE_FIXEDHEAP_FOOTER_SIZE 4 53 #define LE_FIXEDHEAP_CHECKSUM (-1) 55 #define LE_FIXEDHEAP_BLOCK_FOOTER_PTR(size, blk) ((uint8_t*)blk + size - LE_FIXEDHEAP_FOOTER_SIZE) 58 #define LE_FIXEDHEAP_HEADER_SIZE 0 59 #define LE_FIXEDHEAP_FOOTER_SIZE 0 62 #define LE_FIXEDHEAP_BLOCK_SIZE(size) (LE_FIXEDHEAP_HEADER_SIZE + size + LE_FIXEDHEAP_FOOTER_SIZE) 64 #if LE_FIXEDHEAP_DEBUG == 1 83 typedef struct leFixedHeapDebugHeader
85 #if LE_USE_ALLOCATION_TRACKING == 1 93 } leFixedHeapDebugHeader;
111 typedef struct leFixedHeapBlock
113 #if LE_FIXEDHEAP_DEBUG == 1 114 leFixedHeapDebugHeader debug;
139 typedef struct leFixedHeap
142 uint32_t numElements;
143 uint32_t logicalBlockSize;
144 uint32_t physicalBlockSize;
189 leResult leFixedHeap_Init(leFixedHeap* heap,
222 void leFixedHeap_Destroy(leFixedHeap* heap);
224 #if LE_USE_DEBUG_ALLOCATOR == 1 267 void* leFixedHeap_Alloc(leFixedHeap* heap,
269 const char* funcName,
270 const char* fileName);
302 void* leFixedHeap_Alloc(leFixedHeap* heap);
334 void leFixedHeap_Free(leFixedHeap* heap,
void* ptr);
365 leBool leFixedHeap_Contains(leFixedHeap* heap,
void* ptr);
402 leResult leFixedHeap_Validate(leFixedHeap* heap);
436 void leFixedHeap_Dump(leFixedHeap* heap,
leBool dumpRecords);
441 #endif // LE_MEMORY_MANAGER_ENABLE Common macros and definitions used by Legato.
leResult
This enum represents function call results.
Definition: legato_common.h:123
leBool
This enum represents booleans.
Definition: legato_common.h:146