MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.21.00.08
 All Data Structures Functions Variables Modules Pages
mpu

Macros

#define MPU_MAX_SEG_VALUE   0x13C1
 

Functions

void MPU_initTwoSegments (uint16_t baseAddress, uint16_t seg1boundary, uint8_t seg1accmask, uint8_t seg2accmask)
 Initializes MPU with two memory segments. More...
 
void MPU_initThreeSegments (uint16_t baseAddress, MPU_initThreeSegmentsParam *param)
 Initializes MPU with three memory segments. More...
 
void MPU_initInfoSegment (uint16_t baseAddress, uint8_t accmask)
 Initializes user information memory segment. More...
 
void MPU_enableNMIevent (uint16_t baseAddress)
 The following function enables the NMI Event if a Segment violation has occurred. More...
 
void MPU_start (uint16_t baseAddress)
 The following function enables the MPU module in the device. More...
 
void MPU_enablePUCOnViolation (uint16_t baseAddress, uint16_t segment)
 The following function enables PUC generation when an access violation has occurred on the memory segment selected by the user. More...
 
void MPU_disablePUCOnViolation (uint16_t baseAddress, uint16_t segment)
 The following function disables PUC generation when an access violation has occurred on the memory segment selected by the user. More...
 
uint16_t MPU_getInterruptStatus (uint16_t baseAddress, uint16_t memAccFlag)
 Returns the memory segment violation flag status requested by the user. More...
 
uint16_t MPU_clearInterrupt (uint16_t baseAddress, uint16_t memAccFlag)
 Clears the masked interrupt flags. More...
 
uint16_t MPU_clearAllInterrupts (uint16_t baseAddress)
 Clears all Memory Segment Access Violation Interrupt Flags. More...
 
void MPU_lockMPU (uint16_t baseAddress)
 Lock MPU to protect from write access. More...
 

Detailed Description

Function Documentation

uint16_t MPU_clearAllInterrupts ( uint16_t  baseAddress)

Clears all Memory Segment Access Violation Interrupt Flags.

Parameters
baseAddressis the base address of the MPU module.

Modified bits of MPUCTL1 register.

Returns
Logical OR of any of the following:
  • 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
  • MPU_SEG_INFO_ACCESS_VIOLATION is set if an access violation in User Information Memory Segment is detected
    indicating the status of the interrupt flags.
uint16_t MPU_clearInterrupt ( uint16_t  baseAddress,
uint16_t  memAccFlag 
)

Clears the masked interrupt flags.

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. Mask value is the logical OR of any of the following:
  • 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
  • MPU_SEG_INFO_ACCESS_VIOLATION - is set if an access violation in User Information Memory Segment is detected
Returns
Logical OR of any of the following:
  • 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
  • MPU_SEG_INFO_ACCESS_VIOLATION is set if an access violation in User Information Memory Segment is detected
    indicating the status of the masked flags.
void MPU_disablePUCOnViolation ( uint16_t  baseAddress,
uint16_t  segment 
)

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

Note that only specified segments for PUC generation are disabled. Other segments for PUC generation are left untouched. Users may call MPU_enablePUCOnViolation() and MPU_disablePUCOnViolation() to assure that all the bits will be set and/or cleared.

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. Mask value is the logical OR of any of the following:
  • MPU_FIRST_SEG - PUC generation on first memory segment
  • MPU_SECOND_SEG - PUC generation on second memory segment
  • MPU_THIRD_SEG - PUC generation on third memory segment
  • MPU_INFO_SEG - PUC generation on user information memory segment

Modified bits of MPUSAM register and bits of MPUCTL0 register.

Returns
None
void MPU_enableNMIevent ( uint16_t  baseAddress)

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

Parameters
baseAddressis the base address of the MPU module.

Modified bits of MPUCTL0 register.

Returns
None
void MPU_enablePUCOnViolation ( uint16_t  baseAddress,
uint16_t  segment 
)

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

