![]() |
MT2523 API Reference
LinkIt SDK v4
|
This section describes the programming interfaces of Memory Protection Unit (MPU) HAL driver. More...
This section describes the programming interfaces of Memory Protection Unit (MPU) HAL driver.
The MPU is an optional component in ARMv7-M architecture, that provides control of access rights on physical addresses. The processor supports a standard ARMv7 Protected Memory System Architecture model. The MPU divides the memory map into a number of regions, and defines the location, size, access permissions and memory attributes of each region. The Cortex-M4 MPU defines eight separate memory regions as well as a background region. The Cortex-M4 MPU memory map is unified. This means instruction accesses and data accesses have the same region settings. The MPU provides full support for:
MPU mismatches and permission violations invoke the programmable-priority MemManage fault handler.
You can use the MPU to:
The following provides descriptions to the terms commonly used in the MPU driver and how to use its various functions.
| Terms | Details |
|---|---|
| MPU | Memory Protection Unit. For more information, please refer to ARMv7-M Architecture Reference Manual. |
The MPU HAL driver enables configuration of location, size and access permissions for each region. The configuration of memory attributes (TEX, C, B bits field of the Region Attribute and Size Register) is not supported. Call the MPU APIs to configure the MPU, as shown below:
The MPU HAL driver APIs enable the user to perform the following.
Functions | |
| hal_mpu_status_t | hal_mpu_init (const hal_mpu_config_t *mpu_config) |
| MPU initialization function. More... | |
| hal_mpu_status_t | hal_mpu_deinit (void) |
| MPU deinitialization function. More... | |
| hal_mpu_status_t | hal_mpu_enable (void) |
| MPU enable function. More... | |
| hal_mpu_status_t | hal_mpu_disable (void) |
| MPU disable function. More... | |
| hal_mpu_status_t | hal_mpu_region_enable (hal_mpu_region_t region) |
| MPU region enable function. More... | |
| hal_mpu_status_t | hal_mpu_region_disable (hal_mpu_region_t region) |
| MPU region disable function. More... | |
| hal_mpu_status_t | hal_mpu_region_configure (hal_mpu_region_t region, const hal_mpu_region_config_t *region_config) |
| MPU region configuration function. More... | |
Modules | |
| Enum | |
| Struct | |
| hal_mpu_status_t hal_mpu_deinit | ( | void | ) |
MPU deinitialization function.
This function resets the MPU registers to their default values.
| hal_mpu_status_t hal_mpu_disable | ( | void | ) |
MPU disable function.
Disables the MPU settings.
| hal_mpu_status_t hal_mpu_enable | ( | void | ) |
MPU enable function.
Enables the MPU settings during a memory access.
| hal_mpu_status_t hal_mpu_init | ( | const hal_mpu_config_t * | mpu_config | ) |
MPU initialization function.
| [in] | mpu_config | is the configuration information for MPU. |
| hal_mpu_status_t hal_mpu_region_configure | ( | hal_mpu_region_t | region, |
| const hal_mpu_region_config_t * | region_config | ||
| ) |
MPU region configuration function.
| [in] | region | is the region that is configured. |
| [in] | region_config | is the configuration information of the region. |
| hal_mpu_status_t hal_mpu_region_disable | ( | hal_mpu_region_t | region | ) |
MPU region disable function.
Disables the specified region, when this function is called, the settings of corresponding region are disabled even if the hal_mpu_enable() function is called.
| [in] | region | is the region that is disabled, this parameter can only be a value of type hal_mpu_region_t. |
| hal_mpu_status_t hal_mpu_region_enable | ( | hal_mpu_region_t | region | ) |
MPU region enable function.
Enables the specified region, when the hal_mpu_enable() is called, the settings of the corresponding region take effect.
| [in] | region | is the region that is enabled, this parameter can only be a value of type hal_mpu_region_t. |