DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
WRAPPER macros for pre-DDI 8 drivers

Wrapper functions

The wrapper functions for a device driver can include:


_load(D2)
The _load(D2) entry point is called after the driver has been loaded into memory and link edited into the kernel. The _load( ) routine handles any initialization tasks the driver must perform prior to being logically connected to the kernel. Typical initialization tasks performed from _load( ) include acquiring private memory for the driver, initializing devices and data structures, and installing device interrupts.

For hardware drivers that use interrupts, the mod_drvattach(D3) routine must be called by the driver's _load( ) routine to add the driver's interrupts to the running system. Since interrupts are enabled upon return from mod_drvattach( ), the init(D2) routine must be called before mod_drvattach( ) is called and the start start( ) routine must be called after mod_drvattach( ).


_unload(D2)
The _unload(D2) entry point is called after the driver has been logically disconnected from the kernel. The _unload( ) routine handles any clean-up tasks the driver must perform prior to being removed from the system. Typical clean-up tasks performed from _unload( ) include releasing private memory acquired by the driver, removing device interrupts, disabling interrupts from the device and, if possible, disabling the device as well, and canceling any outstanding timeout(D3) or bufcall(D3str) requests made by the module.

If the driver's _load( ) routine attaches interrupts with the mod_drvattach( ) function, the _unload( ) routine must call the mod_drvdetach(D3) function to disable and remove the driver's interrupts from the running system.


halt(D2)
The halt(D2) entry point is called if the driver is loaded at the time the system is shut down. The halt( ) routine shuts down the driver when the halt( ) routines for the statically configured kernel modules are called. When converting a static driver to make it loadable, the static driver's halt(D2) routine can usually be used in the loadable version of the driver. This entry point is optional. Only device driver and hardware controllers may need this entry. Other module types do not need it.

_verify(D2)
The _verify(D2) entry point is used in ISA drivers that support autoconfiguration. When this entry point is called, the driver checks to see if the hardware it supports is present in the machine. This entry point is optional.

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