public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: help DMA FIFO buffer
  2003-04-10  4:18 help DMA FIFO buffer dave
@ 2003-04-09 10:37 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2003-04-09 10:37 UTC (permalink / raw)
  To: dave; +Cc: Linux Kernel Mailing List

On Iau, 2003-04-10 at 05:18, dave wrote:
> 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 ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* help DMA FIFO buffer
@ 2003-04-10  4:18 dave
  2003-04-09 10:37 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: dave @ 2003-04-10  4:18 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-09 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-10  4:18 help DMA FIFO buffer dave
2003-04-09 10:37 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox