MPU Functions
[MPU]

Functions

CSL_IDEF_INLINE void CSL_MPU_GetRevision (CSL_MpuHandle hMpu, Uint32 *revisionInfo)
CSL_IDEF_INLINE void CSL_MPU_GetConfiguration (CSL_MpuHandle hMpu, Uint8 *addressAlign, Uint8 *numFixed, Uint8 *numProg, Uint8 *numFixedAID, Uint8 *assumedAllowed)
CSL_IDEF_INLINE void CSL_MPU_SetInterruptRawStatus (CSL_MpuHandle hMpu, Uint8 addressViolation, Uint8 protocolViolation)
CSL_IDEF_INLINE void CSL_MPU_GetInterruptStatus (CSL_MpuHandle hMpu, Uint8 *addressViolation, Uint8 *protocolViolation)
CSL_IDEF_INLINE void CSL_MPU_ClearInterruptStatus (CSL_MpuHandle hMpu, Uint8 addressViolation, Uint8 protocolViolation)
CSL_IDEF_INLINE void CSL_MPU_EnableInterrupts (CSL_MpuHandle hMpu, Uint8 addressViolation, Uint8 protocolViolation)
CSL_IDEF_INLINE void CSL_MPU_DisableInterrupts (CSL_MpuHandle hMpu, Uint8 addressViolation, Uint8 protocolViolation)
CSL_IDEF_INLINE void CSL_MPU_GetInterruptEnableStatus (CSL_MpuHandle hMpu, Uint8 *addressViolation, Uint8 *protocolViolation)
CSL_IDEF_INLINE void CSL_MPU_SetEOI (CSL_MpuHandle hMpu, Uint8 eoiVector)
CSL_IDEF_INLINE void CSL_MPU_GetFixedAddressInfo (CSL_MpuHandle hMpu, Uint32 *startAddress, Uint32 *endAddress, Uint32 *permissions)
CSL_IDEF_INLINE void CSL_MPU_SetFixedAddressPermissions (CSL_MpuHandle hMpu, Uint32 permissions)
CSL_IDEF_INLINE void CSL_MPU_GetProgrammableAddressInfo (CSL_MpuHandle hMpu, Uint8 addressIndex, Uint32 *startAddress, Uint32 *endAddress, Uint32 *permissions)
CSL_IDEF_INLINE void CSL_MPU_SetProgrammableAddressInfo (CSL_MpuHandle hMpu, Uint8 addressIndex, Uint32 startAddress, Uint32 endAddress, Uint32 permissions)
CSL_IDEF_INLINE void CSL_MPU_GetFaultAddress (CSL_MpuHandle hMpu, Uint32 *faultAddress)
CSL_IDEF_INLINE void CSL_MPU_GetFaultStatus (CSL_MpuHandle hMpu, Uint32 *faultStatus)
CSL_IDEF_INLINE void CSL_MPU_ClearFaultStatus (CSL_MpuHandle hMpu)

Function Documentation

CSL_IDEF_INLINE void CSL_MPU_ClearFaultStatus ( CSL_MpuHandle  hMpu  ) 

============================================================================
CSL_MPU_ClearFaultStatus

Description
This function clears the current fault so that another can be captured.

Arguments

        None
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_FAULT_CLEAR

Affects
MPU_FAULT_STATUS=0

Example

        CSL_MpuHandle   hMpu;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Clear the Fault.
        CSL_MPU_ClearFaultStatus(hMpu);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_ClearInterruptStatus ( CSL_MpuHandle  hMpu,
Uint8  addressViolation,
Uint8  protocolViolation 
)

============================================================================
CSL_MPU_ClearInterruptStatus

Description
This function clears the interrupt status of the MPU

Arguments

        addressViolation      - Address  Violation Error
        protocolViolation     - Protocol Violation Error
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_INT_ENABLED_STATUS_CLEAR_ENABLED_ADDR_ERR,
MPU_INT_ENABLED_STATUS_CLEAR_ENABLED_PROT_ERR

