Linux Device Drivers, 3/e (Paperback)

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

買這商品的人也買了...

商品描述

Description:

Device drivers literally drive everything you're interested in--disks, monitors, keyboards, modems--everything outside the computer chip and memory. And writing device drivers is one of the few areas of programming for the Linux operating system that calls for unique, Linux-specific knowledge. For years now, programmers have relied on the classic Linux Device Drivers from O'Reilly to master this critical subject. Now in its third edition, this bestselling guide provides all the information you'll need to write drivers for a wide range of devices.

Over the years the book has helped countless programmers learn:

  • how to support computer peripherals under the Linux operating system
  • how to develop and write software for new hardware under Linux
  • the basics of Linux operation even if they are not expecting to write a driver


The new edition of Linux Device Drivers is better than ever. The book covers all the significant changes to Version 2.6 of the Linux kernel, which simplifies many activities, and contains subtle new features that can make a driver both more efficient and more flexible. Readers will find new chapters on important types of drivers not covered previously, such as consoles, USB drivers, and more.

Best of all, you don't have to be a kernel hacker to understand and enjoy this book. All you need is an understanding of the C programming language and some background in Unix system calls. And for maximum ease-of-use, the book uses full-featured examples that you can compile and run without special hardware.

Today Linux holds fast as the most rapidly growing segment of the computer market and continues to win over enthusiastic adherents in many application areas. With this increasing support, Linux is now absolutely mainstream, and viewed as a solid platform for embedded systems. If you're writing device drivers, you'll want this book. In fact, you'll wonder how drivers are ever written without it.

 

Table of Contents:

Preface

1. An Introduction to Device Drivers

     The Role of the Device Driver
     Splitting the Kernel

     Classes of Devices and Modules
     Security Issues

     Version Numbering

     License Terms

     Joining the Kernel Development Community

     Overview of the Book

2. Building and Running Modules

     Setting Up Your Test System

     The Hello World Module

     Kernel Modules Versus Applications

     Compiling and Loading

     The Kernel Symbol Table

     Preliminaries

     Initialization and Shutdown

     Module Parameters

     Doing It in User Space

     Quick Reference

3. Char Drivers

     The Design of scull

     Major and Minor Numbers

     Some Important Data Structures

     Char Device Registration

     open and release

     scull's Memory Usage

     read and write

     Playing with the New Devices

     Quick Reference

4. Debugging Techniques

     Debugging Support in the Kernel

     Debugging by Printing

     Debugging by Querying

     Debugging by Watching

     Debugging System Faults

     Debuggers and Related Tools

5. Concurrency and Race Conditions

     Pitfalls in scull

     Concurrency and Its Management

     Semaphores and Mutexes

     Completions

     Spinlocks

     Locking Traps

     Alternatives to Locking

     Quick Reference

6. Advanced Char Driver Operations

     ioctl

     Blocking I/O

     poll and select

     Asynchronous Notification

     Seeking a Device

     Access Control on a Device File

     Quick Reference

7. Time, Delays, and Deferred Work

     Measuring Time Lapses

     Knowing the Current Time

     Delaying Execution

     Kernel Timers

     Tasklets

     Workqueues

     Quick Reference

8. Allocating Memory

     The Real Story of kmalloc

     Lookaside Caches

     get_free_page and Friends

     vmalloc and Friends

     Per-CPU Variables

     Obtaining Large Buffers

     Quick Reference

9. Communicating with Hardware

     I/O Ports and I/O Memory

     Using I/O Ports

     An I/O Port Example

     Using I/O Memory

     Quick Reference

10. Interrupt Handling

     Preparing the Parallel Port

     Installing an Interrupt Handler

     Implementing a Handler

     Top and Bottom Halves

     Interrupt Sharing

     Interrupt-Driven I/O

     Quick Reference

11. Data Types in the Kernel

     Use of Standard C Types

     Assigning an Explicit Size to Data Items

     Interface-Specific Types

     Other Portability Issues

     Linked Lists

     Quick Reference

