MMU Functions provide control of the Memory Management Unit using translation tables and attributes of different regions of the physical memory map.
Reference: Architecture Reference Manual Reference Manual - Armv7-A and Armv7-R edition.  
More...
Content | |
| MMU Defines and Structs | |
| Defines and structures that relate to the Memory Management Unit.  | |
Functions | |
| __STATIC_INLINE int | MMU_XNSection (uint32_t *descriptor_l1, mmu_execute_Type xn) | 
| Set section execution-never attribute.   | |
| __STATIC_INLINE int | MMU_DomainSection (uint32_t *descriptor_l1, uint8_t domain) | 
| Set section domain.   | |
| __STATIC_INLINE int | MMU_PSection (uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit) | 
| Set section parity check.   | |
| __STATIC_INLINE int | MMU_APSection (uint32_t *descriptor_l1, mmu_access_Type user, mmu_access_Type priv, uint32_t afe) | 
| Set section access privileges.   | |
| __STATIC_INLINE int | MMU_SharedSection (uint32_t *descriptor_l1, mmu_shared_Type s_bit) | 
| Set section shareability.   | |
| __STATIC_INLINE int | MMU_GlobalSection (uint32_t *descriptor_l1, mmu_global_Type g_bit) | 
| Set section Global attribute.   | |
| __STATIC_INLINE int | MMU_SecureSection (uint32_t *descriptor_l1, mmu_secure_Type s_bit) | 
| Set section Security attribute.   | |
| __STATIC_INLINE int | MMU_XNPage (uint32_t *descriptor_l2, mmu_execute_Type xn, mmu_region_size_Type page) | 
| Set 4k/64k page execution-never attribute.   | |
| __STATIC_INLINE int | MMU_DomainPage (uint32_t *descriptor_l1, uint8_t domain) | 
| Set 4k/64k page domain.   | |
| __STATIC_INLINE int | MMU_PPage (uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit) | 
| Set 4k/64k page parity check.   | |
| __STATIC_INLINE int | MMU_APPage (uint32_t *descriptor_l2, mmu_access_Type user, mmu_access_Type priv, uint32_t afe) | 
| Set 4k/64k page access privileges.   | |
| __STATIC_INLINE int | MMU_SharedPage (uint32_t *descriptor_l2, mmu_shared_Type s_bit) | 
| Set 4k/64k page shareability.   | |
| __STATIC_INLINE int | MMU_GlobalPage (uint32_t *descriptor_l2, mmu_global_Type g_bit) | 
| Set 4k/64k page Global attribute.   | |
| __STATIC_INLINE int | MMU_SecurePage (uint32_t *descriptor_l1, mmu_secure_Type s_bit) | 
| Set 4k/64k page Security attribute.   | |
| __STATIC_INLINE int | MMU_MemorySection (uint32_t *descriptor_l1, mmu_memory_Type mem, mmu_cacheability_Type outer, mmu_cacheability_Type inner) | 
| Set Section memory attributes.   | |
| __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) | 
| Set 4k/64k page memory attributes.   | |
| __STATIC_INLINE int | MMU_GetSectionDescriptor (uint32_t *descriptor, mmu_region_attributes_Type reg) | 
| Create a L1 section descriptor.   | |
| __STATIC_INLINE int | MMU_GetPageDescriptor (uint32_t *descriptor, uint32_t *descriptor2, mmu_region_attributes_Type reg) | 
| Create a L1 and L2 4k/64k page descriptor.   | |
| __STATIC_INLINE void | MMU_TTSection (uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1) | 
| Create a 1MB Section.   | |
| __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) | 
| Create a 4k page entry.   | |
| __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) | 
| Create a 64k page entry.   | |
| __STATIC_INLINE void | MMU_Enable (void) | 
| Enable MMU.   | |
| __STATIC_INLINE void | MMU_Disable (void) | 
| Disable MMU.   | |
| __STATIC_INLINE void | MMU_InvalidateTLB (void) | 
| Invalidate entire unified TLB.   | |
MMU Functions provide control of the Memory Management Unit using translation tables and attributes of different regions of the physical memory map.
Reference: Architecture Reference Manual Reference Manual - Armv7-A and Armv7-R edition. 
| __STATIC_INLINE int MMU_APPage | ( | uint32_t * | descriptor_l2, | 
| mmu_access_Type | user, | ||
| mmu_access_Type | priv, | ||
| uint32_t | afe | ||
| ) | 
Set 4k/64k page access privileges.
| [out] | descriptor_l2 | L2 descriptor. | 
| [in] | user | User Level Access: NO_ACCESS, RW, READ | 
| [in] | priv | Privilege Level Access: NO_ACCESS, RW, READ | 
| [in] | afe | Access flag enable | 
The function sets 4k/64k page access privileges
| __STATIC_INLINE int MMU_APSection | ( | uint32_t * | descriptor_l1, | 
| mmu_access_Type | user, | ||
| mmu_access_Type | priv, | ||
| uint32_t | afe | ||
| ) | 
Set section access privileges.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | user | User Level Access: NO_ACCESS, RW, READ | 
| [in] | priv | Privilege Level Access: NO_ACCESS, RW, READ | 
| [in] | afe | Access flag enable | 
The function sets section access privileges
| __STATIC_INLINE void MMU_Disable | ( | void | ) | 
Disable MMU.
| __STATIC_INLINE int MMU_DomainPage | ( | uint32_t * | descriptor_l1, | 
| uint8_t | domain | ||
| ) | 
Set 4k/64k page domain.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | domain | Page domain | 
The function sets 4k/64k page domain
| __STATIC_INLINE int MMU_DomainSection | ( | uint32_t * | descriptor_l1, | 
| uint8_t | domain | ||
| ) | 
Set section domain.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | domain | Section domain | 
The function sets section domain.
| __STATIC_INLINE void MMU_Enable | ( | void | ) | 
Enable MMU.
Set M bit 0 to enable the MMU Set AFE bit to enable simplified access permissions model Clear TRE bit to disable TEX remap and A bit to disable strict alignment fault checking
| __STATIC_INLINE int MMU_GetPageDescriptor | ( | uint32_t * | descriptor, | 
| uint32_t * | descriptor2, | ||
| mmu_region_attributes_Type | reg | ||
| ) | 
Create a L1 and L2 4k/64k page descriptor.
| [out] | descriptor | L1 descriptor | 
| [out] | descriptor2 | L2 descriptor | 
| [in] | reg | 4k/64k page attributes | 
The function creates a 4k/64k page descriptor. Assumptions:
| __STATIC_INLINE int MMU_GetSectionDescriptor | ( | uint32_t * | descriptor, | 
| mmu_region_attributes_Type | reg | ||
| ) | 
Create a L1 section descriptor.
| [out] | descriptor | L1 descriptor | 
| [in] | reg | Section attributes | 
The function creates a section descriptor.
| __STATIC_INLINE int MMU_GlobalPage | ( | uint32_t * | descriptor_l2, | 
| mmu_global_Type | g_bit | ||
| ) | 
Set 4k/64k page Global attribute.
| [out] | descriptor_l2 | L2 descriptor. | 
| [in] | g_bit | 4k/64k page attribute: GLOBAL, NON_GLOBAL | 
The function sets 4k/64k page Global attribute
| __STATIC_INLINE int MMU_GlobalSection | ( | uint32_t * | descriptor_l1, | 
| mmu_global_Type | g_bit | ||
| ) | 
Set section Global attribute.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | g_bit | Section attribute: GLOBAL, NON_GLOBAL | 
The function sets section Global attribute
| __STATIC_INLINE void MMU_InvalidateTLB | ( | void | ) | 
Invalidate entire unified TLB.
| __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 | ||
| ) | 
Set 4k/64k page memory attributes.
| [out] | descriptor_l2 | L2 descriptor. | 
| [in] | mem | 4k/64k page memory type: NORMAL, DEVICE, SHARED_DEVICE, NON_SHARED_DEVICE, STRONGLY_ORDERED | 
| [in] | outer | Outer cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, | 
| [in] | inner | Inner cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, | 
| [in] | page | Page size | 
The function sets 4k/64k page memory attributes
| __STATIC_INLINE int MMU_MemorySection | ( | uint32_t * | descriptor_l1, | 
| mmu_memory_Type | mem, | ||
| mmu_cacheability_Type | outer, | ||
| mmu_cacheability_Type | inner | ||
| ) | 
Set Section memory attributes.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | mem | Section memory type: NORMAL, DEVICE, SHARED_DEVICE, NON_SHARED_DEVICE, STRONGLY_ORDERED | 
| [in] | outer | Outer cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, | 
| [in] | inner | Inner cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA, | 
The function sets section memory attributes
| __STATIC_INLINE int MMU_PPage | ( | uint32_t * | descriptor_l1, | 
| mmu_ecc_check_Type | p_bit | ||
| ) | 
Set 4k/64k page parity check.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | p_bit | Parity check: ECC_DISABLED, ECC_ENABLED | 
The function sets 4k/64k page parity check
| __STATIC_INLINE int MMU_PSection | ( | uint32_t * | descriptor_l1, | 
| mmu_ecc_check_Type | p_bit | ||
| ) | 
Set section parity check.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | p_bit | Parity check: ECC_DISABLED, ECC_ENABLED | 
The function sets section parity check
| __STATIC_INLINE int MMU_SecurePage | ( | uint32_t * | descriptor_l1, | 
| mmu_secure_Type | s_bit | ||
| ) | 
Set 4k/64k page Security attribute.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | s_bit | 4k/64k page Security attribute: SECURE, NON_SECURE | 
The function sets 4k/64k page Global attribute
| __STATIC_INLINE int MMU_SecureSection | ( | uint32_t * | descriptor_l1, | 
| mmu_secure_Type | s_bit | ||
| ) | 
Set section Security attribute.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | s_bit | Section Security attribute: SECURE, NON_SECURE | 
The function sets section Global attribute
| __STATIC_INLINE int MMU_SharedPage | ( | uint32_t * | descriptor_l2, | 
| mmu_shared_Type | s_bit | ||
| ) | 
Set 4k/64k page shareability.
| [out] | descriptor_l2 | L2 descriptor. | 
| [in] | s_bit | 4k/64k page shareability: NON_SHARED, SHARED | 
The function sets 4k/64k page shareability
| __STATIC_INLINE int MMU_SharedSection | ( | uint32_t * | descriptor_l1, | 
| mmu_shared_Type | s_bit | ||
| ) | 
Set section shareability.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | s_bit | Section shareability: NON_SHARED, SHARED | 
The function sets section shareability
| __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 | ||
| ) | 
Create a 4k page entry.
| [in] | ttb | L1 table base address | 
| [in] | base_address | 4k base address | 
| [in] | count | Number of 4k pages to create | 
| [in] | descriptor_l1 | L1 descriptor (region attributes) | 
| [in] | ttb_l2 | L2 table base address | 
| [in] | descriptor_l2 | L2 descriptor (region attributes) | 
| __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 | ||
| ) | 
Create a 64k page entry.
| [in] | ttb | L1 table base address | 
| [in] | base_address | 64k base address | 
| [in] | count | Number of 64k pages to create | 
| [in] | descriptor_l1 | L1 descriptor (region attributes) | 
| [in] | ttb_l2 | L2 table base address | 
| [in] | descriptor_l2 | L2 descriptor (region attributes) | 
| __STATIC_INLINE void MMU_TTSection | ( | uint32_t * | ttb, | 
| uint32_t | base_address, | ||
| uint32_t | count, | ||
| uint32_t | descriptor_l1 | ||
| ) | 
Create a 1MB Section.
| [in] | ttb | Translation table base address | 
| [in] | base_address | Section base address | 
| [in] | count | Number of sections to create | 
| [in] | descriptor_l1 | L1 descriptor (region attributes) | 
| __STATIC_INLINE int MMU_XNPage | ( | uint32_t * | descriptor_l2, | 
| mmu_execute_Type | xn, | ||
| mmu_region_size_Type | page | ||
| ) | 
Set 4k/64k page execution-never attribute.
| [out] | descriptor_l2 | L2 descriptor. | 
| [in] | xn | Page execution-never attribute : EXECUTE , NON_EXECUTE. | 
| [in] | page | Page size: PAGE_4k, PAGE_64k, | 
The function sets 4k/64k page execution-never attribute
| __STATIC_INLINE int MMU_XNSection | ( | uint32_t * | descriptor_l1, | 
| mmu_execute_Type | xn | ||
| ) | 
Set section execution-never attribute.
| [out] | descriptor_l1 | L1 descriptor. | 
| [in] | xn | Section execution-never attribute : EXECUTE , NON_EXECUTE. | 
The function sets section execution-never attribute