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)]
struct ch_mutex mutex_t
Type of a mutex structure.
void *(* memgetfunc2_t)(size_t size, unsigned align, size_t offset)
Enhanced memory get function.
static size_t chHeapGetSize(const void *p)
Returns the size of an allocated block.
void chHeapFree(void *p)
Frees a previously allocated memory block.
void __heap_init(void)
Initializes the default heap.
void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size)
Initializes a memory heap from a static memory area.
struct memory_heap memory_heap_t
Type of a memory 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.
size_t chHeapStatus(memory_heap_t *heapp, size_t *totalp, size_t *largestp)
Reports the heap status.
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.
union heap_header heap_header_t
Type of a memory heap header.
#define CH_HEAP_ALIGNMENT
Minimum alignment used for heap.
struct ch_semaphore semaphore_t
Semaphore structure.
Structure describing a memory heap.
memgetfunc2_t provider
Memory blocks provider for this heap.
mutex_t mtx
Heap access mutex.
heap_header_t header
Free blocks list header.