Subject: Re: device driver HOWTO?
To: Ingolf Koch <ingolf@knuut.de>
From: Bill Squier <groo@cs.stevens-tech.edu>
List: netbsd-help
Date: 10/25/1999 14:49:01
> is there something like a "HOWTO write a device driver
> for NetBSD"? I've got McKusick's "The Design and Implementation
> of the 4.4 BSD Operating System". Are the parts on device
> driver (attachment etc) and interrupts applicable for
> NetBSD?
I'm currently writing one. As a start, read:
McKusick, et. al. pp496--502 (autoconfig)
c.f., /sys/kern/subr_autoconf.c
/usr/include/sys/device.h
/usr/include/sys/conf.h
/sys/arch/{some_arch}/compile/{some_dir}/ioconf.c
McKusick, et. al. pp195--204 (device driver overview)
http://www.netbsd.org/Documentation/kernel/programming.html
For info on the "top half" of the device driver, it may be instructive to look
at /sys/miscfs/specfs/spec_vnops.c and a sample driver like /sys/dev/ic/com.c
and /sys/dev/isa/com_isa.c or something platform specific like
/sys/arch/i386/i386/apm.c.
...or hang tight for a couple of weeks until I can get a tutorial written and
proofed. There are quite a few details that can only be learned by reading
code at this point.
Another excellent reference (especially on specfs) is Unix Internals: The New
Frontiers, Uresh Vahalia, Pren. Hall, 0-13-101908-2.
--
Bill Squier (groo@cs.stevens-tech.edu)
http://www.cs.stevens-tech.edu/~groo
Ph: (201)216-5486 Fax: (201)216-8249