Example

        CSL_MpuHandle   hMpu;
        Uint8           addressViolation;
        Uint8           protocolViolation;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the status of the MPU Interrupts.
        CSL_MPU_GetInterruptStatus (hMpu, &addressViolation, &protocolViolation);
        ...
        // Clear the MPU Interrupt status
        CSL_MPU_ClearInterruptStatus(hMpu, addressViolation, protocolViolation);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_DisableInterrupts ( CSL_MpuHandle  hMpu,
Uint8  addressViolation,
Uint8  protocolViolation 
)

============================================================================
CSL_MPU_DisableInterrupts

Description
This function disables the interrupt for the MPU

Arguments

        addressViolation      - Address  Violation Error
        protocolViolation     - Protocol Violation Error
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_INT_ENABLE_CLEAR_ADDR_ERR_EN_CLR,
MPU_INT_ENABLE_CLEAR_PROT_ERR_EN_CLR

Example

        CSL_MpuHandle   hMpu;
        Uint8           addressViolation;
        Uint8           protocolViolation;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Disable both the Address & Protocol Violation Interrupts in the MPU
        CSL_MPU_DisableInterrupts(hMpu, 1, 1);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_EnableInterrupts ( CSL_MpuHandle  hMpu,
Uint8  addressViolation,
Uint8  protocolViolation 
)

============================================================================
CSL_MPU_EnableInterrupts

Description
This function enables the interrupt for the MPU

Arguments

        addressViolation      - Address  Violation Error
        protocolViolation     - Protocol Violation Error
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_INT_ENABLE_ADDR_ERR_EN,
MPU_INT_ENABLE_PROT_ERR_EN

Example

        CSL_MpuHandle   hMpu;
        Uint8           addressViolation;
        Uint8           protocolViolation;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Enable both the Address & Protocol Violation Interrupts in the MPU
        CSL_MPU_EnableInterrupts(hMpu, 1, 1);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetConfiguration ( CSL_MpuHandle  hMpu,
Uint8 *  addressAlign,
Uint8 *  numFixed,
Uint8 *  numProg,
Uint8 *  numFixedAID,
Uint8 *  assumedAllowed 
)

============================================================================
CSL_MPU_GetConfiguration

Description
This function gets the configured values of the MPU Module.

Arguments

        addressAlign    - Address alignment for range checking
        numFixed        - Number of fixed address ranges
        numProg         - Number of programmable address ranges
        numFixedAID     - Number of supported AIDs
        assumedAllowed  - Assumed Allowed Mode 
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_CONFIG_ADDRESS_ALIGN, MPU_CONFIG_NUM_FIXED
MPU_CONFIG_NUM_PROG, MPU_CONFIG_NUM_FIXED_AIDS
MPU_CONFIG_ASSUMED_ALLOWED

Example

        CSL_MpuHandle   hMpu;
        Uint8           addressAlign,
        Uint8           numFixed,
        Uint8           numProg,
        Uint8           numFixedAID,
        Uint8           assumedAllowed

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);

        // Get the MPU Configuration.
        CSL_MPU_GetConfiguration (hMpu, &addressAlign, &numFixed, 
                                  &numProg, &numFixedAID, &assumedAllowed);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetFaultAddress ( CSL_MpuHandle  hMpu,
Uint32 *  faultAddress 
)

============================================================================
CSL_MPU_GetFaultAddress

Description
This function gets the address of the first protecton fault transfer.

Arguments

        faultAddress     - Fault Address.
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_FAULT_ADDRESS

Example

        CSL_MpuHandle   hMpu;
        Uint32          faultAddress;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the Fault Address
        CSL_MPU_GetFaultAddress(hMpu, &faultAddress);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetFaultStatus ( CSL_MpuHandle  hMpu,
Uint32 *  faultStatus 
)

