Go to the documentation of this file.
31 #if (CH_CFG_USE_HEAP == TRUE) || defined(__DOXYGEN__)
41 #if (SIZEOF_PTR == 4) || defined(__DOXYGEN__)
42 #define CH_HEAP_ALIGNMENT 8U
43 #elif (SIZEOF_PTR == 2)
44 #define CH_HEAP_ALIGNMENT 4U
46 #error "unsupported pointer size"
57 #if CH_CFG_USE_MEMCORE == FALSE
58 #error "CH_CFG_USE_HEAP requires CH_CFG_USE_MEMCORE"
61 #if (CH_CFG_USE_MUTEXES == FALSE) && (CH_CFG_USE_SEMAPHORES == FALSE)
62 #error "CH_CFG_USE_HEAP requires CH_CFG_USE_MUTEXES and/or CH_CFG_USE_SEMAPHORES"
100 #if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
114 #define CH_HEAP_AREA(name, size) \
115 ALIGNED_VAR(CH_HEAP_ALIGNMENT) \
116 uint8_t name[MEM_ALIGN_NEXT((size), CH_HEAP_ALIGNMENT)]
mutex_t mtx
Heap access mutex.
static size_t chHeapGetSize(const void *p)
Returns the size of an allocated block.
heap_header_t header
Free blocks list header.
void * chHeapAllocAligned(memory_heap_t *heapp, size_t size, unsigned align)
Allocates a block of memory from the heap by using the first-fit algorithm.
void chHeapFree(void *p)
Frees a previously allocated memory block.
void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size)
Initializes a memory heap from a static memory area.
void *(* memgetfunc2_t)(size_t size, unsigned align, size_t offset)
Enhanced memory get function.
#define CH_HEAP_ALIGNMENT
Minimum alignment used for heap.
Structure describing a memory heap.
size_t chHeapStatus(memory_heap_t *heapp, size_t *totalp, size_t *largestp)
Reports the heap status.
void __heap_init(void)
Initializes the default heap.
memgetfunc2_t provider
Memory blocks provider for this heap.
static void * chHeapAlloc(memory_heap_t *heapp, size_t size)
Allocates a block of memory from the heap by using the first-fit algorithm.