Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mm.h File Reference
#include <zephyr/sys/util.h>
#include <zephyr/toolchain.h>
#include <zephyr/kernel/internal/mm.h>
#include <stdint.h>
#include <stddef.h>
#include <inttypes.h>

Go to the source code of this file.

Macros

Caching mode definitions.

These are mutually exclusive.

#define K_MEM_CACHE_NONE   2
 No caching.
 
#define K_MEM_CACHE_WT   1
 Write-through caching.
 
#define K_MEM_CACHE_WB   0
 Full write-back caching.
 
#define K_MEM_CACHE_MASK   (BIT(3) - 1)
 Reserved bits for cache modes in k_map() flags argument.
 
Region permission attributes.

Default is read-only, no user, no exec

#define K_MEM_PERM_RW   BIT(3)
 Region will have read/write access (and not read-only)
 
#define K_MEM_PERM_EXEC   BIT(4)
 Region will be executable (normally forbidden)
 
#define K_MEM_PERM_USER   BIT(5)
 Region will be accessible to user mode (normally supervisor-only)
 
Region mapping behaviour attributes
#define K_MEM_DIRECT_MAP   BIT(6)
 Region will be mapped to 1:1 virtual and physical address.
 
k_mem_map() control flags
#define K_MEM_MAP_UNINIT   BIT(16)
 The mapped region is not guaranteed to be zeroed.
 
#define K_MEM_MAP_LOCK   BIT(17)
 Region will be pinned in memory and never paged.
 
#define K_MEM_MAP_UNPAGED   BIT(18)
 Region will be unpaged i.e.
 

Functions

size_t k_mem_free_get (void)
 Return the amount of free memory available.
 
static void * k_mem_map (size_t size, uint32_t flags)
 Map anonymous memory into Zephyr's address space.
 
static void k_mem_unmap (void *addr, size_t size)
 Un-map mapped memory.
 
int k_mem_update_flags (void *addr, size_t size, uint32_t flags)
 Modify memory mapping attribute flags.
 
size_t k_mem_region_align (uintptr_t *aligned_addr, size_t *aligned_size, uintptr_t addr, size_t size, size_t align)
 Given an arbitrary region, provide a aligned region that covers it.