JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Device Driver Tutorial     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information

Preface

1.  Introduction to Device Drivers

2.  Template Driver Example

Overview of the Template Driver Example

Writing the Template Driver

Writing the Loadable Module Configuration Entry Points

Declaring the Loadable Module Configuration Entry Points

Defining the Module Initialization Entry Point

Defining the Module Information Entry Point

Defining the Module Unload Entry Point

Including Loadable Module Configuration Header Files

Writing the Autoconfiguration Entry Points

Declaring the Autoconfiguration Entry Points

Defining the Device Attach Entry Point

Defining the Device Detach Entry Point

Defining the Get Driver Information Entry Point

Defining the Report Driver Property Information Entry Point

Including Autoconfiguration Header Files

Writing the User Context Entry Points

Declaring the User Context Entry Points

Defining the Open Device Entry Point

Defining the Close Device Entry Point

Defining the Read Device Entry Point

Defining the Write Device Entry Point

Including User Context Header Files

Writing the Driver Data Structures

Defining the Character and Block Operations Structure

Defining the Device Operations Structure

Defining the Module Linkage Structures

Including Data Structures Header Files

Writing the Device Configuration File

Building and Installing the Template Driver

Testing the Template Driver

Adding the Template Driver

Reading and Writing the Device

Removing the Template Driver

Complete Template Driver Source

3.  Reading and Writing Data in Kernel Memory

4.  Tips for Developing Device Drivers

Index

Chapter 2

Template Driver Example

This chapter shows you how to develop a very simple, working driver. This chapter explains how to write the driver and configuration file, compile the driver, load the driver, and test the driver.

The driver that is shown in this chapter is a pseudo device driver that merely writes a message to a system log every time an entry point is entered. This driver demonstrates the minimum functionality that any character driver must implement. You can use this driver as a template for building a complex driver.

This chapter discusses the following driver development steps: