阅读:933回复:0
spi dma mode 的问题
source code 如下
sspHwSetup(); sspDmaSetup(); sspDmaTxChannelSetup(); sspDmaRxChannleSetup(); XllpDmacStartTransfer(pDevice->dmaRxChannel); XllpDmacStartTransfer(pDevice->dmaTxChannel); HANDLE hEvents[] = {pDevice->hDmaTxFinishedEvent, pDevice->hDmaRxFinishedEvent, pDevice->hCloseDmaIsrEvent}; UINT32 res = WaitForMultipleObjects(3,hEvents,FALSE,INFINITE); for(i=0;i<5;) { switch(res) { case WAIT_OBJECT_0: //Tx DMA Event -- Send Successfull MxdOsDebugPrint(TEXT("[DMA]Tx.. Finished!")); //break; case WAIT_OBJECT_0+1: //Rx DMA Event MxdOsDebugPrint(TEXT("[DMA]Rx.. Finished!")); bLoop = FALSE; i=5; break; case WAIT_OBJECT_0+2: //Cancel Dma Isr MxdOsDebugPrint(TEXT("[DMA]Cancle.. Finished!")); bLoop = FALSE; break; default: bLoop = FALSE; //canceling DmaIsr thread break; } //switch(res) } 但是我只能接收到Tx的finished event , 而接受不到Rx Finished EVent debug时候发现:Rx的length 小于 Tx transfer length 另外 1) 硬件的波形是正确的。 2) 我的dma是采用无描述符传输。 怎样使Tx和Rx同步,Tx传输的数据长度和Rx传输的长度相当? 有没有达人指教一下,十分感谢 |
|