Defines | Functions
mpu_a.h File Reference

Go to the source code of this file.

Defines

#define __MSP430_HAS_MPU_A__
#define MPUA_READ   MPUSEG1RE
#define MPUA_WRITE   MPUSEG1WE
#define MPUA_EXEC   MPUSEG1XE
#define MPUA_FIRST_SEG   MPUSEG1VS
#define MPUA_SECOND_SEG   MPUSEG2VS
#define MPUA_THIRD_SEG   MPUSEG3VS
#define MPUA_MAX_SEG_VALUE   0x13C1
#define MPUA_SEG_1_ACCESS_VIOLATION   MPUSEG1IFG
#define MPUA_SEG_2_ACCESS_VIOLATION   MPUSEG2IFG
#define MPUA_SEG_3_ACCESS_VIOLATION   MPUSEG3IFG

Functions

void MPUA_createTwoSegments (unsigned int baseAddress, unsigned int seg2boundary, unsigned char seg1accmask, unsigned char seg2accmask)
void MPUA_createThreeSegments (unsigned int baseAddress, unsigned int seg1boundary, unsigned int seg2boundary, unsigned char seg1accmask, unsigned char seg2accmask, unsigned char seg3accmask)
void MPUA_enableNMIevent (unsigned int baseAddress)
void MPUA_start (unsigned int baseAddress)
void MPUA_enablePUCOnViolation (unsigned int baseAddress, unsigned int segment)
void MPUA_disablePUCOnViolation (unsigned int baseAddress, unsigned int segment)
unsigned short MPUA_getInterruptStatus (unsigned int baseAddress, unsigned int memAccFlag)
unsigned short MPUA_clearInterruptFlag (unsigned int baseAddress, unsigned int memAccFlag)
unsigned short MPUA_clearAllInterruptFlags (unsigned int baseAddress)

Define Documentation

#define __MSP430_HAS_MPU_A__
#define MPUA_READ   MPUSEG1RE
#define MPUA_WRITE   MPUSEG1WE
#define MPUA_EXEC   MPUSEG1XE
#define MPUA_FIRST_SEG   MPUSEG1VS
#define MPUA_SECOND_SEG   MPUSEG2VS
#define MPUA_THIRD_SEG   MPUSEG3VS
#define MPUA_MAX_SEG_VALUE   0x13C1
#define MPUA_SEG_1_ACCESS_VIOLATION   MPUSEG1IFG
#define MPUA_SEG_2_ACCESS_VIOLATION   MPUSEG2IFG
#define MPUA_SEG_3_ACCESS_VIOLATION   MPUSEG3IFG

Function Documentation

void MPUA_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. For FR58xx/Fr59xx devices consult the "Segment Border Setting" section in 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 0x0400-0x13C0
seg1accmaskis the bit mask of access right for memory segment 1. the following bit masks are available: MPUA_EXEC|MPUA_READ|MPUA_WRITE.- For execution,read and write access rights [Default] MPUA_EXEC|MPUA_READ.- For execution and read access rights. READ|MPUA_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: MPUA_EXEC|MPUA_READ|MPUA_WRITE.- For execution,read and write access rights [Default] MPUA_EXEC|MPUA_READ.- For execution and read access rights. READ|MPUA_WRITE.- For read and write access rights READ.- For read only access rights

Modified registers are MPUCTL0, MPUSEG, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPUA_EXEC, MPUA_MAX_SEG_VALUE, MPUA_READ, and MPUA_WRITE.

void MPUA_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. Consult the "Segment Border Setting" section in 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 0x0400-0x13C0
seg2boundary- Valid values can be found on the deviceFamily User's Guide Valid values Value in the following range 0x0400-0x13C0
seg1accmaskis the bit mask of access right for memory segment 1. the following bit masks are available: MPUA_EXEC|MPUA_READ|MPUA_WRITE.- For execution,read and write access rights [Default] MPUA_EXEC|MPUA_READ.- For execution and read access rights. READ|MPUA_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: MPUA_EXEC|MPUA_READ|MPUA_WRITE.- For execution,read and write access rights [Default] MPUA_EXEC|MPUA_READ.- For execution and read access rights. READ|MPUA_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: MPUA_EXEC|MPUA_READ|MPUA_WRITE.- For execution,read and write access rights [Default] MPUA_EXEC|MPUA_READ.- For execution and read access rights. READ|MPUA_WRITE.- For read and write access rights READ.- For read only access rights

Modified registers are MPUCTL0, MPUSEG, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPUA_EXEC, MPUA_MAX_SEG_VALUE, MPUA_READ, and MPUA_WRITE.

void MPUA_enableNMIevent ( unsigned int  baseAddress)

The following function enables the NMI Event if a Segment violation has occurred.

Parameters:
baseAddressis the base address of the MPU module.

Modified register is MPUCTL0

Returns:
NONE

References HWREG.

void MPUA_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 MPUA_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: MPUA_FIRST_SEG.- enables PUC generation on first memory segment. MPUA_SECOND_SEG.- enables PUC generation on second memory segment. MPUA_THIRD_SEG.- enables PUC generation on third memory segment.

Modified registers are MPUCTL0, MPUSAM

Returns:
NONE

References ASSERT, HWREG, MPUA_SECOND_SEG, and MPUA_THIRD_SEG.

void MPUA_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: MPUA_FIRST_SEG.- enables PUC generation on first memory segment. MPUA_SECOND_SEG.- enables PUC generation on second memory segment. MPUA_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 MPUA_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: MPUA_SEG_1_ACCESS_VIOLATION.- is set if an access violation in Main Memory Segment 1 is detected. MPUA_SEG_2_ACCESS_VIOLATION.- is set if an access violation in Main Memory Segment 2 is detected. MPUA_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 MPUA_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 MPUA_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