device_interrupts(3K) DG/UX R4.11MU05 device_interrupts(3K)
NAME
deviceinterrupts: ioregisterdeviceinfo,
ioderegisterdeviceinfo, iogetdeviceinfo - manage device
interrupt handlers
SYNOPSIS
#include "/usr/src/uts/aviion/ii/iuc.h"
#include "/usr/src/uts/aviion/ii/iio.h"
statustype ioregisterdeviceinfo (
iodevicecodetype devicecode, /*READONLY*/
ucdeviceclassenumtype deviceclass, /*READONLY*/
pointertoanytype infoptr /*READONLY*/
)
void ioderegisterdeviceinfo (devicecode, deviceclass)
iodevicecodetype devicecode, /*READONLY*/
ucdeviceclassenumtype deviceclass /*READONLY*/
)
statustype iogetdeviceinfo (
iodevicecodetype devicecode, /*READONLY*/
ucdeviceclassenumtype deviceclass, /*READONLY*/
ioserviceinterruptroutineptrtype interrupthandler,/*READONLY*/
pointertoanyptrtype ditentryptr /*WRITEONLY*/
)
where:
deviceclass The device class of a particular device interrupt.
devicecode The device code of a particular device interrupt.
infoptr Pointer to device information structure to be as
sociated with the specified device interrupt. The
first field of the structure must contain a point
er to an interrupt handler, which becomes the han
dler for interrupts from the specified device.
interrupthandler The service interrupt routine pointer stored at
the beginning of the device information structure.
This argument is used to ensure that the device
information pointer returned by this routine real
ly does belong to the requester.
DESCRIPTION
Every device interrupt can be identified by a unique pairing of a de
vice class and a device code. If a device generates interrupts, its
driverconfigure routine must call ioregisterdeviceinfo to regis
ter the driver's interrupt service routine with the kernel. This
routine associates a pointer given in infoptr with the device speci
fied by the device code and device class. This process establishes
an interrupt handler for the given interrupt, so that any interrupt
events generated by the device will cause the driver's interrupt ser
vice routine to be invoked. Thus, it is important that the driver
not register the device until the driver is ready to handle inter
rupts.
The ioregisterdeviceinfo routine creates an entry in the appropri
ate device class's device interrupt table (DIT) for the specified de
vice code. If the slot in the DIT is already occupied or if the de
vice code is larger than the maximum device code supported on this
system, then an error is returned and the association between the de
vice code and device information structure is not established.
The iogetdeviceinfo routine can be used to retrieve the device in
formation pointer associated with a given interrupt. If the speci
fied device code has no device information registered to it, or if
the service interrupt routine pointer in the device information
structure does not match the service interrupt routine pointer sup
plied as an argument to this call, then an error status is returned
and the returned device information pointer is undefined.
The ioderegisterdeviceinfo routine deregisters a device by remov
ing its current interrupt handler and device information structure
from the kernel device information table. This routine reverses the
effect of ioregisterdeviceinfo. After this call completes, future
interrupts on the specified device code will be directed to the sys
tem supplied interrupt handler. If you make this call on a device
code that does not currently have an interrupt handler, a panic will
occur.
DIAGNOSTICS
Return Value
For iogetdeviceinfo:
OK The device information pointer was successfully re
turned.
IOENXIODEVICECODEOUTOFRANGE
The supplied device code is not supported on this sys
tem.
IOENXIODEVICEISNOTCONFIGURED
No device information pointer was found for the device
code or the device code does not belong to the re
quester.
For ioregisterdeviceinfo:
OK The deviceinfo was successfully registered.
IOENXIODEVICECODEOUTOFRANGE
The supplied device code is not supported on this sys
tem. The deviceinfo is not registered.
IOENXIODEVICECODEALREADYASSIGNED
An attempt was made to configure a device on a device
code that is already assigned.
For ioderegisterdeviceinfo:
None.
Errors
None.
Abort Conditions
For ioderegisterdeviceinfo, panic may be invoked with the follow
ing error code:
IOPANICILLEGALDEREGISTERDEVICEINFO
An attempt was made to deregister a device on a device
code that did not have information registered.
For the other routines: none.
SEE ALSO
deviceconfiguration(3K).
Programming in the DG/UX Kernel Environment.
Licensed material--property of copyright holder(s)