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

📄 csl_emifgethwstatus.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/*  ============================================================================
 *   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_emifGetHwStatus.c
 *
 *    @brief    File for functional layer of CSL API @a CSL_emifGetHwStatus()
 *
 *    Path: \\(CSLPATH)\\ipmodules\\emifs\\src
 *
 *  Description
 *    - The @a CSL_emifGetHwStatus() function definition & it's associated
 *      functions
 *
 *  Modification 1
 *    - Created on: 23/6/2004
 *    - Reason: created the sources
 *
 *  @date 23rd June, 2004
 *  @author Santosh Narayanan.
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  30-Aug-2004  brn              Updated the source for the new CSL architecture
 *  11-Oct-2004  brn              File updated with the review comments
 * =============================================================================
 */

#include <csl_emif.h>
#include <csl_emifAux.h>

/** ============================================================================
 * @n@b   CSL_emifGetHwStatus
 *
 * @b Description
 * @n This function is used to read the current device configuration, status flags
 *  and the value present associated registers. Following table details the
 *  various status queries supported and the associated data structure to record
 *  the response. User should allocate memory for the said data type and pass
 *  its pointer as an unadorned void* argument to the status query call. For
 *  details about the various status queries supported and the associated data
 *  structure to record the response, refer to @a CSL_EmifHwStatusQuery
 *
 *   @b Arguments
 *   @verbatim
            hEmif           Handle to the EMIF instance

            query           Query to be performed

            response        Pointer to buffer to return the data requested by
                            the query passed
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK            - Successful completion of the
 *                                               query
 *
 *   @li                    CSL_ESYS_BADHANDLE - Invalid handle
 *
 *   @li                    CSL_ESYS_INVQUERY  - Query command not supported
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *       Data requested by the query is returned through the variable "response"
 *
 *   @b Modifies
 *   @n  The input arguement "response" is modified
 *
 *  <b> Usage Constraints: </b>
 *  Both @a CSL_emifInit() and @a CSL_emifOpen() must be called successfully
 *  in that order before @a CSL_emifGetHwStatus() can be called. For the
 *  argument type that can be @a void* casted & passed with a particular command
 *  refer to @a CSL_EmifHwStatusQuery
 *
 * @b Example:
 * @verbatim
      CSL_EmifHandle hEmif;
      CSL_Status status;
      Uint16  *response;
       ...
      status = CSL_emifGetHwStatus(hEmif,
                           CSL_EMIF_QUERY_BUS_BUSY,
                                  &response);
   @endverbatim
 *
 *
 * ============================================================================
 */
#pragma CODE_SECTION (CSL_emifGetHwStatus,".text:csl_section:emif");
CSL_Status  CSL_emifGetHwStatus(
    /** Pointer to the object that holds reference to the
     *  instance of EMIF requested after the call
     */
    CSL_EmifHandle                         hEmif,
    /** The query to this API which indicates the status
     *  to be returned
     */
    CSL_EmifHwStatusQuery                  query,
    /** Placeholder to return the status. @a void* casted */
    void                                   *response
)
{
    CSL_Status status = CSL_SOK;

    if(hEmif == NULL) {
        status = CSL_ESYS_BADHANDLE;
        return status;
    }

    switch(query) {
        case CSL_EMIF_QUERY_REV_ID_STATUS:
            CSL_emifGetRevId (hEmif, (CSL_EmifRevStatus *) response);
            break;

        case CSL_EMIF_QUERY_ENDIANNESS:
            *((Uint16 *)response) = CSL_emifGetEndiannes (hEmif);
            break;

        case CSL_EMIF_QUERY_RATE:
            *(Uint16 *)response = CSL_emifGetRateStatus (hEmif);
            break;

        case CSL_EMIF_QUERY_DDR_STATUS:
            CSL_emifGetDdrStatus (hEmif, (CSL_EmifDdrStatus *) response);
            break;

        case CSL_EMIF_QUERY_DDR_PHY_STATUS:
            CSL_emifGetDdrPhyStatus (hEmif, (CSL_EmifDdrPhyStatus *) response);
            break;

        case CSL_EMIF_QUERY_SDRAM_ACCESS:
            *(Uint32 *)response = CSL_emifGetSdramAccess (hEmif);
            break;

        case CSL_EMIF_QUERY_SDRAM_ACTIVATE:
            *(Uint32 *)response =  CSL_emifGetSdramActive (hEmif);
            break;

        case CSL_EMIF_QUERY_DDR_ID_REV:
            *(Uint32 *)response = CSL_emifGetDdrIdRev (hEmif);
            break;

        case CSL_EMIF_QUERY_LT_INT_STATUS:
            *(Uint16 *)response = CSL_emifGetLtIntStatus (hEmif);
            break;

        case CSL_EMIF_QUERY_AT_INT_STATUS:
            *(Uint16 *)response = CSL_emifGetAtIntStatus (hEmif);
            break;

        case CSL_EMIF_QUERY_IO_STATUS:
            *(Uint16 *)response = CSL_emifGetIoStatus (hEmif);
            break;

        case CSL_EMIF_QUERY_NAND_FLASH_STATUS:
            *(Uint16 *)response = CSL_emifGetNandFlashStatus (hEmif);
            break;

        case CSL_EMIF_QUERY_CS5_NAND_FLASH_ECC:
            CSL_emifGetCS5NandFlashEcc (hEmif,
                                         (CSL_EmifNandFlashECC *) response);
            break;

        case CSL_EMIF_QUERY_CS4_NAND_FLASH_ECC:
            CSL_emifGetCS4NandFlashEcc (hEmif,
                                         (CSL_EmifNandFlashECC *) response);
            break;

        case CSL_EMIF_QUERY_CS3_NAND_FLASH_ECC:
            CSL_emifGetCS3NandFlashEcc (hEmif,
                                         (CSL_EmifNandFlashECC *) response);
            break;

        case CSL_EMIF_QUERY_CS2_NAND_FLASH_ECC:
            CSL_emifGetCS2NandFlashEcc (hEmif,
                                         (CSL_EmifNandFlashECC *) response);
            break;

        default:
            status = CSL_ESYS_INVQUERY ;
            break;
    }
    return status;
}

⌨️ 快捷键说明

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