SCO OpenServer


intr -- handle interrupts


All hardware drivers. Note that SCSI peripheral drivers use a different syntax.

Synopsis (all but SCSI peripheral drivers)

   void prefixintr(int ivec);


The intr( ) entry point routine is entered when a hardware interrupt is received from a driver-controlled device. The contents of the routine depend on the device for which you are writing your driver. It should process job completions, errors, changes in device status, and spurious interrupts.


interrupt vector number corresponding to the interrupting device.

All UNIX operating system releases support shared interrupts for devices that can poll the shared vector to determine whether that device has posted an interrupt; see sdevice(F). This feature is hardware dependent and only works when a controller can ``float'' an interrupt, that is, to keep an interrupt ina neutral state on the bus rather than holding it high or low. Use configure(ADM) , with the -T2 or -T3 option to establish a shared interrupt.

Return values



The intr( ) routine for an intelligent controller that does not use individual interrupt vectors for each subdevice must access a completion queue to determine which subdevice generated the interrupt. It must also update the status information, set/clear flags, set/clear error indicators, and so forth to complete the handling of a job. The code should also be able to handle a spurious completion interrupt, identified by an empty completion queue. When the routine finishes, it should advance the unload pointer to the next entry in the completion queue.

If the driver called iowait(D3oddi) or sleep(D3oddi) to await the completion of an operation, the intr( ) routine must call iodone(D3oddi) or wakeup(D3oddi) to unblock the process and allow the process to resume.

block drivers

The intr( ) routine in a block driver must dequeue requests, wake up processes that are sleeping on an I/O request, and ensure that system generation has completed.

terminal drivers

The intr( ) routine in a terminal driver must receive and send characters.

printer drivers

The intr( ) routine in a printer driver must ensure that characters are sent.

Context and synchronization

Interrupt context. The driver may not block or access any process state information.

Hardware applicability


Version applicability

oddi: 1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

SVR5 DDI compatibility

The intr(D2) entry point routine provides similar functionality for DDI drivers, although note that the syntax is different. For DDI 8 and later versions, the intr(D2) entry point routine returns an int that indicates the interrupt status. The mechanism for registering the intr( ) routine is also different; see ``Interrupt handlers, attaching and registering'' in HDK Technical Reference.

External dependencies

The sdevice(F) , file must contain the device's local system configuration information, including the interrupt handler's interrupt priority level, the type of interrupt line required, and the interrupt vector number. The driver's init(D2oddi) routine should configure interrupts dynamically using the idistributed(D3oddi) or Sharegister(D3osdi) functions although manual configuration is also supported. ODDI version 2 drivers use the add_intr_handler(D3oddi) function to configure interrupts dynamically.


add_intr_handler(D3oddi), idistributed(D3oddi)

``Interrupts'' in HDK Technical Reference
``Interrupt handlers, attaching and registering'' in HDK Technical Reference

19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005