35 #define DEBUG_MALLOC_FAILURES 0
40 #if DEBUG_MALLOC_FAILURES
41 static volatile bool wait_here =
true;
52 #if defined(PIOS_INCLUDE_RTOS)
64 uintptr_t buf_addr = (uintptr_t)buf;
75 uint32_t align_pad = (
sizeof(uintptr_t) - (size & (
sizeof(uintptr_t) - 1))) %
sizeof(uintptr_t);
77 #if defined(PIOS_INCLUDE_RTOS)
81 if (heap->
free_addr + size <= heap->end_addr) {
86 #if defined(PIOS_INCLUDE_RTOS)
114 extern const void *
_eheap;
115 extern const void *
_sheap;
120 .free_addr = (uintptr_t)&
_sheap,
141 #if defined(PIOS_INCLUDE_FASTHEAP)
143 extern const void * _efastheap;
144 extern const void * _sfastheap;
145 static struct pios_heap pios_nodma_heap = {
147 .
end_addr = (
const uintptr_t)&_efastheap,
148 .free_addr = (uintptr_t)&_sfastheap,
176 #if defined(PIOS_INCLUDE_FASTHEAP)
186 size_t PIOS_heap_get_free_size(
void)
188 #if defined(PIOS_INCLUDE_RTOS)
194 #if defined(PIOS_INCLUDE_RTOS)
202 #if defined(PIOS_INCLUDE_FASTHEAP)
206 #if defined(PIOS_INCLUDE_RTOS)
212 #if defined(PIOS_INCLUDE_RTOS)
226 #endif // PIOS_INCLUDE_FASTHEAP
235 #if defined(PIOS_INCLUDE_RTOS)
241 #if defined(PIOS_INCLUDE_RTOS)
251 static uintptr_t
brk_ptr = (uintptr_t) sbrk_pool;
255 uintptr_t
new = brk_ptr + incr;
257 uintptr_t end = ((uintptr_t) sbrk_pool) +
sizeof(
sbrk_pool);
static uintptr_t sbrk_pool[1024]
static void simple_free(struct pios_heap *heap, void *buf)
Main PiOS header to include all the compiled in PiOS options.
size_t PIOS_fastheap_get_free_size(void)
static size_t simple_get_free_bytes(struct pios_heap *heap)
void PIOS_Thread_Scheduler_Suspend(void)
void * PIOS_malloc(size_t size)
void * PIOS_malloc_no_dma(size_t size)
void PIOS_heap_increase_size(size_t bytes)
void vPortFree(void *buf) __attribute__((alias("PIOS_free")))
static void malloc_failed_hook(void)
size_t xPortGetFreeHeapSize(void)
void PIOS_heap_initialize_blocks(void)
struct pios_heap __attribute__
void * pvPortMalloc(size_t size) __attribute__((alias("PIOS_malloc")
static struct pios_heap pios_standard_heap
void PIOS_free(void *buf)
static bool is_ptr_in_heap_p(const struct pios_heap *heap, void *buf)
static volatile bool malloc_failed_flag
bool PIOS_heap_malloc_failed_p(void)
static void simple_extend_heap(struct pios_heap *heap, size_t bytes)
void PIOS_Thread_Scheduler_Resume(void)
const uintptr_t start_addr
static void * simple_malloc(struct pios_heap *heap, size_t size)
size_t PIOS_heap_get_free_size(void)