CMSIS-Core (Cortex-A)  Version 1.2.1
CMSIS-Core support for Cortex-A processor-based devices
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Memory Management Unit Functions

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. More...
 
__STATIC_INLINE int MMU_DomainSection (uint32_t *descriptor_l1, uint8_t domain)
 Set section domain. More...
 
__STATIC_INLINE int MMU_PSection (uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit)
 Set section parity check. More...
 
__STATIC_INLINE int MMU_APSection (uint32_t *descriptor_l1, mmu_access_Type user, mmu_access_Type priv, uint32_t afe)
 Set section access privileges. More...
 
__STATIC_INLINE int MMU_SharedSection (uint32_t *descriptor_l1, mmu_shared_Type s_bit)
 Set section shareability. More...
 
__STATIC_INLINE int MMU_GlobalSection (uint32_t *descriptor_l1, mmu_global_Type g_bit)
 Set section Global attribute. More...
 
__STATIC_INLINE int MMU_SecureSection (uint32_t *descriptor_l1, mmu_secure_Type s_bit)
 Set section Security attribute. More...
 
__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. More...
 
__STATIC_INLINE int MMU_DomainPage (uint32_t *descriptor_l1, uint8_t domain)
 Set 4k/64k page domain. More...
 
__STATIC_INLINE int MMU_PPage (uint32_t *descriptor_l1, mmu_ecc_check_Type p_bit)
 Set 4k/64k page parity check. More...
 
__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. More...
 
__STATIC_INLINE int MMU_SharedPage (uint32_t *descriptor_l2, mmu_shared_Type s_bit)
 Set 4k/64k page shareability. More...
 
__STATIC_INLINE int MMU_GlobalPage (uint32_t *descriptor_l2, mmu_global_Type g_bit)
 Set 4k/64k page Global attribute. More...
 
__STATIC_INLINE int MMU_SecurePage (uint32_t *descriptor_l1, mmu_secure_Type s_bit)
 Set 4k/64k page Security attribute. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE int MMU_GetSectionDescriptor (uint32_t *descriptor, mmu_region_attributes_Type reg)
 Create a L1 section descriptor. More...
 
__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. More...
 
__STATIC_INLINE void MMU_TTSection (uint32_t *ttb, uint32_t base_address, uint32_t count, uint32_t descriptor_l1)
 Create a 1MB Section. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void MMU_Enable (void)
 Enable MMU. More...
 
__STATIC_INLINE void MMU_Disable (void)
 Disable MMU. More...
 
__STATIC_INLINE void MMU_InvalidateTLB (void)
 Invalidate entire unified TLB. More...
 

Description

Function Documentation

__STATIC_INLINE int MMU_APPage ( uint32_t *  descriptor_l2,
mmu_access_Type  user,
mmu_access_Type  priv,
uint32_t  afe 
)
Parameters
[out]descriptor_l2L2 descriptor.
[in]userUser Level Access: NO_ACCESS, RW, READ
[in]privPrivilege Level Access: NO_ACCESS, RW, READ
[in]afeAccess flag enable
Returns
0

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 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]userUser Level Access: NO_ACCESS, RW, READ
[in]privPrivilege Level Access: NO_ACCESS, RW, READ
[in]afeAccess flag enable
Returns
0

The function sets section access privileges

__STATIC_INLINE void MMU_Disable ( void  )
__STATIC_INLINE int MMU_DomainPage ( uint32_t *  descriptor_l1,
uint8_t  domain 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]domainPage domain
Returns
0

The function sets 4k/64k page domain

__STATIC_INLINE int MMU_DomainSection ( uint32_t *  descriptor_l1,
uint8_t  domain 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]domainSection domain
Returns
0

The function sets section domain.

__STATIC_INLINE void MMU_Enable ( void  )

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 
)
Parameters
[out]descriptorL1 descriptor
[out]descriptor2L2 descriptor
[in]reg4k/64k page attributes
Returns
0

The function creates a 4k/64k page descriptor. Assumptions:

  • TEX remap disabled, so memory type and attributes are described directly by bits in the descriptor
  • Functions always return 0
__STATIC_INLINE int MMU_GetSectionDescriptor ( uint32_t *  descriptor,
mmu_region_attributes_Type  reg 
)
Parameters
[out]descriptorL1 descriptor
[in]regSection attributes
Returns
0

The function creates a section descriptor.

