MPU
Detailed Description
Memory Protection Unit (MPU) Peripheral API.
-
Deprecated:
- These functions are deprecated and marked for removal in a later release. Use ARM's ARM_MPU_xxx API instead. See file platform/CMSIS/Include/mpu_armv7.h or mpu_armv8.h
This module contains functions to enable, disable, and set up MPU. MPU is used to control access attributes and permissions in the memory map. The settings that can be controlled are:
- Executable attribute.
- Cachable, bufferable and shareable attributes.
- Cache policy.
- Access permissions: Privileged or User state, read or write access, and combinations of all these.
The MPU module can be activated and deactivated with functions:
* MPU_Enable(..); * MPU_Disable();
The MPU module can control 8 memory regions with individual access control settings. Section attributes and permissions are set with:
* MPU_ConfigureRegion(..);
It is advisable to disable MPU when altering region settings.
Data Structures |
|
struct | MPU_RegionInit_TypeDef |
Macros |
|
#define | MPU_CTRL_HFNMIENA MPU_CTRL_HFNMIENA_Msk |
#define | MPU_CTRL_PRIVDEFENA MPU_CTRL_PRIVDEFENA_Msk |
#define | MPU_INIT_FLASH_DEFAULT |
#define | MPU_INIT_PERIPHERAL_DEFAULT |
#define | MPU_INIT_SRAM_DEFAULT |
Enumerations |
|
enum |
MPU_RegionAp_TypeDef
{
mpuRegionNoAccess = 0, mpuRegionApPRw = 1, mpuRegionApPRwURo = 2, mpuRegionApFullAccess = 3, mpuRegionApPRo = 5, mpuRegionApPRo_URo = 6 } |
enum |
MPU_RegionSize_TypeDef
{
mpuRegionSize32b = 4, mpuRegionSize64b = 5, mpuRegionSize128b = 6, mpuRegionSize256b = 7, mpuRegionSize512b = 8, mpuRegionSize1Kb = 9, mpuRegionSize2Kb = 10, mpuRegionSize4Kb = 11, mpuRegionSize8Kb = 12, mpuRegionSize16Kb = 13, mpuRegionSize32Kb = 14, mpuRegionSize64Kb = 15, mpuRegionSize128Kb = 16, mpuRegionSize256Kb = 17, mpuRegionSize512Kb = 18, mpuRegionSize1Mb = 19, mpuRegionSize2Mb = 20, mpuRegionSize4Mb = 21, mpuRegionSize8Mb = 22, mpuRegionSize16Mb = 23, mpuRegionSize32Mb = 24, mpuRegionSize64Mb = 25, mpuRegionSize128Mb = 26, mpuRegionSize256Mb = 27, mpuRegionSize512Mb = 28, mpuRegionSize1Gb = 29, mpuRegionSize2Gb = 30, mpuRegionSize4Gb = 31 } |
Functions |
|
void | MPU_ConfigureRegion (const MPU_RegionInit_TypeDef *init) |
Configure the MPU region.
|
|
__STATIC_INLINE void | MPU_Disable (void) |
Disable the MPU.
|
|
__STATIC_INLINE void | MPU_Enable (uint32_t flags) |
Enable the MPU.
|
|
Macro Definition Documentation
#define MPU_CTRL_HFNMIENA MPU_CTRL_HFNMIENA_Msk |
#define MPU_CTRL_PRIVDEFENA MPU_CTRL_PRIVDEFENA_Msk |
#define MPU_INIT_FLASH_DEFAULT |
Default configuration of MPU region initialization structure for flash memory.
Definition at line
138
of file
em_mpu.h
.
#define MPU_INIT_PERIPHERAL_DEFAULT |
Default configuration of MPU region initialization structure for on-chip peripherals.
Definition at line
172
of file
em_mpu.h
.
#define MPU_INIT_SRAM_DEFAULT |
Default configuration of MPU region initialization structure for static random access memory (SRAM).
Definition at line
155
of file
em_mpu.h
.
Enumeration Type Documentation
enum MPU_RegionAp_TypeDef |
MPU region access permission attributes.
Definition at line
108
of file
em_mpu.h
.
Size of an MPU region.
Definition at line
74
of file
em_mpu.h
.
Function Documentation
void MPU_ConfigureRegion | ( | const MPU_RegionInit_TypeDef * |
init
|
) |
Configure the MPU region.
-
Deprecated:
- Deprecated and marked for removal in a later release. Use ARM's ARM_MPU_SetRegion(), ARM_MPU_SetRegionEx(), ARM_MPU_Load() or similar instead.
Writes to MPU RBAR and RASR registers. See Cortex-M3 Reference Manual, MPU chapter for more details. To disable a region, set init->regionNo to the desired value and init->regionEnable = false.
- Parameters
-
[in] init
A pointer to the structure containing the MPU region initialization information.
Definition at line
96
of file
em_mpu.c
.
References MPU_RegionInit_TypeDef::accessPermission , MPU_RegionInit_TypeDef::baseAddress , MPU_RegionInit_TypeDef::bufferable , MPU_RegionInit_TypeDef::cacheable , MPU_RegionInit_TypeDef::disableExec , MPU_RegionInit_TypeDef::regionEnable , MPU_RegionInit_TypeDef::regionNo , MPU_RegionInit_TypeDef::shareable , MPU_RegionInit_TypeDef::size , MPU_RegionInit_TypeDef::srd , and MPU_RegionInit_TypeDef::tex .
__STATIC_INLINE void MPU_Disable | ( | void |
|
) |
Disable the MPU.
-
Deprecated:
- Deprecated and marked for removal in a later release. Use ARM's ARM_MPU_Disable() instead.
Disable MPU and MPU fault exceptions.
Definition at line
202
of file
em_mpu.h
.
__STATIC_INLINE void MPU_Enable | ( | uint32_t |
flags
|
) |
Enable the MPU.
-
Deprecated:
- Deprecated and marked for removal in a later release. Use ARM's ARM_MPU_Enable() instead.
Enable MPU and MPU fault exceptions.
- Parameters
-
[in] flags
Use a logical OR of MPU_CTRL_PRIVDEFENA and MPU_CTRL_HFNMIENA as needed.
Definition at line
222
of file
em_mpu.h
.