The FreeBSD webpage contains a link to an interesting introduction on how to write kernel modules. It's a very good starting point if you plan to write a module or if you want to read an existing modules code. You can find the article at

http://www.freesoftwaremagazine.com/articles/writing_a_kernel_module_for_freebsd

Have fun