186d7f5d3SJohn Marino$FreeBSD: src/share/examples/drivers/README,v 1.2.6.1 2002/11/16 13:24:28 blackend Exp $ 286d7f5d3SJohn Marino$DragonFly: src/share/examples/drivers/README,v 1.3 2006/10/24 17:09:45 swildner Exp $ 386d7f5d3SJohn Marino 486d7f5d3SJohn MarinoAuthor: Julian Elischer 586d7f5d3SJohn Marino 686d7f5d3SJohn MarinoThe files in this directory are shell scripts. 786d7f5d3SJohn Marino 886d7f5d3SJohn MarinoThey will, when run, create an example skeleton driver 986d7f5d3SJohn Marinofor you. You can use this driver as a starting point for 1086d7f5d3SJohn Marinowriting drivers for your own devices. They have all the hooks needed 1186d7f5d3SJohn Marinofor initialization, probing, attaching, as well as DEVFS 1286d7f5d3SJohn Marinonode creation. They also create sample ioctl commands and a sample 1386d7f5d3SJohn Marinoioctl definition .h file in /sys/sys. In other words they are fully 1486d7f5d3SJohn Marinofunctional in a 'skeleton' sort of a way. They support multiple devices 1586d7f5d3SJohn Marinoso that you may have several of your 'foobar' devices probed and attached 1686d7f5d3SJohn Marinoat once. 1786d7f5d3SJohn Marino 1886d7f5d3SJohn MarinoI expect that these scripts will improve with time. 1986d7f5d3SJohn Marino 2086d7f5d3SJohn MarinoAt present these scripts also link the newly created driver into 2186d7f5d3SJohn Marinothe kernel sources in /sys. Possibly a better way would be 2286d7f5d3SJohn Marinoto make them interactive. (and ask what kernel tree to use as well as 2386d7f5d3SJohn Marinoa name for the driver.). 2486d7f5d3SJohn Marino 2586d7f5d3SJohn MarinoThere are presently two scripts. 2686d7f5d3SJohn MarinoOne for making a real device driver for ISA devices, and 2786d7f5d3SJohn Marinoone for making a device driver for pseudo devices (e.g. /dev/null). 2886d7f5d3SJohn MarinoHopefully they will be joined by similar scripts for creating 2986d7f5d3SJohn Marinoskeletons for PCI and EISA devices as well. 3086d7f5d3SJohn Marino 3186d7f5d3SJohn MarinoGive them a single argument: the name of the driver. 3286d7f5d3SJohn MarinoThey will use this given name in many places within the driver, 3386d7f5d3SJohn Marinoboth in lower and upper case form. (conforming to normal usage). 3486d7f5d3SJohn Marino 3586d7f5d3SJohn MarinoThe skeleton driver should already link with the kernel 3686d7f5d3SJohn Marinoand in fact the shell script will compile a kernel with the new 3786d7f5d3SJohn Marinodrive linked in.. The new kernel should still be 3886d7f5d3SJohn Marinorunnable and the new driver should be 3986d7f5d3SJohn Marinofully callable (once you get your device to probe). 4086d7f5d3SJohn MarinoYou should simply edit the driver and continue to use 4186d7f5d3SJohn Marino'make' (as done in the script) until your driver does what you want. 4286d7f5d3SJohn Marino 4386d7f5d3SJohn MarinoThe driver will end up in /sys/arch/i386/isa for the device driver script, 4486d7f5d3SJohn Marinoand in /sys/dev for the pseudo driver script. 45