xref: /dragonfly/share/examples/drivers/README (revision c89a6c1b)
1$FreeBSD: src/share/examples/drivers/README,v 1.2.6.1 2002/11/16 13:24:28 blackend Exp $
2$DragonFly: src/share/examples/drivers/README,v 1.3 2006/10/24 17:09:45 swildner Exp $
3
4Author: Julian Elischer
5
6The files in this directory are shell scripts.
7
8They will, when run, create an example skeleton driver
9for you. You can use this driver as a starting point for
10writing drivers for your own devices. They have all the hooks needed
11for initialization, probing, attaching, as well as DEVFS
12node creation. They also create sample ioctl commands and a sample
13ioctl definition .h file in /sys/sys. In other words they are fully
14functional in a 'skeleton' sort of a way. They support multiple devices
15so that you may have several of your 'foobar' devices probed and attached
16at once.
17
18I expect that these scripts will improve with time.
19
20At present these scripts also link the newly created driver into
21the kernel sources in /sys. Possibly a better way would be
22to make them interactive. (and ask what kernel tree to use as well as
23a name for the driver.).
24
25There are presently two scripts.
26One for making a real device driver for ISA devices, and
27one for making a device driver for pseudo devices (e.g. /dev/null).
28Hopefully they will be joined by similar scripts for creating
29skeletons for PCI and EISA devices as well.
30
31Give them a single argument: the name of the driver.
32They will use this given name in many places within the driver,
33both in lower and upper case form.  (conforming to normal usage).
34
35The skeleton driver should already link with the kernel
36and in fact the shell script will compile a kernel with the new
37drive linked in..  The new kernel should still be
38runnable and the new driver should be
39fully callable (once you get your device to probe).
40You should simply edit the driver and continue to use
41'make' (as done in the script) until your driver does what you want.
42
43The driver will end up in /sys/arch/i386/isa for the device driver script,
44and in /sys/dev for the pseudo driver script.
45