mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
heap: Support adding new heap regions at runtime
To facilitate this, the list of registered heap regions is now a linked list (allowing entries to be appended at runtime.)
This commit is contained in:

committed by
Angus Gratton

parent
11a87ca811
commit
5361c08989
@@ -18,23 +18,36 @@
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <soc/soc_memory_layout.h>
|
||||
#include "multi_heap.h"
|
||||
#include "rom/queue.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Some common heap registration data structures used
|
||||
for heap_caps_init.c to share heap information with heap_caps.c
|
||||
*/
|
||||
|
||||
/* Type for describing each registered heap */
|
||||
typedef struct {
|
||||
size_t type;
|
||||
typedef struct heap_t_ {
|
||||
uint32_t caps[SOC_MEMORY_TYPE_NO_PRIOS]; ///< Capabilities for the type of memory in this heap (as a prioritised set). Copied from soc_memory_types so it's in RAM not flash.
|
||||
intptr_t start;
|
||||
intptr_t end;
|
||||
portMUX_TYPE heap_mux;
|
||||
multi_heap_handle_t heap;
|
||||
SLIST_ENTRY(heap_t_) next;
|
||||
} heap_t;
|
||||
|
||||
extern heap_t *registered_heaps;
|
||||
extern size_t num_registered_heaps;
|
||||
/* All registered heaps.
|
||||
|
||||
Forms a single linked list, even though most entries are contiguous.
|
||||
This means at the expense of 4 bytes per heap, new heaps can be
|
||||
added at runtime in a fast & thread-safe way.
|
||||
*/
|
||||
extern SLIST_HEAD(registered_heap_ll, heap_t_) registered_heaps;
|
||||
|
||||
bool heap_caps_match(const heap_t *heap, uint32_t caps);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user