Re: Kernel device driver programming

From: Grant Stockly <grant@stockly.com>
Date: Sun Feb 20 2005 - 20:39:39 AKST

I'm writing a device driver for a line array camera. Basically, a flat bed
scanner.

There are 4 6" segments to the camera which read out at the same
time. There are 4 12bit A/D converters which are read at a 1MHz rate
(fastest scan speed). There is a microcontroller running that clocks all
this data into a 16kx16 fifo and a half full flag interrupting the
computer. Every time the computer gets an interrupt I am save downloading
at least 8k, but could just download .5k or even 1k at a time with no
issues (other than the latency from data at the end of a scan).

There are two issues. The data is going through a FIFO. I'm still
designing the PC/104 capture card on protoboard and writing the firmware
for the microcontrollers. I'm thinking of inserting "Beginning of line"
into the stream (or any other binary stream random enough).

The data has to be organized in lines, not a stream. So do any of you have
an idea where it would be best to do this and with what function? String
functions like sscanf would probably bog down the processor too much. The
computer has a 20MHz ISA bus, which I'll be using about 7.5MHz of, thats
almost 50% cpu time blocked by I/O. The data also has to be transmitted to
the client computer using UDP, which of 41 seconds takes about 15 seconds
of processor time.

I'm thinking the easiest (while not being BEST) would be to search for B,
then e, etc...and sync to the first line. Unless a hardware error occurs,
byte counts should keep everything in sync.

Any ideas? :)

Grant

At 11:34 AM 2/19/2005, Arthur Corliss wrote:
>On Sat, 19 Feb 2005, Arthur Corliss wrote:
>
> > Character devices are typically used for unbuffered non-random
> access. Block
> > devices are mandatory random-access, and are a bit more complicated to
> > initialise (requiring a strategy routine, etc.). The reason why you see so
> > many tutorials on character devices is because they're much simpler to deal
> > with in general.
>
>I should have also pointed out that with block devices you operate almost
>exclusively on the buffer cache. If you're writing to a hardware device (like
>a disk controller) this can help you maximise throughput via the strategy
>routine, by reordering writes into a more efficient pattern, etc.
>
>Ultimately, which is faster is going to depend on what you're actually writing
>to.
>
> --Arthur Corliss
> Bolverk's Lair -- http://arthur.corlissfamily.org/
> Digital Mages -- http://www.digitalmages.com/
> "Live Free or Die, the Only Way to Live" -- NH State Motto
>---------
>To unsubscribe, send email to <aklug-request@aklug.org>
>with 'unsubscribe' in the message body.

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Feb 20 20:39:49 2005

This archive was generated by hypermail 2.1.8 : Sun Feb 20 2005 - 20:39:49 AKST