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;