Functions
mpu.c File Reference
#include "inc/hw_types.h"
#include "driverlib/5xx_6xx/mpu.h"
#include "deprecated/CCS/msp430xgeneric.h"
#include "driverlib/5xx_6xx/debug.h"

Functions

void MPU_createTwoSegments (unsigned int baseAddress, unsigned int seg1boundary, unsigned char seg1accmask, unsigned char seg2accmask)
void MPU_createThreeSegments (unsigned int baseAddress, unsigned int seg1boundary, unsigned int seg2boundary, unsigned char seg1accmask, unsigned char seg2accmask, unsigned char seg3accmask)
void MPU_start (unsigned int baseAddress)
void MPU_enablePUCOnViolation (unsigned int baseAddress, unsigned int segment)
void MPU_disablePUCOnViolation (unsigned int baseAddress, unsigned int segment)
unsigned short MPU_getInterruptStatus (unsigned int baseAddress, unsigned int memAccFlag)
unsigned short MPU_clearInterruptFlag (unsigned int baseAddress, unsigned int memAccFlag)
unsigned short MPU_clearAllInterruptFlags (unsigned int baseAddress)

Function Documentation

void MPU_createTwoSegments ( unsigned int  baseAddress,
unsigned int  seg1boundary,
unsigned char  seg1accmask,
unsigned char  seg2accmask 
)

This function creates two memory segmentations in FRAM allowing the user to set access right to each segment. To set the correct value for seg1boundary, the user must consult the Device Family User's Guide and provide the MPUSBx value corresponding to the memory address where the user wants to create the partition. For FR57xx device consult Table 6-1 in Section 6.2.2 of the User's Guide to find the options available for MPUSBx.

Parameters:
baseAddressis the base address of the MPU module.
seg1boundary- Valid values can be found on the deviceFamily User's Guide Value in the following range 0x00-0x1F
seg1accmaskis the bit mask of access right for memory segment 1. the following bit masks are available: MPU_EXEC|MPU_READ|MPU_WRITE.- For execution,read and write access rights [Default] MPU_EXEC|MPU_READ.- For execution and read access rights. READ|MPU_WRITE.- For read and write access rights READ.- For read only access rights
seg2accmaskis the bit mask of access right for memory segment 2. the following bit masks are available: MPU_EXEC|MPU_READ|MPU_WRITE.- For execution,read and write access rights [Default] MPU_EXEC|MPU_READ.- For execution and read access rights. READ|MPU_WRITE.- For read and write access rights READ.- For read only access rights

Modified registers are MPUCTL0, MPUSEG, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPU_EXEC, MPU_READ, and MPU_WRITE.

void MPU_createThreeSegments ( unsigned int  baseAddress,
unsigned int  seg1boundary,
unsigned int  seg2boundary,
unsigned char  seg1accmask,
unsigned char  seg2accmask,
unsigned char  seg3accmask 
)

This function creates three memory segmentations in FRAM allowing the user to set access right to each segment. To set the correct value for seg1boundary, the user must consult the Device Family User's Guide and provide the MPUSBx value corresponding to the memory address where the user wants to create the partition. For FR57xx device consult Table 6-1 in Section 6.2.2 of the User's Guide to find the options available for MPUSBx.

Parameters:
baseAddressis the base address of the MPU module.
seg1boundary- Valid values can be found on the deviceFamily User's Guide Valid values Value in the following range 0x00-0x1F
seg2boundary- Valid values can be found on the deviceFamily User's Guide Valid values Value in the following range 0x00-0x1F
seg1accmaskis the bit mask of access right for memory segment 1. the following bit masks are available: MPU_EXEC|MPU_READ|MPU_WRITE.- For execution,read and write access rights [Default] MPU_EXEC|MPU_READ.- For execution and read access rights. READ|MPU_WRITE.- For read and write access rights READ.- For read only access rights
seg2accmaskis the bit mask of access right for memory segment 2. the following bit masks are available: MPU_EXEC|MPU_READ|MPU_WRITE.- For execution,read and write access rights [Default] MPU_EXEC|MPU_READ.- For execution and read access rights. READ|MPU_WRITE.- For read and write access rights READ.- For read only access rights
seg3accmaskis the bit mask of access right for memory segment 1. the following bit masks are available: MPU_EXEC|MPU_READ|MPU_WRITE.- For execution,read and write access rights [Default] MPU_EXEC|MPU_READ.- For execution and read access rights. READ|MPU_WRITE.- For read and write access rights READ.- For read only access rights

