Thursday, June 26, 2008


An ISR (Interrupt Service Routine) and IST (Interrupt Service Thread) are two Interrupt Mechanisms that are used to handle interrupts in Windows CE that are also to referred to as Bottom Half and Top Half Interrupt Handlers.

In the majority of cases, a Windows CE driver will never have a real ISR, and will instead only have an IST. There are of course exceptions to this such as Interrupts that MUST be shared along with Interrupts that have a more time critical approach.

An ISR is not required in Windows CE as the OAL's Interrupt Handler should automatically cause an IST to unblock if no ISR is present for an actual Interrupt. Because of this, drivers that do not require the functionality that an actual ISR provides may simply create and use an IST instead.

Interrupt Service Thread
An interrupt service thread is basically a thread that has an infinite loop around a call to WaitForSingleObject that uses a special "Windows Event" to wait against. The call to WaitForSingleObject will unblock when the SYSINTR that this event is initialized against is returned from the OAL Interrupt Handler.

Interrupt Service Routine
This is commonly referred to as an "Installable Interrupt Service Routine" when dealing with Windows CE. This is created and loaded by the Driver to do some early processing on behalf of the driver.

Most commonly, these drivers are used to do memory copies from hardware to a software buffer, or to enable the use of Shared Interrupts.

See Also
MSDN: Installable ISRs and Device Drivers

Wednesday, June 25, 2008

Physical vs Logical Interrupts and SYSINTR

This article will hopefully clarify the differences between Physical Interrupts, Logical Interrupts and SYSINTR values.

Physical Interrupts
A Physical Interrupt, represents an actual Interrupt Line on the system. It' is important to note that a Physical Interrupt may have more than one actual source (for example Pio Channel A on the Atmel AT91 Processor has 32 possible sources for the Physical Interrupt due to it's 32 GPIO lines.)

Physical Interrupts may be Level-Based, Edge Based (Rising, Falling or Both) or even Level and Edge-Based depending on the platform. Generally, Phyiscal Interrupts cannot be both level and edge sensitive at the same time. Most platforms that support both must be configured for one or the other.

Logical Interrupts
A Logical Interrupt is used by a BSP to allow a driver to indivdually select an Interrupt Source even if it is shared with other devices.

Logical Interrupts allow for two interrupt sources that both share a Physical Interrupt line to be individually acccessed and separated at the Driver Level. This means that two Interrupt Sources may have Logical Interrupts 40 and 41 even though they are both actually Physical Interrupt 2.

It is the responsibilty of the person creating the BSP to create the actual Logical to Physical Interrupt mapping (part of the OAL Interrupt code.)

SYSINTR Values are a mapping between values that drivers and system components use hook their ISTs up to actual Interrrupts. This mapping may be done dynamically or statically.

All SYSINTR values that are used by device drivers MUST use SYSINTR values that are are in the range of SYSINTR_FIRMWARE(16) to SYSINTR_MAXIMUM(72). If dynamic SYSINTRs are being used (highly recommended) then the driver will simply request a SYSINTR value from the OS for a Logical Interrupt that it already knows.

If a static SYSINTR value must be used, they may only exist between SYSINTR_FIRMWARE(16) + 16 and SYSINTR_MAXIMUM(72). Additionally, static SYSINTR values MUST be configured in the OAL of the BSP.

First Post

I've decided to create a technical blog that contains posts about various technical topics that I have personally dealt with or learned about.

The posts that I write are here generally to help others, or to remind myself how things work (should I forget.) Hopefully these posts will be of use to someone else other than just me.

Although this blog will not be geared specifically towards Windows, I expect that for the near future this blog will focus nearly entirely on Windows Embedded CE 6.0 as that is where most of my time is being spent.