Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
modules
►
subsys
▼
zephyr
►
acpi
►
app_memory
▼
arch
►
arc
▼
arm
►
cortex_a_r
►
cortex_m
▼
mmu
►
arm_mmu.h
►
mpu
►
arch.h
►
arch_inlines.h
asm_inline.h
►
asm_inline_gcc.h
barrier.h
error.h
exception.h
►
gdbstub.h
►
irq.h
►
misc.h
nmi.h
structs.h
►
syscall.h
thread.h
►
arm64
►
common
►
mips
►
posix
►
riscv
►
rx
►
sparc
►
x86
►
xtensa
arch_inlines.h
►
arch_interface.h
►
cache.h
cpu.h
exception.h
structs.h
syscall.h
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
►
drivers
►
dsp
►
dt-bindings
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
pmci
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
►
sys
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
►
virtio
►
xen
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
arm_mmu.h
Go to the documentation of this file.
1
/*
2
* ARMv7 MMU support
3
*
4
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
5
* SPDX-License-Identifier: Apache-2.0
6
*/
7
8
#ifndef ZEPHYR_INCLUDE_ARCH_AARCH32_ARM_MMU_H_
9
#define ZEPHYR_INCLUDE_ARCH_AARCH32_ARM_MMU_H_
10
11
#ifndef _ASMLANGUAGE
12
13
#include <
stdint.h
>
14
#include <
stdlib.h
>
15
16
/*
17
* Comp.:
18
* ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition,
19
* ARM document ID DDI0406C Rev. d, March 2018
20
* Memory type definitions:
21
* Table B3-10, chap. B3.8.2, p. B3-1363f.
22
* Outer / inner cache attributes for cacheable memory:
23
* Table B3-11, chap. B3.8.2, p. B3-1364
24
*/
25
26
/*
27
* The following definitions are used when specifying a memory
28
* range to be mapped at boot time using the MMU_REGION_ENTRY
29
* macro.
30
*/
31
#define MT_STRONGLY_ORDERED BIT(0)
32
#define MT_DEVICE BIT(1)
33
#define MT_NORMAL BIT(2)
34
#define MT_MASK 0x7
35
36
#define MPERM_R BIT(3)
37
#define MPERM_W BIT(4)
38
#define MPERM_X BIT(5)
39
#define MPERM_UNPRIVILEGED BIT(6)
40
41
#define MATTR_NON_SECURE BIT(7)
42
#define MATTR_NON_GLOBAL BIT(8)
43
#define MATTR_SHARED BIT(9)
44
#define MATTR_CACHE_OUTER_WB_WA BIT(10)
45
#define MATTR_CACHE_OUTER_WT_nWA BIT(11)
46
#define MATTR_CACHE_OUTER_WB_nWA BIT(12)
47
#define MATTR_CACHE_INNER_WB_WA BIT(13)
48
#define MATTR_CACHE_INNER_WT_nWA BIT(14)
49
#define MATTR_CACHE_INNER_WB_nWA BIT(15)
50
51
#define MATTR_MAY_MAP_L1_SECTION BIT(16)
52
53
/*
54
* The following macros are used for adding constant entries
55
* mmu_regions array of the mmu_config struct. Use MMU_REGION_ENTRY
56
* for the specification of mappings whose PA and VA differ,
57
* the use of MMU_REGION_FLAT_ENTRY always results in an identity
58
* mapping, which are used for the mappings of the Zephyr image's
59
* code and data.
60
*/
61
#define MMU_REGION_ENTRY(_name, _base_pa, _base_va, _size, _attrs) \
62
{\
63
.name = _name, \
64
.base_pa = _base_pa, \
65
.base_va = _base_va, \
66
.size = _size, \
67
.attrs = _attrs, \
68
}
61
#define MMU_REGION_ENTRY(_name, _base_pa, _base_va, _size, _attrs) \
…
69
70
#define MMU_REGION_FLAT_ENTRY(name, adr, sz, attrs) \
71
MMU_REGION_ENTRY(name, adr, adr, sz, attrs)
70
#define MMU_REGION_FLAT_ENTRY(name, adr, sz, attrs) \
…
72
73
/*
74
* @brief Auto generate mmu region entry for node_id
75
*
76
* Example usage:
77
*
78
* @code{.c}
79
* DT_FOREACH_STATUS_OKAY_VARGS(nxp_imx_gpio,
80
* MMU_REGION_DT_FLAT_ENTRY,
81
* (MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS))
82
* @endcode
83
*
84
* @note Since devicetree_generated.h does not include
85
* node_id##_P_reg_FOREACH_PROP_ELEM* definitions,
86
* we can't automate dts node with multiple reg
87
* entries.
88
*/
89
#define MMU_REGION_DT_FLAT_ENTRY(node_id, attrs) \
90
MMU_REGION_FLAT_ENTRY(DT_NODE_FULL_NAME(node_id), \
91
DT_REG_ADDR(node_id), \
92
DT_REG_SIZE(node_id), \
93
attrs),
89
#define MMU_REGION_DT_FLAT_ENTRY(node_id, attrs) \
…
94
95
/*
96
* @brief Auto generate mmu region entry for status = "okay"
97
* nodes compatible to a driver
98
*
99
* Example usage:
100
*
101
* @code{.c}
102
* MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(nxp_imx_gpio,
103
* (MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS))
104
* @endcode
105
*
106
* @note This is a wrapper of @ref MMU_REGION_DT_FLAT_ENTRY
107
*/
108
#define MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(compat, attr) \
109
DT_FOREACH_STATUS_OKAY_VARGS(compat, \
110
MMU_REGION_DT_FLAT_ENTRY, attr)
108
#define MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(compat, attr) \
…
111
112
/* Region definition data structure */
113
struct
arm_mmu_region
{
114
/* Region Base Physical Address */
115
uintptr_t
base_pa
;
116
/* Region Base Virtual Address */
117
uintptr_t
base_va
;
118
/* Region size */
119
size_t
size
;
120
/* Region Name */
121
const
char
*
name
;
122
/* Region Attributes */
123
uint32_t
attrs
;
124
};
113
struct
arm_mmu_region
{
…
};
125
126
/* MMU configuration data structure */
127
struct
arm_mmu_config
{
128
/* Number of regions */
129
uint32_t
num_regions
;
130
/* Regions */
131
const
struct
arm_mmu_region
*
mmu_regions
;
132
};
127
struct
arm_mmu_config
{
…
};
133
134
/*
135
* Reference to the MMU configuration.
136
*
137
* This struct is defined and populated for each SoC (in the SoC definition),
138
* and holds the build-time configuration information for the fixed MMU
139
* regions enabled during kernel initialization.
140
*/
141
extern
const
struct
arm_mmu_config
mmu_config
;
142
143
int
z_arm_mmu_init(
void
);
144
145
#endif
/* _ASMLANGUAGE */
146
147
#endif
/* ZEPHYR_INCLUDE_ARCH_AARCH32_ARM_MMU_H_ */
mmu_config
const struct arm_mmu_config mmu_config
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uintptr_t
__UINTPTR_TYPE__ uintptr_t
Definition
stdint.h:105
stdlib.h
arm_mmu_config
Definition
arm_mmu.h:127
arm_mmu_config::mmu_regions
const struct arm_mmu_region * mmu_regions
Definition
arm_mmu.h:131
arm_mmu_config::num_regions
uint32_t num_regions
Definition
arm_mmu.h:129
arm_mmu_region
Definition
arm_mmu.h:113
arm_mmu_region::base_va
uintptr_t base_va
Definition
arm_mmu.h:117
arm_mmu_region::size
size_t size
Definition
arm_mmu.h:119
arm_mmu_region::base_pa
uintptr_t base_pa
Definition
arm_mmu.h:115
arm_mmu_region::name
const char * name
Definition
arm_mmu.h:121
arm_mmu_region::attrs
uint32_t attrs
Definition
arm_mmu.h:123
zephyr
arch
arm
mmu
arm_mmu.h
Generated on Tue Jun 3 2025 18:07:21 for Zephyr API Documentation by
1.12.0