Specifications

D
evice Driver Programming
17-34
Developing the Driver’s Interrupt Service Routine 17
To develop a user-level driver routine that services interrupts generated by a device
controlled by the driver, you must use the operating system’s support for user-level
interrupt routines as described in “The User-Level Interrupt Library Routines and Utility”
on page 17-22.
Remember, the user-level interrupt routine facility is optional. To configure a kernel with
user-level interrupt support enabled, modify the ui file in the /etc/conf/sdevice.d
directory. Set the configure fieldintheui file to Y, and build a kernel with the
idbuild(1M) utility. Refer to the idbuild(1M) system manual page for details.
It is recommended that you carefully review the documentation on user-level interrupt
routines that is located in the PowerUX Real-Time Guide prior to beginning the develop-
ment of the driver’s interrupt routines.
To use the system’s user-level interrupt routine facility, you can develop a driver interrupt
initialization routine that invokes fork(2) to create a user-level interrupt process. The
user-level interrupt process defines and enables a connection to an interrupt vector
generated by the device that the user-level driver controls. You must also develop a driver
interrupt-handling routine that executes each time the connected interrupt occurs. The
driver interrupt initialization routine should be called by the device configuration program
when the -i option is specified (procedures for developing the device configuration
program are explained in “Developing the Device Configuration Program” on page
17-38).
To develop the driver’s user-level interrupt process, you must take into consideration the
constraints that are imposed on that process. A complete discussion of those constraints is
provided in the PowerUX Real-Time Guide. Some of the most significant ones are sum-
marized as follows:
A single-threaded user-level interrupt process can define a connection to
only one interrupt vector at a time. A multithreaded process can connect to
one or more interrupt vectors at a time by using a separate bound thread for
each interrupt vector connection.
Only one user-level interrupt process can define a connection to a particular
interrupt vector at a time.
Prior to enabling an interrupt connection, a user-level interrupt process
must lock into memory portions of its virtual address space referenced by
the interrupt-handling routine. Exceptions that occur during execution of
the interrupt-handling routine are fatal.
Connecting a User-Level Interrupt Process and Interrupt Vector 17
To define and enable a connection between a user-level interrupt process and an interrupt
vector, you must perform a series of steps. These steps are fully explained in the PowerUX
Real-Time Guide. They are summarized as follows: