66
K
A
DAK
Interrupt Service Procedures
Shared Interrupt Handlers
Occasionally a single Interrupt Handler can be used to service more than one identical
device. For example, an Interrupt Handler for an asynchronous serial I/O device (UART)
could be used to service the UART for each of several communication lines.
For the Interrupt Handler to be shared, the code must be reentrant. This usually implies
that the information unique to each UART (such as the device port address and line
status) must be in a data structure accessible by the handler.
A shared Interrupt Handler must therefore be able to determine which of several device
dependent data structures it should use to service a particular device interrupt. A pair of
custom ISP roots coded in assembly language can be used to solve this problem.
The following example illustrates how little application code must be written to create a
shared Interrupt Handler to handle two devices.
struct dvcblock {
int port; /* Device port */
int line; /* Logical line number */
:
Other dynamic device parameters
};
struct dvcblock dcbA = {0xF8, 1};
struct dvcblock dcbB = {0xE8, 2};
void cdecl deviceih(struct dvcblock *dcbp)
{:
Service device specified by pointer dcbp
:
}