# XMC Functions
[XMC]

## Functions

CSL_IDEF_INLINE void | CSL_XMC_setXMPAXH (Uint32 index, CSL_XMC_XMPAXH *mpaxh)
CSL_IDEF_INLINE void | CSL_XMC_setXMPAXL (Uint32 index, CSL_XMC_XMPAXL *mpaxl)
CSL_IDEF_INLINE void | CSL_XMC_getXMPAXH (Uint32 index, CSL_XMC_XMPAXH *mpaxh)
CSL_IDEF_INLINE void | CSL_XMC_getXMPAXL (Uint32 index, CSL_XMC_XMPAXL *mpaxl)
CSL_IDEF_INLINE Uint32 | CSL_XMC_getFaultAddress (void)
CSL_IDEF_INLINE void | CSL_XMC_clearFault (void)
CSL_IDEF_INLINE void | CSL_XMC_getFaultStatus (CSL_XMC_MPFSR *xmpfsr)
CSL_IDEF_INLINE void | CSL_XMC_invalidatePrefetchBuffer (void)
CSL_IDEF_INLINE void | CSL_XMC_loadAnalysisCounterEnable (void)
CSL_IDEF_INLINE void | CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE acenMode)
CSL_IDEF_INLINE void | CSL_XMC_resetAnalysisCounters (void)
CSL_IDEF_INLINE void | CSL_XMC_setPrefetchCommand (Uint8 inv, Uint8 acEnLoad, CSL_XMC_ACEN_MODE acenMode, Uint8 acRst)
CSL_IDEF_INLINE CSL_XMC_ACEN_MODE | CSL_XMC_getAnalysisCounterEnableStatus (void)
CSL_IDEF_INLINE Uint32 | CSL_XMC_getNumPrefetchSent (void)
CSL_IDEF_INLINE Uint32 | CSL_XMC_getNumPrefetchCanceled (void)
CSL_IDEF_INLINE Uint32 | CSL_XMC_getNumPrefetchHits (void)
CSL_IDEF_INLINE Uint32 | CSL_XMC_getNumPrefetchMisses (void)
CSL_IDEF_INLINE void | CSL_XMC_getPrefetchAddress (Uint32 index, CSL_XMC_XPFADDR *xpfaddr)
CSL_IDEF_INLINE void | CSL_XMC_setMDMAPriority (Uint32 priority)
CSL_IDEF_INLINE Uint32 | CSL_XMC_getMDMAPriority (void)

## Function Documentation

CSL_IDEF_INLINE void CSL_XMC_clearFault | ( | void |  | ) |

============================================================================
CSL_XMC_clearFault

Description
This function clears the fault information.

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
XMPFCR register configured with the value passed. Fault address and status registers are cleared.

Writes
XMC_XMPFCR_MPFCLR=1

Affects
XMC_XMPFAR_FADDR=0, XMC_XMPFSR_LOCAL=0, XMC_XMPFSR_SR=0, XMC_XMPFSR_SX=0, XMC_XMPFSR_UR=0, XMC_XMPFSR_UW=0, XMC_XMPFSR_UW=0

Example

            CSL_XMC_clearFault ();

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

CSL_IDEF_INLINE CSL_XMC_ACEN_MODE CSL_XMC_getAnalysisCounterEnableStatus | ( | void |  | ) |

============================================================================
CSL_XMC_getAnalysisCounterEnableStatus

Description
This function returns the Analysis counter enable mode by reading the contents of 'ACEN' bits from the XPFACS register.

Arguments
None

Return Value CSL_XMC_ACEN_MODE - Event counting mode

Pre Condition
None

Post Condition
CSL_XMC_XPFACS_ACEN bits read and returned

Reads
XMC_XPFACS_ACEN

Example

            CSL_XMC_ACEN_MODE   acenMode;

            // Read ACEN Mode Status
            acenMode = CSL_XMC_getAnalysisCounterEnableStatus ();
            if (acenMode == CSL_XMC_ACEN_MODE_COUNT_DISABLE)
            {
                ...
            }

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

CSL_IDEF_INLINE Uint32 CSL_XMC_getFaultAddress | ( | void |  | ) |

============================================================================
CSL_XMC_getFaultAddress

Description
This function gets the access address causing the fault.

Arguments
None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
XMC_XMPFAR_FADDR

Example

            Uint32 faultAddr;

            faultAddr = CSL_XMC_getFaultAddress ();

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

