From owner-freebsd-hackers Thu Aug 13 13:17:46 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA05033 for freebsd-hackers-outgoing; Thu, 13 Aug 1998 13:17:46 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp01.primenet.com (smtp01.primenet.com [206.165.6.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA05028 for ; Thu, 13 Aug 1998 13:17:44 -0700 (PDT) (envelope-from tlambert@usr09.primenet.com) Received: (from daemon@localhost) by smtp01.primenet.com (8.8.8/8.8.8) id NAA14664; Thu, 13 Aug 1998 13:17:17 -0700 (MST) Received: from usr09.primenet.com(206.165.6.209) via SMTP by smtp01.primenet.com, id smtpd014641; Thu Aug 13 13:17:16 1998 Received: (from tlambert@localhost) by usr09.primenet.com (8.8.5/8.8.5) id NAA14261; Thu, 13 Aug 1998 13:17:13 -0700 (MST) From: Terry Lambert Message-Id: <199808132017.NAA14261@usr09.primenet.com> Subject: Re: developing device drivers To: hm@kts.org Date: Thu, 13 Aug 1998 20:17:13 +0000 (GMT) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: from "Hellmuth Michaelis" at Aug 13, 98 11:57:23 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 ? You probe and attach at load time, normally. This means you detect the IRQ/DRQ/IOBase/MemBase/Etc., not assign it. That means you should write the probe code first. The flags and spl have to be dealt with by unloading, modifying, and loading. Frankly, I think you'll not need to change the spl you use since it's pretty much fixed by the kind of device you are driving. You could also provide an ioctl to diddle the flags, and run a program in user space that diddles them one the driver is loaded. You are doing this under -current, right? If not, it's going to be hard to unload, since detaching ISA resources wasn't well supported before the PCMCIA code required it. One of the sample drivers used to be an LPT driver, which grabbed IRQ7; I haven't looked at the hardware part of the codebase for LKM in a while (well, mostly; I did help someone with loading a line discipline recently, but that didn't grab and release resources). Most -current drivers are capable of dual-mode compilation. For specific examples, look in /usr/src/lkm/ for joy, pcic, qcam, and wcd. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message