Interrupt Service Routines (Windows Embedded CE 6.0)

1/6/2010

An interrupt service routine (ISR) is a software routine that hardware invokes in response to an interrupt. ISRs examine an interrupt and determine how to handle it. ISRs handle the interrupt, and then return a logical interrupt value. If no further handling is required because the device is disabled or data is buffered, the ISR notifies the kernel with a SYSINTR_NOP return value. An ISR must perform very fast to avoid slowing down the operation of the device and the operation of all lower priority ISRs.

Although an ISR might move data from a CPU register or a hardware port into a memory buffer, in general it relies on a dedicated interrupt thread, called the interrupt service thread (IST), to do most of the required processing. If additional processing is required, the ISR returns a logical interrupt value, other than SYSINTR_NOP, to the kernel. It then maps a physical interrupt number to a logical interrupt value. For example, the keyboard might be associated with hardware interrupt 4 on one device and hardware interrupt 15 on another device. The ISR, which is in the OAL, translates the hardware-specific value to the Windows Embedded CE standard value of SYSINTR_KEYBOARD. In this example, SYSINTR_KEYBOARD is the return value from the ISR.

When an ISR notifies the kernel of a specific logical interrupt value, the kernel examines an internal table to map the logical interrupt value to an event handle. The kernel wakes the IST by signaling the event. An event is a standard Microsoft® Win32® synchronization object that serves as an alarm clock to wake up a thread when something interesting happens.

The following table compares hardware platforms that support a single ISR with hardware platforms that support multiple ISRs.

ISR model Description

Single ISR hardware platform

The name of the ISR is OEMInterruptHandler.

Multiple ISR hardware platform

The OAL does not provide an OEMInterruptHandler function. Instead, you must register ISRs for each interrupt by calling HookInterrupt function in the OAL.

Note

Other than having to map from an IRQ to an interrupt service routine, handling interrupts with multiple ISRs is identical to handling interrupts when a single ISR is present. One reason not to process data in the ISR is that there is no way to access the user buffer. The user mode IST routine can access this buffer.

In This Section

See Also

Concepts

Interrupts