help DMA FIFO buffer

dave (davekern@ihug.co.nz)
Wed, 9 Apr 2003 21:18:01 -0700


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 ;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/