diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-68446E8E-129C-444A-836A-EF8F56BFE0BC.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-68446E8E-129C-444A-836A-EF8F56BFE0BC.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,72 @@ + + + + + +Handling InterruptsDescribes how a device driver can use interrupts. +

The clients +of the Interrupt platform service must know the following:

    +
  • ISR function

  • +
  • Interrupt ID

  • +

+

Interrupts +are sent by hardware to indicate an event has occurred. Interrupts +typically cause an Interrupt Service Routine (ISR) to be executed. +The Interrupt platform service specifies the interface APIs for setting +up the ISRs and connecting them to specific Interrupt IDs. Interrupt +handling is a blocking high priority task and needs to take a minimal +amount of time. While the ISR is executed the kernel will be in an +indeterminate state and this puts restrictions on doing various operations, +such as allocating heap storage.

The device driver provides +an ISR to handle an interrupt and perform the required response to +the events. Symbian platform provides an Interrupt class (implemented by the ASSP) with an API to bind and unbind an +Interrupt ID with an ISR.

An Interrupt ID is identified by +number, defined as a TInt type. Typically, the ASSP +layer may define this number for each interrupt in a header file and +export it so that it can be included and used by device drivers. Alternatively, +device drivers may be required to retrieve the appropriate Interrupt +ID from the Hardware Configuration Repository (HCR). The scheme used +is implementation dependent.

+ +Call Interrupt::Bind(TInt, TIsr, TAny*) with appropriate Interrupt +ID, ISR and argument to be passed to the ISR. This function binds +the interrupt to the ISR. + +Assign the +priority to the Interrupt if needed using the Interrupt::SetPriority(TInt, +TInt) function. + +Enable the +interrupt by calling the Interrupt::Enable(TInt) function. This function is called when the device driver is ready +to handle hardware events. +

An ISR is a static function that will be executed when an +interrupt is received by the interrupt handler. The interrupt handler +executes the ISR that is bound to the received Interrupt ID. It performs +the actions necessary to service the event of the peripheral that +generated the interrupt. The ISR must either remove the condition +that caused the interrupt or call Interrupt::Disable() otherwise the machine will hang. The device driver may queue a DFC +within the ISR to perform deferred processing.

+
+Once the +DFC processing is completed, it is a good practice to enable the interrupt +if it is disabled, using Interrupt::Enable(TInt) function. + +At the point +when the PDD of the device driver gets unloaded, unbind the ISR from +the specified Interrupt Id using Interrupt::Unbind(TInt) function by passing Interrupt ID as the parameter. + +
+

The device +driver is able to handle interrupts.

+
+Interrupt +Client Interface Guide +Interrupt +Technology Guide +
\ No newline at end of file