CMSIS-Core (Cortex-A)  
CMSIS-Core support for Cortex-A processor-based devices
 
Loading...
Searching...
No Matches
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.
 
__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.
 

Description

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.

Function Documentation

◆ MMU_APPage()

__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.

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

◆ MMU_APSection()

__STATIC_INLINE int MMU_APSection ( uint32_t *  descriptor_l1,
mmu_access_Type  user,
mmu_access_Type  priv,
uint32_t  afe 
)

Set section access privileges.

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

◆ MMU_Disable()

__STATIC_INLINE void MMU_Disable ( void  )

Disable MMU.

◆ MMU_DomainPage()

__STATIC_INLINE int MMU_DomainPage ( uint32_t *  descriptor_l1,
uint8_t  domain 
)

Set 4k/64k page domain.

Parameters
[out]descriptor_l1L1 descriptor.
[in]domainPage domain
Returns
0

The function sets 4k/64k page domain

◆ MMU_DomainSection()

__STATIC_INLINE int MMU_DomainSection ( uint32_t *  descriptor_l1,
uint8_t  domain 
)

Set section domain.

Parameters
[out]descriptor_l1L1 descriptor.
[in]domainSection domain
Returns
0

The function sets section domain.

◆ MMU_Enable()

__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

◆ MMU_GetPageDescriptor()

__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.

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

◆ MMU_GetSectionDescriptor()

__STATIC_INLINE int MMU_GetSectionDescriptor ( uint32_t *  descriptor,
mmu_region_attributes_Type  reg 
)

Create a L1 section descriptor.

Parameters
[out]descriptorL1 descriptor
[in]regSection attributes
Returns
0

The function creates a section descriptor.

◆ MMU_GlobalPage()

__STATIC_INLINE int MMU_GlobalPage ( uint32_t *  descriptor_l2,
mmu_global_Type  g_bit 
)

Set 4k/64k page Global attribute.

Parameters
[out]descriptor_l2L2 descriptor.
[in]g_bit4k/64k page attribute: GLOBAL, NON_GLOBAL
Returns
0

The function sets 4k/64k page Global attribute

◆ MMU_GlobalSection()

__STATIC_INLINE int MMU_GlobalSection ( uint32_t *  descriptor_l1,
mmu_global_Type  g_bit 
)

Set section Global attribute.

Parameters
[out]descriptor_l1L1 descriptor.
[in]g_bitSection attribute: GLOBAL, NON_GLOBAL
Returns
0

The function sets section Global attribute

◆ MMU_InvalidateTLB()

__STATIC_INLINE void MMU_InvalidateTLB ( void  )

Invalidate entire unified TLB.

◆ MMU_MemoryPage()

__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.

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

◆ MMU_MemorySection()

__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.

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

◆ MMU_PPage()

__STATIC_INLINE int MMU_PPage ( uint32_t *  descriptor_l1,
mmu_ecc_check_Type  p_bit 
)

Set 4k/64k page parity check.

Parameters
[out]descriptor_l1L1 descriptor.
[in]p_bitParity check: ECC_DISABLED, ECC_ENABLED
Returns
0

The function sets 4k/64k page parity check

◆ MMU_PSection()

__STATIC_INLINE int MMU_PSection ( uint32_t *  descriptor_l1,
mmu_ecc_check_Type  p_bit 
)

Set section parity check.

Parameters
[out]descriptor_l1L1 descriptor.
[in]p_bitParity check: ECC_DISABLED, ECC_ENABLED
Returns
0

The function sets section parity check

◆ MMU_SecurePage()

__STATIC_INLINE int MMU_SecurePage ( uint32_t *  descriptor_l1,
mmu_secure_Type  s_bit 
)

Set 4k/64k page Security attribute.

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

◆ MMU_SecureSection()

__STATIC_INLINE int MMU_SecureSection ( uint32_t *  descriptor_l1,
mmu_secure_Type  s_bit 
)

Set section Security attribute.

Parameters
[out]descriptor_l1L1 descriptor.
[in]s_bitSection Security attribute: SECURE, NON_SECURE
Returns
0

The function sets section Global attribute

◆ MMU_SharedPage()

__STATIC_INLINE int MMU_SharedPage ( uint32_t *  descriptor_l2,
mmu_shared_Type  s_bit 
)

Set 4k/64k page shareability.

Parameters
[out]descriptor_l2L2 descriptor.
[in]s_bit4k/64k page shareability: NON_SHARED, SHARED
Returns
0

The function sets 4k/64k page shareability

◆ MMU_SharedSection()

__STATIC_INLINE int MMU_SharedSection ( uint32_t *  descriptor_l1,
mmu_shared_Type  s_bit 
)

Set section shareability.

Parameters
[out]descriptor_l1L1 descriptor.
[in]s_bitSection shareability: NON_SHARED, SHARED
Returns
0

The function sets section shareability

◆ MMU_TTPage4k()

__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.

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)

◆ MMU_TTPage64k()

__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.

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)

◆ MMU_TTSection()

__STATIC_INLINE void MMU_TTSection ( uint32_t *  ttb,
uint32_t  base_address,
uint32_t  count,
uint32_t  descriptor_l1 
)

Create a 1MB Section.

Parameters
[in]ttbTranslation table base address
[in]base_addressSection base address
[in]countNumber of sections to create
[in]descriptor_l1L1 descriptor (region attributes)

◆ MMU_XNPage()

__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.

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

◆ MMU_XNSection()

__STATIC_INLINE int MMU_XNSection ( uint32_t *  descriptor_l1,
mmu_execute_Type  xn 
)

Set section execution-never attribute.

Parameters
[out]descriptor_l1L1 descriptor.
[in]xnSection execution-never attribute : EXECUTE , NON_EXECUTE.
Returns
0

The function sets section execution-never attribute