From owner-freebsd-hackers Thu Aug 13 05:08:47 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA19164 for freebsd-hackers-outgoing; Thu, 13 Aug 1998 05:08:47 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mrelay.jrc.it (mrelay.jrc.it [139.191.1.65]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA19156 for ; Thu, 13 Aug 1998 05:08:42 -0700 (PDT) (envelope-from nick.hibma@jrc.it) Received: from elect8 (elect8.jrc.it [139.191.71.152]) by mrelay.jrc.it (LMC5688) with SMTP id OAA02778; Thu, 13 Aug 1998 14:07:49 +0200 (MET DST) Date: Thu, 13 Aug 1998 14:07:49 +0200 (MET DST) From: Nick Hibma X-Sender: n_hibma@elect8 Reply-To: Nick Hibma To: hm@kts.org cc: FreeBSD hackers mailing list Subject: Re: developing device drivers In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I second this. If you look in /usr/share/examples, you'll find a > > couple of sample LKMs written by Terry Lambert. I hijacked the syscall > > example from here and used it a lot to experiment with the XL driver. > > I'd really like to write drivers (for ISA cards) as LKM modules, but so > far i don't know how to assign 1) the IRQ, 2) the iobase and 3) the membase > ( and perhaps flags and spl) to the LKM at module load time. > > Did i miss something ? Perhaps, Have a look at the verious examples, for example the wcd driver. Another possibility is to write a device driver that hooks into the kernel at boot time, picks up the relevant information and stores it in a struct. Besides attaching to the device getting that information and maybe initialising the device it doesn't do anything. About 200 lines of code should be easy enough to debug. Then you write an LKM that abuses this information struct to initialise the card as soon as the LKM is loaded. If you get the init and deinit right in your LKM there should be no problem. It worked for me while doing some work on a USB driver stack. If needed I can send that code to you as an example. Or pick it up at http://www.etla.net/~n_hibma/usb/usb.pl Cheers, Nick -- building: 27A address: STA-ISIS, T.P.270, Joint Research Centre, 21020 Ispra, Italy tel.: +39 332 78 9549 fax.: +39 332 78 9185 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message