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

📄 csl_ddr2.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 3 页
字号:
 */
typedef struct {
    /** Refresh Rate */
    Uint16               refreshRate;
    /** Structure for DDR2 SDRAM Timing1 */
    CSL_Ddr2Timing1    *timing1Param;
    /** Structure for DDR2 SDRAM Timing2 */
    CSL_Ddr2Timing2     *timing2Param;
    /** Structure for DDR2 SDRAM configuration */
    CSL_Ddr2Settings    *setParam;        
} CSL_Ddr2HwSetup;

/** 
 * @brief DDR2 Module ID and Revision structure
 *
 *  This structure is used for querying the DDR2 module ID and revision 
 */
typedef struct {
    /** DDR2 EMIF Module ID */
    Uint16    modId;
    /** DDR2 EMIF Major Revision */
    Uint8     majRev;
    /** DDR2 EMIF Minor Revision */
    Uint8     minRev;
} CSL_Ddr2ModIdRev;   

/** 
 * @brief DDR2 config structure which is used in CSL_ddr2HwSetupRaw function
 */
typedef struct {
    /** SDRAM Config Register */
    volatile Uint32 SDCFG;
    /** SDRAM Refresh Control Register */
    volatile Uint32 SDRFC;    
    /** SDRAM Timing1 Register*/

    volatile Uint32 SDTIM1;
    /** SDRAM Timing2 Register */
    volatile Uint32 SDTIM2;    
    /** VBUSM Burst Priority Register */
    volatile Uint32 BPRIO;     
} CSL_Ddr2Config;

/** 
 * @brief Enumeration for queries passed to @a CSL_ddr2GetHwStatus()
 *
 * This is used to get the status of different operations 
 */
typedef enum {
    /** Get the DDR2 EMIF module ID and revision numbers (response type: 
     *  @a (CSL_Ddr2ModIdRev*)) 
     */
    CSL_DDR2_QUERY_REV_ID,     
    /** Get the EMIF refresh rate information
     *  (response type: @a Uint16 *)  
     */
    CSL_DDR2_QUERY_REFRESH_RATE,
    /** Get self refresh bit value(response type: 
     *  @a (CSL_Ddr2SelfRefresh *))   
     */
    CSL_DDR2_QUERY_SELF_REFRESH,
    /** VBUSM Configuration values such as FIFO depths and Bus width
     *   (response type: @a CSL_Ddr2VbusmCfg*)   
     */
    CSL_DDR2_QUERY_ENDIAN,
    /** Reflects the value on the IFRDY_ready port (active high) that
     *  defines whether the DDR IFRDY is ready for normal operation.
     *   (response type: @a Uint8*)   
     */
    CSL_DDR2_QUERY_IFRDY
} CSL_Ddr2HwStatusQuery;

/** 
 * @brief Enumeration for commands passed to @a CSL_ddr2HwControl()
 *
 * This is used to select the commands to control the operations
 * existing setup of DDR2. The arguments to be passed with each
 * enumeration if any are specified next to the enumeration.
 */
typedef enum {    
    /** Self refresh enable or disable based on arg passed
     *  : argument @a (CSL_Ddr2SelfRefresh *)  
     */
    CSL_DDR2_CMD_SELF_REFRESH = 0,
    /** Enters the Refresh rate value : argument @a (Uint16 *) */     
    CSL_DDR2_CMD_REFRESH_RATE,     
    /** Number of memory transfers after which the DDR2 EMIF momentarily 
     *  raises the priority of old commands in the VBUSM Command FIFO. : 
     *  argument @a (Uint8 *) 
     */
    CSL_DDR2_CMD_PRIO_RAISE        
} CSL_Ddr2HwControlCmd;
 
/** @brief The defaults of DDR2 SDRAM Timing1 Control structure */
#define CSL_DDR2_TIMING1_DEFAULTS  {\
    (Uint8)CSL_DDR2_TIMING1_TRFC_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING1_TRP_DEFAULT,  \
    (Uint8)CSL_DDR2_TIMING1_TRCD_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING1_TWR_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING1_TRAS_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING1_TRC_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING1_TRRD_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING1_TWTR_DEFAULT \
}

/** @brief The defaults of DDR2 SDRAM Timing2 Control structure */
#define CSL_DDR2_TIMING2_DEFAULTS  { \
    (Uint8)CSL_DDR2_TIMING2_T_ODT_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING2_TSXNR_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING2_TSXRD_DEFAULT, \
    (Uint8)CSL_DDR2_TIMING2_TRTP_DEFAULT,  \
    (Uint8)CSL_DDR2_TIMING2_TCKE_DEFAULT   \
}

/** @brief The defaults of DDR2 SDRAM Config structure */
#define CSL_DDR2_SETTING_DEFAULTS  {  \
    (CSL_Ddr2CasLatency)CSL_DDR2_CAS_LATENCY_5, \
    (CSL_Ddr2IntBank)CSL_DDR2_4_SDRAM_BANKS, \
    (CSL_Ddr2PageSize)CSL_DDR2_256WORD_8COL_ADDR, \
    (CSL_Ddr2Mode)CSL_DDR2_NORMAL_MODE,  \
    (CSL_Ddr2Drive)CSL_DDR2_NORM_DRIVE \
}

/** @brief The default Config structure */
#define CSL_DDR2_CONFIG_DEFAULTS { \
    CSL_DDR2_SDCFG_DEFAULT,       \
    CSL_DDR2_SDRFC_DEFAULT,       \
    CSL_DDR2_SDTIM1_DEFAULT,       \
    CSL_DDR2_SDTIM2_DEFAULT,       \
    CSL_DDR2_BPRIO_RESETVAL \
}

