Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the MPU HAL driver.

Data Structures

struct  mpu_hardware_info_t
 MPU hardware basic information. More...
 
struct  mpu_access_err_info_t
 Descripts MPU detail error access info. More...
 
struct  mpu_low_masters_access_rights_t
 MPU access rights for low master0~master3. More...
 
struct  mpu_high_masters_access_rights_t
 MPU access rights mode for high master4~master7. More...
 
struct  mpu_region_config_t
 Data v for MPU region initialize. More...
 

Enumerations

enum  mpu_region_num_t
 MPU region number region0~region11. More...
 
enum  mpu_region_total_num_t {
  kMPU8Regions = 0x0U,
  kMPU12Regions = 0x1U,
  kMPU16Regions = 0x2U
}
 Descripts the number of MPU regions. More...
 
enum  mpu_err_access_type_t {
  kMPUErrTypeRead = 0U,
  kMPUErrTypeWrite = 1U
}
 MPU access error. More...
 
enum  mpu_err_attributes_t {
  kMPUInstructionAccessInUserMode = 0U,
  kMPUDataAccessInUserMode = 1U,
  kMPUInstructionAccessInSupervisorMode = 2U,
  kMPUDataAccessInSupervisorMode = 3U
}
 MPU access error attributes. More...
 
enum  mpu_access_mode_t {
  kMPUAccessInUserMode = 0U,
  kMPUAccessInSupervisorMode = 1U
}
 access MPU in which mode. More...
 
enum  mpu_master_t {
  kMPUMaster0 = 0U,
  kMPUMaster1 = 1U,
  kMPUMaster2 = 2U,
  kMPUMaster3 = 3U,
  kMPUMaster4 = 4U,
  kMPUMaster5 = 5U,
  kMPUMaster6 = 6U
}
 MPU master number. More...
 
enum  mpu_err_access_ctr_t {
  kMPUNoRegionHit = 0U,
  kMPUNoneOverlappRegion = 1U,
  kMPUOverlappRegion = 2U
}
 MPU error access control detail. More...
 
enum  mpu_supervisor_access_rights_t {
  kMPUSupervisorReadWriteExecute = 0U,
  kMPUSupervisorReadExecute = 1U,
  kMPUSupervisorReadWrite = 2U,
  kMPUSupervisorEqualToUsermode = 3U
}
 MPU access rights in supervisor mode for master0~master3. More...
 
enum  mpu_user_access_rights_t {
  kMPUUserNoAccessRights = 0U,
  kMPUUserExecute = 1U,
  kMPUUserWrite = 2U,
  kMPUUserWriteExecute = 3U,
  kMPUUserRead = 4U,
  kMPUUserReadExecute = 5U,
  kMPUUserReadWrite = 6U,
  kMPUUserReadWriteExecute = 7U
}
 MPU access rights in user mode for master0~master3. More...
 
enum  mpu_status_t {
  kStatus_MPU_Success = 0x0U,
  kStatus_MPU_Fail = 0x1U,
  kStatus_MPU_NotInitlialized = 0x2U,
  kStatus_MPU_NullArgument = 0x3U
}
 MPU status return codes. More...
 

MPU HAL.

static void MPU_HAL_Enable (MPU_Type *base)
 Enables the MPU module operation. More...
 
static void MPU_HAL_Disable (MPU_Type *base)
 Disables the MPU module operation. More...
 
static bool MPU_HAL_IsEnable (MPU_Type *base)
 Checks whether the MPU module is enabled. More...
 
void MPU_HAL_GetHardwareInfo (MPU_Type *base, mpu_hardware_info_t *infoPtr)
 Gets MPU basic hardware info. More...
 
void MPU_HAL_GetDetailErrorAccessInfo (MPU_Type *base, mpu_access_err_info_t *errInfoArrayPtr)
 Gets MPU derail error access info. More...
 
void MPU_HAL_SetRegionAddr (MPU_Type *base, mpu_region_num_t regionNum, uint32_t startAddr, uint32_t endAddr)
 Sets region start and end address. More...
 
void MPU_HAL_SetLowMasterAccessRights (MPU_Type *base, mpu_region_num_t regionNum, mpu_master_t masterNum, const mpu_low_masters_access_rights_t *accessRightsPtr)
 Configures low master0~3 access permission for a specific region. More...
 
void MPU_HAL_SetHighMasterAccessRights (MPU_Type *base, mpu_region_num_t regionNum, mpu_master_t masterNum, const mpu_high_masters_access_rights_t *accessRightsPtr)
 Sets high master access permission for a specific region. More...
 
