Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
Memory Management Driver APIs. More...
#include <zephyr/types.h>
Go to the source code of this file.
Data Structures | |
struct | sys_mm_drv_region |
Represents an available memory region. More... | |
Macros | |
Caching mode definitions. | |
These are mutually exclusive. | |
#define | SYS_MM_MEM_CACHE_NONE 2 |
No caching. | |
#define | SYS_MM_MEM_CACHE_WT 1 |
Write-through caching. | |
#define | SYS_MM_MEM_CACHE_WB 0 |
Full write-back caching. | |
#define | SYS_MM_MEM_CACHE_MASK (BIT(3) - 1) |
Reserved bits for cache modes. | |
Region permission attributes. | |
Default should be read-only, no user, no exec. | |
#define | SYS_MM_MEM_PERM_RW BIT(3) |
Region will have read/write access (and not read-only) | |
#define | SYS_MM_MEM_PERM_EXEC BIT(4) |
Region will be executable (normally forbidden) | |
#define | SYS_MM_MEM_PERM_USER BIT(5) |
Region will be accessible to user mode (normally supervisor-only) | |
Functions | |
Memory Mapping and Unmapping | |
On mapping and unmapping of memory. | |
int | sys_mm_drv_map_page (void *virt, uintptr_t phys, uint32_t flags) |
Map one physical page into the virtual address space. | |
int | sys_mm_drv_map_region (void *virt, uintptr_t phys, size_t size, uint32_t flags) |
Map a region of physical memory into the virtual address space. | |
int | sys_mm_drv_map_array (void *virt, uintptr_t *phys, size_t cnt, uint32_t flags) |
Map an array of physical memory into the virtual address space. | |
int | sys_mm_drv_unmap_page (void *virt) |
Remove mapping for one page of the provided virtual address. | |
int | sys_mm_drv_unmap_region (void *virt, size_t size) |
Remove mappings for a provided virtual address range. | |
int | sys_mm_drv_remap_region (void *virt_old, size_t size, void *virt_new) |
Remap virtual pages into new address. | |
Memory Moving | |
On moving already mapped memory. | |
int | sys_mm_drv_move_region (void *virt_old, size_t size, void *virt_new, uintptr_t phys_new) |
Physically move memory, with copy. | |
int | sys_mm_drv_move_array (void *virt_old, size_t size, void *virt_new, uintptr_t *phys_new, size_t phys_cnt) |
Physically move memory, with copy. | |
Memory Mapping Attributes | |
On manipulating attributes of already mapped memory. | |
int | sys_mm_drv_update_page_flags (void *virt, uint32_t flags) |
Update memory page flags. | |
int | sys_mm_drv_update_region_flags (void *virt, size_t size, uint32_t flags) |
Update memory region flags. | |
Memory Mappings Query | |
On querying information on memory mappings. | |
#define | SYS_MM_DRV_MEMORY_REGION_FOREACH(regions, iter) for (iter = regions; iter->size; iter++) |
Iterates over an array of regions returned by sys_mm_drv_query_memory_regions. | |
int | sys_mm_drv_page_phys_get (void *virt, uintptr_t *phys) |
Get the mapped physical memory address from virtual address. | |
const struct sys_mm_drv_region * | sys_mm_drv_query_memory_regions (void) |
Query available memory regions. | |
void | sys_mm_drv_query_memory_regions_free (const struct sys_mm_drv_region *regions) |
Free the memory array returned by sys_mm_drv_query_memory_regions. | |
Memory Management Driver APIs.
This contains APIs for a system-wide memory management driver. Only one instance is permitted on the system.