]> begriffs open source - cmsis/blob - CMSIS/Documentation/Doxygen/Core_A/src/ref_mmu.txt
Possible bugs in MMU_MemorySection(), MMU_MemoryPage() (#219)
[cmsis] / CMSIS / Documentation / Doxygen / Core_A / src / ref_mmu.txt
1 /* ##########################  MMU functions  ###################################### */
2 /**
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>.
7 */
8
9 /** @{ */
10
11 /**
12 \fn __STATIC_INLINE int MMU_XNSection(uint32_t *descriptor_l1, mmu_execute_Type xn)
13 \details 
14   The function sets section execution-never attribute
15
16 \fn __STATIC_INLINE int MMU_DomainSection(uint32_t *descriptor_l1, uint8_t domain)
17 \details 
18 The function sets section domain.
19
20 \fn __STATIC_INLINE int MMU_PSection(uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit)
21 \details
22   The function sets section parity check
23
24 \fn __STATIC_INLINE int MMU_APSection(uint32_t *descriptor_l1, mmu_access_Type user, mmu_access_Type priv, uint32_t afe)
25 \details 
26 The function sets section access privileges
27
28 \fn __STATIC_INLINE int MMU_SharedSection(uint32_t *descriptor_l1, mmu_shared_Type s_bit)
29 \details
30   The function sets section shareability
31
32 \fn __STATIC_INLINE int MMU_GlobalSection(uint32_t *descriptor_l1, mmu_global_Type g_bit)
33 \details
34   The function sets section Global attribute
35
36 \fn __STATIC_INLINE int MMU_SecureSection(uint32_t *descriptor_l1, mmu_secure_Type s_bit)
37 \details
38   The function sets section Global attribute
39
40 \fn __STATIC_INLINE int MMU_XNPage(uint32_t *descriptor_l2, mmu_execute_Type xn, mmu_region_size_Type page)
41 \details
42   The function sets 4k/64k page execution-never attribute
43
44 \fn __STATIC_INLINE int MMU_DomainPage(uint32_t *descriptor_l1, uint8_t domain)
45 \details
46   The function sets 4k/64k page domain
47
48 \fn __STATIC_INLINE int MMU_PPage(uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit)
49 \details
50   The function sets 4k/64k page parity check
51
52 \fn __STATIC_INLINE int MMU_APPage(uint32_t *descriptor_l2, mmu_access_Type user, mmu_access_Type priv, uint32_t afe)
53 \details
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)
56 \details
57   The function sets 4k/64k page shareability
58
59 \fn __STATIC_INLINE int MMU_GlobalPage(uint32_t *descriptor_l2, mmu_global_Type g_bit)
60 \details
61   The function sets 4k/64k page Global attribute
62
63 \fn __STATIC_INLINE int MMU_SecurePage(uint32_t *descriptor_l1, mmu_secure_Type s_bit)
64 \details
65   The function sets 4k/64k page Global attribute
66
67 \fn __STATIC_INLINE int MMU_MemorySection(uint32_t *descriptor_l1, mmu_memory_Type mem, mmu_cacheability_Type outer, mmu_cacheability_Type inner)
68 \details
69   The function sets section memory attributes
70
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)
72 \details
73   The function sets 4k/64k page memory attributes
74
75 \fn __STATIC_INLINE int MMU_GetSectionDescriptor(uint32_t *descriptor, mmu_region_attributes_Type reg)
76 \details
77   The function creates a section descriptor.
78
79 \fn __STATIC_INLINE int MMU_GetPageDescriptor(uint32_t *descriptor, uint32_t *descriptor2, mmu_region_attributes_Type reg)
80 \details
81   The function creates a 4k/64k page descriptor.
82   Assumptions:
83   - TEX remap disabled, so memory type and attributes are described directly by bits in the descriptor
84   - Functions always return 0
85
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) 
90 \details 
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
94
95 \fn __STATIC_INLINE void MMU_Disable(void)
96
97 \fn __STATIC_INLINE void MMU_InvalidateTLB(void) 
98 */
99
100 /** @} */
101 /* end of MMU_functions */
102
103 /**
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
107 */
108
109 /** @{ */
110
111 /**
112 \def SECTION_DESCRIPTOR
113 \def SECTION_B_SHIFT
114 \def SECTION_C_SHIFT
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    
120 \def SECTION_P_SHIFT         
121 \def SECTION_AP_SHIFT        
122 \def SECTION_AP2_SHIFT       
123 \def SECTION_S_SHIFT         
124 \def SECTION_NG_SHIFT        
125 \def SECTION_NS_SHIFT        
126 \def PAGE_L1_DESCRIPTOR      
127 \def PAGE_L2_4K_DESC         
128 \def PAGE_L2_64K_DESC        
129 \def PAGE_4K_B_SHIFT         
130 \def PAGE_4K_C_SHIFT         
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     
139 \def PAGE_B_SHIFT            
140 \def PAGE_C_SHIFT            
141 \def PAGE_TEX_SHIFT          
142 \def PAGE_XN_4K_SHIFT        
143 \def PAGE_XN_64K_SHIFT       
144 \def PAGE_DOMAIN_SHIFT       
145 \def PAGE_P_SHIFT            
146 \def PAGE_AP_SHIFT           
147 \def PAGE_AP2_SHIFT          
148 \def PAGE_S_SHIFT            
149 \def PAGE_NG_SHIFT           
150 \def PAGE_NS_SHIFT           
151 \def OFFSET_1M               
152 \def OFFSET_64K              
153 \def OFFSET_4K               
154 \def DESCRIPTOR_FAULT             
155
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
165
166 \struct  mmu_region_attributes_Type
167
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) 
177 */
178 /** @} */ 
179 /* end group MMU_defs_gr */