AM263Px MCU+ SDK: APIs for MPU for ARMv7 (ARM R5, ARM M4)

| AM263Px MCU+ SDK 26.00.00 |

Data Structures | Functions | Enumerations
APIs for MPU for ARMv7 (ARM R5, ARM M4)
APIs for Driver Porting Layer

## Introduction

For more details and example usage, see MPU for ARMv7 (ARM R5, ARM M4)

## Data Structures
struct | MpuP_RegionAttrs
| Attribute's to apply for a MPU region. More...
struct | MpuP_RegionConfig
| Region config structure, this used by SysConfig and not to be used by end-users directly. More...
struct | MpuP_Config
| MPU config structure, this used by SysConfig and not to be used by end-users directly. More...

## Functions
void | MpuP_RegionAttrs_init (MpuP_RegionAttrs *region)
| Set default values to MpuP_RegionAttrs. More...
void | MpuP_setRegion (uint32_t regionNum, void *addr, uint32_t size, MpuP_RegionAttrs *attrs)
| Setup a region in the MPU. More...
void | MpuP_enable (void)
| Enable MPU sub-system using the region that are setup using MpuP_setRegion. More...
void | MpuP_disable (void)
| Disable MPU sub-system. More...
uint32_t | MpuP_isEnable (void)
| Check if MPU sub-system is enabled. More...
void | MpuP_init (void)
| Initialize MPU sub-system, called by SysConfig, not to be called by end users. More...
uint32_t | MpuP_isUserAuthorizedToAccessMemory (uint32_t memAddr, uint32_t memLength, MpuP_RegionPerm perm)
| Check if the user is authorized to access a specific memory. More...

## Enumerations
enum | MpuP_AccessPerm { MpuP_AP_ALL_BLOCK = (0x0u), MpuP_AP_S_RW = (0x1u), MpuP_AP_S_RW_U_R = (0x2u), MpuP_AP_ALL_RW = (0x3u), MpuP_AP_S_R = (0x5u), MpuP_AP_ALL_R = (0x6u) }
| Enum's to represent different types of access permissions that are possible for a given MPU region. More...
enum | MpuP_RegionPerm { MpuP_RP_R = 1U, MpuP_RP_RW = 2U }
| Enum's to authorize access requests for a given MPU region. More...
enum | MpuP_RegionSize { MpuP_RegionSize_32 = 0x4, MpuP_RegionSize_64, MpuP_RegionSize_128, MpuP_RegionSize_256, MpuP_RegionSize_512, MpuP_RegionSize_1K, MpuP_RegionSize_2K, MpuP_RegionSize_4K, MpuP_RegionSize_8K, MpuP_RegionSize_16K, MpuP_RegionSize_32K, MpuP_RegionSize_64K, MpuP_RegionSize_128K, MpuP_RegionSize_256K, MpuP_RegionSize_512K, MpuP_RegionSize_1M, MpuP_RegionSize_2M, MpuP_RegionSize_4M, MpuP_RegionSize_8M, MpuP_RegionSize_16M, MpuP_RegionSize_32M, MpuP_RegionSize_64M, MpuP_RegionSize_128M, MpuP_RegionSize_256M, MpuP_RegionSize_512M, MpuP_RegionSize_1G, MpuP_RegionSize_2G, MpuP_RegionSize_4G }
| Enum's to represent different possible MPU region size. More...

## Enumeration Type Documentation

## ◆ MpuP_AccessPerm

enum MpuP_AccessPerm

Enum's to represent different types of access permissions that are possible for a given MPU region.

Enumerator
MpuP_AP_ALL_BLOCK | All accesses are blocked
MpuP_AP_S_RW | Only RD+WR supervisor mode accesses are allowed
MpuP_AP_S_RW_U_R | RD+WR supervisor and RD only user mode accesses are allowed
MpuP_AP_ALL_RW | All RD+WR accesses are allowed
MpuP_AP_S_R | Only RD supervisor mode accesses are allowed
MpuP_AP_ALL_R | All RD accesses are allowed

## ◆ MpuP_RegionPerm

enum MpuP_RegionPerm

Enum's to authorize access requests for a given MPU region.

Enumerator
MpuP_RP_R | Read-only
MpuP_RP_RW | Read-Write

## ◆ MpuP_RegionSize

enum MpuP_RegionSize

Enum's to represent different possible MPU region size.

Enumerator
MpuP_RegionSize_32 |
MpuP_RegionSize_64 |
MpuP_RegionSize_128 |
MpuP_RegionSize_256 |
MpuP_RegionSize_512 |
MpuP_RegionSize_1K |
MpuP_RegionSize_2K |
MpuP_RegionSize_4K |
MpuP_RegionSize_8K |
MpuP_RegionSize_16K |
MpuP_RegionSize_32K |
MpuP_RegionSize_64K |
MpuP_RegionSize_128K |
MpuP_RegionSize_256K |
MpuP_RegionSize_512K |
MpuP_RegionSize_1M |
MpuP_RegionSize_2M |
MpuP_RegionSize_4M |
MpuP_RegionSize_8M |
MpuP_RegionSize_16M |
MpuP_RegionSize_32M |
MpuP_RegionSize_64M |
MpuP_RegionSize_128M |
MpuP_RegionSize_256M |
MpuP_RegionSize_512M |
MpuP_RegionSize_1G |
MpuP_RegionSize_2G |
MpuP_RegionSize_4G |

## Function Documentation

## ◆ MpuP_RegionAttrs_init()

void MpuP_RegionAttrs_init | ( | MpuP_RegionAttrs * | region | ) |

Set default values to MpuP_RegionAttrs.

Strongly recommended to be called before seting values in MpuP_RegionAttrs

Parameters

  region | [out] parameter structure to set to default

## ◆ MpuP_setRegion()

void MpuP_setRegion | ( | uint32_t | regionNum,
|  | void * | addr,
|  | uint32_t | size,
|  | MpuP_RegionAttrs * | attrs
| ) |  |

Setup a region in the MPU.

Note
  Refer to ARMv7-R or ARMv7-M architecture manual for more details
  Recommended to disable MPU and disable cache before setting up MPU regions

Parameters

  regionNum | [in] region to setup
  addr | [in] region start address, MUST aligned to region size
  size | [in] region size, see MpuP_RegionSize
  attrs | [in] region attrs, see MpuP_RegionAttrs

## ◆ MpuP_enable()

void MpuP_enable | ( | void |  | ) |

Enable MPU sub-system using the region that are setup using MpuP_setRegion.

## ◆ MpuP_disable()

void MpuP_disable | ( | void |  | ) |

Disable MPU sub-system.

## ◆ MpuP_isEnable()

uint32_t MpuP_isEnable | ( | void |  | ) |

Check if MPU sub-system is enabled.

Returns
  0: MPU sub-system is disabled, 1: MPU sub-system is enabled

## ◆ MpuP_init()

void MpuP_init | ( | void |  | ) |

Initialize MPU sub-system, called by SysConfig, not to be called by end users.

## ◆ MpuP_isUserAuthorizedToAccessMemory()

uint32_t MpuP_isUserAuthorizedToAccessMemory | ( | uint32_t | memAddr,
|  | uint32_t | memLength,
|  | MpuP_RegionPerm | perm
| ) |  |

Check if the user is authorized to access a specific memory.

Parameters

  memAddr | [in] Pointer to the memory start address
  memLength | [in] Length of the memory in bytes
  perm | [in] Permissions to check, see MpuP_RegionPerm

Returns
  0: User is not authorized, 1: User is authorized