HyperNews Linux KHG
If you choose to write a device driver, you must take
everything written here as a guide, and no more. I cannot
guarantee that this chapter will be free of errors, and I
cannot guarantee that you will not damage your computer, even
if you follow these instructions exactly. It is highly
unlikely that you will damage it, but I cannot guarantee
against it. There is only one ``infallible'' direction I can
give you: Back up! Back up before you test your new
device driver, or you may regret it later.
- What is a Device Driver?
- What is this ``device driver'' stuff anyway? Here's
a very short introduction to the concept.
- User-space device drivers
- It's not always necessary to write a ``real'' device
driver. Sometimes you just need to know how to write
code that runs as a normal user process and still accesses
- Device Driver Basics
- Assuming that you need to write a ``real'' device driver,
there are some things that you need to know regardless of
what type of driver you are writing. In fact, you may need
to learn what type of driver you ought to write...
- Character Device Drivers
- This section includes details specific to character device
drivers, and assumes that you know everything in the previous section.
- TTY drivers
- This section hasn't been written yet. TTY drivers are
character devices that interface with the kernel's generic TTY
support, and they require more than just a standard character
device interface. I'd appreciate it if someone would write
up how to attach a character device driver to the generic
TTY layer and submit it to me for inclusion in this guide.
- Block Device Drivers
- This section includes details specific to block device drivers (suprise!)
- Writing a SCSI Device Driver
- This is a technical paper written by Rik Faith at the
University of North Carolina.
- Network Device Drivers
- Alan Cox gives an introduction to the network layer, including
- Supporting Functions
- Many functions are useful to all sorts of drivers. Here is
a summary of quite a few of them.
- Translating Addresses in Kernel Space
- An edited version of a post of Linus Torvalds to the linux-kernel
mailing list about how to correctly deal with translating memory
references when writing kernel source code such as device drivers.
- Kernel-Level Exception Handling
- An edited version of a post of Joerg Pommnitz to the linux-kernel
mailing list about how the new (Linux 2.1.8) exception mechanism
Other sources of information
Quite a few other references are also available on the topic
of writing Linux device drivers by now. I put up some (slightly
outdated by now, but still worth reading, I think) notes for a
talk I gave in May 1995 entitled
Linux Device Drivers,
which is specifically oriented at character devices implemented
as kernel runtime-loadable modules.
Linux Journal has
had a long-running series of articles called Kernel Korner
which, despite the wacky name, has had quite a bit of useful information
on it. Some of the articles from that column may be available on
the web; most of them are available for purchase as back issues.
One particularly useful series of articles, which focussed in
far more detail than my 30 minute talk on the subject of kernel
runtime-loadable modules, was in issues 23, 24, 25, 26, and 28.
They were written by Alessandro Rubini and Georg v. Zezschwitz.
Issue 29 is slated (as of this writing) to have an article
on writing network device drivers, written by Alan Cox.
Issues 9, 10, and 11 have a series that I wrote on block device
Copyright (C) 1992, 1993, 1994, 1996 Michael K. Johnson,
DMA to user space by Marcel Boosten
How a device driver can driver his device by Kim yeonseop
memcpy error? by Edgar Vonk
Unable to handle kernel paging request - error by Edgar Vonk
_syscallX() Macros by Tom Howley
MediaMagic Sound Card DSP-16. How to run in Linux. by Robert Hinson
What does mark_bh() do? by Erik Petersen
Untitled by Praveen Dwivedi
3D Acceleration by firstname.lastname@example.org
Device Drivers: /dev/radio... by Matthew Kirkwood
Does anybody know why kernel wakes my driver up without apparant reasons? by David van Leeuwen
Getting a DMA buffer aligned with 64k boundaries by Juan de La Figuera Bayon
Hardware Interface I/O Access by Terry Moore
You are somewhat confused... by Michael K. Johnson
Is Anybody know something about SIS 496 IDE chipset? by Alexander
Vertical Retrace Interrupt - I need to use it by Brynn Rogers
Your choice... by Michael K. Johnson
help working with skb structures by arkane
Interrupt Sharing ? by Frieder Löffler
Interrupt sharing-possible by Vladimir Myslik
Interrupt sharing - How to do with Network Drivers? by Frieder Löffler
Interrupt sharing 101 by Christophe Beauregard
Device Driver notification of "Linux going down" by Stan Troeh
Through application which has opened the device by Michael K. Johnson
Device Driver notification of "Linux going down" by Marko Kohtala
Is waitv honored? by Michael K. Johnson
PCI Driver by Flavia Donno
There is linux-2.0/drivers/pci/pci.c by Hasdi
Re: Network Device Drivers by Paul Gortmaker
Re: Network Device Drivers by Neal Tucker
network driver info by Neal Tucker
Network Driver Desprately Needed by Paul Atkinson
Transmit function by Joerg Schorr
Re: Transmit function by Paul Gortmaker
Skbuff by Joerg Schorr