40 #define HEAP_CCM_BUFFER HEAP_CCM ## _buffer
41 #define HEAP_CCM_MTX HEAP_CCM ## _mtx
48 #define HEAP_SRAM_BUFFER HEAP_SRAM ## _buffer
49 #define HEAP_SRAM_MTX HEAP_SRAM ## _mtx
50 static uint8_t HEAP_SRAM_BUFFER[HEAP_SRAM_SIZE] __attribute__((section(HEAP_SRAM_SECTION), aligned(8))) ;
56 #define HEAP_EXTERN_BUFFER HEAP_EXTERN ## _buffer
57 #define HEAP_EXTERN_MTX HEAP_EXTERN ## _mtx
58 static uint8_t HEAP_EXTERN_BUFFER[HEAP_EXTERN_SIZE] __attribute__((section(HEAP_EXTERN_SECTION), aligned(8))) ;
65 #if defined RTOS_DEBUG && RTOS_DEBUG == 1
81 HEAP_SRAM.
mtx = &HEAP_SRAM_MTX;
82 HEAP_SRAM.
tlsf = tlsf_create_with_pool(HEAP_SRAM_BUFFER, HEAP_SRAM_SIZE,
error_cb);
85 HEAP_EXTERN.
mtx = &HEAP_EXTERN_MTX;
86 HEAP_EXTERN.
tlsf = tlsf_create_with_pool(HEAP_EXTERN_BUFFER, HEAP_EXTERN_SIZE,
error_cb);
98 void *ret = tlsf_malloc(heap->
tlsf, bytes);
99 chMtxUnlock(heap->
mtx);
105 chMtxLock(heap->
mtx);
106 void *ret = tlsf_memalign(heap->
tlsf, align, bytes);
107 chMtxUnlock(heap->
mtx);
113 chMtxLock(heap->
mtx);
114 void *ret = tlsf_realloc(heap->
tlsf, ptr, bytes);
115 chMtxUnlock(heap->
mtx);
121 chMtxLock(heap->
mtx);
122 tlsf_free(heap->
tlsf, ptr);
123 chMtxUnlock(heap->
mtx);
130 chMtxLock(heap->
mtx);
132 chMtxUnlock(heap->
mtx);
140 chMtxLock(heap->
mtx);
141 ret = tlsf_check(heap->
tlsf);
143 ret = tlsf_check_pool(tlsf_get_pool(heap->
tlsf));
146 chMtxUnlock(heap->
mtx);
156 tstat->
mused += size;
158 tstat->
mfree += size;
static MUTEX_DECL(sys_time_mtx)
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
Dynamic memory allocation based on TLSF library.
size_t mfree
free memory available
void * tlsf_get_heap_addr(const tlsf_memory_heap_t *heap)
void tlsf_free_r(tlsf_memory_heap_t *heap, void *ptr)
void tlsf_init_heaps(void)
void tlsf_stat_r(tlsf_memory_heap_t *heap, struct tlsf_stat_t *stat)
static void stat_tlsf_walker(void *ptr, size_t size, int used, void *user)
int tlsf_check_r(tlsf_memory_heap_t *heap)
void * tlsf_memalign_r(tlsf_memory_heap_t *heap, size_t align, size_t bytes)
void * tlsf_realloc_r(tlsf_memory_heap_t *heap, void *ptr, size_t bytes)
void * tlsf_malloc_r(tlsf_memory_heap_t *heap, size_t bytes)
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.