/******************************************************************************
 * DDR2 global function declarations
 ******************************************************************************
 */
/** ===========================================================================
 *   @n@b   CSL_ddr2Init
 *
 *  @b Description
 *  @n This function is idempotent i.e. calling it many times is same as calling
 *     it once.  This function presently does nothing.
 *
 * <b> Usage Constraints: </b>
 *  This function should be called before using any of the CSL APIs
 *
 *   @b Arguments
     @verbatim
            pContext   Context information for the instance. Should be NULL
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK - Always returns
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 * @verbatim
   ...
   
   CSL_ddr2Init( NULL );
   ...    
   }
   @endverbatim
 *
 *
 * ============================================================================
 */
CSL_Status  CSL_ddr2Init (
    CSL_Ddr2Context    *pContext
);

/** =============================================================================
 *   @n@b   CSL_ddr2Open
 *
 *   @b Description
 *   @n This function returns the handle to the DDR2 instance. This
 *      handle is passed to all other CSL APIs.
 *
 *   @b Arguments
 *   @verbatim

            pDdr2Obj        Pointer to the object that holds reference to the
                            instance of DDR2 requested after the call
            
            ddr2Num         Instance of DDR2 to which a handle is requested
 
            pDdr2Param      Pointer to module specific parameters
 
            pStatus         pointer for returning status of the function call

     @endverbatim
 *
 *   <b> Return Value </b>  
 *      CSL_Ddr2Handle - Valid DDR2 instance handle will be returned if status
 *    @li                value is equal to CSL_SOK.
 * 
 *   <b> Pre Condition </b>
 *   @n  @a The DDR2 must be successfully initialized via CSL_ ddr2Init() 
 *          before calling this function.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b  Modifies
 *   @n  None
 *
 *   @b Example:
 *   @verbatim
         CSL_Status         status;
         CSL_Ddr2Obj        ddr2Obj;
         CSL_Ddr2Handle     hDdr2;
 
         hDdr2 = CSL_Ddr2Open(&ddr2Obj,
                              CSL_DDR2,
                              NULL,
                              &status
                             );
     @endverbatim
 *
 * ===========================================================================
 */
CSL_Ddr2Handle CSL_ddr2Open (
    CSL_Ddr2Obj      *pDdr2Obj,
    CSL_InstNum      ddr2Num,
    CSL_Ddr2Param    *pDdr2Param,
    CSL_Status       *pStatus
);

/** ===========================================================================
 *   @n@b csl_ddr2Close.c                                                       
 *                                                                             
 *   @b Description                                                            
 *   @n This function marks that CSL for the external memory interface instance 
 *      is CSL for the external memory interface instance need to be reopened 
 *      before external memory interface CSL API.                                        
 *                                                                             
 *   @b Arguments                                                              
 *   @verbatim                                                                 
            hDdr2         Pointer to the object that holds reference to the
                          instance of DDR2 requested after the call        
     @endverbatim                                                              
 *                                                                             
 *   <b> Return Value </b>  CSL_Status                                         
 *   @li                    CSL_SOK            - external memory interface is 
 *                                               close successfully                  
 *                                                                             
 *   @li                    CSL_ESYS_BADHANDLE - The handle passed is invalid  
 *                                                                             
 *   <b> Pre Condition </b>                                                    
 *   @n  Both @a CSL_ddr2Init() and @a CSL_ddr2Open() must be called 
 *     successfully in that order before @a CSL_ddr2Close() can be called.
 *                                                                             
 *   <b> Post Condition </b>                                                   
 *   @n  1. The external memory interface CSL APIs can not be called until the    
 *          external memory interface CSL is reopened again using CSL_ddr2Open()   
 *                                                                             
 *   @b Modifies                                                               
 *   @n  hDdr2 structure                                                                 
 *                                                                             
 *   @b Example                                                                
 *   @verbatim                                                                 
            CSL_Ddr2Handle   hDdr2;                                              
                                                                               
            ...                                                                
                                                                               
            CSL_ddr2Close (hDdr2);                                               
                                                                               
            ...                                                                
     @endverbatim     
 *
 * ============================================================================
 */               
CSL_Status  CSL_ddr2Close (
    CSL_Ddr2Handle    hDdr2
);

/** ===========================================================================
 *   @n@b CSL_ddr2GetBaseAddress
 *
 * @b Description
 * @n Function to get the base address of the peripheral instance.
 *    This function is used for getting the base address of the peripheral
 *    instance. This function will be called inside the CSL_mcbspOpen()
 *    function call.
 *
 *   @b Arguments
 *   @verbatim      
            ddr2Num         Specifies the instance of the DDR2 external memory
                            interface for which the base address is requested
 
            pDdr2Param      Module specific parameters.
 
            pBaseAddress    Pointer to the base address structure to return the
                            base address details.
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_OK            Open call is successful
 *   @li                    CSL_ESYS_FAIL     The external memory interface 
 *                                            instance is not available.
 *
 *   <b> Pre Condition </b>
 *   @n  @a CSL_ddr2Init() and CSL_ddr2Open () must be called successfully.
 *
 *   <b> Post Condition </b>
 *   @n  Base address structure is populated
 *
 *   @b Modifies
 *   @n    1. The status variable
 *
 *         2. Base address structure.
 *
 *   @b Example

⌨️ 快捷键说明

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