Date: Thu, 17 Aug 2006 18:55:05 +0800 From: "Intron is my alias on the Internet" <mag@intron.ac> To: "Jonathan Herriott" <herriojr@gmail.com> Cc: freebsd-drivers@freebsd.org Subject: Re: Newbie Question to Device driver writing Message-ID: <courier.44E44B09.00015C21@intron.ac> In-Reply-To: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com> References: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Jonathan Herriott wrote: > Hi! > > I've been interested in learning how to write device drivers for quite > some time, but I had never had the time to devote to it until now. > > I was reading through the FreeBSD architecture handbook and came > across the example echo character driver. To make sure I understand > all that's going on, I'm searching though all the header files to > understand what each thing is such as the cdevsw structure and cdev > structure. > > I've come to the conclusion that the cdev structure is what is used to > store the information about the actual device I open with make_dev. I > was wondering if there is a place in which I can find a good > explanation of the different attributes of the structure. The header > files don't provide much insight for a newbie, so I was wondering if > there might be some other location. > > On a side note, is there a good irc channel for FreeBSD driver writing > discussion? > > Thanks in advance! > > Jon > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" In my opinion, any hardware driver has two interfaces, one user side interface and one kernel side interface. User side interface is created by make_dev(9). The structure cdevsw mainly contains a table of operations upon this device (i.e. "method" in object-oriented model) and permission of the device file node to be created under /dev/. We are familiar with the operations for read(2), write(2) and so on, but "strategy", "dump", "kqfilter" and others are relatively strange to us. Kernel side interface is used to access PCI bus, USB and other hardware resource, and to obtain memory space, shared/exclusive lock and module management support and other function sets. To be honest, you need to hack FreeBSD source code yourself if you would master FreeBSD kernel really. The mailing list -drivers@ lacks discussants. And you may send your question to -hackers@. What driver would you contribute to FreeBSD? I have interests to contribute something concerning hardware to FreeBSD. ------------------------------------------------------------------------ From Beijing, China
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?courier.44E44B09.00015C21>