⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_emifaux.h

📁 TI达芬奇dm644x各硬件模块测试代码
💻 H
📖 第 1 页 / 共 4 页
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005                 
 *                                                                              
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.             
 *   ===========================================================================
 */ 
 
/** @file csl_emifAux.h
 *
 * @brief  Header file for functional layer of CSL
 *
 *    Path: \\(CSLPATH)\\ipmodules\\emifs\\src
 *
 * Description
 *    - The defines inline function definitions 
 *
 */

/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004
 *
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.
 *   ===========================================================================
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  30-Aug-2004 brn File Created
 *  11-Oct_2004 brn File updated with the review comments
 * =============================================================================
 */


#ifndef _CSL_EMIFAUX_H_
#define _CSL_EMIFAUX_H_

#include <csl_emif.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  Status query functions of the external memory interface
 */
 
/** ============================================================================
 *   @n@b CSL_emifGetRevId
 *
 *   @b Description
 *   @n Gets the the current value of Rev ID value of external memory interface
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
        CSL_EmifRevStatus  Revision status structure  
 *   @endverbatim
 *
 *   <b> Return Value </b> None
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n assigns the current value of the revision status of external memory interface
 *    @n to the rev status structure parameter passed as parameter
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        CSL_EmifRevStatus *revStatus;
        CSL_emifGetID (hEmif, revStatus);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
void CSL_emifGetRevId (
    CSL_EmifHandle       hEmif,
    CSL_EmifRevStatus    *revStatus    
)
{
    revStatus->moduleID = (Uint16) 
                           CSL_FEXT (hEmif->regs->ERCSR, EMIF_ERCSR_MID);
    revStatus->majorRev = (Uint16) 
                           CSL_FEXT (hEmif->regs->ERCSR, EMIF_ERCSR_MAJREV);
    revStatus->minorRev = (Uint16) 
                           CSL_FEXT (hEmif->regs->ERCSR, EMIF_ERCSR_MINREV);
}


/** ============================================================================
 *   @n@b CSL_emifGetEndiannes
 *
 *   @b Description
 *   @n Gets the endiannes of the external memory interface instance
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
 *   @endverbatim
 *
 *   <b> Return Value </b> Uint16
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the endiannes of the external memory interface instance
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        Uint16   endiannes;
        endiannes = CSL_emifGetEndiannes (hEmif);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint16 CSL_emifGetEndiannes (
    CSL_EmifHandle      hEmif
)
{
    Uint16   endiannes;
    endiannes = (Uint16) CSL_FEXT (hEmif->regs->ERCSR, EMIF_ERCSR_BE);
    
    return endiannes;
}


/** ============================================================================
 *   @n@b CSL_emifGetRateStatus
 *
 *   @b Description
 *   @n Gets the data rate information of the external memory interface instance
 *   @n  whether it is working in full rate or half rate
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
 *   @endverbatim
 *
 *   <b> Return Value </b> Uint16
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the rate information of external memory interface instance
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        Uint16   rate;
        rate = CSL_emifGetRateStatus (hEmif);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint16 CSL_emifGetRateStatus (
    CSL_EmifHandle      hEmif
)
{
    Uint16    rate;
    rate = (Uint16) CSL_FEXT (hEmif->regs->ERCSR, EMIF_ERCSR_FR);  
     
    return rate;
}


/** ============================================================================
 *   @n@b CSL_emifGetDdrStatus
 *
 *   @b Description
 *   @n Gets the DDR status information of the external memory interface 
 *                                                                      instance
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
        ddrStatus          Pointer to DDR status structure
 *   @endverbatim
 *
 *   <b> Return Value </b> N
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Sets the ddr status information in structure parameter sent as 
 *                                                                     arguement
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        CSL_EmifDdrStatus   *ddrStatus;
        CSL_emifGetDdrStatus (hEmif, ddrStatus);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
void CSL_emifGetDdrStatus (
    CSL_EmifHandle      hEmif,
    CSL_EmifDdrStatus   *ddrStatus
)
{
    ddrStatus->phyDllRdy = CSL_FEXT (hEmif->regs->DDRSR, EMIF_DDRSR_PHYDLLRDY);
    ddrStatus->trainCS1  = CSL_FEXT (hEmif->regs->DDRSR, EMIF_DDRSR_TRPHYCS1);
    ddrStatus->trainCS0  = CSL_FEXT (hEmif->regs->DDRSR, EMIF_DDRSR_TRPHYCS0);
    ddrStatus->ddr       = CSL_FEXT (hEmif->regs->DDRSR, EMIF_DDRSR_DDR);
}

/** ============================================================================
 *   @n@b CSL_emifGetDdrPhyStatus
 *
 *   @b Description
 *   @n Gets the DDR PHY status information of the external memory interface 
 *      instance
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
        ddrRhyStatus          Pointer to DDR PHY status structure
 *   @endverbatim
 *
 *   <b> Return Value </b> N
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Sets the ddr status information in structure parameter sent as 
 *       arguement
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        CSL_EmifDdrStatus   *ddrPhyStatus;
        CSL_emifGetDdrPhyStatus (hEmif, ddrPhyStatus);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
void CSL_emifGetDdrPhyStatus (
    CSL_EmifHandle          hEmif,
    CSL_EmifDdrPhyStatus    *ddrPhyStatus
)
{
    ddrPhyStatus->tldq3sel = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TLDQ3SEL);
    ddrPhyStatus->taplvl1dq3 = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TAPLVL1DQ3);
    ddrPhyStatus->tldq2sel = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TLDQ2SEL);
    ddrPhyStatus->taplvl1dq2 = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TAPLVL1DQ2);
    ddrPhyStatus->tldq1sel = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TLDQ1SEL);
    ddrPhyStatus->taplvl1dq1 = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TAPLVL1DQ1);
    ddrPhyStatus->tldq0sel = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TLDQ0SEL);
    ddrPhyStatus->taplvl1dq0 = 
                  CSL_FEXT (hEmif->regs->DDRPHYSR, EMIF_DDRPHYSR_TAPLVL1DQ0);
}


/** ============================================================================
 *   @n@b CSL_emifGetSdramAccess
 *
 *   @b Description
 *   @n Gets the data of SDRAM access information of the external memory 
 *      interface instance
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
 *   @endverbatim
 *
 *   <b> Return Value </b> Uint32
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the SDRAM access information of external memory interface 
 *       instance
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        Uint32            sdramAccess;
        sdramAccess = CSL_emifGetSDRAMAccess (hEmif);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint32 CSL_emifGetSdramAccess (
    CSL_EmifHandle hEmif
)
{
    Uint32 sdramAccess;
    sdramAccess = CSL_FEXT (hEmif->regs->TOTAR, EMIF_TOTAR_TA);
     
    return sdramAccess;
}


/** ============================================================================
 *   @n@b CSL_emifGetSdramActive
 *
 *   @b Description
 *   @n Gets the information whether SDRAM is active or not of the external 
 *   @n memory interface instance
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
 *   @endverbatim
 *
 *   <b> Return Value </b> Uint32
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the information whether SDRAM is active or not of external 
      @n memory interface instance
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        Uint32            sdramActive;
        sdramActive = CSL_emifGetSdramActive (hEmif);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint32 CSL_emifGetSdramActive (
    CSL_EmifHandle hEmif
)
{
    Uint32 sdramActive;
    sdramActive = CSL_FEXT (hEmif->regs->TOTACTR, EMIF_TOTACTR_TACT); 
    
    return sdramActive;
}


/** ============================================================================
 *   @n@b CSL_emifGetDdrIdRev
 *
 *   @b Description
 *   @n Gets the information about the DDR Id revision information of the 
 *   @n external memory interface instance
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
 *   @endverbatim
 *
 *   <b> Return Value </b> Uint32
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the information of DDR ID revision infor mation of external 
      @n memory interface instance
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        Uint32            ddrIdRev;
        ddrIdRev = CSL_emifGetDdrIdRev (hEmif);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint32 CSL_emifGetDdrIdRev (
    CSL_EmifHandle hEmif
)
{
    Uint32 ddrIdRev;
    ddrIdRev = CSL_FEXT (hEmif->regs->DDRPHYID_REV, 
                                                EMIF_DDRPHYID_REV_DDRPHYID_REV);
    
    return ddrIdRev;
}


/** ============================================================================
 *   @n@b CSL_emifGetLtIntStatus
 *
 *   @b Description
 *   @n Gets the line trap information of the external memory interface instance
 *
 *   @b Arguments
 *   @verbatim
        hEmif              Handle to the external memory interface instance
 *   @endverbatim
 *
 *   <b> Return Value </b> Uint16
                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the information line trap information of external memory 
 *    @n interface instance
 *
 *   @b Modifies
 *   @n None
 *
 *   @b Example
 *   @verbatim
        CSL_EmifHandle     hEmif;
        Uint16            ltIntStatus;
        ltIntStatus = CSL_emifGetLtIntStatus (hEmif);
        ...
     @endverbatim
 * ===========================================================================
 */
CSL_IDEF_INLINE
Uint16 CSL_emifGetLtIntStatus (
    CSL_EmifHandle hEmif
)
{ 
    Uint16    ltIntStatus;
    ltIntStatus = CSL_FEXT (hEmif->regs->EIRR, EMIF_EIRR_LT);
    
    return ltIntStatus;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -