Introduction to I/O Kit Device Driver Design Guidelines

To create and deploy an I/O Kit device driver requires a range of knowledge and skills, some of which seem only remotely connected to the business of writing driver code. For example, you need to package the driver for installation. You may need to localize text and images associated with the driver and display dialogs when user intervention is necessary. And unless the code you write is always perfect when first typed, you’ll need to debug your driver.

This document describes various tasks that driver writers commonly perform. It is intended as a kind of “sequel” to IOKit Fundamentals. Whereas that document is primarily conceptual in nature—describing such things as the I/O Kit architecture and families, event handling, and memory and power management—this document takes a more practical approach. It is a collection of sundry topics related to writing, debugging, testing, and deploying I/O Kit device drivers.

Who Should Read This Document?

If you are developing a device driver to run in OS X, you should read this document. Because this document assumes familiarity with basic I/O Kit concepts and terminology, it’s a good idea to read IOKit Fundamentals first. It also helps to be familiar with object-oriented programming in general, and C++ programming specifically.

If you need to develop an application that accesses a device, you should read instead Accessing Hardware From Applications for more information on various ways to do that. If this sounds like a good solution for you, be aware that Objective-C does not provide interfaces for I/O Kit or BSD APIs. However, because these are C APIs, you can call them from a Cocoa application.

Organization of This Document

I/O Kit Device Driver Design Guidelines has the following chapters:

See Also

In addition to I/O Kit Device Driver Design Guidelines, Apple developer documentation includes several documents that cover the OS X kernel, the I/O Kit in general, and driver development for specific devices. Some of these documents are listed below.

In addition to these Apple publications, you can browse the BSD man pages for more information on BSD and POSIX APIs. You can view the documentation for BSD and POSIX functions and tools by typing manfunction_name in a Terminal window (for example, man gdb) or in HTML at OS X Man Pages.

Of course, you can always browse the header files shipped with the I/O Kit, which are installed in Kernel.framework/Headers/iokit (kernel-resident) and IOKit.framework/Headers (user-space).

You can also view developer documentation in Xcode. To do this, select Help from the Xcode menu and then click Show Documentation Window.

If you're ready to create a universal binary version of your device driver to run in an Intel-based Macintosh, see Universal Binary Programming Guidelines, Second Edition. The Universal Binary Programming Guidelines describes the differences between the Intel and PowerPC architectures and provides tips for developing a universal binary.

Apple maintains several websites where developers can go for general and technical information on Darwin and OS X.