Specifications
D
evice Driver Programming
17-40
3. Initialize global data structures that contain information about a particular
device, and initialize synchronization primitives.
4. Initialize and reset the device.
For information on the use of ftok and the shmget, shmbind, and shmat system calls,
refer to the PowerUX Programming Guide and to the stdipc(3C), shmget(2),
shmbind(2), and shmat(2) system manual pages.
Reset the Device 17
To support the -r option, the device configuration program must perform the following
functions:
• Reset the device.
• Restore device and driver status information to the values to which it was
initialized at open time.
The reset option allows a user to reset the device if it is hung because a user process has
terminated abnormally and has not cleaned up the global data structures associated with
the device.
Note that a user process might have the device open when a reset is performed. The
operation of such a process becomes undefined. The -r option is intended to perform a
hard reset; a process that has the device open should be terminated. A soft reset can be
provided as a control function that is available to a user application.
Create a User-Level Interrupt Process 17
You need to provide the -i option only if you are writing a user-level driver that handles
interrupts. To support the -i option, the device configuration program must perform the
following functions:
• Create the user-level interrupt process with access to the driver status and
device register regions.
• Connect to the interrupt vector.
• Lock the interrupt-handling routine’s text, stack, and data regions in
memory.
• Enable the interrupt vector connection.
Procedures for developing the user-level interrupt process are explained in detail in
“Developing the Driver’s Interrupt Service Routine” on page 17-34.