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