help DMA FIFO buffer
Hi I am writing a device driver LNVRM is uses DMA for commands and data i need a function that will wait until their is enough room in the FIFO for the new
data this function works but their must be a better way I need a formula that dose
not have if's in it
Like this
#define NV04_DMA_WAIT_FREE(free) while((dma->size -
(dma->put - dma->control->get)) < free)
thank you .
also it thear is no way can this be made inline ?
void lnvrm_dmaNv04WaitFree(struct _nvxf_dmaChannel dma , unsigned long) {
unsigned long get , put = dma->put , size = dma->mask + 1 , free , f = 0 ;
loop1:
get = dma->control->Get ;
if(put < get)
free = size - (size - get + put) ;
else
free = size - (put - get) ;if(count <= free) return ; /* Get out as quick as possible */
if(f) { ErrorF("lnvrm_dmaNv04WaitFree: FIFO FULL free = %8.8lX needed =
%8.8lX\n",free,count) ; f++ }
goto loop1 ;
}
Quoted 6 lines · dave
Hi I am writing a device driver LNVRM is uses DMA for commands and data i need a function that will wait until their is enough room in the FIFO for the new
data this function works but their must be a better way I need a formula that dose
not have if's in it
Why ?