SDL API Guide for J721E
sdl_arm_r5_mpu.h
Go to the documentation of this file.
1 
39 #ifndef SDL_ARM_R5_MPU_H
40 #define SDL_ARM_R5_MPU_H
41 
42 #include <stdint.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
93 typedef uint32_t SDL_ArmR5MpuRegionSize;
94 
95 #define SDL_ARM_R5_MPU_REGION_SIZE_32B (4U)
96 
97 #define SDL_ARM_R5_MPU_REGION_SIZE_64B (5U)
98 
99 #define SDL_ARM_R5_MPU_REGION_SIZE_128B (6U)
100 
101 #define SDL_ARM_R5_MPU_REGION_SIZE_256B (7U)
102 
103 #define SDL_ARM_R5_MPU_REGION_SIZE_512B (8U)
104 
105 #define SDL_ARM_R5_MPU_REGION_SIZE_1KB (9U)
106 
107 #define SDL_ARM_R5_MPU_REGION_SIZE_2KB (10U)
108 
109 #define SDL_ARM_R5_MPU_REGION_SIZE_4KB (11U)
110 
111 #define SDL_ARM_R5_MPU_REGION_SIZE_8KB (12U)
112 
113 #define SDL_ARM_R5_MPU_REGION_SIZE_16KB (13U)
114 
115 #define SDL_ARM_R5_MPU_REGION_SIZE_32KB (14U)
116 
117 #define SDL_ARM_R5_MPU_REGION_SIZE_64KB (15U)
118 
119 #define SDL_ARM_R5_MPU_REGION_SIZE_128KB (16U)
120 
121 #define SDL_ARM_R5_MPU_REGION_SIZE_256KB (17U)
122 
123 #define SDL_ARM_R5_MPU_REGION_SIZE_512KB (18U)
124 
125 #define SDL_ARM_R5_MPU_REGION_SIZE_1MB (19U)
126 
127 #define SDL_ARM_R5_MPU_REGION_SIZE_2MB (20U)
128 
129 #define SDL_ARM_R5_MPU_REGION_SIZE_4MB (21U)
130 
131 #define SDL_ARM_R5_MPU_REGION_SIZE_8MB (22U)
132 
133 #define SDL_ARM_R5_MPU_REGION_SIZE_16MB (23U)
134 
135 #define SDL_ARM_R5_MPU_REGION_SIZE_32MB (24U)
136 
137 #define SDL_ARM_R5_MPU_REGION_SIZE_64MB (25U)
138 
139 #define SDL_ARM_R5_MPU_REGION_SIZE_128MB (26U)
140 
141 #define SDL_ARM_R5_MPU_REGION_SIZE_256MB (27U)
142 
143 #define SDL_ARM_R5_MPU_REGION_SIZE_512MB (28U)
144 
145 #define SDL_ARM_R5_MPU_REGION_SIZE_1GB (29U)
146 
147 #define SDL_ARM_R5_MPU_REGION_SIZE_2GB (30U)
148 
149 #define SDL_ARM_R5_MPU_REGION_SIZE_4GB (31U)
150 
151 /* @} */
152 
153 
154 /* @} */
155 
169 #define SDL_ARM_R5F_MPU_REGIONS_MAX ((uint32_t) 16U)
170 /* @} */
171 
180 #define SDL_ARM_R5_MPU_SUB_REGION_ENABLE_ALL ((uint32_t) 0x0U)
181 
182 #define SDL_ARM_R5_MPU_SUB_REGION_0_DISABLE ((uint32_t) 0x1U)
183 
184 #define SDL_ARM_R5_MPU_SUB_REGION_1_DISABLE ((uint32_t) 0x2U)
185 
186 #define SDL_ARM_R5_MPU_SUB_REGION_2_DISABLE ((uint32_t) 0x4U)
187 
188 #define SDL_ARM_R5_MPU_SUB_REGION_3_DISABLE ((uint32_t) 0x8U)
189 
190 #define SDL_ARM_R5_MPU_SUB_REGION_4_DISABLE ((uint32_t) 0x10U)
191 
192 #define SDL_ARM_R5_MPU_SUB_REGION_5_DISABLE ((uint32_t) 0x20U)
193 
194 #define SDL_ARM_R5_MPU_SUB_REGION_6_DISABLE ((uint32_t) 0x40U)
195 
196 #define SDL_ARM_R5_MPU_SUB_REGION_8_DISABLE ((uint32_t) 0x80U)
197 /* @} */
198 
207 #define SDL_ARM_R5_ACC_PERM_NO_ACCESS ((uint32_t) 0x0U)
208 
209 #define SDL_ARM_R5_ACC_PERM_PRIV_RD_WR ((uint32_t) 0x1U)
210 
211 #define SDL_ARM_R5_ACC_PERM_PRIV_RD_WR_USR_RD ((uint32_t) 0x2U)
212 
213 #define SDL_ARM_R5_ACC_PERM_PRIV_USR_RD_WR ((uint32_t) 0x3U)
214 
215 #define SDL_ARM_R5_ACC_PERM_PRIV_RD_ONLY ((uint32_t) 0x5U)
216 
217 #define SDL_ARM_R5_ACC_PERM_PRIV_USR_RD ((uint32_t) 0x6U)
218 /* @} */
219 
228 #define SDL_ARM_R5_CACHE_POLICY_NON_CACHEABLE ((uint32_t) 0x0U)
229 
230 #define SDL_ARM_R5_CACHE_POLICY_WB_WA ((uint32_t) 0x1U)
231 
232 #define SDL_ARM_R5_CACHE_POLICY_WT_NO_WA ((uint32_t) 0x2U)
233 
234 #define SDL_ARM_R5_CACHE_POLICY_WB_NO_WA ((uint32_t) 0x3U)
235 /* @} */
236 
245 #define SDL_ARM_R5_MEM_ATTR_STRONGLY_ORDERED ((uint32_t) 0x0U)
246 
247 #define SDL_ARM_R5_MEM_ATTR_SHAREABLE ((uint32_t) 0x1U)
248 
250 #define SDL_ARM_R5_MEM_ATTR_CACHED_WT_NO_WA ((uint32_t) 0x2U)
251 
253 #define SDL_ARM_R5_MEM_ATTR_CACHED_WB_NO_WA ((uint32_t) 0x3U)
254 
255 #define SDL_ARM_R5_MEM_ATTR_STRONGLY_NON_CACHED ((uint32_t) 0x4U)
256 
258 #define SDL_ARM_R5_MEM_ATTR_CACHED_WB_WA ((uint32_t) 0x5U)
259 
260 #define SDL_ARM_R5_MEM_ATTR_NON_SHAREABLE ((uint32_t) 0x6U)
261 
262 #define SDL_ARM_R5_MEM_ATTR_MAX ((uint32_t) 0x7U)
263 
264 /* @} */
265 
266 
267 /* @} */
268 
269 
270 /* MPU_REGION_BASE */
271 
272 #define SDL_ARM_R5_MPU_REGION_BASE_ADDR_MASK (0xFFFFFFFEU)
273 #define SDL_ARM_R5_MPU_REGION_BASE_ADDR_SHIFT (0x00000005U)
274 #define SDL_ARM_R5_MPU_REGION_BASE_ADDR_RESETVAL (0x00000000U)
275 #define SDL_ARM_R5_MPU_REGION_BASE_ADDR_MAX (0x07FFFFFFU)
276 
277 /* MPU_REGION_SZEN */
278 
279 #define SDL_ARM_R5_MPU_REGION_SZEN_EN_MASK (0x00000001U)
280 #define SDL_ARM_R5_MPU_REGION_SZEN_EN_SHIFT (0x00000000U)
281 #define SDL_ARM_R5_MPU_REGION_SZEN_EN_RESETVAL (0x00000000U)
282 #define SDL_ARM_R5_MPU_REGION_SZEN_EN_MAX (0x00000001U)
283 
284 #define SDL_ARM_R5_MPU_REGION_SZEN_SZ_MASK (0x00000037U)
285 #define SDL_ARM_R5_MPU_REGION_SZEN_SZ_SHIFT (0x00000001U)
286 #define SDL_ARM_R5_MPU_REGION_SZEN_SZ_RESETVAL (0x00000000U)
287 #define SDL_ARM_R5_MPU_REGION_SZEN_SZ_MAX (0x0000001FU)
288 
289 #define SDL_ARM_R5_MPU_REGION_SZEN_SRD_MASK (0x0000FF00U)
290 #define SDL_ARM_R5_MPU_REGION_SZEN_SRD_SHIFT (0x00000008U)
291 #define SDL_ARM_R5_MPU_REGION_SZEN_SRD_RESETVAL (0x00000000U)
292 #define SDL_ARM_R5_MPU_REGION_SZEN_SRD_MAX (0x000000FFU)
293 
294 /* MPU_REGION_AC */
295 
296 #define SDL_ARM_R5_MPU_REGION_AC_B_MASK (0x00000001U)
297 #define SDL_ARM_R5_MPU_REGION_AC_B_SHIFT (0x00000000U)
298 #define SDL_ARM_R5_MPU_REGION_AC_B_RESETVAL (0x00000000U)
299 #define SDL_ARM_R5_MPU_REGION_AC_B_MAX (0x00000001U)
300 
301 #define SDL_ARM_R5_MPU_REGION_AC_CB_MASK (0x00000003U)
302 #define SDL_ARM_R5_MPU_REGION_AC_CB_SHIFT (0x00000000U)
303 #define SDL_ARM_R5_MPU_REGION_AC_CB_RESETVAL (0x00000000U)
304 
305 #define SDL_ARM_R5_MPU_REGION_AC_C_MASK (0x00000002U)
306 #define SDL_ARM_R5_MPU_REGION_AC_C_SHIFT (0x00000001U)
307 #define SDL_ARM_R5_MPU_REGION_AC_C_RESETVAL (0x00000000U)
308 #define SDL_ARM_R5_MPU_REGION_AC_C_MAX (0x00000001U)
309 
310 #define SDL_ARM_R5_MPU_REGION_AC_S_MASK (0x00000004U)
311 #define SDL_ARM_R5_MPU_REGION_AC_S_SHIFT (0x00000002U)
312 #define SDL_ARM_R5_MPU_REGION_AC_S_RESETVAL (0x00000000U)
313 #define SDL_ARM_R5_MPU_REGION_AC_S_MAX (0x00000001U)
314 
315 #define SDL_ARM_R5_MPU_REGION_AC_TEX_MASK (0x00000038U)
316 #define SDL_ARM_R5_MPU_REGION_AC_TEX_SHIFT (0x00000003U)
317 #define SDL_ARM_R5_MPU_REGION_AC_TEX_RESETVAL (0x00000000U)
318 #define SDL_ARM_R5_MPU_REGION_AC_TEX_MAX (0x00000007U)
319 
320 #define SDL_ARM_R5_MPU_REGION_AC_AP_MASK (0x00000700U)
321 #define SDL_ARM_R5_MPU_REGION_AC_AP_SHIFT (0x00000008U)
322 #define SDL_ARM_R5_MPU_REGION_AC_AP_RESETVAL (0x00000000U)
323 #define SDL_ARM_R5_MPU_REGION_AC_AP_MAX (0x00000007U)
324 #define SDL_ARM_R5_MPU_REGION_AC_AP_VAL_NO_ACCESS (0U)
325 #define SDL_ARM_R5_MPU_REGION_AC_AP_VAL_RW (3U)
326 #define SDL_ARM_R5_MPU_REGION_AC_AP_VAL_RO (6U)
327 
328 #define SDL_ARM_R5_MPU_REGION_AC_XN_MASK (0x00001000U)
329 #define SDL_ARM_R5_MPU_REGION_AC_XN_SHIFT (0x0000000CU)
330 #define SDL_ARM_R5_MPU_REGION_AC_XN_RESETVAL (0x00000000U)
331 #define SDL_ARM_R5_MPU_REGION_AC_XN_MAX (0x00000001U)
332 
348 typedef struct
349 {
350  uint32_t regionId;
353  uint32_t enable;
357  uint32_t baseAddr;
362  uint32_t subRegionEnable;
366  uint32_t exeNeverControl;
373  uint32_t shareable;
377  uint32_t cacheable;
381  uint32_t cachePolicy;
385  uint32_t memAttr;
390 
397 typedef struct SDL_MPU_staticReg_read
398 {
399  uint32_t sysControlreg;
401  uint32_t mpuTypeReg;
403  uint32_t regionId;
406  uint32_t baseAddr;
408  uint32_t size;
416 
417 /* @} */
418 
435 extern void SDL_R5MPU_Enable( uint32_t enable );
436 
447 extern uint32_t SDL_R5MPU_getNumRegions( void );
448 
472 extern void SDL_R5MPU_Cfg( uint32_t regionNum, uint32_t baseAddrRegVal, uint32_t sizeRegVal, uint32_t accessCtrlRegVal );
473 
496 extern int32_t SDL_R5MPU_VerifyCfg( uint32_t regionNum, uint32_t baseAddrRegVal, uint32_t sizeRegVal, uint32_t accessCtrlRegVal );
497 
510 extern void SDL_R5FMPU_enableRegion( uint32_t regionNum, uint32_t enable );
511 
523 extern int32_t SDL_R5MPU_VerifyEnableRegion( uint32_t regionNum, uint32_t enable );
524 
538 extern void SDL_R5MPU_readStaticRegisters(SDL_MPU_staticRegs *pStaticRegs,uint32_t regionNum);
539 
540 /* @} */
541 
542 #ifdef __cplusplus
543 }
544 #endif /* extern "C" */
545 
546 #endif /* end of SDL_ARM_R5_MPU_H definition */
uint32_t cacheable
Definition: sdl_arm_r5_mpu.h:377
uint32_t baseAddr
Definition: sdl_arm_r5_mpu.h:406
uint32_t enable
Definition: sdl_arm_r5_mpu.h:353
uint32_t regionId
Definition: sdl_arm_r5_mpu.h:350
uint32_t sysControlreg
Definition: sdl_arm_r5_mpu.h:399
Structure containing the region configuration parameters. If application wants to do it&#39;s own MPU reg...
Definition: sdl_arm_r5_mpu.h:348
void SDL_R5MPU_Enable(uint32_t enable)
Enable/disable the Memory Protection Unit (MPU)
void SDL_R5FMPU_enableRegion(uint32_t regionNum, uint32_t enable)
Enable/disable an MPU region.
uint32_t regionId
Definition: sdl_arm_r5_mpu.h:403
uint32_t subRegionEnable
Definition: sdl_arm_r5_mpu.h:362
uint32_t SDL_ArmR5MpuRegionSize
MPU region sizes supported.
Definition: sdl_arm_r5_mpu.h:93
uint32_t baseAddr
Definition: sdl_arm_r5_mpu.h:357
int32_t SDL_R5MPU_VerifyCfg(uint32_t regionNum, uint32_t baseAddrRegVal, uint32_t sizeRegVal, uint32_t accessCtrlRegVal)
Verify an MPU region that is previously configured.
uint32_t accessPermission
Definition: sdl_arm_r5_mpu.h:411
uint32_t shareable
Definition: sdl_arm_r5_mpu.h:373
void SDL_R5MPU_Cfg(uint32_t regionNum, uint32_t baseAddrRegVal, uint32_t sizeRegVal, uint32_t accessCtrlRegVal)
Configure an MPU region.
uint32_t size
Definition: sdl_arm_r5_mpu.h:408
int32_t SDL_R5MPU_VerifyEnableRegion(uint32_t regionNum, uint32_t enable)
Verifies the previously called Enable/disable an MPU region API.
uint32_t cachePolicy
Definition: sdl_arm_r5_mpu.h:381
uint32_t SDL_R5MPU_getNumRegions(void)
Get the number of unified MPU regions supported.
uint32_t accessPermission
Definition: sdl_arm_r5_mpu.h:370
uint32_t mpuTypeReg
Definition: sdl_arm_r5_mpu.h:401
SDL_ArmR5MpuRegionSize size
Definition: sdl_arm_r5_mpu.h:359
void SDL_R5MPU_readStaticRegisters(SDL_MPU_staticRegs *pStaticRegs, uint32_t regionNum)
MPU API to Read the Static Registers. This function reads the values of the static registers such as ...
uint32_t exeNeverControl
Definition: sdl_arm_r5_mpu.h:366
MPU Static Registers structure.
Definition: sdl_arm_r5_mpu.h:397
uint32_t memAttr
Definition: sdl_arm_r5_mpu.h:385