1 /* ########################## MMU functions ###################################### */
3 \defgroup MMU_functions Memory Management Unit Functions
4 \ingroup CMSIS_Core_FunctionInterface
5 \brief MMU Functions provide control of the Memory Management Unit using translation tables and attributes of different regions of the physical memory map.\n
6 Reference: <a href="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0406c/index.html">Architecture Reference Manual Reference Manual - Armv7-A and Armv7-R edition</a>.
12 \fn __STATIC_INLINE int MMU_XNSection(uint32_t *descriptor_l1, mmu_execute_Type xn)
14 The function sets section execution-never attribute
16 \fn __STATIC_INLINE int MMU_DomainSection(uint32_t *descriptor_l1, uint8_t domain)
18 The function sets section domain.
20 \fn __STATIC_INLINE int MMU_PSection(uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit)
22 The function sets section parity check
24 \fn __STATIC_INLINE int MMU_APSection(uint32_t *descriptor_l1, mmu_access_Type user, mmu_access_Type priv, uint32_t afe)
26 The function sets section access privileges
28 \fn __STATIC_INLINE int MMU_SharedSection(uint32_t *descriptor_l1, mmu_shared_Type s_bit)
30 The function sets section shareability
32 \fn __STATIC_INLINE int MMU_GlobalSection(uint32_t *descriptor_l1, mmu_global_Type g_bit)
34 The function sets section Global attribute
36 \fn __STATIC_INLINE int MMU_SecureSection(uint32_t *descriptor_l1, mmu_secure_Type s_bit)
38 The function sets section Global attribute
40 \fn __STATIC_INLINE int MMU_XNPage(uint32_t *descriptor_l2, mmu_execute_Type xn, mmu_region_size_Type page)
42 The function sets 4k/64k page execution-never attribute
44 \fn __STATIC_INLINE int MMU_DomainPage(uint32_t *descriptor_l1, uint8_t domain)
46 The function sets 4k/64k page domain
48 \fn __STATIC_INLINE int MMU_PPage(uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit)
50 The function sets 4k/64k page parity check
52 \fn __STATIC_INLINE int MMU_APPage(uint32_t *descriptor_l2, mmu_access_Type user, mmu_access_Type priv, uint32_t afe)
54 The function sets 4k/64k page access privileges
55 \fn __STATIC_INLINE int MMU_SharedPage(uint32_t *descriptor_l2, mmu_shared_Type s_bit)
57 The function sets 4k/64k page shareability
59 \fn __STATIC_INLINE int MMU_GlobalPage(uint32_t *descriptor_l2, mmu_global_Type g_bit)
61 The function sets 4k/64k page Global attribute
63 \fn __STATIC_INLINE int MMU_SecurePage(uint32_t *descriptor_l1, mmu_secure_Type s_bit)
65 The function sets 4k/64k page Global attribute
67 \fn __STATIC_INLINE int MMU_MemorySection(uint32_t *descriptor_l1, mmu_memory_Type mem, mmu_cacheability_Type outer, mmu_cacheability_Type inner)
69 The function sets section memory attributes
71 \fn __STATIC_INLINE int MMU_MemoryPage(uint32_t *descriptor_l2, mmu_memory_Type mem, mmu_cacheability_Type outer, mmu_cacheability_Type inner, mmu_region_size_Type page)
73 The function sets 4k/64k page memory attributes
75 \fn __STATIC_INLINE int MMU_GetSectionDescriptor(uint32_t *descriptor, mmu_region_attributes_Type reg)
77 The function creates a section descriptor.
79 \fn __STATIC_INLINE int MMU_GetPageDescriptor(uint32_t *descriptor, uint32_t *descriptor2, mmu_region_attributes_Type reg)
81 The function creates a 4k/64k page descriptor.
83 - TEX remap disabled, so memory type and attributes are described directly by bits in the descriptor
84 - Functions always return 0
86 \fn __STATIC_INLINE void MMU_TTSection(uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1)
87 \fn __STATIC_INLINE void MMU_TTPage4k(uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1, uint32_t *ttb_l2, uint32_t descriptor_l2 )
88 \fn __STATIC_INLINE void MMU_TTPage64k(uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1, uint32_t *ttb_l2, uint32_t descriptor_l2 )
89 \fn __STATIC_INLINE void MMU_Enable(void)
91 Set M bit 0 to enable the MMU
92 Set AFE bit to enable simplified access permissions model
93 Clear TRE bit to disable TEX remap and A bit to disable strict alignment fault checking
95 \fn __STATIC_INLINE void MMU_Disable(void)
97 \fn __STATIC_INLINE void MMU_InvalidateTLB(void)
101 /* end of MMU_functions */
104 \defgroup MMU_defs_gr MMU Defines and Structs
105 \ingroup MMU_functions
106 \brief Defines and structures that relate to the Memory Management Unit
112 \def SECTION_DESCRIPTOR
115 \def SECTION_TEX0_SHIFT
116 \def SECTION_TEX1_SHIFT
117 \def SECTION_TEX2_SHIFT
118 \def SECTION_XN_SHIFT
119 \def SECTION_DOMAIN_SHIFT
121 \def SECTION_AP_SHIFT
122 \def SECTION_AP2_SHIFT
124 \def SECTION_NG_SHIFT
125 \def SECTION_NS_SHIFT
126 \def PAGE_L1_DESCRIPTOR
128 \def PAGE_L2_64K_DESC
131 \def PAGE_4K_TEX0_SHIFT
132 \def PAGE_4K_TEX1_SHIFT
133 \def PAGE_4K_TEX2_SHIFT
134 \def PAGE_64K_B_SHIFT
135 \def PAGE_64K_C_SHIFT
136 \def PAGE_64K_TEX0_SHIFT
137 \def PAGE_64K_TEX1_SHIFT
138 \def PAGE_64K_TEX2_SHIFT
142 \def PAGE_XN_4K_SHIFT
143 \def PAGE_XN_64K_SHIFT
144 \def PAGE_DOMAIN_SHIFT
154 \def DESCRIPTOR_FAULT
156 \typedef mmu_region_size_Type
157 \typedef mmu_memory_Type
158 \typedef mmu_cacheability_Type
159 \typedef mmu_ecc_check_Type
160 \typedef mmu_execute_Type
161 \typedef mmu_global_Type
162 \typedef mmu_shared_Type
163 \typedef mmu_secure_Type
164 \typedef mmu_access_Type
166 \struct mmu_region_attributes_Type
168 \def section_normal(descriptor_l1, region)
169 \def section_normal_cod(descriptor_l1, region)
170 \def section_normal_ro(descriptor_l1, region)
171 \def section_normal_rw(descriptor_l1, region)
172 \def section_so(descriptor_l1, region)
173 \def section_device_ro(descriptor_l1, region)
174 \def section_device_rw(descriptor_l1, region)
175 \def page4k_device_rw(descriptor_l1, descriptor_l2, region)
176 \def page64k_device_rw(descriptor_l1, descriptor_l2, region)
179 /* end group MMU_defs_gr */