Mastering Linux Device Driver Development – Bilingual Edition

Mastering Linux Device Driver Development - Bilingual Edition

Mastering Linux Device Driver Development, published by People’s Posts and Telecommunications Press, English original title: Essential Linux Device Drivers. Author: Sreekrishnan Venkateswaran, translated by Song Baohua and others. “Mastering Linux Device Driver Development” is a work in the field of Linux device driver development. The book is based on the 2.6 kernel and not only thoroughly explains basic concepts and techniques but also delves into many important topics and key difficulties that other books do not cover or only briefly touch upon, such as PCMCIA, I2C, and USB external buses, as well as the development of drivers for video, audio, wireless networking, and flash memory, and explains the relevant kernel source files, providing complete development examples.

Table of Contents for Mastering Linux Device Driver Development

Chapter 1 Introduction 1.1 Evolution 1.2 GNU Copyleft 2 1.3 kernel.org 2 1.4 Mailing Lists and Forums 3 1.5 Linux Distributions 3 1.6 Viewing Source Code 4 1.7 Compiling the Kernel 7 1.8 Loadable Modules 8 1.9 Ready to Go 9

Chapter 2 The Kernel 1 2.1 Boot Process 1 2.1.1 BIOS-provided Physical RAM Map 12 2.1.2 758MB LOWMEM Available 14 2.1.3 Kernel Command Line: ro root=/dev/hda1 14 2.1.4 Calibrating Delay… 19 7.46 BogoMIPS (1pj=2394935) 15 2.1.5 Checking HLT Instruction 16 2.1.6 NET: Registered Protocol Family 21 2.1.7 Freeing initrd Memory: 387k Freed 17 2.1.8 I/O Scheduler Anticipatory Registered (Default) 18 2.1.9 Setting Up Standard PCI Resources 18 2.1.10 EXT3-fs: Mounted Filesystem 19 2.1.11 INIT: Version 2.85 Booting 19 2.2 Kernel Mode and User Mode 20 2.3 Process Context and Interrupt Context 20 2.4 Kernel Timers 21 2.4.1 HZ and Jiffies 21 2.4.2 Long Delays 22 2.4.3 Short Delays 24 2.4.4 Pentium Timestamp Counter 24 2.4.5 Real-Time Clock 25 2.5 Concurrency in the Kernel 26 2.5.1 Spinlocks and Mutexes 26 2.5.2 Atomic Operations 30 2.5.3 Read-Write Locks 31 2.5.4 Debugging 32 2.6 proc Filesystem 32 2.7 Memory Allocation 33 2.8 Viewing Source Code 34

Chapter 3 Kernel Components 37 3.1 Kernel Threads 37 3.1.1 Creating Kernel Threads 37 3.1.2 Process States and Wait Queues 41 3.1.3 User Mode Helper 42 3.2 Helper Interfaces 43 3.2.1 Linked Lists 44 3.2.2 Hash Linked Lists 49 3.2.3 Work Queues 49 3.2.4 Notifiers 51 3.2.5 Completion Interfaces 54 3.2.6 kthread Helper Interfaces 56 3.2.7 Error Handling Helper 57 3.3 Viewing Source Code 58

Chapter 4 Basic Concepts 61 4.1 Introduction to Devices and Drivers 61 4.2 Interrupt Handling 63 4.2.1 Interrupt Context 63 4.2.2 Allocating IRQ Numbers 64 4.2.3 Device Instance: Joystick 65 4.2.4 softirq and Tasklet 68 4.3 Linux Device Model 71 4.3.1 udev 71 4.3.2 sysfs, kobject, and Device Class 73 4.3.3 Hot Plugging and Cold Plugging 76 4.3.4 Firmware Download 76 4.3.5 Module Auto-Loading 77 4.4 Memory Barriers 78 4.5 Power Management 79 4.6 Viewing Source Code 79

Chapter 5 Character Device Drivers 81 5.1 Basics of Character Device Drivers 81 5.2 Device Instance: System CMOS 82 5.2.1 Driver Initialization 83 5.2.2 Open and Release 86 5.2.3 Data Exchange 88 5.2.4 Lookup 92 5.2.5 Control 94 5.3 Detecting Data Availability 95 5.3.1 Polling 95 5.3.2 Fasync 98 5.4 Interaction with Parallel Ports 99 5.5 RTC Subsystem 108 5.6 Pseudo Character Drivers 109 5.7 Promiscuous Drivers 110 5.8 Considerations for Character Device Drivers 115 5.9 Viewing Source Code 115

Chapter 6 Serial Device Drivers 118 6.1 Hierarchical Architecture 119 6.2 UART Drivers 121 6.2.1 Device Instance: Mobile Phone 122 6.2.2 RS-485 132 6.3 TTY Drivers 132 6.4 Line Protocol 134 6.5 Viewing Source Code 141

