8#ifndef ZEPHYR_INCLUDE_ARCH_ARM64_CORTEX_R_MPU_ARM_MPU_H_
9#define ZEPHYR_INCLUDE_ARCH_ARM64_CORTEX_R_MPU_ARM_MPU_H_
17#define MPU_IR_REGION_Msk (0xFFU)
19#define MPU_RBAR_BASE_Pos 6U
20#define MPU_RBAR_BASE_Msk (0x3FFFFFFFFFFFFFFUL << MPU_RBAR_BASE_Pos)
21#define MPU_RBAR_SH_Pos 4U
22#define MPU_RBAR_SH_Msk (0x3UL << MPU_RBAR_SH_Pos)
23#define MPU_RBAR_AP_Pos 2U
24#define MPU_RBAR_AP_Msk (0x3UL << MPU_RBAR_AP_Pos)
26#define MPU_RBAR_XN_Pos 1U
27#define MPU_RBAR_XN_Msk (0x1UL << MPU_RBAR_XN_Pos)
30#define MPU_RLAR_LIMIT_Pos 6U
31#define MPU_RLAR_LIMIT_Msk (0x3FFFFFFFFFFFFFFUL << MPU_RLAR_LIMIT_Pos)
32#define MPU_RLAR_AttrIndx_Pos 1U
33#define MPU_RLAR_AttrIndx_Msk (0x7UL << MPU_RLAR_AttrIndx_Pos)
34#define MPU_RLAR_EN_Msk (0x1UL)
37#define NOT_EXEC MPU_RBAR_XN_Msk
42#define P_RW_U_NA_Msk ((P_RW_U_NA << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk)
45#define P_RW_U_RW_Msk ((P_RW_U_RW << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk)
48#define P_RO_U_NA_Msk ((P_RO_U_NA << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk)
51#define P_RO_U_RO_Msk ((P_RO_U_RO << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk)
54#define NON_SHAREABLE 0x0U
55#define NON_SHAREABLE_Msk \
56 ((NON_SHAREABLE << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk)
57#define OUTER_SHAREABLE 0x2U
58#define OUTER_SHAREABLE_Msk \
59 ((OUTER_SHAREABLE << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk)
60#define INNER_SHAREABLE 0x3U
61#define INNER_SHAREABLE_Msk \
62 ((INNER_SHAREABLE << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk)
84#define DEVICE_nGnRnE 0x0U
85#define DEVICE_nGnRE 0x4U
86#define DEVICE_nGRE 0x8U
87#define DEVICE_GRE 0xCU
90#define R_NON_W_NON 0x0U
91#define R_NON_W_ALLOC 0x1U
92#define R_ALLOC_W_NON 0x2U
93#define R_ALLOC_W_ALLOC 0x3U
96#define NORMAL_O_WT_NT 0x80U
97#define NORMAL_O_WB_NT 0xC0U
98#define NORMAL_O_NON_C 0x40U
100#define NORMAL_I_WT_NT 0x08U
101#define NORMAL_I_WB_NT 0x0CU
102#define NORMAL_I_NON_C 0x04U
105#define MPU_MAIR_INDEX_DEVICE 0U
106#define MPU_MAIR_ATTR_DEVICE (DEVICE_nGnRnE)
108#define MPU_MAIR_INDEX_FLASH 1U
109#define MPU_MAIR_ATTR_FLASH \
110 ((NORMAL_O_WT_NT | (R_ALLOC_W_NON << 4)) | \
111 (NORMAL_I_WT_NT | R_ALLOC_W_NON))
113#define MPU_MAIR_INDEX_SRAM 2U
114#define MPU_MAIR_ATTR_SRAM \
115 ((NORMAL_O_WB_NT | (R_ALLOC_W_ALLOC << 4)) | \
116 (NORMAL_I_WB_NT | R_ALLOC_W_ALLOC))
118#define MPU_MAIR_INDEX_SRAM_NOCACHE 3U
119#define MPU_MAIR_ATTR_SRAM_NOCACHE \
120 ((NORMAL_O_NON_C | (R_NON_W_NON << 4)) | \
121 (NORMAL_I_NON_C | R_NON_W_NON))
123#define MPU_MAIR_ATTRS \
124 ((MPU_MAIR_ATTR_DEVICE << (MPU_MAIR_INDEX_DEVICE * 8)) | \
125 (MPU_MAIR_ATTR_FLASH << (MPU_MAIR_INDEX_FLASH * 8)) | \
126 (MPU_MAIR_ATTR_SRAM << (MPU_MAIR_INDEX_SRAM * 8)) | \
127 (MPU_MAIR_ATTR_SRAM_NOCACHE << (MPU_MAIR_INDEX_SRAM_NOCACHE * 8)))
136#define REGION_DEVICE_ATTR \
139 .rbar = NOT_EXEC | P_RW_U_NA_Msk | NON_SHAREABLE_Msk, \
141 .mair_idx = MPU_MAIR_INDEX_DEVICE, \
144#define REGION_RAM_ATTR \
147 .rbar = NOT_EXEC | P_RW_U_NA_Msk | NON_SHAREABLE_Msk, \
149 .mair_idx = MPU_MAIR_INDEX_SRAM, \
152#define REGION_RAM_TEXT_ATTR \
155 .rbar = P_RO_U_NA_Msk | NON_SHAREABLE_Msk, \
157 .mair_idx = MPU_MAIR_INDEX_SRAM, \
160#define REGION_RAM_RO_ATTR \
163 .rbar = NOT_EXEC | P_RO_U_NA_Msk | NON_SHAREABLE_Msk, \
165 .mair_idx = MPU_MAIR_INDEX_SRAM, \
168#if defined(CONFIG_MPU_ALLOW_FLASH_WRITE)
171#define REGION_FLASH_ATTR \
173 .rbar = P_RW_U_RW_Msk | NON_SHAREABLE_Msk, \
175 .mair_idx = MPU_MAIR_INDEX_FLASH, \
178#define REGION_FLASH_ATTR \
180 .rbar = P_RO_U_RO_Msk | NON_SHAREABLE_Msk, \
182 .mair_idx = MPU_MAIR_INDEX_FLASH, \
213#define MPU_REGION_ENTRY(_name, _base, _limit, _attr) \
const struct arm_mpu_config mpu_config
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
uint32_t num_regions
Definition: arm_mpu.h:42
const struct arm_mpu_region * mpu_regions
Definition: arm_mpu.h:44
Definition: arm_mpu_v7m.h:141
uint8_t rbar
Definition: arm_mpu_v8m.h:154
uint8_t mair_idx
Definition: arm_mpu_v8m.h:156
const char * name
Definition: arm_mpu.h:30
uint64_t limit
Definition: arm_mpu.h:198
uint64_t base
Definition: arm_mpu.h:196
arm_mpu_region_attr_t attr
Definition: arm_mpu.h:36