Subject: Re: PCI device driver for sparc, sparc64, and i386
To: None <steven_grunza@ieee.org,tech-kern@netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: tech-kern
Date: 02/06/2001 14:53:26
In article <3.0.6.32.20010206090136.007df8a0@pop.netzero.net> you write:
>I've done pseudo-drivers for NetBSD before but this is the first "real"
>driver I've attempted.  I'll probably need a header file for things private
>to the driver and one for things public to the users of the driver.  Where
>should these two files go and is there a standard naming convention for
>them?  I seem to recall X11 using a capital P at the end of the Public
>header....

WHat do you mean by "private to the driver"?  If your driver needs multiple
files (e.g. sys/dev/pci/foo_pci.c and sys/dev/ic/foo.c), you should have a
foovar.h file next to the main driver (e.g. sys/dev/ic/foovar.h).  For
definitions that just depend on the hardware, and not on your particular
driver (e.g. register offsets and bit definitions) use fooreg.h next to the
main .c file (sys/dev/ic/fooreg.h).

>If I don't hear otherwise, I'll probably try:
>
>/usr/include/jaguar.h	for the public file (the board is called a jaguar)

What kind of device is it?  Is it appropriate for it to have its own
interface to user space, or should it use some existing framework or some
new generic framework for that kind of device?  In any case, since it's a
kernel interface, the file should go in /usr/include/sys or maybe
somewhere under /usr/include/dev.

>/usr/include/sys/jag.h	for the driver's private file

You only need things to be in /usr/include if user code needs access to
them.  If it's only for the driver, keep it near the driver.

Also, it's a good idea to use the same name for the device everywhere to
avoid confusion (don't have a jaguar.h and a jag.h).

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>