Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arc_mpu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Synopsys.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_MPU_ARC_MPU_H_
7#define ZEPHYR_INCLUDE_ARCH_ARC_V2_MPU_ARC_MPU_H_
8
9#define AUX_MPU_ATTR_UE 0x008 /* allow user execution */
10#define AUX_MPU_ATTR_UW 0x010 /* allow user write */
11#define AUX_MPU_ATTR_UR 0x020 /* allow user read */
12#define AUX_MPU_ATTR_KE 0x040 /* only allow kernel execution */
13#define AUX_MPU_ATTR_KW 0x080 /* only allow kernel write */
14#define AUX_MPU_ATTR_KR 0x100 /* only allow kernel read */
15#define AUX_MPU_RDB_DC 0x2000 /* data cache bypass (MPU v6+) */
16#define AUX_MPU_ATTR_S 0x8000 /* secure */
17#define AUX_MPU_ATTR_N 0x0000 /* normal */
18
19/*
20 * a region is dynamic means it can be split into sub regions.
21 * This attribute is meaningful for ARC MPUv3 which does not support mpu
22 * entry overlap. For ARC MPUv2, this attribute will be ignored as it
23 * supports mpu overlap in hardware.
24 */
25#define REGION_DYNAMIC 0x800 /* dynamic flag */
26
27/* Some helper defines for common regions */
28
29#define REGION_KERNEL_RAM_ATTR (AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR)
30
31#define REGION_KERNEL_ROM_ATTR (AUX_MPU_ATTR_KE | AUX_MPU_ATTR_KR)
32
33#define REGION_RAM_ATTR (AUX_MPU_ATTR_UW | AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR)
34
35#define REGION_ROM_ATTR (AUX_MPU_ATTR_UE | AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KE | AUX_MPU_ATTR_KR)
36
37#define REGION_IO_ATTR (AUX_MPU_ATTR_UW | AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR)
38
39#define REGION_NOCACHE_ATTR (AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR | AUX_MPU_RDB_DC)
40
41#define REGION_ALL_ATTR \
42 (AUX_MPU_ATTR_UW | AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR | AUX_MPU_ATTR_KE | \
43 AUX_MPU_ATTR_UE)
44
45#define REGION_32B 0x200
46#define REGION_64B 0x201
47#define REGION_128B 0x202
48#define REGION_256B 0x203
49#define REGION_512B 0x400
50#define REGION_1K 0x401
51#define REGION_2K 0x402
52#define REGION_4K 0x403
53#define REGION_8K 0x600
54#define REGION_16K 0x601
55#define REGION_32K 0x602
56#define REGION_64K 0x603
57#define REGION_128K 0x800
58#define REGION_256K 0x801
59#define REGION_512K 0x802
60#define REGION_1M 0x803
61#define REGION_2M 0xA00
62#define REGION_4M 0xA01
63#define REGION_8M 0xA02
64#define REGION_16M 0xA03
65#define REGION_32M 0xC00
66#define REGION_64M 0xC01
67#define REGION_128M 0xC02
68#define REGION_256M 0xC03
69#define REGION_512M 0xE00
70#define REGION_1G 0xE01
71#define REGION_2G 0xE02
72#define REGION_4G 0xE03
73
74/* Region definition data structure */
76 /* Region Name */
77 const char *name;
78 /* Region Base Address */
81 /* Region Attributes */
83};
84
85#define MPU_REGION_ENTRY(_name, _base, _size, _attr) \
86 { \
87 .name = _name, \
88 .base = _base, \
89 .size = _size, \
90 .attr = _attr, \
91 }
92
93/* MPU configuration data structure */
95 /* Number of regions */
97 /* Regions */
99};
100
101/* Reference to the MPU configuration */
102extern struct arc_mpu_config mpu_config;
103
104#endif /* _ARC_CORE_MPU_H_ */
struct arc_mpu_config mpu_config
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Definition arc_mpu.h:94
uint32_t num_regions
Definition arc_mpu.h:96
struct arc_mpu_region * mpu_regions
Definition arc_mpu.h:98
Definition arc_mpu.h:75
uint32_t size
Definition arc_mpu.h:80
uint32_t base
Definition arc_mpu.h:79
const char * name
Definition arc_mpu.h:77
uint32_t attr
Definition arc_mpu.h:82