## Physical Device Driver Reference

[prev][next][parent][TOC]

### Sharing Interrupts

An OS/2 device driver that supports more than one interrupting device on one interrupt request level (IRQ) must either:

Provide one interrupt handler that supports all of its devices on that level

Not unhook the interrupt vector using DevHelp_UnSetIRQ once it is hooked

The reason for these requirements is a limitation in the DevHelp_UnSetIRQ system service. The service can only tell which interrupt handler to remove by the parameter passed into the DevHlp_IRQ. If more than one interrupt handler has been registered from one device driver for the same IRQ, the service removes one of the interrupt handlers belonging to the device driver. However, the interrupt handler will not be known by the device driver writer because the actual workings of the system service may change from one release of OS/2 to another.

It is possible for an interrupt handler that services multiple devices to service only the first device that it finds to be causing an interrupting condition. The level sensitive nature of the hardware will cause the interrupt handler to be invoked to service the other devices as needed. However, the overhead to do this type of servicing will quickly become excessive on a device that frequently causes interrupts. Therefore, it is important that the interrupt handler service all of the devices on the interrupt level it is responsible for on each interrupt.

OS/2 allows a maximum of four interrupt handlers to be registered to share one interrupt level at one time. These handlers can be in one device driver or different device drivers (except when they will be removed using DevHelp_UnSetIRQ as mentioned above). Each use of the DevHlp_SetIRQ increases by one the number of registered interrupt handlers for an interrupt level. Each use of the DevHlp_UnSetIRQ reduces by one the number of registered interrupt handlers for an interrupt level.