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

📄 csl_spihwsetupraw.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_spiHwSetupRaw.c * *  @brief File for functional layer of CSL API @a CSL_spiHwSetupRaw() * *  Description *    - The @a CSL_spiHwSetupRaw() function definition & it's associated *      functions * *  Path: \\(CSLPATH)\\ipmodules\\spi\\src *//* ============================================================================= *  Revision History *  =============== *  11-oct-2004 Hs Updated code review comments *  01-Sep-2004 Hs File Created. * ============================================================================= */#include <csl_spi.h>/** ============================================================================ *   @n@b CSL_spiHwSetupRaw * *   @b Description *   @n This function initializes the device registers with the register-values *      provided through the Config Data structure. * *   @b Arguments *   @verbatim            hSpi            Handle to the SPI            config          Pointer to config structure     @endverbatim * *   <b> Return Value </b>  CSL_Status *   @li                    CSL_SOK             - Configuration successful *   @li                    CSL_ESYS_BADHANDLE  - Invalid handle *   @li                    CSL_ESYS_INVPARAMS  - Configuration is not *                                                properly initialized * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *   @n  The registers of the specified SPI instance will be setup *       according to value passed. * *   @b Modifies *   @n Hardware registers of the specified SPI instance. * *   @b Example *   @verbatim        CSL_SpiHandle       hSpi;        CSL_SpiConfig       config = CSL_SPI_CONFIG_DEFAULTS;        CSL_Status          status;        status = CSL_spiHwSetupRaw (hSpi, &config);     @endverbatim * =========================================================================== */#pragma CODE_SECTION (CSL_spiHwSetupRaw, ".text:csl_section:spi");CSL_Status CSL_spiHwSetupRaw (    CSL_SpiHandle               hSpi,    CSL_SpiConfig              *config){    if (hSpi == NULL) {        return CSL_ESYS_BADHANDLE;    }    if (config == NULL ) {        return CSL_ESYS_INVPARAMS;    }    hSpi->regs->SPIGCR0     = config->SPIGCR0;    hSpi->regs->SPIGCR1     = config->SPIGCR1;    hSpi->regs->SPIINT0     = config->SPIINT0;    hSpi->regs->SPILVL      = config->SPILVL;    hSpi->regs->SPIFLG      = config->SPIFLG;    hSpi->regs->SPIPC0      = config->SPIPC0;    hSpi->regs->SPIPC1      = config->SPIPC1;    hSpi->regs->SPIPC2      = config->SPIPC2;    hSpi->regs->SPIPC3      = config->SPIPC3;    hSpi->regs->SPIPC4      = config->SPIPC4;    hSpi->regs->SPIPC5      = config->SPIPC5;    hSpi->regs->SPIPC6      = config->SPIPC6;    hSpi->regs->SPIPC7      = config->SPIPC7;    hSpi->regs->SPIPC8      = config->SPIPC8;    hSpi->regs->SPIDAT0     = config->SPIDAT0;    hSpi->regs->SPIDAT1     = config->SPIDAT1;    hSpi->regs->SPIDELAY    = config->SPIDELAY;    hSpi->regs->SPIDEF      = config->SPIDEF;    hSpi->regs->SPIFMT[0]   = config->SPIFMT[0];    hSpi->regs->SPIFMT[1]   = config->SPIFMT[1];    hSpi->regs->SPIFMT[2]   = config->SPIFMT[2];    hSpi->regs->SPIFMT[3]   = config->SPIFMT[3];    hSpi->regs->MIBSPIE     = config->MIBSPIE;    return CSL_SOK;}

⌨️ 快捷键说明

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