Linux设备驱动程序(第三版,影印版)
Linux设备驱动程序(第三版,影印版)
Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman
出版时间:2005年06月
页数:640
这本经典书籍目前已更新至第三版,对于那些希望在Linux操作系统下支持计算机外围设备、运行新硬件,或者仅仅对Linux内核普通编程感兴趣的人来说,它是本必读书籍。《Linux设备驱动程序》揭示了如何给大多数的设备编写驱动程序的信息,这些信息迄今仅通过口头或者隐晦的源代码注释被共享。
本书的作者是Linux社区的领导者。Jonathan Corbet是个不定期的内核开源项目参与者同时还是评价甚高的LWN.net新闻和信息站点的执行编辑。Alessandro Rubini是Linux代码的一个开源提供者同时也是活跃的意大利Linux社区的中心人物。Greg Kroah-Hartman目前是本书描述的USB、PCI和驱动核心子系统相关的内核代码维护者。
本书新版根据Linux内核2.6.10彻底更新。内核的这个版本更加合理化并简化了普通工作任务的几个方法,比如即插即用、通过sysfs文件系统和用户空间交互、标准总线上的多设备管理。
你不必是一个内核高手就可以理解并享受本书,所需要的只是C以及Unix系统调用方面的背景知识。在不需要特殊的硬件设备就能编译和运行的详细示例的指引下,你将学会如何给字符设备、块设备和网络接口编写驱动程序。PCI、USB和tty(终端)子系统都单列一章。本书为那些对操作系统的工作机制好奇的人提供了地址空间、异步事件和I/O等方面的阐述。
本书的主题包括:
* 字符设备、块设备、tty(终端)和网络驱动程序
* 驱动程序调试
* 中断
* 定时问题
* 内存管理和DMA
* 驱动模型和sysfs
* 热插拔设备
* 通用总线,包括SCSI、PCI、USB和IEEE1394(FireWire)的特殊要求
  1. Preface
  2. 1. An Introduction to Device Drivers
  3. The Role of the Device Driver
  4. Splitting the Kernel
  5. Classes of Devices and Modules
  6. Security Issues
  7. Version Numbering
  8. License Terms
  9. Joining the Kernel Development Community
  10. Overview of the Book
  11. 2. Building and Running Modules
  12. Setting Up Your Test System
  13. The Hello World Module
  14. Kernel Modules Versus Applications
  15. Compiling and Loading
  16. The Kernel Symbol Table
  17. Preliminaries
  18. Initialization and Shutdown
  19. Module Parameters
  20. Doing It in User Space
  21. Quick Reference
  22. 3. Char Drivers
  23. The Design of scull
  24. Major and Minor Numbers
  25. Some Important Data Structures 49Char Device Registration
  26. open and release
  27. scull's Memory Usage
  28. read and write
  29. Playing with the New Devices
  30. Quick Reference
  31. 4. Debugging Techniques
  32. Debugging Support in the Kernel
  33. Debugging by Printing
  34. Debugging by Querying
  35. Debugging by Watching
  36. Debugging System Faults
  37. Debuggers and Related Tools
  38. 5. Concurrency and Race Conditions
  39. Pitfalls in scull
  40. Concurrency and Its Management
  41. Semaphores and Mutexes
  42. Completions
  43. Spinlocks
  44. Locking Traps
  45. Alternatives to Locking
  46. Quick Reference
  47. 6. Advanced Char Driver Operations
  48. ioctl
  49. Blocking I/O
  50. poll and select
  51. Asynchronous Notification
  52. Seeking a Device
  53. Access Control on a Device File
  54. Quick Reference
  55. 7. Time, Delays, and Deferred Work
  56. Measuring Time Lapses
  57. Knowing the Current Time
  58. Delaying Execution
  59. Kernel Timers
  60. Tasklets
  61. Workqueues
  62. Quick Reference
  63. 8. Allocating Memory
  64. The Real Story of kmalloc
  65. Lookaside Caches
  66. get_free_page and Friends
  67. vmalloc and Friends
  68. Per-CPU Variables
  69. Obtaining Large Buffers
  70. Quick Reference
  71. 9. Communicating with Hardware
  72. I/O Ports and I/O Memory
  73. Using I/O Ports
  74. An I/O Port Example
  75. Using I/O Memory
  76. Quick Reference
  77. 10. Interrupt Handling
  78. Preparing the Parallel Port
  79. Installing an Interrupt Handler
  80. Implementing a Handler
  81. Top and Bottom Halves
  82. Interrupt Sharing
  83. Interrupt-Driven I/O
  84. Quick Reference
  85. 11. Data Types in the Kernel
  86. Use of Standard C Types
  87. Assigning an Explicit Size to Data Items
  88. Interface-Specific Types
  89. Other Portability Issues
  90. Linked Lists
  91. Quick Reference
  92. 12. PCI Drivers
  93. The PCI Interface
  94. A Look Back:ISA
  95. PC/104 and PC/104+
  96. Other PC Buses
  97. SBus
  98. NuBus
  99. External Buses
  100. Quick Reference
  101. 13. USB Drivers
  102. USB Device Basics
  103. USB and Sysfs
  104. USB Urbs
  105. Writing a USB Driver
  106. USB Transfers Without Urbs
  107. Quick Reference
  108. 14. The Linux Device Model
  109. Kobjects,Ksets,and Subsystems
  110. Low-Level Sysfs Operations
  111. Hotplug Event Generation
  112. Buses,Devices,and Drivers
  113. Classes
  114. Putting It All Together
  115. Hotplug
  116. Dealing with Firmware
  117. Quick Reference
  118. 15. Memory Mapping and DMA
  119. Memory Management in Linux
  120. The mmap Device Operation
  121. Performing Direct I/O
  122. Direct Memory Access
  123. Quick Reference
  124. 16. Block Drivers
  125. Registration
  126. The Block Device Operations
  127. Request Processing
  128. Some Other Details
  129. Quick Reference
  130. 17. Network Drivers
  131. How snull Is Designed
  132. Connecting to the Kernel
  133. The net_device Structure in Detail
  134. Opening and Closing
  135. Packet Transmission
  136. Packet Reception
  137. The Interrupt Handler
  138. Receive Interrupt Mitigation
  139. Changes in Link State
  140. The Socket Buffers
  141. MAC Address Resolution
  142. Custom ioctl Commands
  143. Statistical Information
  144. Multicast
  145. A Few Other Details
  146. Quick Reference
  147. 18. TTY Drivers
  148. A Small TTY Driver
  149. tty_driver Function Pointers
  150. TTY Line Settings
  151. ioctls
  152. proc and sysfs Handling of TTY Devices
  153. The tty_driver Structure in Detail
  154. The tty_operations Structure in Detail
  155. The tty_struct Structure in Detail
  156. Quick Reference
  157. Bibliography
  158. Index
