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... | |
uint16_t MPU_clearAllInterrupts | ( | uint16_t | baseAddress | ) |
Clears all Memory Segment Access Violation Interrupt Flags.
baseAddress | is the base address of the MPU module. |
Modified bits of MPUCTL1 register.
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.
baseAddress | is the base address of the MPU module. |
memAccFlag | is the is the memory access violation flag. Mask value is the logical OR of any of the following:
|
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.
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. Mask value is the logical OR of any of the following:
|
Modified bits of MPUSAM register and bits of MPUCTL0 register.
void MPU_enableNMIevent | ( | uint16_t | baseAddress | ) |
The following function enables the NMI Event if a Segment violation has occurred.
baseAddress | is the base address of the MPU module. |
Modified bits of MPUCTL0 register.
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.
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. Mask value is the logical OR of any of the following:
|
Modified bits of MPUSAM register and bits of MPUCTL0 register.
uint16_t MPU_getInterruptStatus | ( | uint16_t | baseAddress, |
uint16_t | 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. Mask value is the logical OR of any of the following:
|
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.
baseAddress | is the base address of the MPU module. |
accmask | is the bit mask of access right for user information memory segment. Mask value is the logical OR of any of the following:
|
Modified bits of MPUSAM register and bits of MPUCTL0 register.
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.
baseAddress | is the base address of the MPU module. |
param | is the pointer to struct for initializing three segments. |
Modified bits of MPUSAM register, bits of MPUSEG register and bits of MPUCTL0 register.
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.
baseAddress | is the base address of the MPU module. |
seg1boundary | Valid values can be found in the Family User's Guide |
seg1accmask | is the bit mask of access right for memory segment 1. Mask value is the logical OR of any of the following:
|
seg2accmask | is the bit mask of access right for memory segment 2 Mask value is the logical OR of any of the following:
|
Modified bits of MPUSAM register, bits of MPUSEG register and bits of MPUCTL0 register.
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.
baseAddress | is the base address of the MPU module. |
Modified bits are MPULOCK of MPUCTL1 register.
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.
baseAddress | is the base address of the MPU module. |
Modified bits of MPUCTL0 register.