Interrupts

This document describes how device drivers use interrupts.

Devices generate interrupts to indicate hardware events. Generally drivers provide an interrupt service routine (ISR) to handle the interrupts and perform the required responses to the events. Symbian provides an Interrupt class (implemented by the ASSP) with an API to bind and unbind an interrupt source and an ISR.

// Bind the interrupt source ID and interrupt service routine
TInt Bind(TInt aId, TIsr aIsr, TAny* aPtr);
// Unbind the interrupt
TInt Unbind(TInt aId);
// Enable interrupts on device interrupt source
TInt Enable(TInt aId);
// Disable interrupts on device interrupt source
TInt Disable(TInt aId);
// Clear the device interrupt
TInt Clear(TInt aId);
// Set the priority of the interrupt
TInt SetPriority(TInt aId, TInt aPriority);

Interrupt handling is typically done in a PDD, as device hardware access is done at that level. Interrupt handling is generally done in two stages in the driver. High priority and short time running tasks are done in the ISR, and the remaining processing is deferred for handling later.

Interrupt handling is a blocking high priority task and needs to take a minimal amount of time. The Kernel will be in an indeterminate state and puts restrictions on doing various operations.