__STATIC_INLINE int MMU_GlobalPage ( uint32_t *  descriptor_l2,
mmu_global_Type  g_bit 
)
Parameters
[out]descriptor_l2L2 descriptor.
[in]g_bit4k/64k page attribute: GLOBAL, NON_GLOBAL
Returns
0

The function sets 4k/64k page Global attribute

__STATIC_INLINE int MMU_GlobalSection ( uint32_t *  descriptor_l1,
mmu_global_Type  g_bit 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]g_bitSection attribute: GLOBAL, NON_GLOBAL
Returns
0

The function sets section Global attribute

__STATIC_INLINE void MMU_InvalidateTLB ( void  )
__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 
)
Parameters
[out]descriptor_l2L2 descriptor.
[in]mem4k/64k page memory type: NORMAL, DEVICE, SHARED_DEVICE, NON_SHARED_DEVICE, STRONGLY_ORDERED
[in]outerOuter cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA,
[in]innerInner cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA,
[in]pagePage size
Returns
0

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 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]memSection memory type: NORMAL, DEVICE, SHARED_DEVICE, NON_SHARED_DEVICE, STRONGLY_ORDERED
[in]outerOuter cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA,
[in]innerInner cacheability: NON_CACHEABLE, WB_WA, WT, WB_NO_WA,
Returns
0

The function sets section memory attributes

__STATIC_INLINE int MMU_PPage ( uint32_t *  descriptor_l1,
mmu_ecc_check_Type  p_bit 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]p_bitParity check: ECC_DISABLED, ECC_ENABLED
Returns
0

The function sets 4k/64k page parity check

__STATIC_INLINE int MMU_PSection ( uint32_t *  descriptor_l1,
mmu_ecc_check_Type  p_bit 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]p_bitParity check: ECC_DISABLED, ECC_ENABLED
Returns
0

The function sets section parity check

__STATIC_INLINE int MMU_SecurePage ( uint32_t *  descriptor_l1,
mmu_secure_Type  s_bit 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]s_bit4k/64k page Security attribute: SECURE, NON_SECURE
Returns
0

The function sets 4k/64k page Global attribute

__STATIC_INLINE int MMU_SecureSection ( uint32_t *  descriptor_l1,
mmu_secure_Type  s_bit 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]s_bitSection Security attribute: SECURE, NON_SECURE
Returns
0

The function sets section Global attribute

__STATIC_INLINE int MMU_SharedPage ( uint32_t *  descriptor_l2,
mmu_shared_Type  s_bit 
)
Parameters
[out]descriptor_l2L2 descriptor.
[in]s_bit4k/64k page shareability: NON_SHARED, SHARED
Returns
0

The function sets 4k/64k page shareability

__STATIC_INLINE int MMU_SharedSection ( uint32_t *  descriptor_l1,
mmu_shared_Type  s_bit 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]s_bitSection shareability: NON_SHARED, SHARED
Returns
0

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 
)
Parameters
[in]ttbL1 table base address
[in]base_address4k base address
[in]countNumber of 4k pages to create
[in]descriptor_l1L1 descriptor (region attributes)
[in]ttb_l2L2 table base address
[in]descriptor_l2L2 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 
)
Parameters
[in]ttbL1 table base address
[in]base_address64k base address
[in]countNumber of 64k pages to create
[in]descriptor_l1L1 descriptor (region attributes)
[in]ttb_l2L2 table base address
[in]descriptor_l2L2 descriptor (region attributes)
__STATIC_INLINE void MMU_TTSection ( uint32_t *  ttb,
uint32_t  base_address,
uint32_t  count,
uint32_t  descriptor_l1 
)
Parameters
[in]ttbTranslation table base address
[in]base_addressSection base address
[in]countNumber of sections to create
[in]descriptor_l1L1 descriptor (region attributes)
__STATIC_INLINE int MMU_XNPage ( uint32_t *  descriptor_l2,
mmu_execute_Type  xn,
mmu_region_size_Type  page 
)
Parameters
[out]descriptor_l2L2 descriptor.
[in]xnPage execution-never attribute : EXECUTE , NON_EXECUTE.
[in]pagePage size: PAGE_4k, PAGE_64k,
Returns
0

The function sets 4k/64k page execution-never attribute

__STATIC_INLINE int MMU_XNSection ( uint32_t *  descriptor_l1,
mmu_execute_Type  xn 
)
Parameters
[out]descriptor_l1L1 descriptor.
[in]xnSection execution-never attribute : EXECUTE , NON_EXECUTE.
Returns
0

The function sets section execution-never attribute