MPU driver that allows the user to divide the memory space into different protection regions.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the MEMORY - MPU - Memory Protection Unit. | |
Data Structures | |
struct | mpu_entry_t |
Macros | |
#define | CAST(to, from) |
Functions | |
void | disable_mpu (void) |
Disable the memory protection unit. MPU address checking is disabled, no exceptions will be generated by the MPU. More... | |
void | disable_mpu_entry (unsigned int region_number, unsigned int register_select) |
void | enable_mpu (void) |
Enable the memory protection unit. MPU address checking is enabled. More... | |
bool | mpu_convert_kbsize_to_eregionsize (eRegionSize *peRegionSizeValue, U32 kBSizeValue) |
Converts an input region size expressed in kBytes to the corresponding eRegionSize type value. More... | |
void | select_subregion (unsigned int region_number, unsigned int pattern_select) |
void | set_access_permissions (unsigned int region_number, unsigned int register_select, unsigned int right_access) |
char | set_mpu_entry (const mpu_entry_t *mpu_entry, unsigned int region_number) |
#define | MPU_APRA_ID 0 |
MPU Access Permission Register A & B identifiers. More... | |
#define | MPU_APRB_ID 1 |
#define | MPU_PRIVR_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_R_UNPRIV_NONE |
MPU Access Permissions. More... | |
#define | MPU_PRIVRX_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_RX_UNPRIV_NONE |
#define | MPU_PRIVRW_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_NONE |
#define | MPU_PRIVRWX_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_RWX_UNPRIV_NONE |
#define | MPU_PRIVR_UNPRIVR AVR32_MPUAPRA_AP0_PRIV_R_UNPRIV_R |
#define | MPU_PRIVRX_UNPRIVRX AVR32_MPUAPRA_AP0_PRIV_RX_UNPRIV_RX |
#define | MPU_PRIVRW_UNPRIVRW AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_RW |
#define | MPU_PRIVRWX_UNPRIVRWX AVR32_MPUAPRA_AP0_PRIV_RWX_UNPRIV_RWX |
#define | MPU_PRIVRW_UNPRIVR AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_R |
#define | MPU_PRIVRW_UNPRIVRX AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_RX |
#define | MPU_PRIVNONE_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_NONE_UNPRIV_NONE |
#define | MPU_SETUP_ENTRY_OK 0 |
MPU entry set up function (set_mpu_entry) return codes. More... | |
#define | MPU_SETUP_ENTRY_INVALIDBASEADDR 1 |
#define | MPU_SETUP_ENTRY_INVALIDSIZE 2 |
#define CAST | ( | to, | |
from | |||
) |
#define MPU_APRA_ID 0 |
MPU Access Permission Register A & B identifiers.
Referenced by configure_memory_area().
#define MPU_APRB_ID 1 |
Referenced by configure_memory_area().
#define MPU_PRIVNONE_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_NONE_UNPRIV_NONE |
#define MPU_PRIVR_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_R_UNPRIV_NONE |
MPU Access Permissions.
Referenced by configure_memory_area().
#define MPU_PRIVR_UNPRIVR AVR32_MPUAPRA_AP0_PRIV_R_UNPRIV_R |
#define MPU_PRIVRW_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_NONE |
Referenced by configure_memory_area().
#define MPU_PRIVRW_UNPRIVR AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_R |
#define MPU_PRIVRW_UNPRIVRW AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_RW |
#define MPU_PRIVRW_UNPRIVRX AVR32_MPUAPRA_AP0_PRIV_RW_UNPRIV_RX |
#define MPU_PRIVRWX_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_RWX_UNPRIV_NONE |
#define MPU_PRIVRWX_UNPRIVRWX AVR32_MPUAPRA_AP0_PRIV_RWX_UNPRIV_RWX |
#define MPU_PRIVRX_UNPRIVNONE AVR32_MPUAPRA_AP0_PRIV_RX_UNPRIV_NONE |
#define MPU_PRIVRX_UNPRIVRX AVR32_MPUAPRA_AP0_PRIV_RX_UNPRIV_RX |
Referenced by configure_memory_area().
#define MPU_SETUP_ENTRY_INVALIDBASEADDR 1 |
Referenced by set_mpu_entry().
#define MPU_SETUP_ENTRY_INVALIDSIZE 2 |
Referenced by set_mpu_entry().
#define MPU_SETUP_ENTRY_OK 0 |
MPU entry set up function (set_mpu_entry) return codes.
Referenced by set_mpu_entry().
enum eRegionSize |
Possible protected region sizes. Based on Table 5.1 in doc32002 "AVR32UC Technical Reference Manual Complete".
void disable_mpu | ( | void | ) |
Disable the memory protection unit. MPU address checking is disabled, no exceptions will be generated by the MPU.
Control of the MPU control register MPUCR: disable MPUCR
References Set_system_register.
Referenced by handle_exception().
void disable_mpu_entry | ( | unsigned int | region_number, |
unsigned int | register_select | ||
) |
Disable a MPU entry
region_number,: | MPU entry region number (0..7). |
register_select,: | register A: '0' – B: '1' |
References Set_system_register.
void enable_mpu | ( | void | ) |
Enable the memory protection unit. MPU address checking is enabled.
Control of the MPU control register MPUCR: enable MPUCR
References Set_system_register.
Referenced by configure_memory_area().
bool mpu_convert_kbsize_to_eregionsize | ( | eRegionSize * | peRegionSizeValue, |
U32 | kBSizeValue | ||
) |
Converts an input region size expressed in kBytes to the corresponding eRegionSize type value.
kBSizeValue,: | input region size expressed in kBytes |
peRegionSizeValue,: | output region size in the eRegionSize type |
References clz, MPU_REGION_SIZE_HIGHLIMIT_FORBIDDEN, and MPU_REGION_SIZE_LOWLIMIT_FORBIDDEN.
Referenced by configure_memory_area().
void select_subregion | ( | unsigned int | region_number, |
unsigned int | pattern_select | ||
) |
Setup a Subregion
region_number,: | MPU entry region number (0..7). |
pattern_select,: | bit-field for the 16 subregions: register A: '0' – B: '1' |
References Set_system_register.
Referenced by configure_memory_area().
void set_access_permissions | ( | unsigned int | region_number, |
unsigned int | register_select, | ||
unsigned int | right_access | ||
) |
Setup a register A and B
region_number,: | MPU entry region number (0..7). |
register_select,: | register A: '0' – B: '1' |
right_access,: | R/W/X see doc32002.pdf (Table 5-3. Access permissions implied by the APn bits) |
References Get_system_register, and Set_system_register.
Referenced by configure_memory_area().
char set_mpu_entry | ( | const mpu_entry_t * | mpu_entry, |
unsigned int | region_number | ||
) |
Setup a MPU entry
mpu_entry,: | pointer to mpu_entry_t with the MPU settings (base address, size, validity, access permission) . |
region_number,: | MPU entry region number (0..7). |
Setup a MPU entry
mpu_entry,: | pointer to mpu_entry_t with the MPU settings (base address, size, validity). |
region_number,: | MPU entry region number (0..7). |
References mpu_entry_t::addr, MPU_REGION_SIZE_HIGHLIMIT_FORBIDDEN, MPU_REGION_SIZE_LOWLIMIT_FORBIDDEN, MPU_SETUP_ENTRY_INVALIDBASEADDR, MPU_SETUP_ENTRY_INVALIDSIZE, MPU_SETUP_ENTRY_OK, Set_system_register, mpu_entry_t::size, Test_align, and mpu_entry_t::valid.
Referenced by configure_memory_area().