Newbie Question to Device driver writing
gurney_j at resnet.uoregon.edu
Thu Aug 17 06:29:31 UTC 2006
Jonathan Herriott wrote this message on Thu, Aug 17, 2006 at 00:29 -0400:
> 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
> 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.
Well, the cdevsw doesn't contain much more than the standard operations
you can do on a character device... The Design and Implementation of
the FreeBSD Operating System doesn't have much more info on cdevsw than
you can get from the header file...
d_open, d_fdopen, d_close, d_read, d_write, d_ioctl are each called
in response to their respective call (if d_fdopen is defined, it is
used instead of d_open for open calls, though apparently no one is
using this yet)...
d_poll, d_mmap and d_kqfilter can be called multiple times or not at
all for their respective syscalls... FreeBSD implements select as a
wrapper around poll...
> On a side note, is there a good irc channel for FreeBSD driver writing
Not that I know of... Though the -drivers mailing list has been more
active of late...
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-drivers