static void MPU_HAL_SetRegionValidCmd (MPU_Type *base, mpu_region_num_t regionNum, bool enable)
 Sets the region valid value. More...
 
void MPU_HAL_SetLowMasterAccessRightsByAlternateReg (MPU_Type *base, mpu_region_num_t regionNum, mpu_master_t masterNum, const mpu_low_masters_access_rights_t *accessRightsPtr)
 Configures low master0~3 access permission for a specific region. More...
 
void MPU_HAL_SetHighMasterAccessRightsByAlternateReg (MPU_Type *base, mpu_region_num_t regionNum, mpu_master_t masterNum, const mpu_high_masters_access_rights_t *accessRightsPtr)
 Sets high master access permission for a specific region. More...
 
void MPU_HAL_SetRegionConfig (MPU_Type *base, const mpu_region_config_t *regionConfigPtr)
 Configures the MPU region. More...
 
void MPU_HAL_Init (MPU_Type *base)
 Initializes the MPU module. More...
 

Data Structure Documentation

struct mpu_hardware_info_t

Data Fields

uint8_t kMPUHardwareRevisionLevel
 Specifies the MPU's hardware and definition reversion level.
 
uint8_t kMPUSupportSlavePortsNum
 Specifies the number of slave ports connnected to MPU.
 
mpu_region_total_num_t kMPUSupportRegionsNum
 Indicates the number of region descriptors implemented.
 
struct mpu_access_err_info_t

Data Fields

mpu_master_t master
 Access error master.
 
mpu_err_attributes_t attributes
 Access error attribues.
 
mpu_err_access_type_t accessType
 Access error type.
 
mpu_err_access_ctr_t accessCtr
 Access error control.
 
uint32_t addr
 Access error address.
 
uint8_t slavePort
 Access error slave port.
 
struct mpu_low_masters_access_rights_t

Data Fields

mpu_supervisor_access_rights_t superAccessRights
 master access rights in supervisor mode
 
mpu_user_access_rights_t userAccessRights
 master access rights in user mode
 
struct mpu_high_masters_access_rights_t

Data Fields

bool kMPUWriteEnable
 Enables or disables write permission.
 
bool kMPUReadEnable
 Enables or disables read permission.
 
struct mpu_region_config_t

This structure is used when calling the MPU_DRV_Init function.

Data Fields

mpu_region_num_t regionNum
 MPU region number.
 
uint32_t startAddr
 Memory region start address.
 
uint32_t endAddr
 Memory region end address.
 
mpu_low_masters_access_rights_t accessRights1 [4]
 Low masters access permission.
 
mpu_high_masters_access_rights_t accessRights2 [4]
 Low masters access permission.
 
bool regionEnable
 Enables or disables region.
 

Enumeration Type Documentation

Enumerator
kMPU8Regions 

MPU supports 8 regions.

kMPU12Regions 

MPU supports 12 regions.

kMPU16Regions 

MPU supports 16 regions.

Enumerator
kMPUErrTypeRead 

MPU error type—read.

kMPUErrTypeWrite 

MPU error type—write.

Enumerator
kMPUInstructionAccessInUserMode 

access instruction error in user mode

kMPUDataAccessInUserMode 

access data error in user mode

kMPUInstructionAccessInSupervisorMode 

access instruction error in supervisor mode

kMPUDataAccessInSupervisorMode 

access data error in supervisor mode

Enumerator
kMPUAccessInUserMode 

access data or instruction in user mode

kMPUAccessInSupervisorMode 

access data or instruction in supervisor mode

Enumerator
kMPUMaster0 

MPU master core.

kMPUMaster1 

MPU master defined in SOC.

kMPUMaster2 

MPU master defined in SOC.

kMPUMaster3 

MPU master defined in SOC.

kMPUMaster4 

MPU master defined in SOC.

kMPUMaster5 

MPU master defined in SOC.

kMPUMaster6 

MPU master defined in SOC.

Enumerator
kMPUNoRegionHit 

no region hit error

kMPUNoneOverlappRegion 

access single region error

kMPUOverlappRegion 

access overlapping region error

Enumerator
kMPUSupervisorReadWriteExecute 

Read write and execute operations are allowed in supervisor mode.

kMPUSupervisorReadExecute 

Read and execute operations are allowed in supervisor mode.

kMPUSupervisorReadWrite 

Read write operations are allowed in supervisor mode.

kMPUSupervisorEqualToUsermode 

Access permission equal to user mode.

Enumerator
kMPUUserNoAccessRights 

no access allowed in user mode

kMPUUserExecute 

execute operation is allowed in user mode

