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

📄 csl_spiaux.h

📁 Configuring External Interrupts on TMS320C672x Devices
💻 H
📖 第 1 页 / 共 2 页
字号:
 * *   @b Example *   @verbatim        CSL_spiCptDma (hSpi, dmaEn);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiCptDma(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiCptDma                  dmaEn){	CSL_FINS(hSpi->regs->SPIINT0, SPI_SPIINT0_DMAREQEN, dmaEn);}/** ============================================================================ *   @n@b CSL_spiCptWrite0 * *   @b Description *   @n This function writes data on the SPI. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            val             data to be written     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiCptWrite0 (hSpi, val);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiCptWrite0(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    Uint16                         val){	CSL_FINS(hSpi->regs->SPIDAT0, SPI_SPIDAT0_SPIDAT0, val);}/** ============================================================================ *   @n@b CSL_spiCptWrite1 * *   @b Description *   @n This function writes data on the SPI. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            val             value to be written     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiCptWrite1 (hSpi, val);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiCptWrite1(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    Uint16                         val){	CSL_FINS(hSpi->regs->SPIDAT1, SPI_SPIDAT1_SPIDAT1, val);}/** ============================================================================ *   @n@b CSL_spiCptRead * *   @b Description *   @n This function reads the SPI data buffer. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            *data           pointer to the buffer that receives data            *bufStat        pointer to the buffer status register     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiCptRead (hSpi, &data, &bufStat);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiCptRead(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    Uint16                         *data,    CSL_SpiBufStat                 *bufStat){	Uint32 temp = hSpi->regs->SPIBUF;	*data = CSL_FEXT(temp, SPI_SPIBUF_SPIBUF);	if (bufStat) {		bufStat->status = CSL_FEXTR(temp, 31, 25);	}}/** ============================================================================ *   @n@b CSL_spiInt * *   @b Description *   @n This function initializes the SPI module. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            cmd             command to enable or disable interrupts            intVal          interrupt value     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiInt (hSpi, cmd, intVal);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiInt(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiHwControlCmd            cmd,    Uint16                         intVal){	if (CSL_SPI_CMD_INT_ENABLE == cmd) {		hSpi->regs->SPIINT0 |= intVal;	}	else if (CSL_SPI_CMD_INT_DISABLE == cmd) {		hSpi->regs->SPIINT0 &= ~intVal;	}}/** ============================================================================ *   @n@b CSL_spiPins * *   @b Description *   @n This function sets/clears the PC3/4/5 registers of the SPI module. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            cmd             command to set the PC3/4/5 registers            pinVal          value to be set     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiPins (hSpi, cmd, pinVal);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiPins(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiHwControlCmd            cmd,    Uint32                         pinVal){	if (CSL_SPI_CMD_PINS_VALUE == cmd) {		hSpi->regs->SPIPC3 = pinVal;	}	else if (CSL_SPI_CMD_PINS_SET == cmd) {		hSpi->regs->SPIPC4 = pinVal;	}	else if (CSL_SPI_CMD_PINS_CLEAR == cmd) {		hSpi->regs->SPIPC5 = pinVal;	}}/** ============================================================================ *   @n@b CSL_spiXferCtrl * *   @b Description *   @n This function configures the transmission params for the SPI module. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            xferEn          Enable/hiold the SPI in reset     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiXferCtrl (hSpi, xferEn);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiXferCtrl(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiXferEn                  xferEn){	CSL_FINS(hSpi->regs->SPIGCR1, SPI_SPIGCR1_ENABLE, xferEn);}/** ============================================================================ *   @n@b CSL_spiHwSetupPriFmt * *   @b Description *   @n This function sets up the SPI a/c to Hwsetup structure of SPI. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            fmtNum          Format register            *confFmt        pointer to h/w setup fmt structure     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiHwSetupPriFmt (hSpi, fmtNum, &conffmt);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiHwSetupPriFmt(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    /** instance number of the format register to setup */    Uint8                          fmtNum,    /** setup structure for the format register */    CSL_SpiHwSetupPriFmt           *confFmt){	hSpi->regs->SPIFMT[fmtNum] = CSL_FMK(SPI_SPIFMT_WDELAY,		confFmt->wDelay) |		CSL_FMK(SPI_SPIFMT_PRESCALE,		confFmt->preScale) |		CSL_FMK(SPI_SPIFMT_CHARLEN,		confFmt->charLen) |		CSL_FMK(SPI_SPIFMT_WAITENA,		confFmt->waitEna) |		CSL_FMK(SPI_SPIFMT_POLARITY,		confFmt->polarity) |		CSL_FMK(SPI_SPIFMT_PHASE,		confFmt->phase) |		CSL_FMK(SPI_SPIFMT_SHIFTDIR,		confFmt->shiftDir);}/** ============================================================================ *   @n@b CSL_spiHwSetupCptInt * *   @b Description *   @n This function sets the interrupt level of the SPI module. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            intVal          bit-vector for interrupts     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiHwSetupCptInt (hSpi, intVal);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiHwSetupCptInt(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    /** bit-vector for interrupts */    Uint32                         intVal){	hSpi->regs->SPILVL = intVal;}/** ============================================================================ *   @n@b CSL_spiHwSetupGen * *   @b Description *   @n This function does the hardware setup of the SPI module. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            *genPtr         pointer to the HW setup gen structure     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiHwSetupGen (hSpi, &genPtr);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiHwSetupGen(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiHwSetupGen              *genPtr){	CSL_SpiRegsOvly regsPtr = hSpi->regs;	Uint32 temp;	temp = regsPtr->SPIGCR1;	CSL_FINS(temp, SPI_SPIGCR1_CLKMOD, CSL_FEXTR(genPtr->opMode, 1, 1));	CSL_FINS(temp, SPI_SPIGCR1_MASTER, CSL_FEXTR(genPtr->opMode, 0, 0));	regsPtr->SPIGCR1 = temp;	CSL_FINS(regsPtr->SPIINT0, SPI_SPIINT0_ENABLEHIGHZ, genPtr->enaHiZ);	temp = CSL_FMK(SPI_SPIDELAY_C2TDELAY, genPtr->c2tDelay) |		CSL_FMK(SPI_SPIDELAY_T2CDELAY, genPtr->t2cDelay) |		CSL_FMK(SPI_SPIDELAY_T2EDELAY, genPtr->t2eTmout) |		CSL_FMK(SPI_SPIDELAY_C2EDELAY, genPtr->c2eTmout);	regsPtr->SPIDELAY = temp;}/** ============================================================================ *   @n@b CSL_spiHwSetupGpio * *   @b Description *   @n This function sets up the PC0/1/6/7 registers of the SPI module. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            gpioType        gpiotype            value           value to be set     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiHwSetupGpio (hSpi, gpioType, value);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiHwSetupGpio(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiGpioType               gpioType,    Uint32                         value){	if(gpioType == CSL_SPI_GPIOTYPE_FUNC){		hSpi->regs->SPIPC0 = value;	}	if(gpioType ==  CSL_SPI_GPIOTYPE_DIR){		hSpi->regs->SPIPC1 = value;       	}}/** ============================================================================*   @n@b CSL_spiHwSetupCptFmtCtrl**   @b Description*   @n This function sets up the SPI a/c to fmtCtrl structure. * *   @b Arguments *   @verbatim            hSpi            Handle to SPI instance            *fmtCtrlPtr     pointer to the fmtCtrl Structure     @endverbatim * *   <b> Return Value </b>  None * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *    @n None * *   @b Modifies *   @n  None * *   @b Example *   @verbatim        CSL_spiHwSetupCptFmtCtrl (hSpi, &fmtCtrlPtr);     @endverbatim * =========================================================================== */static inlinevoid CSL_spiHwSetupCptFmtCtrl(    /** pointer to the object that holds reference to the    * instance of SPI requested after the call */    CSL_SpiHandle                  hSpi,    CSL_SpiHwSetupFmtCtrl          *fmtCtrlPtr){	Uint32 temp;	temp = CSL_FMK(SPI_SPIDAT1_CSHOLD, fmtCtrlPtr->csHold) |		CSL_FMK(SPI_SPIDAT1_WDEL, fmtCtrlPtr->wDel) |		CSL_FMK(SPI_SPIDAT1_DFSEL, fmtCtrlPtr->fmtSel) |		CSL_FMK(SPI_SPIDAT1_CSNR, fmtCtrlPtr->cSel);	CSL_FINSR(hSpi->regs->SPIDAT1, 32, 16, CSL_FEXTR(temp, 32, 16));}#ifdef __cplusplus}#endif#endif /* _CSLR_SPI_H_ */

⌨️ 快捷键说明

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