============================================================================
CSL_MPU_GetFaultStatus

Description
This function gets the fault status and attributes of the first protection fault transfer

Arguments

        faultStatus     - Fault Status
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_FAULT_STATUS

Example

        CSL_MpuHandle   hMpu;
        Uint32          faultStatus;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the Fault Status
        CSL_MPU_GetFaultStatus(hMpu, &faultStatus);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetFixedAddressInfo ( CSL_MpuHandle  hMpu,
Uint32 *  startAddress,
Uint32 *  endAddress,
Uint32 *  permissions 
)

============================================================================
CSL_MPU_GetFixedAddressInfo

Description
This function gets the fixed address information.

Arguments

        startAddress    - Fixed Start Address
        endAddress      - Fixed End Address
        permissions     - Fixed region permissions.
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_FIXED_START_ADDRESS, MPU_FIXED_END_ADDRESS, MPU_FIXED_MPPA

Example

        CSL_MpuHandle   hMpu;
        Uint32          startAddress,
        Uint32          endAddress,
        Uint32          permissions

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the MPU Fixed Address Information.
        CSL_MPU_GetFixedAddressInfo (hMpu, &startAddress, &endAddress, &permissions);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetInterruptEnableStatus ( CSL_MpuHandle  hMpu,
Uint8 *  addressViolation,
Uint8 *  protocolViolation 
)

============================================================================
CSL_MPU_GetInterruptEnableStatus

Description
This function gets the interrupt enable status of the MPU interrupts.

Arguments

        addressViolation      - Address  Violation Error
        protocolViolation     - Protocol Violation Error
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_INT_ENABLE_CLEAR_ADDR_ERR_EN_CLR,
MPU_INT_ENABLE_CLEAR_PROT_ERR_EN_CLR

Example

        CSL_MpuHandle   hMpu;
        Uint8*          addressViolation;
        Uint8*          protocolViolation;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the Interrupt Enable status for the MPU.
        CSL_MPU_GetInterruptEnableStatus(hMpu, &addressViolation, &protocolViolation);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetInterruptStatus ( CSL_MpuHandle  hMpu,
Uint8 *  addressViolation,
Uint8 *  protocolViolation 
)

============================================================================
CSL_MPU_GetInterruptStatus

Description
This function gets the interrupt status of the MPU

Arguments

        addressViolation      - Address  Violation Error
        protocolViolation     - Protocol Violation Error
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_INT_ENABLED_STATUS_CLEAR_ENABLED_ADDR_ERR,
MPU_INT_ENABLED_STATUS_CLEAR_ENABLED_PROT_ERR

Example

        CSL_MpuHandle   hMpu;
        Uint8           addressViolation;
        Uint8           protocolViolation;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the status of the MPU Interrupts.
        CSL_MPU_GetInterruptStatus (hMpu, &addressViolation, &protocolViolation);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetProgrammableAddressInfo ( CSL_MpuHandle  hMpu,
Uint8  addressIndex,
Uint32 *  startAddress,
Uint32 *  endAddress,
Uint32 *  permissions 
)

============================================================================
CSL_MPU_GetProgrammableAddressInfo

Description
This function gets the fixed address information.

Arguments

        addressIndex    - Programmable Region Index.
        startAddress    - Programmable Start Address
        endAddress      - Programmable End Address
        permissions     - Programmable region permissions.
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_PROG_START_ADDRESS, MPU_PROG_END_ADDRESS, MPU_PROG_MPPA

Example

        CSL_MpuHandle   hMpu;
        Uint32          startAddress,
        Uint32          endAddress,
        Uint32          permissions

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the MPU Programmable Address for Region 1
        CSL_MPU_GetProgrammableAddressInfo (hMpu, 1, &startAddress, &endAddress, &permissions);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_GetRevision ( CSL_MpuHandle  hMpu,
Uint32 *  revisionInfo 
)

============================================================================
CSL_MPU_GetRevision