Chapter 7 Input Device Drivers 143 7.1 Input Event Drivers 144 7.2 Input Device Drivers 150 7.2.1 serio 150 7.2.2 Keyboard 150 7.2.3 Mouse 152 7.2.4 Touch Controller 157 7.2.5 Accelerometer 158 7.2.6 Output Events 158 7.3 Debugging 159 7.4 Viewing Source Code 160

Chapter 8 I2C Protocol 161 8.1 What is I2C/SMBus 161 8.2 I2C Core 162 8.3 Bus Transactions 164 8.4 Device Instance: EEPROM 164 8.4.1 Initialization 165 8.4.2 Device Detection 167 8.4.3 Checking Adapter Capabilities 169 8.4.4 Accessing Devices 169 8.4.5 Other Functions 170 8.5 Device Instance: Real-Time Clock 171 8.6 i2c-dev 174 8.7 Using LM-Sensors to Monitor Hardware 174 8.8 SPI Bus 174 8.9 1-Wire Bus 176 8.10 Debugging 176 8.11 Viewing Source Code 176

Chapter 9 PCMCIA and CF 179 9.1 What is PCMCIA/CF 179 9.2 Linux-PCMCIA Subsystem 181 9.3 Host Controller Drivers 183 9.4 PCMCIA Core 183 9.5 Driver Services 183 9.6 Client Drivers 183 9.6.1 Data Structures 184 9.6.2 Device Instance: PCMCIA Card 185 9.7 Putting Parts Together 188 9.8 PCMCIA Storage 189 9.9 Serial PCMCIA 189 9.10 Debugging 191 9.11 Viewing Source Code 191

Chapter 10 PCI 193 10.1 PCI Series 193 10.2 Addressing and Identification 195 10.3 Accessing PCI 198 10.3.1 Configuration Space 198 10.3.2 I/O and Memory 199 10.4 DMA 200 10.5 Device Instance: Ethernet Modem Card 203 10.5.1 Initialization and Detection 203 10.5.2 Data Transfer 209 10.6 Debugging 214 10.7 Viewing Source Code 214

Chapter 11 USB 216 11.1 USB Architecture 216 11.1.1 Bus Speed 218 11.1.2 Host Controller 218 11.1.3 Transfer Modes 219 11.1.4 Addressing 219 11.2 Linux-USB Subsystem 220 11.3 Driver Data Structures 221 11.3.1 usb_device Structure 221 11.3.2 URB 222 11.3.3 Pipes 223 11.3.4 Descriptor Structures 223 11.4 Enumeration 225 11.5 Device Instance: Telemetry Card 225 11.5.1 Initialization and Detection Process 226 11.5.2 Accessing Card Registers 230 11.5.3 Data Transfer 233 11.6 Class Drivers 236 11.6.1 Mass Storage Devices 236 11.6.2 USB to Serial Port Converters 241 11.6.3 Human Interface Devices 243 11.6.4 Bluetooth 243 11.7 Gadget Drivers 243 11.8 Debugging 244 11.9 Viewing Source Code 245

Chapter 12 Video Drivers 247 12.1 Display Architecture 247 12.2 Linux Video Subsystem 249 12.3 Display Parameters 251 12.4 Framebuffer API 252 12.5 Framebuffer Drivers 254 12.6 Console Drivers 265 12.6.1 Device Instance: Mobile Phone 266 12.6.2 Boot Logo 270 12.7 Debugging 270 12.8 Viewing Source Code 271

Chapter 13 Audio Drivers 273 13.1 Audio Architecture 273 13.2 Linux Sound Subsystem 275 13.3 Device Instance: MP3 Player 277 13.3.1 Driver Functions and Structures 278 13.3.2 ALSA Programming 287 13.4 Debugging 288 13.5 Viewing Source Code 289

Chapter 14 Block Device Drivers 291 14.1 Storage Technologies 291 14.2 Linux Block I/O Layer 295 14.3 I/O Schedulers 295 14.4 Block Driver Data Structures and Methods 296 14.5 Device Instance: Simple Storage Controller 298 14.5.1 Initialization 299 14.5.2 Block Device Operations 301 14.5.3 Disk Access 302 14.6 Advanced Topics 304 14.7 Debugging 306 14.8 Viewing Source Code 306

