Re: Kernel device driver programming

From: Arthur Corliss <acorliss@nevaeh-linux.org>
Date: Tue Feb 22 2005 - 09:39:31 AKST

On Sun, 20 Feb 2005, Grant Stockly wrote:

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

Sounds like a great project.

> 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.

Do you really need to force it into a line format? You're talking about
essentially a bit-mapped image, right? Then every line should be of equal
length. If you can either append or prepend a field to the stream that sets
the line length you should be fine.

> 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.

Keep in mind that I've never played with this kind of hardware, so my head may
be too far stuck up my nether regions to offer any useful advice. Off the
cuff, though, if you're talking about fixed length vectors to be taken out of
a stream I'd go with a fgetc call. That'll allow you to read from the stream
in line-sized chunks.

        --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.
Received on Tue Feb 22 09:39:41 2005

This archive was generated by hypermail 2.1.8 : Tue Feb 22 2005 - 09:39:41 AKST