Description
This function reads the revision register for the MPU Module.

Arguments

        revisionInfo    - Revision Information populated by the API
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Reads
MPU_REVISION

Example

        Uint32          revisionInfo;
        CSL_MpuHandle   hMpu;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);

        // Get the MPU Peripheral Identification.
        CSL_MPU_GetRevision (hMpu, &revisionInfo);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_SetEOI ( CSL_MpuHandle  hMpu,
Uint8  eoiVector 
)

============================================================================
CSL_MPU_SetEOI

Description
This function sets the EOI register to indicate the end of the interrupt service.

Arguments

        eoiVector     - EOI Vector Value
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_EOI_EOI_VECTOR

Example

        CSL_MpuHandle   hMpu;
        Uint8           eoiVector;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Set the EOI Vector.
        CSL_MPU_SetEOI(hMpu, eoiVector);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_SetFixedAddressPermissions ( CSL_MpuHandle  hMpu,
Uint32  permissions 
)

============================================================================
CSL_MPU_SetFixedAddressPermissions

Description
This function sets the fixed address permissions.

Arguments

        permissions     - Fixed region permissions.
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_FIXED_MPPA

Example

        CSL_MpuHandle   hMpu;
        Uint32          startAddress,
        Uint32          endAddress,
        Uint32          permissions

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the MPU Fixed Address Information.
        CSL_MPU_GetFixedAddressInfo (hMpu, &startAddress, &endAddress, &permissions);

        // Allow user executable permissions.
        permissions = permissions | CSL_FMK (MPU_FIXED_MPPA_UX, 1); 

        // Set the permissions for the fixed address
        CSL_MPU_SetFixedAddressPermissions (permissions);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_SetInterruptRawStatus ( CSL_MpuHandle  hMpu,
Uint8  addressViolation,
Uint8  protocolViolation 
)

============================================================================
CSL_MPU_SetInterruptRawStatus

Description
This function sets the interrupt raw status of the MPU

Arguments

        addressViolation      - Address  Violation Error
        protocolViolation     - Protocol Violation Error
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_INT_RAW_STATUS_SET_ADDR_ERR, MPU_INT_RAW_STATUS_SET_PROT_ERR

Example

        CSL_MpuHandle   hMpu;

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);

        // Set the address violation error
        CSL_MPU_SetInterruptRawStatus (hMpu, 1, 0);

     

=============================================================================

CSL_IDEF_INLINE void CSL_MPU_SetProgrammableAddressInfo ( CSL_MpuHandle  hMpu,
Uint8  addressIndex,
Uint32  startAddress,
Uint32  endAddress,
Uint32  permissions 
)

============================================================================
CSL_MPU_SetProgrammableAddressInfo

Description
This function sets the fixed address information.

Arguments

        addressIndex    - Programmable Region Index.
        startAddress    - Programmable Start Address
        endAddress      - Programmable End Address
        permissions     - Programmable region permissions.
     

Return Value
None

Pre Condition
CSL_MPU_Open() must be called

Post Condition
None

Writes
MPU_PROG_START_ADDRESS, MPU_PROG_END_ADDRESS, MPU_PROG_MPPA

Example

        CSL_MpuHandle   hMpu;
        Uint32          startAddress,
        Uint32          endAddress,
        Uint32          permissions

        // Open the MPU MPU Module 0
        hMpu = CSL_MPU_Open (0);
        ...
        // Get the MPU Programmable Address for Region 1
        CSL_MPU_GetProgrammableAddressInfo (hMpu, 1, &startAddress, &endAddress, &permissions);

        // Allow user executable permissions.
        permissions = permissions | CSL_FMK (MPU_FIXED_MPPA_UX, 1);         

        // Set the permissions for the Region 1.
        CSL_MPU_SetProgrammableAddressInfo (hMpu, 1, startAddress, endAddress, permissions);

     

=============================================================================


Copyright 2012, Texas Instruments Incorporated