static void targetWriteGenericSPIWord (uint32 sid, uint32 w) { HRESULT hResult; while (1) { hResult = spiOpNonBlock(sid, w, NULL); if (hResult != SPI_ERROR_BUF_FULL) break; TCTaskYield(); } }
/********************************************************* avs interrupt handler thread */ void avsIntThread(void *dummy) { BOOL bResetDetected = FALSE; UNUSED_ARG(dummy); // wait for bus reset completion lalWaitOnResetCompletion(&bResetDetected); DO_FOREVER { avsIntPollHandlers(); TCTaskYield(); } }
static uint32 targetReadGenericSPIWord (uint32 sid, uint32 w) { HRESULT hResult; uint32 retval; while (1) { hResult = spiOpNonBlock(sid, w, &retval); if (hResult != SPI_ERROR_BUF_FULL) break; TCTaskYield(); } //now wait for the matching reply if (sid == codecSSId) TCSemaphoreWait (codecSem); else if (sid == cpldSSId) TCSemaphoreWait (cpldSem); return retval; }
HRESULT avsTestStartCapture (int time) { avsLogItems = 0; uint32 timeEnd, timeCur, wasBigger, isBigger; //timerRegWrite(TIMER2_CTRL_REG, 4); //timerRegWrite(TIMER2_LOAD_CNT, 0xffffffff); //timerRegWrite(TIMER2_CTRL_REG, 5); InstallAvsHandler (); timeCur = *((volatile int *)(LLCBASE+CY_TMR_REG_DP)); timeEnd = timeCur + time*0x02000000; wasBigger = (timeEnd > timeCur) ? 1 : 0; cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_AVS0); cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_AVS1); cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_AVS2); //avsRegWrite(APBA_PARTITION4_FLUSH,1); while (1) { if (avsLogItems >= AVS_LOG_SIZE) break; timeCur = *((volatile int *)(LLCBASE+CY_TMR_REG_DP)); isBigger = (timeEnd > timeCur) ? 1 : 0; if (wasBigger != isBigger) break; TCTaskYield(); } cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_AVS0); cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_AVS1); cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_AVS2); sysDebugPrintf("Captured %i items\n\r",avsLogItems); return NO_ERROR; }