From owner-freebsd-hackers Sun Dec 17 15:49:38 2000 From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 17 15:49:35 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from db.wireless.net (adsl-gte-la-216-86-194-70.mminternet.com [216.86.194.70]) by hub.freebsd.org (Postfix) with ESMTP id 0C2A937B400 for ; Sun, 17 Dec 2000 15:49:35 -0800 (PST) Received: from wireless.net (dbm.wireless.net [192.168.0.2]) by db.wireless.net (8.9.3/8.9.3) with ESMTP id PAA34345 for ; Sun, 17 Dec 2000 15:35:11 -0800 (PST) (envelope-from dbutter@wireless.net) Sender: dbutter@db.wireless.net Message-ID: <3A3D513B.52737F48@wireless.net> Date: Sun, 17 Dec 2000 15:50:19 -0800 From: Devin Butterfield X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: hackers@freebsd.org Subject: Re: Writing Device Drivers Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG David Preece wrote: > > At 13:02 17/12/00 +0000, you wrote: > >Does anyone have any good tips to get started / HowTo's, or some simple > >examples > >that will give me knowledge like the PC Speaker or something simple like > >that? > > This is turning into a FAQ, but don't worry about it. The usual answer is > to take one of the existing drivers and work out what it does. There's also > a script for making shell drivers under /usr/share/examples/drivers. As for > things like "how does DMA work?", "what exactly is an interrupt and what do > I do with it?" or "what's the story with memory ranges and devices then?" > then I'm afraid I can't help you there. > > In fact (to -hackers) this strikes me as one of the more fundamental > problems of free software: I would go and write/fix some device drivers > (for example the unknown phy in fxp that bothers me so much), except I > can't really get a handle on how you're supposed to start on these things. > Comments? URL's for IRQ101? Perhaps I should just stop whingeing and go > hack with it to see what happens? (probably best). > > >Jamie > > Dave > I've had to deal with this frustration too (and I still do) because there is no good documentation to speak of for writing FreeBSD device drivers. It wouldn't be so bad if there were man pages for many of the commonly used functions like rman_get_bustag(), etc. This way you could study the code of other drivers and quickly be able to identify and understand the function calls you were seeing. Instead of grumbling "what the !@#$ does that function call do?" just type "man 9 foo" or whatever. This is IMHO one of the advantages linux has over FreeBSD. You can run by your local Barnes & Noble bookstore and pick up a copy of "Linux Device Drivers" and start writing code that you actually understand. You'd think a couple of these FreeBSD wizards would get together and write "FreeBSD Device Drivers" to spare us the pain and make a little $$ while they're at it! Just my 2 cents. -- Regards, Devin. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message