Note that only specified segments for PUC generation are enabled. Other segments for PUC generation are left untouched. Users may call MPU_enablePUCOnViolation() and MPU_disablePUCOnViolation() to assure that all the bits will be set and/or cleared.

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. Mask value is the logical OR of any of the following:
  • MPU_FIRST_SEG - PUC generation on first memory segment
  • MPU_SECOND_SEG - PUC generation on second memory segment
  • MPU_THIRD_SEG - PUC generation on third memory segment
  • MPU_INFO_SEG - PUC generation on user information memory segment

Modified bits of MPUSAM register and bits of MPUCTL0 register.

Returns
None
uint16_t MPU_getInterruptStatus ( uint16_t  baseAddress,
uint16_t  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. Mask value is the logical OR of any of the following:
  • 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
  • MPU_SEG_INFO_ACCESS_VIOLATION - is set if an access violation in User Information Memory Segment is detected
Returns
Logical OR of any of the following:
  • 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
  • MPU_SEG_INFO_ACCESS_VIOLATION is set if an access violation in User Information Memory Segment is detected
    indicating the status of the masked flags.
void MPU_initInfoSegment ( uint16_t  baseAddress,
uint8_t  accmask 
)

Initializes user information memory segment.

This function initializes user information memory segment with specified access rights.

Parameters
baseAddressis the base address of the MPU module.
accmaskis the bit mask of access right for user information memory segment. Mask value is the logical OR of any of the following:
  • MPU_READ - Read rights
  • MPU_WRITE - Write rights
  • MPU_EXEC - Execute rights
  • MPU_NO_READ_WRITE_EXEC - no read/write/execute rights

Modified bits of MPUSAM register and bits of MPUCTL0 register.

Returns
None
void MPU_initThreeSegments ( uint16_t  baseAddress,
MPU_initThreeSegmentsParam param 
)

Initializes MPU with three memory segments.

This function creates three memory segments 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.
paramis the pointer to struct for initializing three segments.

Modified bits of MPUSAM register, bits of MPUSEG register and bits of MPUCTL0 register.

Returns
None

References MPU_initThreeSegmentsParam::seg1accmask, MPU_initThreeSegmentsParam::seg1boundary, MPU_initThreeSegmentsParam::seg2accmask, MPU_initThreeSegmentsParam::seg2boundary, and MPU_initThreeSegmentsParam::seg3accmask.

void MPU_initTwoSegments ( uint16_t  baseAddress,
uint16_t  seg1boundary,
uint8_t  seg1accmask,
uint8_t  seg2accmask 
)

Initializes MPU with two memory segments.

This function creates two memory segments 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.
seg1boundaryValid values can be found in the Family User's Guide
seg1accmaskis the bit mask of access right for memory segment 1. Mask value is the logical OR of any of the following:
  • MPU_READ - Read rights
  • MPU_WRITE - Write rights
  • MPU_EXEC - Execute rights
  • MPU_NO_READ_WRITE_EXEC - no read/write/execute rights
seg2accmaskis the bit mask of access right for memory segment 2 Mask value is the logical OR of any of the following:
  • MPU_READ - Read rights
  • MPU_WRITE - Write rights
  • MPU_EXEC - Execute rights
  • MPU_NO_READ_WRITE_EXEC - no read/write/execute rights

Modified bits of MPUSAM register, bits of MPUSEG register and bits of MPUCTL0 register.

Returns
None
void MPU_lockMPU ( uint16_t  baseAddress)

Lock MPU to protect from write access.

Sets MPULOCK to protect MPU from write access on all MPU registers except MPUCTL1, MPUIPC0 and MPUIPSEGBx until a BOR occurs. MPULOCK bit cannot be cleared manually. MPU_clearInterrupt() and MPU_clearAllInterrupts() still can be used after this API is called.

Parameters
baseAddressis the base address of the MPU module.

Modified bits are MPULOCK of MPUCTL1 register.

Returns
None
void MPU_start ( uint16_t  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 bits of MPUCTL0 register.

Returns
None

Copyright 2015, Texas Instruments Incorporated