Device driver overview

Header files and declarations

The first lines in every DDI 8 driver source file must be:

   #define _KERNEL
   #define _DDI=8
The _DDI line gives the ``major'' version number, such as 7 or 8; it does not use full version numbers such as 8.1 or 8mp. These definitions can instead be given as arguments to the -D option of the cc line to compile the driver. For example, if the driver uses DDI 8 or DDI 8mp, the compile line would be:
   cc -D_KERNEL -D_DDI=8

The _DDI=8 definition is optional for DDI versions prior to version 8 and not supported for SCO OpenServer 5 drivers.

After these declarations, the source file has a list of #include lines that reference the header files (see ``Header files'') that are required by the driver at compile time. For example:

   1  #include <sys/types.h>
   2  #include "mydriv.h"
   3  #include <sys/ddi.h>
Lines 1 and 3 reference standard system header files, using a relative path to the header file directory, usually /usr/include. Line 2 declares a driver-specific header file that is located in the same directory as the rest of the driver source code. Driver-specific header files are typically #included after most system header files, but before the sys/ddi.h and related header files.

Driver-specific header files are coded as standard C language files. They contain global definitions and declarations, especially those that may also be accessed by user-level code, other driver code, and administrative tasks, including:

In addition, drivers must make other declarations outside the entry point routines:

© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005