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

📄 csl_spigethwsetup.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_spiGetHwSetup.c * *  @brief    File for functional layer of CSL API @a CSL_spiGetHwStatus() * *  Description *    - The @a CSL_spiGetHwStatus() function definition & it's associated *      functions * *  Path: \\(CSLPATH)\\ipmodules\\spi\\src * *  Modification 1 *    - modified on: 15/12/2003 *    - reason: created the sources * *  Modification 2 *    - modified on: 19/12/2003 *    - 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 15th 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>/** @brief Format number */#define CSL_SPI_FMT_NO 4/** ============================================================================ *   @n@b CSL_spiGetHwSetup * *   @b Description *   @n It retrives the hardware setup parameters * *   @b Arguments * @verbatim            hSpi            Handle to the SPI instance            hwSetup         Pointer to hardware setup structure   @endverbatim * *   <b> Return Value </b>  CSL_Status *   @li                    CSL_SOK             - Hardware setup retrieved *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *   @n  The hardware set up structure will be populated with values from *       the registers * *   @b Modifies *   @n None * *   @b Example *   @verbatim        CSL_status          status;        CSL_SpiHwSetup      hwSetup;        status = CSL_spiGetHwsetup (hSpi, &hwSetup);     @endverbatim * =========================================================================== */#pragma CODE_SECTION (CSL_spiGetHwSetup, ".text:csl_section:spi");CSL_Status CSL_spiGetHwSetup (    CSL_SpiHandle               hSpi,    CSL_SpiHwSetup             *setup){    int fmtNo;    CSL_Status status = CSL_SOK;    if (hSpi == NULL) {        return CSL_ESYS_BADHANDLE;    }    if ((setup == NULL)          ||        (setup->cptPtr == NULL)  ||        (setup->genPtr == NULL)  ||        (setup->pinsPtr == NULL) ||        (setup->priPtr == NULL)) {        return CSL_ESYS_INVPARAMS;    }    if (setup->pinsPtr) {        CSL_SpiHwSetupPins *pinsPtr = setup->pinsPtr;        if (pinsPtr->func) {            CSL_spiGetHwSetupGpio(hSpi,CSL_SPI_GPIOTYPE_FUNC, pinsPtr->func);        }        if (pinsPtr->dir) {            CSL_spiGetHwSetupGpio(hSpi, CSL_SPI_GPIOTYPE_DIR, pinsPtr->dir);        }        if (pinsPtr->pullCtrl) {            CSL_spiGetHwSetupGpio(hSpi,                                  CSL_SPI_GPIOTYPE_PULLCTRL,                                  pinsPtr->pullCtrl);        }        if (pinsPtr->opnDrain) {            CSL_spiGetHwSetupGpio(hSpi,                                  CSL_SPI_GPIOTYPE_OPNDRAIN,                                  pinsPtr->opnDrain);        }    }    if (setup->cptPtr) {        CSL_SpiHwSetupCpt *cptPtr = setup->cptPtr;        if (cptPtr->lvl) {            CSL_spiGetHwSetupCptInt(hSpi, cptPtr->lvl);        }        if (cptPtr->fmtCtrlPtr) {            /* assuming that SPIDAT1 bug will get fixed */            CSL_spiGetHwSetupCptFmtCtrl(hSpi, cptPtr->fmtCtrlPtr);        }    }    if (setup->priPtr) {        CSL_SpiHwSetupPri *priPtr = setup->priPtr;        CSL_SpiHwSetupPriFmt **fmt = priPtr->fmt;        for (fmtNo = 0; fmtNo < CSL_SPI_FMT_NO; fmtNo++) {            if (*fmt) {                CSL_spiGetHwSetupPriFmt(hSpi, fmtNo, *fmt);            }            fmt++;        }    }    if (setup->genPtr) {        CSL_spiGetHwSetupGen(hSpi, setup->genPtr);    }    return status;}

⌨️ 快捷键说明

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