I32U Tcc353xInterruptProcess(void) { I32U ret = 0; I08U irqStatus = 0; I32S moduleIndex = 0; I32U totalSize = 0; I08U data = 0x00; /* Read BB Interrupt Status */ Tcc353xApiGetIrqStatus(moduleIndex, &irqStatus); #if defined (_I2C_STS_) totalSize = 0; data = 0x00; /* Tcc353x IRQ Clear */ Tcc353xApiIrqClear(moduleIndex, irqStatus); ret = 0; /* return no data */ #else /* Stream Interrupt */ if (irqStatus&0x01) { TcpalPrintErr((I08S *) "[TCC353X] FIFO overflow[0x%02X] flush!!!\n", irqStatus); /* IRQ Disable - Prevent additional interrupt signal */ data = 0x00; Tcc353xApiRegisterWrite(0,0, 0x03, &data, 1); /* Tcc353x IRQ Clear */ Tcc353xApiIrqClear(moduleIndex, irqStatus); Tcc353xApiInterruptBuffClr(moduleIndex); gOverflowcnt ++; ret = 0; } else { /* Tcc353x IRQ Clear */ Tcc353xApiIrqClear(moduleIndex, irqStatus); Tcc353xApiGetFifoStatus(moduleIndex, &totalSize); ret = totalSize; if(ret>=150*188) TcpalPrintErr((I08S *) "[TCC353X] FIFO stat size[%d]\n", ret); } gDbgIsrCnt++; if(gDbgIsrCnt>100) { gDbgIsrCnt = 0; #ifdef _DBG_CHK_OVERFLOW_CNT_ TcpalPrintStatus((I08S *) "[TCC353X] CurrOverflow Cnt %d\n", gOverflowcnt); #endif } #endif return ret; }
void Tcc353xInterruptGetStream(I32U _fifoSize) { I32S moduleIndex = 0; I32U totalSize = 0; I32U wp; totalSize = _fifoSize - (_fifoSize%188); // //TcpalPrintErr((I08S *) "Tcc353xInterruptGetStream size[%d]\n", totalSize); totalSize = (totalSize/188/4)*188*4; if(totalSize > 188 * 87) totalSize = 188 * 84; // if(totalSize>=188) { I32U nextwp; if(Tcc353xStreamBufferedSize[moduleIndex]+totalSize > TCC353X_STREAM_BUFFER_SIZE) Tcc353xStreamBufferFlush (moduleIndex); TcpalSemaphoreLock(&Tcc353xStreamSema); wp = Tcc353xStreamWp[moduleIndex]; TcpalSemaphoreUnLock(&Tcc353xStreamSema); nextwp = ((wp+totalSize)%TCC353X_STREAM_BUFFER_SIZE); if(wp+totalSize>TCC353X_STREAM_BUFFER_SIZE) { /* read twice */ I32U first; first = TCC353X_STREAM_BUFFER_SIZE - wp; Tcc353xApiStreamRead(moduleIndex, &Tcc353xStreamData[wp], first); Tcc353xApiStreamRead(moduleIndex, &Tcc353xStreamData[0], nextwp); } else { Tcc353xApiStreamRead(moduleIndex, &Tcc353xStreamData[wp], totalSize); } TcpalSemaphoreLock(&Tcc353xStreamSema); Tcc353xStreamWp[moduleIndex] = nextwp; Tcc353xStreamBufferedSize[moduleIndex] += totalSize; TcpalSemaphoreUnLock(&Tcc353xStreamSema); if(Tcc353xStreamData[wp]!=0x47) { TcpalPrintErr((I08S *) "[TCC353X] SyncByte Error! [0x%02x]\n", Tcc353xStreamData[wp]); TcpalPrintErr((I08S *) "[TCC353X] Buff Flush for SyncByte matching\n"); Tcc353xApiInterruptBuffClr(moduleIndex); } } }
I32U Tcc353xInterruptProcess(void) { I32U ret = 0; I08U irqStatus = 0; I32S moduleIndex = 0; I32U totalSize = 0; /* Read BB Interrupt Status */ Tcc353xApiGetIrqStatus(moduleIndex, &irqStatus); /* Stream Interrupt */ if (irqStatus&0x01) { TcpalPrintErr((I08S *) "[TCC353X] FIFO overflow[0x%02X] flush!!!\n", irqStatus); /* Tcc353x IRQ Clear */ Tcc353xApiIrqClear(moduleIndex, irqStatus); Tcc353xApiInterruptBuffClr(moduleIndex); gOverflowcnt ++; ret = 0; } else { /* Tcc353x IRQ Clear */ Tcc353xApiIrqClear(moduleIndex, irqStatus); Tcc353xApiGetFifoStatus(moduleIndex, &totalSize); ret = totalSize; } gDbgIsrCnt++; if(gDbgIsrCnt>40) { gDbgIsrCnt = 0; #ifdef _DBG_CHK_OVERFLOW_CNT_ TcpalPrintStatus((I08S *) "[TCC353X] CurrOverflow Cnt %d\n", gOverflowcnt); #endif } return ret; }