|
Embedded Artistry Framework
Embedded Systems C++ Framework
|
#include <assert.h>#include <freertos/FreeRTOS.h>#include <freertos/task.h>#include <malloc.h>#include <stdbool.h>#include <stdint.h>#include <stdlib.h>
Macros | |
| #define | FREERTOS_HEAP_REGION_CNT 2 |
| NOTE: This FreeRTOS malloc implementation requires heap_5.c. More... | |
Functions | |
| static int | cmp_heap (const void *a, const void *b) |
| void | malloc_addblock (void *addr, size_t size) |
| malloc_addblock must be called before memory allocation calls are made. More... | |
| __attribute__ ((weak)) | |
| void * | malloc (size_t size) |
| Allocates size bytes of uninitialized storage. More... | |
| void | free (void *ptr) |
| Deallocates allocated memory space. More... | |
Variables | |
| static const uint8_t | heap_region_max = FREERTOS_HEAP_REGION_CNT |
| Maximum number of heap regions that can be specified. More... | |
| static volatile uint8_t | heap_region_cnt = 0 |
| Current number of allocated heap regions. More... | |
| static HeapRegion_t | heap_regions [FREERTOS_HEAP_REGION_CNT+1] |
| FreeRTOS internal memory pool stucture when using heap_5.c. More... | |
| static volatile bool | initialized_ = false |
| Flag that is used in malloc() to cause competing threads to wait until initialization is completed before allocating memory. More... | |
| #define FREERTOS_HEAP_REGION_CNT 2 |
NOTE: This FreeRTOS malloc implementation requires heap_5.c.
Please define the correct heap_region for your project.Your application can define this macro to increase the number of heap regions
| __attribute__ | ( | (weak) | ) |
References assert, cmp_heap(), heap_region_cnt, heap_regions, initialized_, and qsort().
|
static |
Referenced by __attribute__().
| void free | ( | void * | ptr | ) |
Deallocates allocated memory space.
Deallocates the space previously allocated by
The behavior is undefined if the value of ptr does not equal a value returned earlier by
The behavior is undefined if the memory area referred to by ptr has already been deallocated, that is, free() or realloc has already been called with ptr as the argument and no calls to malloc, calloc or realloc resulted in a pointer equal to ptr afterwards.
The behavior is undefined if after free returns, an access is made through the pointer ptr (unless another allocation function happened to result in a pointer value equal to ptr)
| ptr | pointer to the memory to deallocate |
free should NEVER be called before malloc is init'd
References assert, and initialized_.
| void* malloc | ( | size_t | size | ) |
Allocates size bytes of uninitialized storage.
If size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage, but has to be passed to
| size | number of bytes to allocate |
References initialized_, and NULL.
| void malloc_addblock | ( | void * | addr, |
| size_t | size | ||
| ) |
malloc_addblock must be called before memory allocation calls are made.
Assign blocks of memory for use by malloc().
In this FreeRTOS implementation, malloc() calls will block until memory has been allocated
References assert, heap_region_cnt, heap_region_max, and heap_regions.
|
static |
Current number of allocated heap regions.
Referenced by __attribute__(), and malloc_addblock().
|
static |
Maximum number of heap regions that can be specified.
Referenced by malloc_addblock().
|
static |
FreeRTOS internal memory pool stucture when using heap_5.c.
The block with the lowest starting address should appear first in the array
An additional block is allocated to serve as a NULL terminator
Referenced by __attribute__(), and malloc_addblock().
1.8.15