Sound Open Firmware
Loading...
Searching...
No Matches
regions_mm.h File Reference

Virtual Memory Heap (VMH) and multi-block region allocator API. More...

Include dependency graph for regions_mm.h:

Go to the source code of this file.

Data Structures

struct  vmh_block_bundle_descriptor
 Descriptor for a power-of-2 block size bundle in a virtual memory heap. More...
 
struct  vmh_heap_config
 This is a struct that aggregates vmh_block_bundle_descriptor to create one cfg that can be passed to heap initiation. More...
 

Macros

#define VIRTUAL_REGION_SHARED_HEAP_ATTR   1U
 Region attribute for shared virtual memory heap.
 
#define VIRTUAL_REGION_LLEXT_LIBRARIES_ATTR   2U
 Region attribute for loadable LLEXT libraries.
 
#define VIRTUAL_REGION_VPAGES_ATTR   3U
 Region attribute for virtual page allocator.
 
#define MAX_MEMORY_ALLOCATORS_COUNT   10
 Maximum amount of memory block allocators in one heap.
 
#define DEFAULT_CONFIG_ALOCATORS_COUNT   5
 Default number of power-of-2 block allocators partitioned across a region.
 

Functions

struct vmh_heap * vmh_init_heap (const struct vmh_heap_config *cfg, bool allocating_continuously)
 Initialize a virtual memory heap with the given bundle configuration.
 
void * vmh_alloc (struct vmh_heap *heap, uint32_t alloc_size)
 Allocate a memory block from the virtual memory heap.
 
int vmh_free_heap (struct vmh_heap *heap)
 Destroy a virtual memory heap and unmap all backing pages.
 
int vmh_free (struct vmh_heap *heap, void *ptr)
 Free a memory block previously allocated from a virtual memory heap.
 
void vmh_get_default_heap_config (const struct sys_mm_drv_region *region, struct vmh_heap_config *cfg)
 Generate a default heap partition configuration for a memory driver region.
 
static bool vmh_is_ptr_in_memory_range (uintptr_t ptr, uintptr_t range_start, size_t range_size)
 Checks if ptr is in range of given memory range.
 

Detailed Description

Virtual Memory Heap (VMH) and multi-block region allocator API.