Device Driver

From Nekochan
Jump to: navigation, search


Merely cutting and pasting a device driver from FreeBSD source is not going to work. Gather any documentation you can find about the device you are interested in. Become a guru in the protocol or specification not only on the platform you are developing but for any platform. Sure read and analyze existing implementation for BSDs or Linux or anything else, but don't rely on it as the sole source of all wisdom.

Start from user space

Probe and poke the device from user space programs as best you can. For example, write a program to open() the device special file in the hardware graph, call mmap() or ioctl() on it and dump the configuration space of the device. See if you can make the device do something from process (user) space first.

Understand kernel programming

Create an empty loadable kernel module driver that loads, registers and unloads cleanly. Understand basic kernel programming techniques.

See Also