Linux device drivers
Rubini, Alessandro.
Linux device drivers - 2nd Edition. - Sebastopol : O'Reilly & Associates, c2001. - xix, 564 p. : illustrations ;
Included Index.
Chapter 1 An Introduction to Device Drivers 1 --
Role of the Device Driver 2 --
Splitting the Kernel 4 --
Classes of Devices and Modules 6 --
Security Issues 9 --
Version Numbering 10 --
License Terms 12 --
Joining the Kernel Development Community 13 --
Overview of the Book 13 --
Chapter 2 Building and Running Modules 15 --
Kernel Modules Versus Applications 16 --
Compiling and Loading 22 --
Kernel Symbol Table 27 --
Initialization and Shutdown 29 --
Using Resources 35 --
Automatic and Manual Configuration 42 --
Doing It in User Space 45 --
Backward Compatibility 47 --
Chapter 3 Char Drivers 54 --
Design of scull 54 --
Major and Minor Numbers 55 --
File Operations 63 --
File Structure 66 --
Open and release 68 --
Scull's Memory Usage 73 --
A Brief Introduction to Race Conditions 76 --
Read and write 78 --
Playing with the New Devices 85 --
Device Filesystem 85 --
Backward Compatibility 91 --
Chapter 4 Debugging Techniques 97 --
Debugging by Printing 97 --
Debugging by Querying 103 --
Debugging by Watching 108 --
Debugging System Faults 110 --
Debuggers and Related Tools 120 --
Chapter 5 Enhanced Char Driver Operations 128 --
Ioctl 129 --
Blocking I/O 141 --
Poll and select 154 --
Asynchronous Notification 159 --
Seeking a Device 163 --
Access Control on a Device File 164 --
Backward Compatibility 172 --
Chapter 6 Flow of Time 181 --
Time Intervals in the Kernel 181 --
Knowing the Current Time 184 --
Delaying Execution 186 --
Task Queues 189 --
Kernel Timers 200 --
Backward Compatibility 204 --
Chapter 7 Getting Hold of Memory 208 --
Real Story of kmalloc 208 --
Lookaside Caches 211 --
get_free_page and Friends 214 --
Vmalloc and Friends 217 --
Boot-Time Allocation 221 --
Backward Compatibility 223 --
Chapter 8 Hardware Management 226 --
I/O Ports and I/O Memory 226 --
Using I/O Ports 229 --
Using Digital I/O Ports 235 --
Using I/O Memory 238 --
Backward Compatibility 248 --
Chapter 9 Interrupt Handling 251 --
Overall Control of Interrupts 251 --
Preparing the Parallel Port 253 --
Installing an Interrupt Handler 253 --
Implementing a Handler 264 --
Tasklets and Bottom-Half Processing 269 --
Interrupt Sharing 274 --
Interrupt-Driven I/O 278 --
Race Conditions 278 --
Backward Compatibility 288 --
Chapter 10 Judicious Use of Data Types 293 --
Use of Standard C Types 293 --
Assigning an Explicit Size to Data Items 295 --
Interface-Specific Types 296 --
Other Portability Issues 297 --
Linked Lists 300 --
Chapter 11 Kmod and Advanced Modularization 305 --
Loading Modules on Demand 305 --
Intermodule Communication 311 --
Version Control in Modules 314 --
Backward Compatibility 318 --
Chapter 12 Loading Block Drivers 321 --
Registering the Driver 322 --
Header File blk.h 328 --
Handling Requests: A Simple Introduction 330 --
Handling Requests: The Detailed View 334 --
How Mounting and Unmounting Works 348 --
Ioctl Method 349 --
Removable Devices 352 --
Partitionable Devices 355 --
Interrupt-Driven Block Drivers 362 --
Backward Compatibility 364 --
Chapter 13 Mmap and DMA 370 --
Memory Management in Linux 370 --
Mmap Device Operation 382 --
Kiobuf Interface 396 --
Direct Memory Access and Bus Mastering 401 --
Backward Compatibility 418 --
Chapter 14 Network Drivers 425 --
How snull Is Designed 426 --
Connecting to the Kernel 430 --
Net_device Structure in Detail 435 --
Opening and Closing 443 --
Packet Transmission 445 --
Packet Reception 448 --
Interrupt Handler 450 --
Changes in Link State 451 --
Socket Buffers 452 --
MAC Address Resolution 455 --
Custom ioctl Commands 458 --
Statistical Information 459 --
Multicasting 460 --
Backward Compatibility 464 --
Chapter 15 Overview of Peripheral Buses 470 --
PCI Interface 470 --
A Look Back: ISA 494 --
PC/104 and PC/104+ 496 --
Other PC Buses 497 --
SBus 498 --
NuBus 498 --
External Buses 499 --
Backward Compatibility 502 --
Chapter 16 Physical Layout of the Kernel Source 506 --
Booting the Kernel 507 --
Before Booting 509 --
Init Process 511 --
Kernel Directory 512 --
Fs Directory 513 --
Mm Directory 514 --
Net directory 516 --
Ipc and lib 517 --
Include and arch 517 --
Drivers 517.
This book is for anyone who wants to support computer peripherals under the Linux operating system or who wants to develop new hardware and run it under Linux. Linux is the fastest-growing segment of the Unix market, is winning over enthusiastic adherents in many application areas, and is being viewed more and more as a good platform for embedded systems. Linux Device Drivers, already a classic in its second edition, reveals information that heretofore has been shared by word of mouth or in cryptic source code comments, on how to write drivers for a wide range of devices.Version 2.4 of the Linux kernel includes significant changes to device drivers, simplifying many activities, but providing subtle new features that can make a driver both more efficient and more flexible. The second edition of this book thoroughly covers these changes, as well as new processors and buses.You don't have to be a kernel hacker to understand and enjoy this book; all you need is an understanding of C and some background in Unix system calls. You'll learn how to write drivers for character devices, block devices, and network interfaces, guided by full-featured examples that you can compile and run without special hardware. Major changes in the second edition include discussions of symmetric multiprocessing (SMP) and locking, new CPUs, and recently supported buses. For those who are curious about how an operating system does its job, this book provides insights into address spaces, asynchronous events, and I/O.Portability is a major concern in the text. The book is centered on version 2.4, but includes information for kernels back to 2.0 where feasible. Linux Device Driver also shows how to maximize portability among hardware platforms; examples were tested on IA32 (PC) and IA64, PowerPC, SPARC and SPARC64, Alpha, ARM, and MIPS.Contents include:
Building a driver and loading modules
Complete character, block, and network drivers
Debugging a driver
Timing
Handling symmetric multiprocessing (SMP) systems
Memory management and DMA
Interrupts
Portability issues
Peripheral Component Interconnect (PCI)
0596000081 (pbk.) 9780596000080 9788173663604 8173663602
Linux device drivers (Computer programs)
005.43 / RUB
Linux device drivers - 2nd Edition. - Sebastopol : O'Reilly & Associates, c2001. - xix, 564 p. : illustrations ;
Included Index.
Chapter 1 An Introduction to Device Drivers 1 --
Role of the Device Driver 2 --
Splitting the Kernel 4 --
Classes of Devices and Modules 6 --
Security Issues 9 --
Version Numbering 10 --
License Terms 12 --
Joining the Kernel Development Community 13 --
Overview of the Book 13 --
Chapter 2 Building and Running Modules 15 --
Kernel Modules Versus Applications 16 --
Compiling and Loading 22 --
Kernel Symbol Table 27 --
Initialization and Shutdown 29 --
Using Resources 35 --
Automatic and Manual Configuration 42 --
Doing It in User Space 45 --
Backward Compatibility 47 --
Chapter 3 Char Drivers 54 --
Design of scull 54 --
Major and Minor Numbers 55 --
File Operations 63 --
File Structure 66 --
Open and release 68 --
Scull's Memory Usage 73 --
A Brief Introduction to Race Conditions 76 --
Read and write 78 --
Playing with the New Devices 85 --
Device Filesystem 85 --
Backward Compatibility 91 --
Chapter 4 Debugging Techniques 97 --
Debugging by Printing 97 --
Debugging by Querying 103 --
Debugging by Watching 108 --
Debugging System Faults 110 --
Debuggers and Related Tools 120 --
Chapter 5 Enhanced Char Driver Operations 128 --
Ioctl 129 --
Blocking I/O 141 --
Poll and select 154 --
Asynchronous Notification 159 --
Seeking a Device 163 --
Access Control on a Device File 164 --
Backward Compatibility 172 --
Chapter 6 Flow of Time 181 --
Time Intervals in the Kernel 181 --
Knowing the Current Time 184 --
Delaying Execution 186 --
Task Queues 189 --
Kernel Timers 200 --
Backward Compatibility 204 --
Chapter 7 Getting Hold of Memory 208 --
Real Story of kmalloc 208 --
Lookaside Caches 211 --
get_free_page and Friends 214 --
Vmalloc and Friends 217 --
Boot-Time Allocation 221 --
Backward Compatibility 223 --
Chapter 8 Hardware Management 226 --
I/O Ports and I/O Memory 226 --
Using I/O Ports 229 --
Using Digital I/O Ports 235 --
Using I/O Memory 238 --
Backward Compatibility 248 --
Chapter 9 Interrupt Handling 251 --
Overall Control of Interrupts 251 --
Preparing the Parallel Port 253 --
Installing an Interrupt Handler 253 --
Implementing a Handler 264 --
Tasklets and Bottom-Half Processing 269 --
Interrupt Sharing 274 --
Interrupt-Driven I/O 278 --
Race Conditions 278 --
Backward Compatibility 288 --
Chapter 10 Judicious Use of Data Types 293 --
Use of Standard C Types 293 --
Assigning an Explicit Size to Data Items 295 --
Interface-Specific Types 296 --
Other Portability Issues 297 --
Linked Lists 300 --
Chapter 11 Kmod and Advanced Modularization 305 --
Loading Modules on Demand 305 --
Intermodule Communication 311 --
Version Control in Modules 314 --
Backward Compatibility 318 --
Chapter 12 Loading Block Drivers 321 --
Registering the Driver 322 --
Header File blk.h 328 --
Handling Requests: A Simple Introduction 330 --
Handling Requests: The Detailed View 334 --
How Mounting and Unmounting Works 348 --
Ioctl Method 349 --
Removable Devices 352 --
Partitionable Devices 355 --
Interrupt-Driven Block Drivers 362 --
Backward Compatibility 364 --
Chapter 13 Mmap and DMA 370 --
Memory Management in Linux 370 --
Mmap Device Operation 382 --
Kiobuf Interface 396 --
Direct Memory Access and Bus Mastering 401 --
Backward Compatibility 418 --
Chapter 14 Network Drivers 425 --
How snull Is Designed 426 --
Connecting to the Kernel 430 --
Net_device Structure in Detail 435 --
Opening and Closing 443 --
Packet Transmission 445 --
Packet Reception 448 --
Interrupt Handler 450 --
Changes in Link State 451 --
Socket Buffers 452 --
MAC Address Resolution 455 --
Custom ioctl Commands 458 --
Statistical Information 459 --
Multicasting 460 --
Backward Compatibility 464 --
Chapter 15 Overview of Peripheral Buses 470 --
PCI Interface 470 --
A Look Back: ISA 494 --
PC/104 and PC/104+ 496 --
Other PC Buses 497 --
SBus 498 --
NuBus 498 --
External Buses 499 --
Backward Compatibility 502 --
Chapter 16 Physical Layout of the Kernel Source 506 --
Booting the Kernel 507 --
Before Booting 509 --
Init Process 511 --
Kernel Directory 512 --
Fs Directory 513 --
Mm Directory 514 --
Net directory 516 --
Ipc and lib 517 --
Include and arch 517 --
Drivers 517.
This book is for anyone who wants to support computer peripherals under the Linux operating system or who wants to develop new hardware and run it under Linux. Linux is the fastest-growing segment of the Unix market, is winning over enthusiastic adherents in many application areas, and is being viewed more and more as a good platform for embedded systems. Linux Device Drivers, already a classic in its second edition, reveals information that heretofore has been shared by word of mouth or in cryptic source code comments, on how to write drivers for a wide range of devices.Version 2.4 of the Linux kernel includes significant changes to device drivers, simplifying many activities, but providing subtle new features that can make a driver both more efficient and more flexible. The second edition of this book thoroughly covers these changes, as well as new processors and buses.You don't have to be a kernel hacker to understand and enjoy this book; all you need is an understanding of C and some background in Unix system calls. You'll learn how to write drivers for character devices, block devices, and network interfaces, guided by full-featured examples that you can compile and run without special hardware. Major changes in the second edition include discussions of symmetric multiprocessing (SMP) and locking, new CPUs, and recently supported buses. For those who are curious about how an operating system does its job, this book provides insights into address spaces, asynchronous events, and I/O.Portability is a major concern in the text. The book is centered on version 2.4, but includes information for kernels back to 2.0 where feasible. Linux Device Driver also shows how to maximize portability among hardware platforms; examples were tested on IA32 (PC) and IA64, PowerPC, SPARC and SPARC64, Alpha, ARM, and MIPS.Contents include:
Building a driver and loading modules
Complete character, block, and network drivers
Debugging a driver
Timing
Handling symmetric multiprocessing (SMP) systems
Memory management and DMA
Interrupts
Portability issues
Peripheral Component Interconnect (PCI)
0596000081 (pbk.) 9780596000080 9788173663604 8173663602
Linux device drivers (Computer programs)
005.43 / RUB