CSL_IDEF_INLINE void CSL_XMC_getFaultStatus | ( | CSL_XMC_MPFSR * | xmpfsr | ) |

============================================================================
CSL_XMC_getFaultStatus

Description
This function gets the contents of Fault Status Register XMPFSR.

Arguments

              xmpfsr    CSL_XMC_MPFSR structure that needs to be filled in from
                        XMPFSR register

Return Value
None

Pre Condition
None

Post Condition
None

Reads
XMC_XMPFSR_LOCAL, XMC_XMPFSR_SR, XMC_XMPFSR_SX, XMC_XMPFSR_UR, XMC_XMPFSR_UW, XMC_XMPFSR_UW

Example

            CSL_XMC_MPFSR xmpfsr;

            CSL_XMC_getFaultStatus (&xmpfsr);

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

CSL_IDEF_INLINE Uint32 CSL_XMC_getMDMAPriority | ( | void |  | ) |

============================================================================
CSL_XMC_getMDMAPriority

Description
This function retrieves the priority of transaction submissions to Master DMA (MDMA).

Arguments
None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
XMC_MDMAARBX_PRI

Example

            Uint32 priority;

            priority = CSL_XMC_getMDMAPriority ();

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

CSL_IDEF_INLINE Uint32 CSL_XMC_getNumPrefetchCanceled | ( | void |  | ) |

============================================================================
CSL_XMC_getNumPrefetchCanceled

Description
This function returns the contents of XPFAC1 register, i.e., the number of prefetch requests canceled (prefetch requests that returned a non-zero rstatus or other error).

Arguments
None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
XMC_XPFAC1_CANCELED

Example

            Uint32      numPrefetchCanceled;

            // Read Prefetch request canceled
            numPrefetchCanceled = CSL_XMC_getNumPrefetchCanceled ();

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

CSL_IDEF_INLINE Uint32 CSL_XMC_getNumPrefetchHits | ( | void |  | ) |

============================================================================
CSL_XMC_getNumPrefetchHits

Description
This function returns the contents of XPFAC2 register, i.e., the number of demand prefetch requests that resulted in a successful prefetch.

Arguments
None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
XMC_XPFAC2_HIT

Example

            Uint32      numPrefetchHits;

            // Read Number of Prefetch request hits
            numPrefetchHits = CSL_XMC_getNumPrefetchHits ();

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

CSL_IDEF_INLINE Uint32 CSL_XMC_getNumPrefetchMisses | ( | void |  | ) |

============================================================================
CSL_XMC_getNumPrefetchMisses

Description
This function returns the contents of XPFAC3 register, i.e., the number of prefetch requests that resulted in a miss and had to be submitted as a demand prefetch request into the system.

Arguments
None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
XMC_XPFAC3_MISS

Example

            Uint32      numPrefetchMisses;

            // Read Number of Prefetch request misses
            numPrefetchMisses = CSL_XMC_getNumPrefetchMisses ();

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

CSL_IDEF_INLINE Uint32 CSL_XMC_getNumPrefetchSent | ( | void |  | ) |

============================================================================
CSL_XMC_getNumPrefetchSent

Description
This function returns the contents of XPFAC0 register, i.e., the number of prefetch requests sent into the system.

Arguments
None

Return Value Uint32

Pre Condition
None

Post Condition
None

Reads
XMC_XPFAC0_SENT

Example

            Uint32      numPrefetchSent;

            // Read Prefetch request sent count
            numPrefetchSent = CSL_XMC_getNumPrefetchSent ();

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

CSL_IDEF_INLINE void CSL_XMC_getPrefetchAddress | ( | Uint32 | index,
|  | CSL_XMC_XPFADDR * | xpfaddr |
| ) |  |  |

============================================================================
CSL_XMC_getPrefetchAddress

Description
This function gets the contents of XPFADDR register.

Arguments

              index     Index into the set of 8 registers
              xpfaddr   CSL_XMC_XPFADDR structure that needs to be filled from
                        XPFADDR register

Return Value
None

Pre Condition
None

Post Condition
None

Reads
XMC_XPFADDR_ADDR, XMC_XPFADDR_DIR, XMC_XPFADDR_DPH, XMC_XPFADDR_DVH, XMC_XPFADDR_AVH, XMC_XPFADDR_DPL, XMC_XPFADDR_DVL, XMC_XPFADDR_AVL

Example

            Uint32 index = 0;
            CSL_XMC_XPFADDR xpfaddr;

            CSL_XMC_getPrefetchAddress (index, &xpfaddr);

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

