EFM32 Wonder Gecko Software Documentation
efm32wg-doc-5.1.2
|
Memory Protection Unit (MPU) Peripheral API.
This module contains functions to enable, disable and setup the MPU. The MPU is used to control access attributes and permissions in the memory map. The settings that can be controlled are:
The MPU can be activated and deactivated with functions:
* MPU_Enable(..); * MPU_Disable();
The MPU can control 8 memory regions with individual access control settings. Section attributes and permissions are set with:
* MPU_ConfigureRegion(..);
It is advisable to disable the 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 an MPU region. More... | |
__STATIC_INLINE void | MPU_Disable (void) |
Disable the MPU. More... | |
__STATIC_INLINE void | MPU_Enable (uint32_t flags) |
Enable the MPU. More... | |
#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 init structure for flash memory.
#define MPU_INIT_PERIPHERAL_DEFAULT |
Default configuration of MPU region init structure for onchip peripherals.
#define MPU_INIT_SRAM_DEFAULT |
Default configuration of MPU region init structure for sram memory.
enum MPU_RegionAp_TypeDef |
MPU region access permission attributes.
Size of an MPU region.
void MPU_ConfigureRegion | ( | const MPU_RegionInit_TypeDef * | init | ) |
Configure an MPU region.
Writes to MPU RBAR and RASR registers. Refer to Cortex-M3 Reference Manual, MPU chapter for further details. To disable a region it is only required to set init->regionNo to the desired value and init->regionEnable = false.
[in] | init | Pointer to a structure containing MPU region init information. |
Definition at line 91 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 | ) |
__STATIC_INLINE void MPU_Enable | ( | uint32_t | flags | ) |
Enable the MPU.
Enable MPU and MPU fault exceptions.
[in] | flags | Use a logical OR of MPU_CTRL_PRIVDEFENA and MPU_CTRL_HFNMIENA as needed. |