[...]... 3 talks about char drivers and shows the complete code for a 12 | Chapter 1: An Introduction to Device Drivers This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc All rights reserved ,ch 01. 216 8 Page 13 Thursday, January 20, 2005 9: 21 AM memory-based device driver that can be read and written for fun Using memory as the hardware base for the device allows anyone... reserved | 13 ,ch 01. 216 8 Page 14 Thursday, January 20, 2005 9: 21 AM Our understanding of memory will be useful for the following two chapters, which cover the other major driver classes Chapter 16 introduces block drivers and shows how they are different from the char drivers we have worked with so far Then Chapter 17 gets into the writing of network drivers We finish up with a discussion of serial drivers. .. this community Thank you xviii | Preface This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc All rights reserved ,ch 01. 216 8 Page 1 Thursday, January 20, 2005 9: 21 AM Chapter 1 CHAPTER 1 An Introduction to Device Drivers One of the many advantages of free operating systems, as typified by Linux, is that their internals are open for all to view The operating system,... Chapter 1: An Introduction to Device Drivers This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc All rights reserved ,ch 01. 216 8 Page 9 Thursday, January 20, 2005 9: 21 AM As a device driver writer, you should be aware of situations in which some types of device access could adversely affect the system as a whole and should provide adequate controls For example, device. .. 20, 2005 9:30 AM ,ch00 .11 770 Page xi Thursday, January 27, 2005 12 :11 PM Preface This is, on the surface, a book about writing device drivers for the Linux system That is a worthy goal, of course; the flow of new hardware products is not likely to slow down anytime soon, and somebody is going to have to make all those new gadgets work with Linux But this book is also about how the Linux kernel works and... since then Keeping Linux Device Drivers up to date is increasingly a challenge; the Linux kernel hackers continue to improve their code, and they have little patience for documentation that fails to keep up xi This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc All rights reserved ,ch00 .11 770 Page xii Thursday, January 27, 2005 12 :11 PM Linux continues to succeed... Thursday, January 20, 2005 9: 21 AM Block devices Like char devices, block devices are accessed by filesystem nodes in the /dev directory A block device is a device (e.g., a disk) that can host a filesystem In most Unix systems, a block device can only handle I/O operations that transfer one or more whole blocks, which are usually 512 bytes (or a larger power of two) bytes in length Linux, instead, allows... and so on Every USB device is driven by a USB module that works with the USB subsystem, but the device itself shows up in the system as a char device (a USB serial port, say), a block device (a USB memory card reader), or a network device (a USB Ethernet interface) Other classes of device drivers have been added to the kernel in recent times, including FireWire drivers and I2O drivers In the same way... choices made by the Linux developers Although the main, official target of the book is teaching how to write device drivers, the material should give an interesting overview of the kernel implementation as well Preface | This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc All rights reserved xiii ,ch00 .11 770 Page xiv Thursday, January 27, 2005 12 :11 PM Although real... contains information about API changes that have happened since this book was published 10 | Chapter 1: An Introduction to Device Drivers This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc All rights reserved ,ch 01. 216 8 Page 11 Thursday, January 20, 2005 9: 21 AM This text doesn’t talk specifically about odd-numbered kernel versions General users never have a . . . . . . . . . . 13 5 ioctl 13 5 Blocking I/O 14 7 poll and select 16 3 Asynchronous Notification 16 9 Seeking a Device 17 1 Access Control on a Device File 17 3 Quick Reference 17 9 7. Time, Delays,. 10 7 Concurrency and Its Management 10 7 Semaphores and Mutexes 10 9 Completions 11 4 Spinlocks 11 6 Locking Traps 12 1 Alternatives to Locking 12 3 Quick Reference 13 0 6. Advanced Char Driver Operations . you. ,ch00 .11 770 Page xviii Thursday, January 27, 2005 12 :11 PM This is the Title of the Book, eMatter Edition Copyright © 2005 O’Reilly & Associates, Inc. All rights reserved. 1 Chapter 1 CHAPTER 1 An