CSL_IDEF_INLINE void CSL_XMC_getXMPAXH | ( | Uint32 | index,
|  | CSL_XMC_XMPAXH * | mpaxh |
| ) |  |  |

============================================================================
CSL_XMC_getXMPAXH

Description
This function gets the contents of XMPAXH register.

Arguments

            index       Index into the set of 16 XMPAXH registers
            mpaxh       CSL_XMC_XMPAXH structure that needs to be populated with
                        XMPAXH register contents.

Return Value
None

Pre Condition
None

Post Condition
None

Reads
XMC_XMPAXH_SEGSZ, XMC_XMPAXH_BADDR

Example

            Uint32 index = 0;
            CSL_XMC_XMPAXH mpaxh;

            CSL_XMC_getXMPAXH (index, &mpaxh);

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

CSL_IDEF_INLINE void CSL_XMC_getXMPAXL | ( | Uint32 | index,
|  | CSL_XMC_XMPAXL * | mpaxl |
| ) |  |  |

============================================================================
CSL_XMC_getXMPAXL

Description
This function gets the contents of XMPAXL register.

Arguments

            index       Index into the set of 16 registers
            mpaxl       CSL_XMC_XMPAXL structure that needs to be populated with
                        XMPAXL register contents.

Return Value
None

Pre Condition
None

Post Condition
None

Reads
XMC_XMPAXL_RADDR, XMC_XMPAXL_UX, XMC_XMPAXL_UW, XMC_XMPAXL_UR, XMC_XMPAXL_SX, XMC_XMPAXL_SW, XMC_XMPAXL_SR

Example

            Uint32 index = 0;
            CSL_XMC_XMPAXL mpaxl;

            CSL_XMC_getXMPAXL (index, &mpaxl);

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

CSL_IDEF_INLINE void CSL_XMC_invalidatePrefetchBuffer | ( | void |  | ) |

============================================================================
CSL_XMC_invalidatePrefetchBuffer

Description
This function when called marks all slots in the data prefetch buffer and program prefetch buffer invalid by writing 1 in the XPFCMD register's INV bit.

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
CSL_XMC_XPFCMD_INV bit set to 1 and data and program prefetch buffers are invalidated.

Writes
XMC_XPFCMD_INV=1

Affects
XMC_XPFADDR_DVH=0, XMC_XPFADDR_DVL=0

Example

     *
            CSL_XMC_invalidatePrefetchBuffer ();

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

CSL_IDEF_INLINE void CSL_XMC_loadAnalysisCounterEnable | ( | void |  | ) |

============================================================================
CSL_XMC_loadAnalysisCounterEnable

Description
This function when called sets the 'ACENL' bit of the XPFCMD register, thus triggering a copy/load of ACEN bits (Analysis counter enable mode) into ACEN bits of XPFACS register.

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
CSL_XMC_XPFCMD_ACENL bit set to 1 and ACEN bits value is loaded into the ACEN bits of XPFACS register.

Writes
XMC_XPFCMD_ACENL=1

Affects
XMC_XPFACS_ACEN

Example

     *
            CSL_XMC_loadAnalysisCounterEnable ();

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

CSL_IDEF_INLINE void CSL_XMC_resetAnalysisCounters | ( | void |  | ) |

============================================================================
CSL_XMC_resetAnalysisCounters

Description
This function when called sets the 'ACRST' bit of the XPFCMD register, thus triggering a clear/reset operation on the prefetch analysis counter registers.

Arguments
None

Return Value
None

Pre Condition
None

Post Condition
CSL_XMC_XPFCMD_ACRST bit set to 1 and prefetch analysis counter registers are cleared.

Writes
XMC_XPFCMD_ACRST=1

Affects
XMC_XPFAC0_SENT=0, XMC_XPFAC1_CANCELED=0, XMC_XPFAC2_HIT=0, XMC_XPFAC3_MISS=0

Example

     *
            CSL_XMC_resetAnalysisCounters ();

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

CSL_IDEF_INLINE void CSL_XMC_setAnalysisCounterEnableMode | ( | CSL_XMC_ACEN_MODE | acenMode | ) |

============================================================================
CSL_XMC_setAnalysisCounterEnableMode

Description
This function when called sets up the Event counting mode by writing to the 'ACEN' bits of the XPFCMD register.

Arguments

              acenMode  Analyis counter mode.

Return Value
None

Pre Condition
None

Post Condition
CSL_XMC_XPFCMD_ACEN bits written with the Analysis counter mode specified.