Chapter 15 Network Interface Cards 308 15.1 Driver Data Structures 308 15.1.1 Socket Buffers 309 15.1.2 Network Device Interface 310 15.1.3 Activation 311 15.1.4 Data Transfer 311 15.1.5 Watchdog 311 15.1.6 Statistics 312 15.1.7 Configuration 313 15.1.8 Bus Related Content 314 15.2 Session with Protocol Layers 314 15.2.1 Receive Path 314 15.2.2 Transmit Path 315 15.2.3 Flow Control 315 15.3 Buffer Management and Concurrency Control 315 15.4 Device Instance: Ethernet NIC 316 15.5 ISA Network Drivers 321 15.6 ATM 321 15.7 Network Throughput 322 15.7.1 Driver Performance 322 15.7.2 Protocol Performance 323 15.8 Viewing Source Code 324

Chapter 16 Linux Wireless Device Drivers 326 16.1 Bluetooth 327 16.1.1 BlueZ 328 16.1.2 Device Instance: CF Card 329 16.1.3 Device Instance: USB Adapter 330 16.1.4 RFCOMM 331 16.1.5 Networking 332 16.1.6 HID 334 16.1.7 Audio 334 16.1.8 Debugging 334 16.1.9 About Source Code 334 16.2 Infrared 335 16.2.1 Linux-IrDA 335 16.2.2 Device Instance: Super I/O Chip 337 16.2.3 Device Instance: IR Dongle 338 16.2.4 IrCOMM 340 16.2.5 Networking 340 16.2.6 IrDA Sockets 341 16.2.7 LIRC 341 16.2.8 Viewing Source Code 342 16.3 WiFi 343 16.3.1 Configuration 343 16.3.2 Device Drivers 346 16.3.3 Viewing Source Code 347 16.4 Cellular Networks 347 16.4.1 GPRS 347 16.4.2 CDMA 349 16.5 Current Trends 350

Chapter 17 Storage Technology Devices 352 17.1 What is Flash Memory 352 17.2 Linux-MTD Subsystem 353 17.3 Mapping Drivers 353 17.4 NOR Chip Drivers 358 17.5 NAND Chip Drivers 359 17.6 User Modules 361 17.6.1 Block Device Emulation 361 17.6.2 Character Device Emulation 361 17.6.3 JFFS2 362 17.6.4 YAFFS2 363 17.7 MTD Tools 363 17.8 Configuring MTD 363 17.9 XIP 364 17.10 FWH 364 17.11 Debugging 367 17.12 Viewing Source Code 367

Chapter 18 Embedded Linux 369 18.1 Challenges 369 18.2 Component Selection 370 18.3 Toolchain 371 18.4 Bootloader 372 18.5 Memory Layout 374 18.6 Kernel Porting 375 18.7 Embedded Drivers 376 18.7.1 Flash Memory 377 18.7.2 UART 377 18.7.3 Buttons and Scroll Wheels 378 18.7.4 PCMCIA/CF 378 18.7.5 SD/MMC 378 18.7.6 USB 378 18.7.7 RTC 378 18.7.8 Audio 378 18.7.9 Touch Screens 379 18.7.10 Video 379 18.7.11 CPLD/FPGA 379 18.7.12 Connectivity 379 18.7.13 Application-Specific Integrated Circuits 380 18.7.14 More Drivers 380 18.8 Root Filesystem 380 18.8.1 NFS Mounted Root Filesystem 381 18.8.2 Compact Middleware 382 18.9 Testing Infrastructure 383 18.10 Debugging 383 18.10.1 Circuit Board Rework 384 18.10.2 Debugger 385…… Chapter 19 User Space Drivers 386 Chapter 20 Other Devices and Drivers 403 Chapter 21 Debugging Device Drivers 414 Chapter 22 Maintenance and Release 446 Chapter 23 Conclusion 451 Appendix A Linux Assembly 453 Appendix B Linux and BIOS 457 Appendix C seq Files 461

How to Download Mastering Linux Device Driver Development – Bilingual Edition HD PDF eBook

Mastering Linux Device Driver Development - Bilingual Edition

Mastering Linux Device Driver Development - Bilingual Edition

Follow Wu Chuanbin’s Blog Public Account

Mastering Linux Device Driver Development - Bilingual EditionSend a message to Lao Wu in the public account:

Download | Mastering Linux Device Driver Development Chinese Version

Download | Mastering Linux Device Driver Development English Version

It is recommended to copy and paste to avoid typos, O(∩_∩)O~

Lao Wu will send you the Mastering Linux Device Driver Development Chinese and English Version PDF download link, O(∩_∩)O~

If you find it uncomfortable to read PDF eBooks or tiring, you can follow this link to purchase a physical book on Amazon:

https://www.amazon.cn/gp/product/B01EFPCFYO/ref=as_li_qf_sp_asin_tl?ie=UTF8&camp=536&creative=3200&creativeASIN=B01EFPCFYO&linkCode=as2&tag=mrwucn-23

Mastering Linux Device Driver Development - Bilingual Edition

Leave a Comment