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