*BSD News Article 35990


Return to BSD News archive

Xref: sserve comp.os.386bsd.development:2566 comp.os.386bsd.questions:13284
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!news.adelaide.edu.au!gateway.dircsa.org.au!cleese.apana.org.au!apanix.apana.org.au!hart
From: hart@apanix.apana.org.au (Leigh Hart)
Newsgroups: comp.os.386bsd.development,comp.os.386bsd.questions
Subject: Kernel device driver template?
Date: 20 Sep 94 13:21:26 GMT
Organization: Apanix Public Access Unix, +61 8 373 5485 (5 lines)
Lines: 41
Message-ID: <hart.780067286@apanix.apana.org.au>
NNTP-Posting-Host: seldon.apanix.apana.org.au


For a college project next year I plan to build a video frame
grabber for the PC, and write a FreeBSD kernel device driver
and Xwindows interface to the card.

I have found a kit for the card (the hardware side of things
isn't the major component of the project) and have the basic
specs for interfacing to the card.

Is there a device driver template available for FreeBSD (apart
from snarfing the interuptless printer driver code) that I can
use to write a driver for this card?

It's nothing special, two byte port access (control, data) _without_
memory mapping.  Frames are stored in 64K of static ram on the card,
holding a 256x256 pix 256 grey scale image.

Should, for example, the driver accept ioctl's for a read request and
then read in the full 64K into a buffer (pointed to by ioctl argument)?
Or is it more efficient to have the driver lock the card into a grab and
then return one byte at a time to the calling program?

I think returning a full 64k chunk would prevent the driver getting
into a confused state, if for example the calling program stopped 
polling for bytes before the 64k was read.  How would this slow down
the OS if it was spending 0.N seconds in kernel mode reading 64K chunks?

Any advice on this would be GREATLY appreciated :-)

Also, any good references to writing an X graphics app? :-)  I guess
I have a few long days trawling through xv.c for inspiration
otherwise :(

Cheers

Leigh
--
| "By the time they had diminished | Leigh Hart                |
|  from 50 to 8, the other dwarves | <hart@eppie.apana.org.au> |
|  began to suspect 'Hungry' ..."  | C/- 195 Gilles Street     |
|   -- Gary Larson, "The Far Side" | Adelaide  SA  5006        |