In 1998 Alessandro Rubini produced a book that has become the standard reference book for anyone writing a device driver for Linux. At the time he concentrated on the 2.0 series kernels, with an appendix highlighting the differences to be expected when moving to the 2.2 series kernel. Joined by Jonathan Corbet, this excellent book has been brought right up to date (as of June 2001) and now includes details for the 2.4 series kernels, without losing the backwards compatibility with 2.0 and 2.2.
The format of the original book is largely unchanged and assumes only a relatively low level of previous C and Unix/Linux experience - as is commonly the case with low-level code under Unix, C is preferred to C++. The code itself is consistently readable and well commented, although Lint may take exception to some of the constructs used. Sadly the keyword const is conspicuous by its absence and even volatile is only given a passing reference.
Although the writing of a device driver is necessarily a very technical subject, the authors have managed to produce a very readable book - in fact it's so readable a novice would probably be best advised to start by simply reading the text from cover to cover, skipping the code sections entirely! Once all the ideas have been learnt, go back and pick out the technical details needed using the excellent contents pages and index.
The first four chapters of the book really do take the needs of a neophyte device driver writer to heart. Starting with an introduction to what a device driver is and how one can be written as a Linux kernel module, a trivial device driver is written and debugged.
The remaining chapters in the book each address a different topic that may be faced by the device driver writer: how to obtain memory, how to handle interrupts, how to implement DMA and so on. Each topic is dealt with in a consistently thorough manner, showing both the correct way to achieve the goal and pointing out potential pitfalls along the way.
By and large the assumption is that the device driver will run on an i386 based PC with a PCI bus, however other architectures are mentioned whenever significant differences exist. Other bus architectures are also covered, included ISA and PC104/PC104+. USB is also covered briefly, with web references for more detailed coverage.Window's Programming