1#!/bin/sh 2# This writes a skeleton driver and puts it into the kernel tree for you. 3# It also adds FOO and files.FOO configuration files so you can compile 4# a kernel with your FOO driver linked in. 5# To do so: 6# cd /usr/src; make buildkernel KERNCONF=FOO 7# 8# More interestingly, it creates a modules/foo directory --- 6 unchanged lines hidden (view full) --- 15# arg2 path to the kernel sources, "/sys" if omitted 16# 17# Trust me, RUN THIS SCRIPT :) 18# 19# TODO: 20# o generate foo_isa.c, foo_pci.c, foo_pccard.c, foo_cardbus.c, and foovar.h 21# o Put pccard stuff in here. 22# |
23# $FreeBSD: head/share/examples/drivers/make_device_driver.sh 222179 2011-05-22 14:23:48Z uqs $" |
24# 25# 26if [ "X${1}" = "X" ]; then 27 echo "Hey, how about some help here... give me a device name!" 28 exit 1 29fi 30if [ "X${2}" = "X" ]; then 31 TOP=`cd /sys; pwd -P` --- 448 unchanged lines hidden (view full) --- 480 * XXX bytes of memory window, we can override 481 * or set the memory size in the child resource list. 482 */ 483 memsize = inb(port_start + 1) * 1024; /* for example */ 484 error = bus_set_resource(device, SYS_RES_MEMORY, 485 /*rid*/0, membase, memsize); 486 /* 487 * We found one, return non-positive numbers.. |
488 * Return -N if we can't handle it, but not well. |
489 * Return -2 if we would LIKE the device. 490 * Return -1 if we want it a lot. 491 * Return 0 if we MUST get the device. 492 * This allows drivers to 'bid' for a device. 493 */ 494 device_set_desc(device, "ACME Widget model 1234"); 495 error = -1; /* We want it but someone else 496 may be even better. */ --- 519 unchanged lines hidden --- |