Preface
- Writing Device Drivers describes how to develop device drivers for character-oriented devices, block-oriented devices, and Small Computer System Interface (SCSI) target devices.
Who Should Read This Book
- The audience for this book is UNIX programmers familiar with UNIX device drivers. Several overview chapters at the beginning of the book provide background information for the detailed technical chapters that follow, but they are not intended as a general tutorial or text on device drivers.
How This Book Is Organized
- This book discusses the development of a dynamically loadable and unloadable, multithreaded reentrant device driver applicable to all architectures that conform to the Solaris 2.x DDI/DKI.
Chapter Overview
-
-
-
Chapter 3, "Overview of SunOS Device Drivers," gives an outline of the kinds of device drivers and their basic structure.
-
Chapter 4, "Multithreading," describes the mechanisms of the SunOS multithreaded kernel that are of interest to driver writers.
-
Chapter 5, "Autoconfiguration," describes the support a driver must provide for autoconfiguration.
-
Chapter 6, "Interrupt Handlers," describes the interrupt handling mechanisms. These include registering, servicing, and removing interrupts.
-
Chapter 7, "DMA," describes direct memory access (DMA) and the DMA interfaces.
-
Chapter 8, "Drivers for Character Devices," describes the structure and functions of a driver for a character-oriented device.
-
Chapter 9, "Drivers for Block Devices," describes the structure and functions of a driver for a block-oriented device.
-
Chapter 10, "SCSI Target Drivers," outlines the Sun Common SCSI Architecture and describes the additional requirements of SCSI target drivers.
-
Chapter 11, "Device Context Management" describes the set of interfaces that allow device drivers to manage the context of user processes accessing a device.
-
Chapter 12, "Loading and Unloading Drivers," shows the steps for compiling and linking a driver, and for installing it in the system.
-
Chapter 13, "Debugging," gives coding suggestions, debugging hints, a simple adb/kadb tutorial, and some hints on testing the driver.
-
Appendix A, "Converting a Device Driver to SunOS 5.4," gives hints on converting SunOS 4.x drivers to SunOS 5.x.
-
Appendix B, "Advanced Topics," presents a collection of optional topics.
-
Appendix C, "Summary of Solaris 2.4 DDI/DKI Services," summarizes, by topic, the kernel functions device driver can use.
-
Appendix D, "Sample Driver Source Code Listings" displays a list of sample drivers, and the location of the sample code in the DDK.
Related Books
- For information about writing STREAMS device drivers and modules, see the STREAMS Programmer's Guide. For more detailed reference information about the device driver interfaces, see sections 9, 9E (entry points), 9F (functions), and 9S (structures) of the Solaris 2.4 Reference Manual AnswerBook.
Typographic Conventions
- The following table describes the meanings of the typefaces used in this book:
- Typographic Conventions
-
| Typeface | Meaning | Example |
| constant width | C language symbol or UNIX command | ddi_add_intr() registers a device interrupt with the system. add_drv adds a driver to the system. |
| italic | Placeholder for a value that the driver must supply | inumber is the number of the interrupt to register. |
| italic | Book title, a new word or term, or an emphasized word | See chapter 9 of the STREAMS Programmer's Guide. A mutual exclusion lock is... Any device interrupts must be registered with the system.
|
|