Read more
Foreword xxi Preface xxiii Acknowledgments xxix About the Author xxx Chapter 1 Introduction 1 Evolution 2 The GNU Copyleft 3 Kernelorg 4 Mailing Lists and Forums 4 Linux Distributions 5 Looking at the Sources 6 Building the Kernel 10 Loadable Modules 12 Before Starting 14 Chapter 2 A Peek Inside the Kernel 17 Booting Up 18 Kernel Mode and User Mode 30 Process Context and Interrupt Context 30 Kernel Timers 31 HZ and Jiffies 31 Long Delays 33 Short Delays 36 Pentium Time Stamp Counter 36 Real Time Clock 37 Concurrency in the Kernel 39 Spinlocks and Mutexes 39 Atomic Operators 45 Reader-Writer Locks 46 Debugging 48 Process Filesystem 49 Allocating Memory 49 Looking at the Sources 52 Chapter 3 Kernel Facilities 55 Kernel Threads 56 Creating a Kernel Thread 56 Process States and Wait Queues 61 User Mode Helpers 63 Helper Interfaces 65 Linked Lists 65 Hash Lists 72 Work Queues 72 Notifier Chains 74 Completion Interface 78 Kthread Helpers 81 Error-Handling Aids 83 Looking at the Sources 85 Chapter 4 Laying the Groundwork 89 Introducing Devices and Drivers 90 Interrupt Handling 92 Interrupt Context 92 Assigning IRQs 94 Device Example: Roller Wheel 94 Softirqs and Tasklets 99 The Linux Device Model 103 Udev 103 Sysfs, Kobjects, and Device Classes 106 Hotplug and Coldplug 110 Microcode Download 111 Module Autoload 112 Memory Barriers 114 Power Management 114 Looking at the Sources 115 Chapter 5 Character Drivers 119 Char Driver Basics 120 Device Example: System CMOS 121 Driver Initialization 122 Open and Release 127 Exchanging Data 129 Seek 136 Control 137 Sensing Data Availability 139 Poll 139 Fasync 142 Talking to the Parallel Port 145 Device Example: Parallel Port LED Board 146 RTC Subsystem 156 Pseudo Char Drivers 157 Misc Drivers 160 Device Example: Watchdog Timer 160 Character Caveats 166 Looking at the Sources 167 6556_Bookindb i6556_ix 3/4/08 9:31:21 AM Chapter 6 Serial Drivers 171 Layered Architecture 173 UART Drivers 176 Device Example: Cell Phone 178 RS-485 191 TTY Drivers 192 Line Disciplines 194 Device Example: Touch Controller 195 Looking at the Sources 205 Chapter 7 Input Drivers 207 Input Event Drivers 210 The Evdev Interface 210 Input Device Drivers 216 Serio 217 Keyboards 217 Mice 220 Touch Controllers 227 Accelerometers 228 Output Events 228 Debugging 230 Looking at the Sources 231 Chapter 8 The Inter-Integrated Circuit Protocol 233 What's I2C/SMBus? 234 I2C Core 235 Bus Transactions 237 Device Example: EEPROM 238 Initializing 238 Probing the Device 241 Checking Adapter Capabilities 244 Accessing the Device 244 More Methods 246 Device Example: Real Time Clock 247 I2C-dev 251...