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

📄 csl_spihwcontrol.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_spiHwControl.c * *  @brief    File for functional layer of CSL API @a CSL_spiHwControl() * *  Description *    - The @a CSL_spiHwControl() function definition & it's associated *      functions * *  Path: \\(CSLPATH)\\ipmodules\\spi\\src * *  Modification 1 *    - modified on: 26/12/2003 *    - reason: created the sources * *  Modification 2 *    - modified on: 05/01/2004 *    - reason: created better documentation * *  Modification 3 *    - modified on: 01/03/2004 *    - reason: modified according to review comments * *  Modification 4 *    - modified on: 10/05/2004 *    - reason: removed MIB from code & documentation * *  Date 26th Dec, 2003 *  Author Sumant S. NaikKhanvte *//* ============================================================================= *  Revision History *  =============== *  11-oct-2004 HMM Updated code review comments *  01-Sep-2004 HMM File Updated. * ============================================================================= */#include <csl_spi.h>#include <csl_spiAux.h>/** ============================================================================ *   @n@b CSL_spiHwControl * *   @b Description *   @n This function performs various control operations on the SPI instance, *      based on the command passed. * *   @b Arguments * @verbatim            hSpi         Handle to the SPI instance            cmd          Operation to be performed on the SPI            cmdArg       Arguement specific to the command   @endverbatim * *   <b> Return Value </b>  CSL_Status *   @li                    CSL_SOK            - Command execution successful. *   @li                    CSL_ESYS_BADHANDLE - Invalid handle *   @li                    CSL_ESYS_INVCMD    - Invalid command * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *   @n  Registers of the SPI instance are configured according to the command *       and the command arguments. The command determines which registers are *       modified. * *   @b Modifies *   @n Registers determined by the command * *   @b Example *   @verbatim        CSL_Status status;        status  = CSL_spiHwControl (hSpi, CSL_SPI_CMD_CPT_DMA_ENABLE, NULL);     @endverbatim * =========================================================================== */#pragma CODE_SECTION (CSL_spiHwControl, ".text:csl_section:spi")CSL_Status CSL_spiHwControl (    CSL_SpiHandle              hSpi,    CSL_SpiHwControlCmd        cmd,    void                      *arg){    CSL_Status status = CSL_SOK;    if (hSpi == NULL) {        return CSL_ESYS_BADHANDLE;    }    switch (cmd) {        case CSL_SPI_CMD_PRI_RESET:            CSL_spiPriResetOut(hSpi);            break;        case CSL_SPI_CMD_POWER_UP:            CSL_spiPwr(hSpi, CSL_SPI_PWRSTAT_ACTIVE);            break;        case CSL_SPI_CMD_POWER_DOWN:            CSL_spiPwr(hSpi, CSL_SPI_PWRSTAT_DOWN);            break;        case CSL_SPI_CMD_CPT_DMA_ENABLE:            CSL_spiCptDma(hSpi, CSL_SPI_CPTDMA_ENABLE);            break;        case CSL_SPI_CMD_CPT_DMA_DISABLE:            CSL_spiCptDma(hSpi, CSL_SPI_CPTDMA_DISABLE);            break;        case CSL_SPI_CMD_CPT_WRITE0:            CSL_spiCptWrite0(hSpi, *(Uint16 *)arg);            break;        case CSL_SPI_CMD_CPT_WRITE1:            CSL_spiCptWrite1(hSpi, *(Uint16 *)arg);            break;        case CSL_SPI_CMD_CPT_READ:            CSL_spiCptRead(hSpi,                           &(((CSL_SpiCptData *)arg)->data),                           ((CSL_SpiCptData *)arg)->bufStat);            break;        case CSL_SPI_CMD_INT_ENABLE:        case CSL_SPI_CMD_INT_DISABLE:            CSL_spiInt(hSpi, cmd, *(Uint16 *)arg);            break;        case CSL_SPI_CMD_PINS_SET:        case CSL_SPI_CMD_PINS_CLEAR:        case CSL_SPI_CMD_PINS_VALUE:            CSL_spiPins(hSpi, cmd, *(Uint32 *)arg);            break;        case CSL_SPI_CMD_XFER_ENABLE:            CSL_spiXferCtrl(hSpi, CSL_SPI_XFEREN_ENABLE);            break;        case CSL_SPI_CMD_XFER_DISABLE:            CSL_spiXferCtrl(hSpi, CSL_SPI_XFEREN_DISABLE);            break;        default:            status = CSL_ESYS_INVCMD;    }    return status;}

⌨️ 快捷键说明

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