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

📄 csl_mmcsdhwcontrol.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_mmcsdHwControl.c
 *
 *  \brief    File for functional layer of CSL API \a CSL_mmcsdHwControl()
 *  
 *  Description
 *    - The \a CSL_mmcsdHwControl() function definition & it's associated
 *      functions
 *  Path: \\(CSLPATH)\\ipmodules\\mmcsd\\src
 *  \date   10 May, 2004
 *  \author Pratheesh Gangadhar
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  12-Oct-2004 Hs Added code to validate input parameter hMmcsd
 *                 Removed variable stat
 *  31-aug-2004 Hs Updated the CSL_mmcsdHwControl to call respective functions.
 * =============================================================================
 */

#include <csl_mmcsd.h>
#include <csl_mmcsdAux.h>

/** ============================================================================
 *   @n@b CSL_mmcsdHwControl
 *
 *   @b Description
 *   @n Takes a command of mmcsd with an optional argument & implements it.
 *
 *   @b Arguments
 *   @verbatim
            hMmcsd          Handle to the mmcsd instance

            cmd             The command to this API indicates the action to be
                            taken on mmcsd.

            arg             An optional argument.

     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li         CSL_SOK               - Status info return successful.
 *   @li         CSL_ESYS_BADHANDLE    - Invalid handle
 *   @li         CSL_ESYS_INVCMD       - Invalid command
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n The hardware registers of mmcsd.
 *
 *   @b Example
 *   @verbatim
        CSL_MmcsdHandle         hMmcsd;
        CSL_MmcsdHwControlCmd   cmd;
        void                    arg;

        status = CSL_mmcsdHwControl (hMmcsd, cmd, &arg);

     @endverbatim
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_mmcsdHwControl, ".text:csl_section:mmcsd");
CSL_Status CSL_mmcsdHwControl (
    CSL_MmcsdHandle hMmcsd,
    CSL_MmcsdHwControlCmd cmd,
    void *arg
)
{
    CSL_Status status = CSL_SOK;

    /* MISTRAL: Hs Added code to validate input argument hMmcsd
     * according to review comment no. 2
     */
    
    if (hMmcsd == NULL)
        return CSL_ESYS_INVPARAMS;
  
    switch (cmd) {
        case CSL_MMCSD_CMD_RESET:
            CSL_mmcsdReset (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_ENABLE:
            CSL_mmcsdEnable (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_INITSEQ_SEND:
            CSL_mmcsdInitSeqSend (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_SET_SD_BUSWIDTH:
            /* MMC controller must be in RESET state */
            CSL_mmcsdSetSdBusWidth (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SET_BLKSIZE:
            CSL_mmcsdSetBlkSize (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SET_NUMBLKS:
            CSL_mmcsdSetNumBlks (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SEND_CMD:
            /* See the need to implement preconditions like clear status and
             * clear response  here
             */
            CSL_mmcsdSendCmd (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_READ_WORD:
            CSL_mmcsdReadWord (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_WRITE_WORD:
            CSL_mmcsdWriteWord (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_READ:
            /* Check the function implementation also. */
            CSL_mmcsdRead (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_WRITE:
            /* Check the function implementation also. */
            CSL_mmcsdWrite (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_INTR_ENABLE:
            CSL_mmcsdIntrEnable (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_INTR_DISABLE:
            CSL_mmcsdIntrDisable (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SET_ACCESS_WIDTH:
            CSL_mmcsdSetAccessWidth (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SET_FIFO_THRESHOLD:
            CSL_mmcsdSetFifoThreshold (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SET_FIFO_DIR:
            CSL_mmcsdSetFifoDir (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_RESET_FIFO:
            CSL_mmcsdResetFifo (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_CLEAR_STATUS:
            CSL_mmcsdClearStatus (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_CLEAR_RESPONSE:
            CSL_mmcsdClearResponse (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_SDIO_ENABLE_RDWT_CRC:
            CSL_mmcsdSdioEnableRdwtCrc (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_SDIO_START_RDWT:
            CSL_mmcsdSdioStartRdwt (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_SDIO_END_RDWT:
            CSL_mmcsdSdioEndRdwt (hMmcsd);
            break;
      
        case CSL_MMCSD_CMD_SDIO_INTR_ENABLE:
            CSL_mmcsdSdioIntrEnable (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SDIO_INTR_DISABLE:
            CSL_mmcsdSdioIntrDisable (hMmcsd, arg);
            break;
      
        case CSL_MMCSD_CMD_SDIO_CLEAR_STATUS:
            /* Write 1 to clear */
            CSL_mmcsdSdioClearStatus (hMmcsd, arg);
            break;
      
        default:
            status = CSL_ESYS_INVCMD;
            break;
    }

    return status;
}

⌨️ 快捷键说明

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