lkml.org 
[lkml]   [2003]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjecthelp DMA FIFO buffer
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.019 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site