Writes
XMC_XPFCMD_ACEN

Example

            // Enable both program and data events
            CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE_COUNT_ALL);

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

CSL_IDEF_INLINE void CSL_XMC_setMDMAPriority | ( | Uint32 | priority | ) |

============================================================================
CSL_XMC_setMDMAPriority

Description
This function configures the priority of transaction submissions to Master DMA (MDMA).

Arguments

            priority        Priority value to set for MDMA transactions.

Return Value
None

Pre Condition
None

Post Condition
None

Writes
XMC_MDMAARBX_PRI

Example

            Uint32 priority = 4;

            CSL_XMC_setMDMAPriority (priority);

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

CSL_IDEF_INLINE void CSL_XMC_setPrefetchCommand | ( | Uint8 | inv,
|  | Uint8 | acEnLoad,
|  | CSL_XMC_ACEN_MODE | acenMode,
|  | Uint8 | acRst |
| ) |  |  |

============================================================================
CSL_XMC_setPrefetchCommand

Description
This function sets up the contents of the XPFCMD register based on the inputs specified.

Arguments

            inv         Invalidate Prefetch Buffer command flag. When set to 1,
                        data and program prefetch buffers are invalidated.
            acEnLoad    Analysis Counter Enable Load flag. When set to 1, the
                        Analysis Counter Enable mode is loaded into the XPFACS status
                        register.
            acEnMode    Analyis counter enable mode. Specifies the event counting mode
                        for the prefetcher.
            acRst       Analysis counter Reset flag. When set to 1, resets all
                        the prefetch event counters.

Return Value
None

Pre Condition
None

Post Condition
CSL_XMC_XPFCMD written with the settings specified.

Writes
XMC_XPFCMD_INV, XMC_XPFCMD_ACENL, XMC_XPFCMD_ACEN, XMC_XPFCMD_ACRST

Example

            // Issue the following prefetch commands:
            //  - Dont invalidate prefetch buffers
            //  - Enable Analysis Counter Enable load
            //  - Enable both program and data event counting
            //  - Dont reset the prefetch counters
            CSL_XMC_setPrefetchCommand (0, 1, CSL_XMC_ACEN_MODE_COUNT_ALL, 0);

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

CSL_IDEF_INLINE void CSL_XMC_setXMPAXH | ( | Uint32 | index,
|  | CSL_XMC_XMPAXH * | mpaxh |
| ) |  |  |

============================================================================
CSL_XMC_setXMPAXH

Description
This function sets the contents of XMPAXH register indicated by the index here.

Arguments

            index       Index into the set of 16 registers (0-15)
            mpaxh       CSL_XMC_XMPAXH structure that needs to be set into the
                        register

Return Value
None

Pre Condition
None

Post Condition
Corresponding XMPAXH register configured with the value passed.

Writes
XMC_XMPAXH_SEGSZ, XMC_XMPAXH_BADDR

Example

            Uint32 index = 0;
            CSL_XMC_XMPAXH mpaxh;

            mpaxh.segSize = 4;
            mpaxh.baseAddress = 0x1000;

            CSL_XMC_setXMPAXH (index, &mpaxh);

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

CSL_IDEF_INLINE void CSL_XMC_setXMPAXL | ( | Uint32 | index,
|  | CSL_XMC_XMPAXL * | mpaxl |
| ) |  |  |

============================================================================
CSL_XMC_setXMPAXL

Description
This function sets the contents of XMPAXL register corresponding to the index specified.

Arguments

            index       Index into the set of 16 registers (0-15)
            mpaxl       CSL_XMC_XMPAXL structure that needs to be set into the
                        register

Return Value
None

Pre Condition
None

Post Condition
Corresponding XMPAXL register configured with the value passed.

Writes
XMC_XMPAXL_RADDR, XMC_XMPAXL_UX, XMC_XMPAXL_UW, XMC_XMPAXL_UR, XMC_XMPAXL_SX, XMC_XMPAXL_SW, XMC_XMPAXL_SR

Example

            Uint32 index = 0;
            CSL_XMC_XMPAXL mpaxl;

            mpaxl.ux = 1;
            mpaxl.uw = 1;
            mpaxl.ur = 1;
            mpaxl.sx = 1;
            mpaxl.sw = 1;
            mpaxl.sr = 1;
            mpaxl.rAddr = 0x4000 ;

            CSL_XMC_setXMPAXL (index, &mpaxl);

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

Copyright 2012, Texas Instruments Incorporated