Go to the source code of this file.
Defines | |
#define | __MSP430_HAS_MPU__ |
#define | MPU_READ MPUSEG1RE |
#define | MPU_WRITE MPUSEG1WE |
#define | MPU_EXEC MPUSEG1XE |
#define | MPU_FIRST_SEG MPUSEG1VS |
#define | MPU_SECOND_SEG MPUSEG2VS |
#define | MPU_THIRD_SEG MPUSEG3VS |
#define | MPU_MAX_SEG_VALUE 0x20 |
#define | MPU_SEG_1_ACCESS_VIOLATION MPUSEG1IFG |
#define | MPU_SEG_2_ACCESS_VIOLATION MPUSEG2IFG |
#define | MPU_SEG_3_ACCESS_VIOLATION MPUSEG3IFG |
Functions | |
void | MPU_createTwoSegments (unsigned int baseAddress, unsigned int seg2boundary, 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) |
#define __MSP430_HAS_MPU__ |
#define MPU_READ MPUSEG1RE |
Referenced by MPU_createThreeSegments(), and MPU_createTwoSegments().
#define MPU_WRITE MPUSEG1WE |
Referenced by MPU_createThreeSegments(), and MPU_createTwoSegments().
#define MPU_EXEC MPUSEG1XE |
Referenced by MPU_createThreeSegments(), and MPU_createTwoSegments().
#define MPU_FIRST_SEG MPUSEG1VS |
#define MPU_SECOND_SEG MPUSEG2VS |
Referenced by MPU_disablePUCOnViolation(), MPU_enablePUCOnViolation(), and MPUA_disablePUCOnViolation().
#define MPU_THIRD_SEG MPUSEG3VS |
Referenced by MPU_disablePUCOnViolation(), MPU_enablePUCOnViolation(), and MPUA_disablePUCOnViolation().
#define MPU_MAX_SEG_VALUE 0x20 |
Referenced by MPU_createThreeSegments().
#define MPU_SEG_1_ACCESS_VIOLATION MPUSEG1IFG |
#define MPU_SEG_2_ACCESS_VIOLATION MPUSEG2IFG |
#define MPU_SEG_3_ACCESS_VIOLATION MPUSEG3IFG |
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.
baseAddress | is 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 |
seg1accmask | is 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 |
seg2accmask | is 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
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.
baseAddress | is 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 |
seg1accmask | is 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 |
seg2accmask | is 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 |
seg3accmask | is 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
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.
baseAddress | is the base address of the MPU module. |
Modified register is MPUCTL0
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.
baseAddress | is the base address of the MPU module. |
segment | is 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
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.
baseAddress | is the base address of the MPU module. |
segment | is 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
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.
baseAddress | is the base address of the MPU module. |
memAccFlag | is 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. |
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
baseAddress | is the base address of the MPU module. |
memAccFlag | is 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. |
References HWREG.
unsigned short MPU_clearAllInterruptFlags | ( | unsigned int | baseAddress | ) |
Clears all Memory Segment Access Violation Interrupt Flags.
baseAddress | is the base address of the MPU module. |
Modified registers are MPUCTL1
References HWREG.