12. PCI Drivers

     The PCI Interface

     A Look Back: ISA

     PC/104 and PC/104+

     Other PC Buses

     SBus

     NuBus

     External Buses

     Quick Reference

13. USB Drivers

     USB Device Basics

     USB and Sysfs

     USB Urbs

     Writing a USB Driver

     USB Transfers Without Urbs

     Quick Reference

14. The Linux Device Model

     Kobjects, Ksets, and Subsystems

     Low-Level Sysfs Operations

     Hotplug Event Generation

     Buses, Devices, and Drivers

     Classes

     Putting It All Together

     Hotplug

     Dealing with Firmware

     Quick Reference

15. Memory Mapping and DMA

     Memory Management in Linux

     The mmap Device Operation

     Performing Direct I/O

     Direct Memory Access

     Quick Reference

16. Block Drivers

     Registration

     The Block Device Operations

     Request Processing

     Some Other Details

     Quick Reference

17. Network Drivers

     How snull Is Designed

     Connecting to the Kernel

     The net_device Structure in Detail

     Opening and Closing

     Packet Transmission

     Packet Reception

     The Interrupt Handler

     Receive Interrupt Mitigation

     Changes in Link State

     The Socket Buffers

     MAC Address Resolution

     Custom ioctl Commands

     Statistical Information

     Multicast

     A Few Other Details

     Quick Reference

18. TTY Drivers

     A Small TTY Driver

     tty_driver Function Pointers

     TTY Line Settings

     ioctls

     proc and sysfs Handling of TTY Devices

     The tty_driver Structure in Detail

     The tty_operations Structure in Detail

     The tty_struct Structure in Detail

     Quick Reference

Bibliography

Index

商品描述(中文翻譯)

描述:
設備驅動程式實際上驅動著你所感興趣的一切 - 磁碟、顯示器、鍵盤、調制解調器 - 除了電腦芯片和記憶體以外的所有東西。而撰寫設備驅動程式是Linux作業系統中少數需要獨特、特定於Linux的知識的程式設計領域之一。多年來,程式設計師一直依賴O'Reilly出版的經典書籍《Linux設備驅動程式》來掌握這個重要的主題。現在,這本暢銷指南的第三版提供了撰寫各種設備驅動程式所需的所有資訊。

多年來,這本書幫助了無數程式設計師學習:
- 如何在Linux作業系統下支援電腦外設
- 如何在Linux下開發和撰寫新硬體的軟體
- 即使他們不打算撰寫驅動程式,也能了解Linux操作的基礎知識

《Linux設備驅動程式》的新版比以往任何時候都更好。這本書涵蓋了Linux核心2.6版本的所有重大變化,這簡化了許多活動,並包含了可以使驅動程式更高效和更靈活的微妙新功能。讀者將找到以前未涵蓋的重要類型的驅動程式的新章節,例如控制台、USB驅動程式等。

最重要的是,你不需要成為核心黑客才能理解和享受這本書。你只需要對C編程語言有一定的了解,以及對Unix系統調用有一些背景知識。為了最大限度地提高易用性,這本書使用了完整功能的範例,你可以編譯和運行而無需特殊硬體。

如今,Linux在電腦市場中持續快速增長,並在許多應用領域贏得了熱情的支持者。隨著這種支持的增加,Linux現在絕對是主流,被視為嵌入式系統的穩定平台。如果你正在撰寫設備驅動程式,你一定需要這本書。事實上,你會想知道沒有這本書,驅動程式是如何被撰寫的。

目錄:
前言
1. 設備驅動程式介紹
- 設備驅動程式的角色
- 分割核心
- 設備和模組的類別
- 安全問題
- 版本編號
- 授權條款
- 加入核心開發社群
- 本書概述
2. 建立和執行模組
- 設置測試系統
- Hello World模組
- 核心模組與應用程式
- 編譯和載入
- 核心符號表
- 預備工作
- 初始化和關機
- 模組參數
- 在使用者空間中執行
- 快速參考
3. 字元驅動程式