Partager via


Handle Nested Interrupts (Compact 7)

3/12/2014

To prevent loss and delay of high-priority interrupts, the Windows Embedded Compact kernel uses nested interrupts. Nested interrupts allow interrupt requests (IRQs) of a higher priority to preempt IRQs of a lower priority. Because of this preemption at the hardware level, interrupt service routines (ISRs) of a higher priority might preempt ISRs of a lower priority.

The following steps explain how Windows Embedded Compact handles nested ISR calls:

  1. The kernel disables all other IRQs that have the same priority or lower priority as the IRQ that invoked the current ISR call.
  2. If a higher-priority IRQ arrives before the current ISR completes processing, the kernel saves the current ISR state. The state includes only the set of CPU registers that the OS supports for use in an ISR.
  3. The kernel calls the higher-priority ISR to handle the new request.
  4. The kernel loads the original ISR state and continues processing.

The kernel saves the state of the currently running ISR when a higher-priority interrupt occurs and restores it after the high-priority ISR has finished processing. In most cases, a preempted ISR does not detect that it has been preempted. The level of interrupt nesting is limited solely by what the hardware platform can support.

An ISR that uses too much time can cause other interrupts to be missed entirely, resulting in erratic or sluggish performance of the whole system. By separating interrupt processing into a very short ISR and a longer interrupt service thread (IST), ISRs can mask interrupts for as little time as possible. ISRs can only mask interrupts that are of equal or lower priority. Windows Embedded Compact can nest as many ISRs as the hardware platform supports. Other than a possible delay in completion, a higher-priority interrupt does not affect the processing of a running ISR.

See Also

Concepts

Add Interrupt Handling Functionality