public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <ttabi@interactivesi.com>
To: Timothy Hamlin <thamlin@zeus.nmt.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: questions of a kernel-newbie, simple ISA driver
Date: Thu, 13 Sep 2001 12:53:47 -0500	[thread overview]
Message-ID: <3BA0F2AB.1050100@interactivesi.com> (raw)
In-Reply-To: <Pine.LNX.4.30.0109131124420.20602-100000@zeus.lma.net>

Timothy Hamlin wrote:

 > Driver polls for the 1/2 full FIFO flag, when found transfer 16k words out
 > of the FIFO and place this in a larger buffer, say 320k or something.

The driver should instead poll the device at regular, adjustable intervals, 
and read ALL the data it can at each interval.  Assuming the hardware allows 
that, of couse.

 > How would I maintain this buffer?  Reads to the /dev entry need to be able
 > to get a continuous stream from the device, how do I keep the buffer both
 > filling, and being read out at the same time?  Should I make the buffer a
 > FIFO as well?  How?  How do I keep track of what has been read from the
 > buffer, so that subsequent reads get new data, not data that is lower down
 > in the buffer?

This is a basic, first-year computer science question.  Just use a circular 
buffer.  You can get the algorithm from any CS book.

 >  Can I allow multiple processes to be reading from this
 > /dev entry without loosing data to any of them?

Sure, just use one circular buffer per process.

 > Also, when I read for a device like a serial port I can just do cat
 > /dev/ttyS0 and watch the stream coming in.  So far in my driver, a read
 > performs one operation, outputs whatever, and then stops.  So a cat of my
 > device only transfers the current data, and then just sits there.  How do
 > I keep that steam going so that a cat will continually update?

Increase the rate at which you read the hardware FIFO.  Or perhaps, use the 
reads to your /dev device as a trigger to get more data from the HW.


      reply	other threads:[~2001-09-13 17:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-13 17:28 questions of a kernel-newbie, simple ISA driver Timothy Hamlin
2001-09-13 17:53 ` Timur Tabi [this message]

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=3BA0F2AB.1050100@interactivesi.com \
    --to=ttabi@interactivesi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thamlin@zeus.nmt.edu \
    /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