书名:Linux设备驱动程序(第三版,影印版)
国内出版社:东南大学出版社
出版时间:2005年06月
页数:640
书号:7-5641-0044-3
原版书出版商:O'Reilly Media
Jonathan Corbet
 
Jonathan Corbet早在1981年就开始接触BSD Unix的源代码。那时,科罗拉多大 学的一名讲师让他“修正”其中的分页算法。从那时起直到现在,他深入研究了他 所遇到的每一个系统,其中包括VAX、Sun、Ardent以及x86系统的驱动程序。他 在 1993年第一次接触Linux系统,从此以后一直从事Linux的开发。Corbet先生是 《Linux Weekly News》(http://LWN.net)的创始人和执行主编。他和妻子及两个孩子生活在科罗拉多州的玻尔得市(Boulder)。
 
 
Alessandro Rubini
 
Alessandro Rubini在获得电子工程师资格后不久,他就安装了Linux 0.99.14版 本。后来,他在Pavia大学获得了计算机科学博士学位。但很快他就离开了大学, 因为他实在不想写文章。现在,他是一名自由撰稿人,编写有关设备驱动程序方面的文章(这也许是命运的安排)。在他的小孩出世之前,他曾是一名年轻的黑客,而现在他是一位老练、偏爱非PC计算机平台开发的自由软件鼓吹者。
 
 
Greg Kroah-Hartman
 
Greg Kroah-Hartman has been building the Linux kernel since 1996 and started
writing Linux kernel drivers in 1999. He is currently the maintainer of the USB,
PCI,driver core,and sysfs subsystems in the kernel source tree and is also one half of the -stable kernel release team. He created the udev program and maintains the Linux hotplug userspace project. He is a Gentoo Linux developer as well as the coauthor of the third edition of Linux Device Drivers (O'Reilly) and a contributing editor to Linux Journal. He also created and maintains the Linux Device Driver Kit. He currently works for SUSE Labs/Novell,doing various Linux kernelrelated tasks.

Greg Kroah-Hartman has been writing Linux kernel drivers since 1999 and is currently the maintainer for the USB, PCI, I2C, driver core, and sysfs kernel subsystems. He is also the maintainer of the udev and hotplug userspace programs, as well as a Gentoo kernel maintainer, ensuring that his inbox is never empty. He is a contributing editor to Linux Journal magazine.
 
 
The image on the cover of Linux Device Drivers, Third Edition is a bucking bronco. A colorful description of this animal appears in Marvels of the New West: A Vivid Portrayal of the Stupendous Marvels in the Vast Wonderland West of the Missouri River, by William Thayer (The Henry Bill Publishing Co., Norwich, CT, 1888). Thayer quotes a stockman, who gives this description of a bucking horse: "When a horse bucks he puts his head down between his legs, arches his back like an angrycat, and springs into the air with all his legs at once,coming down again with a frightful jar, and he sometimes keeps on repeating the performance until he is completely worn out with the excursion. The rider is apt to feel rather worn out too by that time, if he has kept his seat,which is not a very easy matter, especially if the horse is a real scientific bucker,and puts a kind of side action into every jump. The double girth commonly attached to these Mexican saddles is useful for keeping the saddle in its place during one of those bouts,but there is no doubt that they frequently make a horse buck who would not do so with a single girth.With some animals you can never draw up the flank girth without setting them bucking."