S32 SDK
mpu_hal.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "device_registers.h"

Go to the source code of this file.

Data Structures

struct  mpu_access_err_info_t
 MPU detail error access info Implements : mpu_access_err_info_t_Class. More...
 
struct  mpu_low_masters_access_rights_t
 MPU access rights for masters which have separated privilege rights for user and supervisor mode accesses (e.g. master0~2 in S32K144) Implements : mpu_low_masters_access_rights_t_Class. More...
 
struct  mpu_high_masters_access_rights_t
 MPU access rights for master which have only read and write permissions Implements : mpu_high_masters_access_rights_t_Class. More...
 

Enumerations

enum  mpu_err_access_type_t { MPU_ERR_TYPE_READ = 0U, MPU_ERR_TYPE_WRITE = 1U }
 MPU access error Implements : mpu_err_access_type_t_Class. More...
 
enum  mpu_err_attributes_t { MPU_INSTRUCTION_ACCESS_IN_USER_MODE = 0U, MPU_DATA_ACCESS_IN_USER_MODE = 1U, MPU_INSTRUCTION_ACCESS_IN_SUPERVISOR_MODE = 2U, MPU_DATA_ACCESS_IN_SUPERVISOR_MODE = 3U }
 MPU access error attributes Implements : mpu_err_attributes_t_Class. More...
 
enum  mpu_supervisor_access_rights_t { MPU_SUPERVISOR_READ_WRITE_EXECUTE = 0U, MPU_SUPERVISOR_READ_EXECUTE = 1U, MPU_SUPERVISOR_READ_WRITE = 2U, MPU_SUPERVISOR_EQUAL_TO_USERMODE = 3U }
 MPU access rights in supervisor mode Implements : mpu_supervisor_access_rights_t_Class. More...
 
enum  mpu_user_access_rights_t {
  MPU_USER_NO_ACCESS_RIGHTS = 0U, MPU_USER_EXECUTE = 1U, MPU_USER_WRITE = 2U, MPU_USER_WRITE_EXECUTE = 3U,
  MPU_USER_READ = 4U, MPU_USER_READ_EXECUTE = 5U, MPU_USER_READ_WRITE = 6U, MPU_USER_READ_WRITE_EXECUTE = 7U
}
 MPU access rights in user mode Implements : mpu_user_access_rights_t_Class. More...
 

Functions

static void MPU_HAL_Enable (MPU_Type *const base)
 Enables the MPU module. More...
 
static void MPU_HAL_Disable (MPU_Type *const base)
 Disables the MPU module. More...
 
static bool MPU_HAL_IsEnable (const MPU_Type *const base)
 Checks whether the MPU module is enabled. More...
 
static uint8_t MPU_HAL_GetHardwareRevision (const MPU_Type *const base)
 Gets MPU hardware revision level. More...
 
bool MPU_HAL_GetSlavePortErrorStatus (const MPU_Type *const base, uint8_t slaveNum)
 Gets the error status of a specified slave port. More...
 
void MPU_HAL_GetDetailErrorAccessInfo (MPU_Type *const base, uint8_t slaveNum, mpu_access_err_info_t *errInfoPtr)
 Gets MPU detail error access info. More...
 
void MPU_HAL_SetRegionAddr (MPU_Type *const base, uint8_t regionNum, uint32_t startAddr, uint32_t endAddr)
 Sets region start and end address. Please note that using this function will clear the valid bit of the region, and a further validation might be needed. More...
 
void MPU_HAL_SetLowMasterAccessRights (MPU_Type *const base, uint8_t regionNum, uint8_t masterNum, const mpu_low_masters_access_rights_t *accessRightsPtr)
 Sets access permission for master which has separated privilege rights for user and supervisor mode accesses in a specific region. Please note that using this function will clear the valid bit of the region. In order to keep the region valid, the MPU_HAL_SetAlternateLowMasterAccessRights function can be used. More...
 
void MPU_HAL_SetHighMasterAccessRights (MPU_Type *const base, uint8_t regionNum, uint8_t masterNum, const mpu_high_masters_access_rights_t *accessRightsPtr)
 Sets access permission for master which has only read and write permissions in a specific region. Please note that using this function will clear the valid bit of the region. In order to keep the region valid, the MPU_HAL_SetAlternateHighMasterAccessRights function can be used. More...
 
static void MPU_HAL_SetRegionValidCmd (MPU_Type *const base, uint8_t regionNum, bool enable)
 Sets the region valid value. When a region changed not by alternating registers should set the valid again. More...
 
static void MPU_HAL_SetProcessIdentifierMask (MPU_Type *const base, uint8_t regionNum, uint8_t processIdentifierMask)
 Sets the process identifier mask. More...
 
static void MPU_HAL_SetProcessIdentifier (MPU_Type *const base, uint8_t regionNum, uint8_t processIdentifier)
 Sets the process identifier. More...
 
void MPU_HAL_SetAlternateLowMasterAccessRights (MPU_Type *const base, uint8_t regionNum, uint8_t masterNum, const mpu_low_masters_access_rights_t *accessRightsPtr)
 Sets access permission for master which has separated privilege rights for user and supervisor mode accesses in a specific region by alternate register. More...
 
void MPU_HAL_SetAlternateHighMasterAccessRights (MPU_Type *const base, uint8_t regionNum, uint8_t masterNum, const mpu_high_masters_access_rights_t *accessRightsPtr)
 Sets access permission for master which has only read and write permissions in a specific region by alternate register. More...
 
void MPU_HAL_Init (MPU_Type *const base)
 Initializes the MPU module and all regions will be invalid after cleared access permission. More...