|
= |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
| #include <std.h> |
|
#include <std.h> |
| #include <assert.h> |
|
#include <assert.h> |
| #include <sys.h> |
|
#include <sys.h> |
| #include <iom.h> |
|
#include <iom.h> |
| #include <bcache.h> |
|
#include <bcache.h> |
| #include <sem.h> |
|
#include <sem.h> |
| |
|
|
| #ifdef Spi_EDMA_ENABLE |
|
#ifdef Spi_EDMA_ENABLE |
| |
|
|
| #include <ti/sdo/edma3/drv/edma3_drv.h> |
|
#include <ti/sdo/edma3/drv/edma3_drv.h> |
| #include <ti/pspiom/spi/Spi.h> |
|
#include <ti/pspiom/spi/Spi.h> |
| #include <ti/pspiom/gpio/Gpio.h> |
|
#include <ti/pspiom/gpio/Gpio.h> |
| #include "SpiLocal.h" |
|
#include "SpiLocal.h" |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
| static Void SpiUpdateError(Spi_ChanObj *chanHandle,Uint32 intStatus); |
|
static Void SpiUpdateError(Spi_ChanObj *chanHandle,Uint32 intStatus); |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Int Spi_localEdmaTransfer(Spi_Object *instHandle, |
|
Int Spi_localEdmaTransfer(Spi_Object *instHandle, |
| Spi_DataParam *dataParam) |
|
Spi_DataParam *dataParam) |
| { |
|
{ |
| Uint32 spidat1 = 0; |
|
Uint32 spidat1 = 0; |
| Spi_ChanObj *chanHandle = NULL; |
|
Spi_ChanObj *chanHandle = NULL; |
| Uint32 acntFlag = 1u; |
|
Uint32 acntFlag = 1u; |
| volatile Uint16 *spiDat1Cfg = NULL; |
|
volatile Uint16 *spiDat1Cfg = NULL; |
| EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0}; |
|
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0}; |
| Int32 status = IOM_COMPLETED; |
|
Int32 status = IOM_COMPLETED; |
| |
|
|
| assert(NULL != instHandle); |
|
assert(NULL != instHandle); |
| assert(NULL != dataParam); |
|
assert(NULL != dataParam); |
| chanHandle = instHandle->currentActiveChannel; |
|
chanHandle = instHandle->currentActiveChannel; |
| assert(NULL != chanHandle); |
|
assert(NULL != chanHandle); |
| |
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| if ((Spi_CSHOLD != (dataParam->flags & Spi_CSHOLD)) |
|
if ((Spi_CSHOLD != (dataParam->flags & Spi_CSHOLD)) |
| && (Spi_GPIO_CS == (dataParam->flags & Spi_GPIO_CS))) |
|
&& (Spi_GPIO_CS == (dataParam->flags & Spi_GPIO_CS))) |
| { |
|
{ |
| status = IOM_EBADARGS; |
|
status = IOM_EBADARGS; |
| } |
|
} |
| |
|
|
| if (IOM_COMPLETED == status) |
|
if (IOM_COMPLETED == status) |
| { |
|
{ |
| |
|
|
|
|
|
| spidat1 = Spi_localControlDataConfig( |
|
spidat1 = Spi_localControlDataConfig( |
| chanHandle, |
|
chanHandle, |
| dataParam->chipSelect, |
|
dataParam->chipSelect, |
| dataParam->dataFormat, |
|
dataParam->dataFormat, |
| dataParam->gpioPinNum, |
|
dataParam->gpioPinNum, |
| dataParam->flags); |
|
dataParam->flags); |
| |
|
|
| spiDat1Cfg = (((volatile Uint16 *) |
|
spiDat1Cfg = (((volatile Uint16 *) |
| (&(instHandle->deviceInfo.baseAddress)->SPIDAT1))+1); |
|
(&(instHandle->deviceInfo.baseAddress)->SPIDAT1))+1); |
| assert(NULL != spiDat1Cfg); |
|
assert(NULL != spiDat1Cfg); |
| |
|
|
| |
|
|
|
|
|
| *spiDat1Cfg = (Uint16)(spidat1 >> 16); |
|
*spiDat1Cfg = (Uint16)(spidat1 >> 16); |
| } |
|
} |
| |
|
|
| |
|
|
| if (IOM_COMPLETED == status) |
|
if (IOM_COMPLETED == status) |
| { |
|
{ |
| status = EDMA3_DRV_clearErrorBits( |
|
status = EDMA3_DRV_clearErrorBits( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| instHandle->deviceInfo.txDmaEventNumber); |
|
instHandle->deviceInfo.txDmaEventNumber); |
| } |
|
} |
| |
|
|
| if (IOM_COMPLETED == status) |
|
if (IOM_COMPLETED == status) |
| { |
|
{ |
| |
|
|
| while (CSL_SPI_SPIBUF_RXEMPTY_MASK |
|
while (CSL_SPI_SPIBUF_RXEMPTY_MASK |
| != ((instHandle->deviceInfo.baseAddress)->SPIBUF |
|
!= ((instHandle->deviceInfo.baseAddress)->SPIBUF |
| & CSL_SPI_SPIBUF_RXEMPTY_MASK)) |
|
& CSL_SPI_SPIBUF_RXEMPTY_MASK)) |
| { |
|
{ |
| (*chanHandle->rxBuffer) = |
|
(*chanHandle->rxBuffer) = |
| (Uint8)(instHandle->deviceInfo.baseAddress)->SPIBUF; |
|
(Uint8)(instHandle->deviceInfo.baseAddress)->SPIBUF; |
| } |
|
} |
| |
|
|
| |
|
|
| if (TRUE == chanHandle->charLength16Bits) |
|
if (TRUE == chanHandle->charLength16Bits) |
| { |
|
{ |
| acntFlag = 2u; |
|
acntFlag = 2u; |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| acntFlag = 1u; |
|
acntFlag = 1u; |
| } |
|
} |
| |
|
|
| if ((TRUE == chanHandle->rxBufFlag) && (TRUE == instHandle->enableCache)) |
|
if ((TRUE == chanHandle->rxBufFlag) && (TRUE == instHandle->enableCache)) |
| { |
|
{ |
| BCACHE_wbInv((Ptr)chanHandle->rxBuffer,chanHandle->rxBufferLen,TRUE); |
|
BCACHE_wbInv((Ptr)chanHandle->rxBuffer,chanHandle->rxBufferLen,TRUE); |
| } |
|
} |
| |
|
|
| |
|
|
|
|
|
| |
|
|
| EDMA3_DRV_getPaRAM ( |
|
EDMA3_DRV_getPaRAM ( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| instHandle->deviceInfo.rxDmaEventNumber, |
|
instHandle->deviceInfo.rxDmaEventNumber, |
| ¶mSet); |
|
¶mSet); |
| |
|
|
| |
|
|
| paramSet.srcAddr = (Uint32)(&((instHandle->deviceInfo.baseAddress)->SPIBUF)); |
|
paramSet.srcAddr = (Uint32)(&((instHandle->deviceInfo.baseAddress)->SPIBUF)); |
| paramSet.destAddr = (Uint32)(chanHandle->rxBuffer); |
|
paramSet.destAddr = (Uint32)(chanHandle->rxBuffer); |
| |
|
|
| |
|
|
| paramSet.srcBIdx = 0; |
|
paramSet.srcBIdx = 0; |
| paramSet.srcCIdx = 0; |
|
paramSet.srcCIdx = 0; |
| paramSet.destCIdx = 0; |
|
paramSet.destCIdx = 0; |
| |
|
|
| |
|
|
|
|
|
| if (FALSE == chanHandle->rxBufFlag) |
|
if (FALSE == chanHandle->rxBufFlag) |
| { |
|
{ |
| paramSet.destBIdx = 0; |
|
paramSet.destBIdx = 0; |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| paramSet.destBIdx = 1; |
<> |
paramSet.destBIdx = acntFlag; |
| } |
= |
} |
| |
|
|
| |
|
|
| if ((acntFlag > 0xFFFFu ) || (chanHandle->rxBufferLen > 0xFFFF )) |
|
if ((acntFlag > 0xFFFFu ) || (chanHandle->rxBufferLen > 0xFFFF )) |
| { |
|
{ |
| status = IOM_EBADIO; |
|
status = IOM_EBADIO; |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| paramSet.aCnt = (unsigned short)acntFlag; |
|
paramSet.aCnt = (unsigned short)acntFlag; |
| paramSet.bCnt = (unsigned short)chanHandle->rxBufferLen; |
<> |
paramSet.bCnt = ((unsigned short)chanHandle->rxBufferLen)/acntFlag; |
| } |
= |
} |
| |
|
|
| paramSet.cCnt = (Uint16)1; |
|
paramSet.cCnt = (Uint16)1; |
| paramSet.bCntReload = 0; |
|
paramSet.bCntReload = 0; |
| |
|
|
| |
|
|
| |
|
|
| paramSet.linkAddr = 0xFFFFu; |
|
paramSet.linkAddr = 0xFFFFu; |
| |
|
|
| |
|
|
| paramSet.opt &= 0xFFFFFFFCu; |
|
paramSet.opt &= 0xFFFFFFFCu; |
| |
|
|
| |
|
|
| paramSet.opt &= 0xFFFFF8FFu; |
|
paramSet.opt &= 0xFFFFF8FFu; |
| |
|
|
| |
|
|
| paramSet.opt &= 0xFFFFFFFBu; |
|
paramSet.opt &= 0xFFFFFFFBu; |
| |
|
|
| |
|
|
| paramSet.opt |= (1 << Spi_OPT_TCINTEN_SHIFT); |
|
paramSet.opt |= (1 << Spi_OPT_TCINTEN_SHIFT); |
| |
|
|
| |
|
|
| if (IOM_COMPLETED == status) |
|
if (IOM_COMPLETED == status) |
| { |
|
{ |
| |
|
|
| status = EDMA3_DRV_setPaRAM( |
|
status = EDMA3_DRV_setPaRAM( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| instHandle->deviceInfo.rxDmaEventNumber, |
|
instHandle->deviceInfo.rxDmaEventNumber, |
| ¶mSet); |
|
¶mSet); |
| } |
|
} |
| |
|
|
| |
|
|
| if (IOM_COMPLETED != status) |
|
if (IOM_COMPLETED != status) |
| { |
|
{ |
| SYS_printf("\nSPI Test: EDMA Param Setting failed" ); |
|
SYS_printf("\nSPI Test: EDMA Param Setting failed" ); |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| status = EDMA3_DRV_enableTransfer( |
|
status = EDMA3_DRV_enableTransfer( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| instHandle->deviceInfo.rxDmaEventNumber, |
|
instHandle->deviceInfo.rxDmaEventNumber, |
| EDMA3_DRV_TRIG_MODE_EVENT); |
|
EDMA3_DRV_TRIG_MODE_EVENT); |
| } |
|
} |
| |
|
|
| if (IOM_COMPLETED != status) |
|
if (IOM_COMPLETED != status) |
| { |
|
{ |
| SYS_printf("\nSPI Test: EDMA Transfer Enable failed" ); |
|
SYS_printf("\nSPI Test: EDMA Transfer Enable failed" ); |
| } |
|
} |
| |
|
|
| |
|
|
| |
|
|
| if ((TRUE == chanHandle->txBufFlag) && (TRUE == instHandle->enableCache)) |
|
if ((TRUE == chanHandle->txBufFlag) && (TRUE == instHandle->enableCache)) |
| { |
|
{ |
| |
|
|
| BCACHE_wbInv((Ptr)chanHandle->txBuffer,chanHandle->txBufferLen,TRUE); |
|
BCACHE_wbInv((Ptr)chanHandle->txBuffer,chanHandle->txBufferLen,TRUE); |
| } |
|
} |
| |
|
|
| |
|
|
| EDMA3_DRV_getPaRAM (instHandle->hEdma, |
|
EDMA3_DRV_getPaRAM (instHandle->hEdma, |
| instHandle->deviceInfo.txDmaEventNumber, |
|
instHandle->deviceInfo.txDmaEventNumber, |
| ¶mSet); |
|
¶mSet); |
| |
|
|
| |
|
|
| paramSet.srcAddr = (Uint32)(chanHandle->txBuffer); |
|
paramSet.srcAddr = (Uint32)(chanHandle->txBuffer); |
| paramSet.destAddr = (Uint32)(&((instHandle->deviceInfo.baseAddress)->SPIDAT1)); |
|
paramSet.destAddr = (Uint32)(&((instHandle->deviceInfo.baseAddress)->SPIDAT1)); |
| |
|
|
| |
|
|
| if (TRUE == chanHandle->txBufFlag) |
|
if (TRUE == chanHandle->txBufFlag) |
| { |
|
{ |
| paramSet.srcBIdx = 1; |
<> |
paramSet.srcBIdx = acntFlag; |
| } |
= |
} |
| else |
|
else |
| { |
|
{ |
| paramSet.srcBIdx = 0; |
|
paramSet.srcBIdx = 0; |
| } |
|
} |
| paramSet.srcCIdx = 0; |
|
paramSet.srcCIdx = 0; |
| paramSet.destBIdx = 0; |
|
paramSet.destBIdx = 0; |
| paramSet.destCIdx = 0; |
|
paramSet.destCIdx = 0; |
| |
|
|
| |
|
|
| if ((acntFlag > 0xFFFFu ) || (chanHandle->txBufferLen> 0xFFFFu)) |
|
if ((acntFlag > 0xFFFFu ) || (chanHandle->txBufferLen> 0xFFFFu)) |
| { |
|
{ |
| status = IOM_EBADIO; |
|
status = IOM_EBADIO; |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| paramSet.aCnt = (Uint16)acntFlag; |
|
paramSet.aCnt = (Uint16)acntFlag; |
| paramSet.bCnt = (Uint16)chanHandle->txBufferLen; |
<> |
paramSet.bCnt = ((Uint16)chanHandle->txBufferLen)/acntFlag; |
| } |
= |
} |
| |
|
|
| paramSet.cCnt = (Uint16)1; |
|
paramSet.cCnt = (Uint16)1; |
| paramSet.bCntReload = 0; |
|
paramSet.bCntReload = 0; |
| |
|
|
| |
|
|
| paramSet.linkAddr = 0xFFFFu; |
|
paramSet.linkAddr = 0xFFFFu; |
| |
|
|
| |
|
|
| paramSet.opt &= 0xFFFFFFFCu; |
|
paramSet.opt &= 0xFFFFFFFCu; |
| |
|
|
| |
|
|
| paramSet.opt &= 0xFFFFF8FFu; |
|
paramSet.opt &= 0xFFFFF8FFu; |
| |
|
|
| |
|
|
| paramSet.opt &= 0xFFFFFFFBu; |
|
paramSet.opt &= 0xFFFFFFFBu; |
| |
|
|
| |
|
|
| paramSet.opt |= (1 << Spi_OPT_TCINTEN_SHIFT); |
|
paramSet.opt |= (1 << Spi_OPT_TCINTEN_SHIFT); |
| |
|
|
| if (IOM_COMPLETED == status) |
|
if (IOM_COMPLETED == status) |
| { |
|
{ |
| |
|
|
| status = EDMA3_DRV_setPaRAM(instHandle->hEdma, |
|
status = EDMA3_DRV_setPaRAM(instHandle->hEdma, |
| instHandle->deviceInfo.txDmaEventNumber, |
|
instHandle->deviceInfo.txDmaEventNumber, |
| ¶mSet); |
|
¶mSet); |
| } |
|
} |
| |
|
|
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIINT0 |= |
|
(instHandle->deviceInfo.baseAddress)->SPIINT0 |= |
| CSL_SPI_SPIINT0_OVRNINTENA_MASK; |
|
CSL_SPI_SPIINT0_OVRNINTENA_MASK; |
| |
|
|
| if (IOM_COMPLETED != status) |
|
if (IOM_COMPLETED != status) |
| { |
|
{ |
| SYS_printf("SPI Test: EDMA Param Setting failed\n"); |
|
SYS_printf("SPI Test: EDMA Param Setting failed\n"); |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| Spi_localGpioPinToggle(chanHandle, Spi_LOW); |
|
Spi_localGpioPinToggle(chanHandle, Spi_LOW); |
| |
|
|
| |
|
|
|
|
|
| if(Spi_GPIO_CS == (dataParam->flags & Spi_GPIO_CS)) |
|
if(Spi_GPIO_CS == (dataParam->flags & Spi_GPIO_CS)) |
| { |
|
{ |
| Spi_localgenericDelay(dataParam->csToTxDelay); |
|
Spi_localgenericDelay(dataParam->csToTxDelay); |
| } |
|
} |
| |
|
|
| EDMA3_DRV_enableTransfer( |
|
EDMA3_DRV_enableTransfer( |
| (instHandle->hEdma), |
|
(instHandle->hEdma), |
| instHandle->deviceInfo.txDmaEventNumber, |
|
instHandle->deviceInfo.txDmaEventNumber, |
| EDMA3_DRV_TRIG_MODE_EVENT); |
|
EDMA3_DRV_TRIG_MODE_EVENT); |
| } |
|
} |
| |
|
|
| if (IOM_COMPLETED != status) |
|
if (IOM_COMPLETED != status) |
| { |
|
{ |
| SYS_printf("SPI Test: EDMA Transfer Enable failed\n"); |
|
SYS_printf("SPI Test: EDMA Transfer Enable failed\n"); |
| } |
|
} |
| |
|
|
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIGCR1 |= |
|
(instHandle->deviceInfo.baseAddress)->SPIGCR1 |= |
| (((Uint32)CSL_SPI_SPIGCR1_ENABLE_ENABLE) |
|
(((Uint32)CSL_SPI_SPIGCR1_ENABLE_ENABLE) |
| << ((Uint32)CSL_SPI_SPIGCR1_ENABLE_SHIFT)); |
|
<< ((Uint32)CSL_SPI_SPIGCR1_ENABLE_SHIFT)); |
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIINT0 |= |
|
(instHandle->deviceInfo.baseAddress)->SPIINT0 |= |
| (CSL_SPI_SPIINT0_DMAREQEN_ENABLE |
|
(CSL_SPI_SPIINT0_DMAREQEN_ENABLE |
| << CSL_SPI_SPIINT0_DMAREQEN_SHIFT); |
|
<< CSL_SPI_SPIINT0_DMAREQEN_SHIFT); |
| |
|
|
| } |
|
} |
| |
|
|
| |
|
|
| return (status) ; |
|
return (status) ; |
| } |
|
} |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Void Spi_localCallbackTransmit(Uns tcc, |
|
Void Spi_localCallbackTransmit(Uns tcc, |
| EDMA3_RM_TccStatus edmaStatus, |
|
EDMA3_RM_TccStatus edmaStatus, |
| Ptr appData) |
|
Ptr appData) |
| { |
|
{ |
| Spi_Object *instHandle = NULL; |
|
Spi_Object *instHandle = NULL; |
| Spi_ChanObj *chanHandle = NULL; |
|
Spi_ChanObj *chanHandle = NULL; |
| Uns ch_Tx = tcc; |
|
Uns ch_Tx = tcc; |
| Uint32 intStatus = 0x00; |
|
Uint32 intStatus = 0x00; |
| |
|
|
| assert(NULL != appData); |
|
assert(NULL != appData); |
| instHandle = (Spi_Object *)appData; |
|
instHandle = (Spi_Object *)appData; |
| assert(NULL != instHandle); |
|
assert(NULL != instHandle); |
| chanHandle = instHandle->currentActiveChannel; |
|
chanHandle = instHandle->currentActiveChannel; |
| |
|
|
| if(NULL != chanHandle) |
|
if(NULL != chanHandle) |
| { |
|
{ |
| |
|
|
| |
|
|
| EDMA3_DRV_disableLogicalChannel( |
|
EDMA3_DRV_disableLogicalChannel( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| ch_Tx, |
|
ch_Tx, |
| EDMA3_DRV_TRIG_MODE_EVENT); |
|
EDMA3_DRV_TRIG_MODE_EVENT); |
| |
|
|
| EDMA3_DRV_setOptField( |
|
EDMA3_DRV_setOptField( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| ch_Tx, |
|
ch_Tx, |
| EDMA3_DRV_OPT_FIELD_TCC, |
|
EDMA3_DRV_OPT_FIELD_TCC, |
| ch_Tx); |
|
ch_Tx); |
| |
|
|
| if (Spi_RX_EDMA_CALLBACK_OCCURED == instHandle->edmaCbCheck) |
|
if (Spi_RX_EDMA_CALLBACK_OCCURED == instHandle->edmaCbCheck) |
| { |
|
{ |
| intStatus = (instHandle->deviceInfo.baseAddress)->SPIFLG; |
|
intStatus = (instHandle->deviceInfo.baseAddress)->SPIFLG; |
| SpiUpdateError(chanHandle,intStatus); |
|
SpiUpdateError(chanHandle,intStatus); |
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
|
(instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
| (CSL_SPI_SPIINT0_DMAREQEN_DISABLE |
|
(CSL_SPI_SPIINT0_DMAREQEN_DISABLE |
| << CSL_SPI_SPIINT0_DMAREQEN_SHIFT); |
|
<< CSL_SPI_SPIINT0_DMAREQEN_SHIFT); |
| |
|
|
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIGCR1 &= |
|
(instHandle->deviceInfo.baseAddress)->SPIGCR1 &= |
| (~(CSL_SPI_SPIGCR1_ENABLE_MASK)); |
|
(~(CSL_SPI_SPIGCR1_ENABLE_MASK)); |
| |
|
|
| instHandle->edmaCbCheck = 0x0; |
|
instHandle->edmaCbCheck = 0x0; |
| |
|
|
| if(NULL != chanHandle->activeIOP) |
|
if(NULL != chanHandle->activeIOP) |
| { |
|
{ |
| if(EDMA3_RM_XFER_COMPLETE != edmaStatus) |
|
if(EDMA3_RM_XFER_COMPLETE != edmaStatus) |
| { |
|
{ |
| |
|
|
| EDMA3_DRV_clearErrorBits(instHandle->hEdma, ch_Tx); |
|
EDMA3_DRV_clearErrorBits(instHandle->hEdma, ch_Tx); |
| chanHandle->activeIOP->status = (Int32)edmaStatus; |
|
chanHandle->activeIOP->status = (Int32)edmaStatus; |
| instHandle->stats.txBytes += chanHandle->activeIOP->size; |
|
instHandle->stats.txBytes += chanHandle->activeIOP->size; |
| } |
|
} |
| |
|
|
|
|
|
| Spi_localGpioPinToggle(chanHandle, Spi_HIGH); |
|
Spi_localGpioPinToggle(chanHandle, Spi_HIGH); |
| spi_localCompleteIOedmaCallback(instHandle); |
|
spi_localCompleteIOedmaCallback(instHandle); |
| } |
|
} |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| if((EDMA3_RM_XFER_COMPLETE == edmaStatus)&& |
|
if((EDMA3_RM_XFER_COMPLETE == edmaStatus)&& |
| (NULL != chanHandle) && |
|
(NULL != chanHandle) && |
| (NULL != chanHandle->activeIOP)) |
|
(NULL != chanHandle->activeIOP)) |
| { |
|
{ |
| instHandle->edmaCbCheck = Spi_TX_EDMA_CALLBACK_OCCURED; |
|
instHandle->edmaCbCheck = Spi_TX_EDMA_CALLBACK_OCCURED; |
| } |
|
} |
| } |
|
} |
| } |
|
} |
| } |
|
} |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Void Spi_localCallbackReceive(Uns tcc, |
|
Void Spi_localCallbackReceive(Uns tcc, |
| EDMA3_RM_TccStatus edmaStatus, |
|
EDMA3_RM_TccStatus edmaStatus, |
| Ptr appData) |
|
Ptr appData) |
| { |
|
{ |
| Spi_Object *instHandle = NULL; |
|
Spi_Object *instHandle = NULL; |
| Spi_ChanObj *chanHandle = NULL; |
|
Spi_ChanObj *chanHandle = NULL; |
| Uns chan_Rx = tcc; |
|
Uns chan_Rx = tcc; |
| Uint32 intStatus = 0x00; |
|
Uint32 intStatus = 0x00; |
| |
|
|
| assert(NULL != appData); |
|
assert(NULL != appData); |
| instHandle = (Spi_Object *)appData; |
|
instHandle = (Spi_Object *)appData; |
| assert(NULL != instHandle); |
|
assert(NULL != instHandle); |
| chanHandle = instHandle->currentActiveChannel; |
|
chanHandle = instHandle->currentActiveChannel; |
| |
|
|
| if(NULL != chanHandle) |
|
if(NULL != chanHandle) |
| { |
|
{ |
| |
|
|
| EDMA3_DRV_disableLogicalChannel( |
|
EDMA3_DRV_disableLogicalChannel( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| chan_Rx, |
|
chan_Rx, |
| EDMA3_DRV_TRIG_MODE_EVENT); |
|
EDMA3_DRV_TRIG_MODE_EVENT); |
| |
|
|
| EDMA3_DRV_setOptField ( |
|
EDMA3_DRV_setOptField ( |
| (instHandle->hEdma), |
|
(instHandle->hEdma), |
| chan_Rx, |
|
chan_Rx, |
| EDMA3_DRV_OPT_FIELD_TCC, |
|
EDMA3_DRV_OPT_FIELD_TCC, |
| chan_Rx); |
|
chan_Rx); |
| |
|
|
| if (EDMA3_RM_XFER_COMPLETE != edmaStatus) |
|
if (EDMA3_RM_XFER_COMPLETE != edmaStatus) |
| { |
|
{ |
| |
|
|
| EDMA3_DRV_clearErrorBits(instHandle->hEdma, chan_Rx); |
|
EDMA3_DRV_clearErrorBits(instHandle->hEdma, chan_Rx); |
| } |
|
} |
| |
|
|
| if (Spi_TX_EDMA_CALLBACK_OCCURED == instHandle->edmaCbCheck) |
|
if (Spi_TX_EDMA_CALLBACK_OCCURED == instHandle->edmaCbCheck) |
| { |
|
{ |
| intStatus = (instHandle->deviceInfo.baseAddress)->SPIFLG; |
|
intStatus = (instHandle->deviceInfo.baseAddress)->SPIFLG; |
| |
|
|
| SpiUpdateError(chanHandle,intStatus); |
|
SpiUpdateError(chanHandle,intStatus); |
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
|
(instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
| (CSL_SPI_SPIINT0_DMAREQEN_DISABLE |
|
(CSL_SPI_SPIINT0_DMAREQEN_DISABLE |
| << CSL_SPI_SPIINT0_DMAREQEN_SHIFT); |
|
<< CSL_SPI_SPIINT0_DMAREQEN_SHIFT); |
| |
|
|
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIGCR1 &= |
|
(instHandle->deviceInfo.baseAddress)->SPIGCR1 &= |
| (~(CSL_SPI_SPIGCR1_ENABLE_MASK)); |
|
(~(CSL_SPI_SPIGCR1_ENABLE_MASK)); |
| |
|
|
| instHandle->edmaCbCheck = 0x0; |
|
instHandle->edmaCbCheck = 0x0; |
| |
|
|
| if(NULL != chanHandle->activeIOP) |
|
if(NULL != chanHandle->activeIOP) |
| { |
|
{ |
| if(EDMA3_RM_XFER_COMPLETE != edmaStatus) |
|
if(EDMA3_RM_XFER_COMPLETE != edmaStatus) |
| { |
|
{ |
| chanHandle->activeIOP->status = (Int32)edmaStatus; |
|
chanHandle->activeIOP->status = (Int32)edmaStatus; |
| instHandle->stats.rxBytes += chanHandle->activeIOP->size; |
|
instHandle->stats.rxBytes += chanHandle->activeIOP->size; |
| } |
|
} |
| |
|
|
|
|
|
| Spi_localGpioPinToggle(chanHandle, Spi_HIGH); |
|
Spi_localGpioPinToggle(chanHandle, Spi_HIGH); |
| spi_localCompleteIOedmaCallback(instHandle); |
|
spi_localCompleteIOedmaCallback(instHandle); |
| } |
|
} |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| if((EDMA3_RM_XFER_COMPLETE == edmaStatus)&& |
|
if((EDMA3_RM_XFER_COMPLETE == edmaStatus)&& |
| (NULL != chanHandle) && |
|
(NULL != chanHandle) && |
| (NULL != chanHandle->activeIOP)) |
|
(NULL != chanHandle->activeIOP)) |
| { |
|
{ |
| instHandle->edmaCbCheck = Spi_RX_EDMA_CALLBACK_OCCURED; |
|
instHandle->edmaCbCheck = Spi_RX_EDMA_CALLBACK_OCCURED; |
| } |
|
} |
| } |
|
} |
| } |
|
} |
| } |
|
} |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| void spi_localCompleteIOedmaCallback (Spi_Object *instHandle) |
|
void spi_localCompleteIOedmaCallback (Spi_Object *instHandle) |
| { |
|
{ |
| volatile Uint8 *spiDat1 = NULL; |
|
volatile Uint8 *spiDat1 = NULL; |
| Spi_ChanObj *chanHandle = NULL; |
|
Spi_ChanObj *chanHandle = NULL; |
| Spi_DataParam *dataParam = NULL; |
|
Spi_DataParam *dataParam = NULL; |
| IOM_Packet *ioPacket = NULL; |
|
IOM_Packet *ioPacket = NULL; |
| EDMA3_DRV_PaRAMRegs paramSet = {0}; |
|
EDMA3_DRV_PaRAMRegs paramSet = {0}; |
| Uint32 edmaNum = 0x00; |
|
Uint32 edmaNum = 0x00; |
| #ifdef BIOS_PWRM_ENABLE |
|
#ifdef BIOS_PWRM_ENABLE |
| PWRM_Status status = PWRM_SOK; |
|
PWRM_Status status = PWRM_SOK; |
| Uint32 count = 0x00; |
|
Uint32 count = 0x00; |
| #endif |
|
#endif |
| Int32 retVal = IOM_COMPLETED; |
|
Int32 retVal = IOM_COMPLETED; |
| |
|
|
| assert(NULL != instHandle); |
|
assert(NULL != instHandle); |
| |
|
|
| chanHandle = instHandle->currentActiveChannel; |
|
chanHandle = instHandle->currentActiveChannel; |
| assert(NULL != chanHandle); |
|
assert(NULL != chanHandle); |
| ioPacket = chanHandle->activeIOP; |
|
ioPacket = chanHandle->activeIOP; |
| dataParam = (Spi_DataParam *)chanHandle->activeIOP->addr; |
|
dataParam = (Spi_DataParam *)chanHandle->activeIOP->addr; |
| assert(NULL != dataParam); |
|
assert(NULL != dataParam); |
| |
|
|
| |
|
|
|
|
|
| if ((dataParam->flags & Spi_CSHOLD_FOR_MULTI_TRANSCEIVE) != |
|
if ((dataParam->flags & Spi_CSHOLD_FOR_MULTI_TRANSCEIVE) != |
| Spi_CSHOLD_FOR_MULTI_TRANSCEIVE) |
|
Spi_CSHOLD_FOR_MULTI_TRANSCEIVE) |
| { |
|
{ |
| |
|
|
| spiDat1 = |
|
spiDat1 = |
| ((volatile Uint8*)&((instHandle->deviceInfo.baseAddress)->SPIDAT1))+3u; |
|
((volatile Uint8*)&((instHandle->deviceInfo.baseAddress)->SPIDAT1))+3u; |
| |
|
|
| assert(NULL != spiDat1); |
|
assert(NULL != spiDat1); |
| |
|
|
| *spiDat1 &= ~(Spi_SPIDAT1_CSHOLD_8BIT_MASK); |
|
*spiDat1 &= ~(Spi_SPIDAT1_CSHOLD_8BIT_MASK); |
| } |
|
} |
| |
|
|
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
|
(instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
| (~(Spi_INTERRUPT_MASK)); |
|
(~(Spi_INTERRUPT_MASK)); |
| |
|
|
| |
|
|
| if (TRUE == chanHandle->txBufFlag) |
|
if (TRUE == chanHandle->txBufFlag) |
| { |
|
{ |
| edmaNum = instHandle->deviceInfo.txDmaEventNumber; |
|
edmaNum = instHandle->deviceInfo.txDmaEventNumber; |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| edmaNum = instHandle->deviceInfo.rxDmaEventNumber; |
|
edmaNum = instHandle->deviceInfo.rxDmaEventNumber; |
| } |
|
} |
| |
|
|
| |
|
|
| EDMA3_DRV_getPaRAM (instHandle->hEdma, edmaNum, ¶mSet); |
|
EDMA3_DRV_getPaRAM (instHandle->hEdma, edmaNum, ¶mSet); |
| |
|
|
| ioPacket->size -= (paramSet.aCnt * paramSet.bCnt); |
|
ioPacket->size -= (paramSet.aCnt * paramSet.bCnt); |
| |
|
|
| |
|
|
| if (IOM_COMPLETED == ioPacket->status) |
|
if (IOM_COMPLETED == ioPacket->status) |
| { |
|
{ |
| ioPacket->status = chanHandle->currError; |
|
ioPacket->status = chanHandle->currError; |
| } |
|
} |
| |
|
|
| |
|
|
| retVal = Spi_localLpscOff(instHandle); |
|
retVal = Spi_localLpscOff(instHandle); |
| |
|
|
| if (IOM_COMPLETED == ioPacket->status) |
|
if (IOM_COMPLETED == ioPacket->status) |
| { |
|
{ |
| ioPacket->status = retVal; |
|
ioPacket->status = retVal; |
| } |
|
} |
| |
|
|
| |
|
|
|
|
|
| if ((NULL != chanHandle->cbFxn) && (NULL != chanHandle->cbArg)) |
|
if ((NULL != chanHandle->cbFxn) && (NULL != chanHandle->cbArg)) |
| { |
|
{ |
| |
|
|
| (*chanHandle->cbFxn)((Ptr)chanHandle->cbArg, ioPacket); |
|
(*chanHandle->cbFxn)((Ptr)chanHandle->cbArg, ioPacket); |
| } |
|
} |
| |
|
|
| |
|
|
|
|
|
| chanHandle->currError = 0; |
|
chanHandle->currError = 0; |
| chanHandle->pendingState = FALSE; |
|
chanHandle->pendingState = FALSE; |
| chanHandle->activeIOP = NULL; |
|
chanHandle->activeIOP = NULL; |
| chanHandle->charLength16Bits = FALSE; |
|
chanHandle->charLength16Bits = FALSE; |
| |
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
| if (TRUE == chanHandle->abortAllIo) |
|
if (TRUE == chanHandle->abortAllIo) |
| { |
|
{ |
| while(FALSE == QUE_empty(&chanHandle->queuePendingList)) |
|
while(FALSE == QUE_empty(&chanHandle->queuePendingList)) |
| { |
|
{ |
| |
|
|
| ioPacket = (IOM_Packet *) |
|
ioPacket = (IOM_Packet *) |
| QUE_get(&chanHandle->queuePendingList); |
|
QUE_get(&chanHandle->queuePendingList); |
| if (NULL != ioPacket) |
|
if (NULL != ioPacket) |
| { |
|
{ |
| ioPacket->status = IOM_ABORTED; |
|
ioPacket->status = IOM_ABORTED; |
| |
|
|
| |
|
|
| Spi_localLpscOff(instHandle); |
|
Spi_localLpscOff(instHandle); |
| |
|
|
| if ((NULL != chanHandle->cbFxn) && (NULL != chanHandle->cbArg)) |
|
if ((NULL != chanHandle->cbFxn) && (NULL != chanHandle->cbArg)) |
| { |
|
{ |
| |
|
|
| (*chanHandle->cbFxn)((Ptr)chanHandle->cbArg,ioPacket); |
|
(*chanHandle->cbFxn)((Ptr)chanHandle->cbArg,ioPacket); |
| } |
|
} |
| |
|
|
| instHandle->stats.pendingPacket--; |
|
instHandle->stats.pendingPacket--; |
| } |
|
} |
| } |
|
} |
| chanHandle->abortAllIo = FALSE; |
|
chanHandle->abortAllIo = FALSE; |
| } |
|
} |
| |
|
|
| #ifdef BIOS_PWRM_ENABLE |
|
#ifdef BIOS_PWRM_ENABLE |
| if (FALSE == instHandle->pwrmInfo.ioSuspend) |
|
if (FALSE == instHandle->pwrmInfo.ioSuspend) |
| { |
|
{ |
| #endif |
|
#endif |
| Spi_loadPendedIops(instHandle); |
|
Spi_loadPendedIops(instHandle); |
| #ifdef BIOS_PWRM_ENABLE |
|
#ifdef BIOS_PWRM_ENABLE |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| if (TRUE == instHandle->pscPwrmEnable) |
|
if (TRUE == instHandle->pscPwrmEnable) |
| { |
|
{ |
| if ((PWRM_GOINGTOSLEEP == instHandle->pwrmInfo.pwrmEvent) || |
|
if ((PWRM_GOINGTOSLEEP == instHandle->pwrmInfo.pwrmEvent) || |
| (PWRM_GOINGTODEEPSLEEP == instHandle->pwrmInfo.pwrmEvent)) |
|
(PWRM_GOINGTODEEPSLEEP == instHandle->pwrmInfo.pwrmEvent)) |
| { |
|
{ |
| |
|
|
| status = PWRM_getDependencyCount( |
|
status = PWRM_getDependencyCount( |
| (PWRM_Resource)instHandle->deviceInfo.pwrmLpscId, |
|
(PWRM_Resource)instHandle->deviceInfo.pwrmLpscId, |
| &count); |
|
&count); |
| |
|
|
| instHandle->pwrmInfo.dependencyCount = count; |
|
instHandle->pwrmInfo.dependencyCount = count; |
| |
|
|
| if (PWRM_SOK == status) |
|
if (PWRM_SOK == status) |
| { |
|
{ |
| while (count > 0) |
|
while (count > 0) |
| { |
|
{ |
| status = PWRM_releaseDependency( |
|
status = PWRM_releaseDependency( |
| (PWRM_Resource)instHandle->deviceInfo.pwrmLpscId); |
|
(PWRM_Resource)instHandle->deviceInfo.pwrmLpscId); |
| |
|
|
| if (PWRM_SOK != status) |
|
if (PWRM_SOK != status) |
| { |
|
{ |
| break; |
|
break; |
| } |
|
} |
| count--; |
|
count--; |
| } |
|
} |
| } |
|
} |
| } |
|
} |
| |
|
|
| |
|
|
| instHandle->currentActiveChannel = NULL; |
|
instHandle->currentActiveChannel = NULL; |
| |
|
|
| instHandle->pwrmInfo.ioSuspend = FALSE; |
|
instHandle->pwrmInfo.ioSuspend = FALSE; |
| instHandle->devState = Spi_DriverState_PWRM_SUSPEND; |
|
instHandle->devState = Spi_DriverState_PWRM_SUSPEND; |
| |
|
|
| |
|
|
| (instHandle->pwrmInfo.delayedCompletionFxn[instHandle->pwrmInfo.pwrmEvent])(); |
|
(instHandle->pwrmInfo.delayedCompletionFxn[instHandle->pwrmInfo.pwrmEvent])(); |
| |
|
|
| |
|
|
| (instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
|
(instHandle->deviceInfo.baseAddress)->SPIINT0 &= |
| (~CSL_SPI_SPIINT0_OVRNINTENA_MASK); |
|
(~CSL_SPI_SPIINT0_OVRNINTENA_MASK); |
| } |
|
} |
| } |
|
} |
| #endif |
|
#endif |
| } |
|
} |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Int32 Spi_localEdmaChannel_Request(Spi_Object *instHandle) |
|
Int32 Spi_localEdmaChannel_Request(Spi_Object *instHandle) |
| { |
|
{ |
| Int32 status = IOM_COMPLETED; |
|
Int32 status = IOM_COMPLETED; |
| |
|
|
| assert(NULL != instHandle); |
|
assert(NULL != instHandle); |
| |
|
|
| |
|
|
| if (Spi_OpMode_DMAINTERRUPT == instHandle->opMode) |
|
if (Spi_OpMode_DMAINTERRUPT == instHandle->opMode) |
| { |
|
{ |
| |
|
|
| instHandle->dmaChanAllocated = TRUE; |
|
instHandle->dmaChanAllocated = TRUE; |
| |
|
|
| |
|
|
| status = EDMA3_DRV_requestChannel( |
|
status = EDMA3_DRV_requestChannel( |
| (instHandle->hEdma), |
|
(instHandle->hEdma), |
| &(instHandle->deviceInfo.rxDmaEventNumber), |
|
&(instHandle->deviceInfo.rxDmaEventNumber), |
| &(instHandle->deviceInfo.rxDmaEventNumber), |
|
&(instHandle->deviceInfo.rxDmaEventNumber), |
| (EDMA3_RM_EventQueue)0, |
|
(EDMA3_RM_EventQueue)0, |
| &Spi_localCallbackReceive, |
|
&Spi_localCallbackReceive, |
| instHandle); |
|
instHandle); |
| |
|
|
| if (IOM_COMPLETED != status) |
|
if (IOM_COMPLETED != status) |
| { |
|
{ |
| instHandle->dmaChanAllocated = FALSE; |
|
instHandle->dmaChanAllocated = FALSE; |
| SYS_printf("\nSPI Test: EDMA Request failed"); |
|
SYS_printf("\nSPI Test: EDMA Request failed"); |
| } |
|
} |
| else |
|
else |
| { |
|
{ |
| |
|
|
| EDMA3_DRV_clearErrorBits(instHandle->hEdma, |
|
EDMA3_DRV_clearErrorBits(instHandle->hEdma, |
| instHandle->deviceInfo.txDmaEventNumber); |
|
instHandle->deviceInfo.txDmaEventNumber); |
| |
|
|
| |
|
|
| |
|
|
| status = EDMA3_DRV_requestChannel( |
|
status = EDMA3_DRV_requestChannel( |
| (instHandle->hEdma), |
|
(instHandle->hEdma), |
| &(instHandle->deviceInfo.txDmaEventNumber), |
|
&(instHandle->deviceInfo.txDmaEventNumber), |
| &(instHandle->deviceInfo.txDmaEventNumber), |
|
&(instHandle->deviceInfo.txDmaEventNumber), |
| (EDMA3_RM_EventQueue)0, |
|
(EDMA3_RM_EventQueue)0, |
| &Spi_localCallbackTransmit, |
|
&Spi_localCallbackTransmit, |
| instHandle); |
|
instHandle); |
| } |
|
} |
| |
|
|
| if (IOM_COMPLETED != status) |
|
if (IOM_COMPLETED != status) |
| { |
|
{ |
| |
|
|
| EDMA3_DRV_freeChannel( |
|
EDMA3_DRV_freeChannel( |
| instHandle->hEdma, |
|
instHandle->hEdma, |
| instHandle->deviceInfo.rxDmaEventNumber); |
|
instHandle->deviceInfo.rxDmaEventNumber); |
| |
|
|
| instHandle->dmaChanAllocated = FALSE; |
|
instHandle->dmaChanAllocated = FALSE; |
| |
|
|
| SYS_printf("\nSPI Test: EDMA Request failed"); |
|
SYS_printf("\nSPI Test: EDMA Request failed"); |
| } |
|
} |
| |
|
|
| EDMA3_DRV_clearErrorBits(instHandle->hEdma, |
|
EDMA3_DRV_clearErrorBits(instHandle->hEdma, |
| instHandle->deviceInfo.txDmaEventNumber); |
|
instHandle->deviceInfo.txDmaEventNumber); |
| } |
|
} |
| return status; |
|
return status; |
| } |
|
} |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| static Void SpiUpdateError(Spi_ChanObj *chanHandle,Uint32 intStatus) |
|
static Void SpiUpdateError(Spi_ChanObj *chanHandle,Uint32 intStatus) |
| { |
|
{ |
| Spi_Object *instHandle = NULL; |
|
Spi_Object *instHandle = NULL; |
| |
|
|
| assert(NULL != chanHandle); |
|
assert(NULL != chanHandle); |
| |
|
|
| instHandle = chanHandle->instHandle; |
|
instHandle = chanHandle->instHandle; |
| assert(NULL != instHandle); |
|
assert(NULL != instHandle); |
| |
|
|
| |
|
|
| if (CSL_SPI_SPIFLG_TIMEOUTFLG_MASK |
|
if (CSL_SPI_SPIFLG_TIMEOUTFLG_MASK |
| == (intStatus & CSL_SPI_SPIFLG_TIMEOUTFLG_MASK)) |
|
== (intStatus & CSL_SPI_SPIFLG_TIMEOUTFLG_MASK)) |
| { |
|
{ |
| chanHandle->currError = Spi_TIMEOUT_ERR; |
|
chanHandle->currError = Spi_TIMEOUT_ERR; |
| (instHandle->deviceInfo.baseAddress)->SPIFLG |= |
|
(instHandle->deviceInfo.baseAddress)->SPIFLG |= |
| CSL_SPI_SPIFLG_TIMEOUTFLG_MASK; |
|
CSL_SPI_SPIFLG_TIMEOUTFLG_MASK; |
| instHandle->stats.timeoutError++; |
|
instHandle->stats.timeoutError++; |
| } |
|
} |
| |
|
|
| if (CSL_SPI_SPIFLG_PARERRFLG_MASK |
|
if (CSL_SPI_SPIFLG_PARERRFLG_MASK |
| == (intStatus & CSL_SPI_SPIFLG_PARERRFLG_MASK)) |
|
== (intStatus & CSL_SPI_SPIFLG_PARERRFLG_MASK)) |
| { |
|
{ |
| |
|
|
| chanHandle->currError = Spi_PARITY_ERR ; |
|
chanHandle->currError = Spi_PARITY_ERR ; |
| (instHandle->deviceInfo.baseAddress)->SPIFLG |= |
|
(instHandle->deviceInfo.baseAddress)->SPIFLG |= |
| CSL_SPI_SPIFLG_PARERRFLG_MASK; |
|
CSL_SPI_SPIFLG_PARERRFLG_MASK; |
| instHandle->stats.parityError++; |
|
instHandle->stats.parityError++; |
| } |
|
} |
| |
|
|
| if (CSL_SPI_SPIFLG_DESYNCFLG_MASK |
|
if (CSL_SPI_SPIFLG_DESYNCFLG_MASK |
| == (intStatus & CSL_SPI_SPIFLG_DESYNCFLG_MASK )) |
|
== (intStatus & CSL_SPI_SPIFLG_DESYNCFLG_MASK )) |
| { |
|
{ |
| |
|
|
| chanHandle->currError = Spi_DESYNC_ERR ; |
|
chanHandle->currError = Spi_DESYNC_ERR ; |
| (instHandle->deviceInfo.baseAddress)->SPIFLG |= |
|
(instHandle->deviceInfo.baseAddress)->SPIFLG |= |
| CSL_SPI_SPIFLG_DESYNCFLG_MASK ; |
|
CSL_SPI_SPIFLG_DESYNCFLG_MASK ; |
| instHandle->stats.desyncError++; |
|
instHandle->stats.desyncError++; |
| } |
|
} |
| |
|
|
| if (CSL_SPI_SPIFLG_BITERRFLG_MASK |
|
if (CSL_SPI_SPIFLG_BITERRFLG_MASK |
| == (intStatus & CSL_SPI_SPIFLG_BITERRFLG_MASK)) |
|
== (intStatus & CSL_SPI_SPIFLG_BITERRFLG_MASK)) |
| { |
|
{ |
| |
|
|
| chanHandle->currError = Spi_BIT_ERR ; |
|
chanHandle->currError = Spi_BIT_ERR ; |
| (instHandle->deviceInfo.baseAddress)->SPIFLG |= |
|
(instHandle->deviceInfo.baseAddress)->SPIFLG |= |
| CSL_SPI_SPIFLG_BITERRFLG_MASK; |
|
CSL_SPI_SPIFLG_BITERRFLG_MASK; |
| instHandle->stats.bitError++; |
|
instHandle->stats.bitError++; |
| } |
|
} |
| |
|
|
| |
|
|
| if ((intStatus & CSL_SPI_SPIFLG_OVRNINTFLG_MASK) |
|
if ((intStatus & CSL_SPI_SPIFLG_OVRNINTFLG_MASK) |
| == CSL_SPI_SPIFLG_OVRNINTFLG_MASK) |
|
== CSL_SPI_SPIFLG_OVRNINTFLG_MASK) |
| { |
|
{ |
| chanHandle->currError = Spi_RECEIVE_OVERRUN_ERR; |
|
chanHandle->currError = Spi_RECEIVE_OVERRUN_ERR; |
| (instHandle->deviceInfo.baseAddress)->SPIFLG |= |
|
(instHandle->deviceInfo.baseAddress)->SPIFLG |= |
| CSL_SPI_SPIFLG_OVRNINTFLG_MASK; |
|
CSL_SPI_SPIFLG_OVRNINTFLG_MASK; |
| instHandle->stats.rxOverrunError++; |
|
instHandle->stats.rxOverrunError++; |
| } |
|
} |
| } |
|
} |
| #endif |
|
#endif |
|
|
|
|
|
|
|
|
|