kMPUUserWrite 

Write operation is allowed in user mode.

kMPUUserWriteExecute 

Write and execute operations are allowed in user mode.

kMPUUserRead 

Read is allowed in user mode.

kMPUUserReadExecute 

Read and execute operations are allowed in user mode.

kMPUUserReadWrite 

Read and write operations are allowed in user mode.

kMPUUserReadWriteExecute 

Read write and execute operations are allowed in user mode.

Enumerator
kStatus_MPU_Success 

MPU Succeed.

kStatus_MPU_Fail 

MPU failed.

kStatus_MPU_NotInitlialized 

MPU is not initialized yet.

kStatus_MPU_NullArgument 

Argument is NULL.

Function Documentation

static void MPU_HAL_Enable ( MPU_Type *  base)
inlinestatic
Parameters
baseBase address of MPU peripheral instance.
static void MPU_HAL_Disable ( MPU_Type *  base)
inlinestatic
Parameters
baseBase address of MPU peripheral instance.
static bool MPU_HAL_IsEnable ( MPU_Type *  base)
inlinestatic
Parameters
baseBase address of MPU peripheral instance.
Returns
State of the module
Return values
trueMPU module is enabled.
falseMPU module is disabled.
void MPU_HAL_GetHardwareInfo ( MPU_Type *  base,
mpu_hardware_info_t infoPtr 
)
Parameters
baseBase address of MPU peripheral instance.
infoPtrThe pointer to the hardware information structure see mpu_hardware_info_t.
void MPU_HAL_GetDetailErrorAccessInfo ( MPU_Type *  base,
mpu_access_err_info_t errInfoArrayPtr 
)
Parameters
baseBase address of MPU peripheral instance.
errInfoArrayPtrThe pointer to array of structure mpu_access_err_info_t.
void MPU_HAL_SetRegionAddr ( MPU_Type *  base,
mpu_region_num_t  regionNum,
uint32_t  startAddr,
uint32_t  endAddr 
)
Parameters
baseBase address of MPU peripheral instance..
regionNumMPU region number.
startAddrRegion start address.
endAddrRegion end address.
void MPU_HAL_SetLowMasterAccessRights ( MPU_Type *  base,
mpu_region_num_t  regionNum,
mpu_master_t  masterNum,
const mpu_low_masters_access_rights_t accessRightsPtr 
)
Parameters
baseBase address of MPU peripheral instance.
regionNumMPU region number.
masterNumMPU master number.
accessRightsPtrThe pointer of master access rights see mpu_low_masters_access_rights_t.
void MPU_HAL_SetHighMasterAccessRights ( MPU_Type *  base,
mpu_region_num_t  regionNum,
mpu_master_t  masterNum,
const mpu_high_masters_access_rights_t accessRightsPtr 
)
Parameters
baseBase address of MPU peripheral instance.
regionNumMPU region number.
masterNumMPU master number.
accessRightsPtrThe pointer of master access rights see mpu_low_masters_access_rights_t.
static void MPU_HAL_SetRegionValidCmd ( MPU_Type *  base,
mpu_region_num_t  regionNum,
bool  enable 
)
inlinestatic

When a region changed not by alternating registers should set the valid again.

Parameters
baseBase address of MPU peripheral instance.
regionNumMPU region number.
enableEnables or disables region.
void MPU_HAL_SetLowMasterAccessRightsByAlternateReg ( MPU_Type *  base,
mpu_region_num_t  regionNum,
mpu_master_t  masterNum,
const mpu_low_masters_access_rights_t accessRightsPtr 
)
Parameters
baseBase address of MPU peripheral instance.
regionNumMPU region number.
masterNumMPU master number.
accessRightsPtrThe pointer of master access rights see mpu_low_masters_access_rights_t.
void MPU_HAL_SetHighMasterAccessRightsByAlternateReg ( MPU_Type *  base,
mpu_region_num_t  regionNum,
mpu_master_t  masterNum,
const mpu_high_masters_access_rights_t accessRightsPtr 
)
Parameters
baseBase address of MPU peripheral instance.
regionNumMPU region number.
masterNumMPU master number.
accessRightsPtrThe pointer of master access rights see mpu_low_masters_access_rights_t.
void MPU_HAL_SetRegionConfig ( MPU_Type *  base,
const mpu_region_config_t regionConfigPtr 
)
Parameters
baseThe MPU peripheral base address.
regionConfigPtrThe pointer to the MPU user configure structure, see mpu_region_config_t.
void MPU_HAL_Init ( MPU_Type *  base)
Parameters
baseThe MPU peripheral base address.