Subject: Re: How to write a driver for a new PCI device?
To: Soren S. Jorvang <email@example.com>
From: Nathan J. Williams <nathanw@MIT.EDU>
Date: 03/01/2000 15:18:33
<firstname.lastname@example.org> (Soren S. Jorvang) writes:
> On Wed, Mar 01, 2000 at 12:46:14PM -0500, Steven Grunza wrote:
> > Does anyone have a pointer to information on how to write a machine
> > independant PCI device driver? I'm starting work on the Yamaha XG64
> > driver and could do with some more documentation on NetBSD's inards....
> Best way to start is to look at existing drivers really. Try grepping
> for 'audio' in sys/dev/pci.
That's a little cruder than necessary, and doesn't help explain the
process. If you look at the GENERIC configuration file for i386,
you'll see a number of PCI audio devices: clcs, eap, eso, fms, and
sv. Next, look in src/sys/dev/pci/files.pci and search for each of
those names, and they'll point you at the files that are involved in
those existing drivers (both the device-specific files and some of the
audio infrastructure that they hook in to), such as dev/pci/cs4280.c,
dev/pci/fms.c, dev/pci/eap.c, and so on.
Looking at those is currently your best way to figure out what a
The audio(9) manual page also describes the in-kernel interface that a
audio device driver must supply, but I suspect that what you need to
do is glue between the PCI front-end and the sbdsb engine rather than
a full device implementation (until somebody gets real programming
information from Yamaha).
In an ideal world we'd have a pci(9) manual page that described the
interfaces avaliable to you, some driver templates to work from, and a
handy manual of the tehcniques and pitfalls involved in writing a
device driver. Not yet, though.