public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "dave" <davekern@ihug.co.nz>
To: <linux-kernel@vger.kernel.org>
Subject: help DMA FIFO buffer
Date: Wed, 9 Apr 2003 21:18:01 -0700	[thread overview]
Message-ID: <002e01c2ff18$2f043ca0$0b721cac@stacy> (raw)

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


             reply	other threads:[~2003-04-09  7:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-10  4:18 dave [this message]
2003-04-09 10:37 ` help DMA FIFO buffer Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002e01c2ff18$2f043ca0$0b721cac@stacy' \
    --to=davekern@ihug.co.nz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox