Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.arcetri.astro.it/irlab/doc/library/linux/khg/HyperNews/get/devices/devices.html
Дата изменения: Thu Mar 23 12:37:25 2000
Дата индексирования: Wed Sep 15 01:27:05 2010
Кодировка:

Поисковые слова: coma
Device Drivers The HyperNews Linux KHG Discussion Pages

Device Drivers

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 hardware.
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 device drivers.
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 works.

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 Writing 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 drivers.

Copyright (C) 1992, 1993, 1994, 1996 Michael K. Johnson, johnsonm@redhat.com.


Messages

22. Question: DMA to user space by Marcel Boosten newer
21. Question: How a device driver can driver his device by Kim yeonseop new
1. None: Untitled new
20. Question: memcpy error? by Edgar Vonk
19. Question: Unable to handle kernel paging request - error by Edgar Vonk
17. Question: _syscallX() Macros by Tom Howley
16. Question: MediaMagic Sound Card DSP-16. How to run in Linux. by Robert Hinson
15. Question: What does mark_bh() do? by Erik Petersen
1. None: Untitled by Praveen Dwivedi
14. Question: 3D Acceleration by jamesbat@innotts.co.uk
13. Question: Device Drivers: /dev/radio... by Matthew Kirkwood
12. None: Does anybody know why kernel wakes my driver up without apparant reasons? by David van Leeuwen
11. Question: Getting a DMA buffer aligned with 64k boundaries by Juan de La Figuera Bayon
10. Question: Hardware Interface I/O Access by Terry Moore
1. More: You are somewhat confused... by Michael K. Johnson
9. Question: Is Anybody know something about SIS 496 IDE chipset? by Alexander
7. Question: Vertical Retrace Interrupt - I need to use it by Brynn Rogers
1. None: Your choice... by Michael K. Johnson
6. Question: help working with skb structures by arkane
5. Question: Interrupt Sharing ? by Frieder Löffler
1. Idea: Interrupt sharing-possible by Vladimir Myslik
-> More: Interrupt sharing - How to do with Network Drivers? by Frieder Löffler
-> Feedback: Interrupt sharing 101 by Christophe Beauregard
4. Question: Device Driver notification of "Linux going down" by Stan Troeh
1. Note: Through application which has opened the device by Michael K. Johnson
2. News: Device Driver notification of "Linux going down" by Marko Kohtala
3. Question: Is waitv honored? by Michael K. Johnson
2. None: PCI Driver by Flavia Donno
1. Question: There is linux-2.0/drivers/pci/pci.c by Hasdi
1. Note: Re: Network Device Drivers by Paul Gortmaker
1. More: Re: Network Device Drivers by Neal Tucker
1. More: network driver info by Neal Tucker
-> Idea: Network Driver Desprately Needed by Paul Atkinson
2. Question: Transmit function by Joerg Schorr
1. More: Re: Transmit function by Paul Gortmaker
-> Question: Skbuff by Joerg Schorr