Date: Thu, 13 Aug 1998 20:17:13 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: hm@kts.org Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: developing device drivers Message-ID: <199808132017.NAA14261@usr09.primenet.com> In-Reply-To: <m0z6u8J-000026C@bert.kts.org> from "Hellmuth Michaelis" at Aug 13, 98 11:57:23 am
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808132017.NAA14261>