Modified registers are MPUCTL0, MPUSEG, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPU_EXEC, MPU_MAX_SEG_VALUE, MPU_READ, and MPU_WRITE.

void MPU_start ( unsigned int  baseAddress)

The following function enables the MPU module in the device.

This function needs to be called once all memory segmentation has been done. If this function is not called the MPU module will not be activated.

Parameters:
baseAddressis the base address of the MPU module.

Modified register is MPUCTL0

Returns:
NONE

References HWREG.

void MPU_enablePUCOnViolation ( unsigned int  baseAddress,
unsigned int  segment 
)

The following function enables PUC generation when an access violation has Occurred on the memory segment selected by the user.

Parameters:
baseAddressis the base address of the MPU module.
segmentis the bit mask of memory segment that will generate a PUC when an access violation occurs. Valid values is the bit mask of any of the following values: MPU_FIRST_SEG.- enables PUC generation on first memory segment. MPU_SECOND_SEG.- enables PUC generation on second memory segment. MPU_THIRD_SEG.- enables PUC generation on third memory segment.

Modified registers are MPUCTL0, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPU_SECOND_SEG, and MPU_THIRD_SEG.

void MPU_disablePUCOnViolation ( unsigned int  baseAddress,
unsigned int  segment 
)

The following function isables PUC generation when an access violation has Occurred on the memory segment selected by the user.

Parameters:
baseAddressis the base address of the MPU module.
segmentis the bit mask of memory segment that will NOT generate a PUC when an access violation occurs. Valid values is the bit mask of any of the following values: MPU_FIRST_SEG.- enables PUC generation on first memory segment. MPU_SECOND_SEG.- enables PUC generation on second memory segment. MPU_THIRD_SEG.- enables PUC generation on third memory segment.

Modified registers are MPUCTL0, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPU_SECOND_SEG, and MPU_THIRD_SEG.

unsigned short MPU_getInterruptStatus ( unsigned int  baseAddress,
unsigned int  memAccFlag 
)

Returns the memory segment violation flag status requested by the user.

Parameters:
baseAddressis the base address of the MPU module.
memAccFlagis the is the memory access violation flag. Valid value is the bit mask of any of the following value: MPU_SEG_1_ACCESS_VIOLATION.- is set if an access violation in Main Memory Segment 1 is detected. MPU_SEG_2_ACCESS_VIOLATION.- is set if an access violation in Main Memory Segment 2 is detected. MPU_SEG_3_ACCESS_VIOLATION.- is set if an access violation in Main Memory Segment 3 is detected.
Returns:
The current interrupt status as the mask of the set flags.

References HWREG.

unsigned short MPU_clearInterruptFlag ( unsigned int  baseAddress,
unsigned int  memAccFlag 
)

Returns the memory segment violation flag status requested by the user or if user is providing a bit mask value, the function will return a value indicating if all flags were cleared

Parameters:
baseAddressis the base address of the MPU module.
memAccFlagis the is the memory access violation flag. Valid values for this function are: MPUSEG1IFG is set if an access violation in Main Memory Segment 1 is detected. MPUSEG2IFG is set if an access violation in Main Memory Segment 2 is detected. MPUSEG3IFG is set if an access violation in Main Memory Segment 3 is detected.
Returns:
The current interrupt status as the mask of the set flags.

References HWREG.

unsigned short MPU_clearAllInterruptFlags ( unsigned int  baseAddress)

Clears all Memory Segment Access Violation Interrupt Flags.

Parameters:
baseAddressis the base address of the MPU module.

Modified registers are MPUCTL1

Returns:
The current interrupt status as the mask of the set flags.

References HWREG.


Copyright 2012, Texas Instruments Incorporated