diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-F4B2D20B-8F1D-4A4B-8ECB-65BE8E9824DD.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-F4B2D20B-8F1D-4A4B-8ECB-65BE8E9824DD.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,103 @@ + + + + + +Interrupt OverviewHardware or software uses interrupts to indicate an event +has occurred, such as a data buffer being ready or a key has been +pressed. +

Interrupts are sent by hardware or software 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.

+

Interrupts can be managed using the GPIO platform +service when an interrupt source is connected through GPIO pins.

+

The Interrupt platform service is used by the device drivers that +use an interrupt source routed directly to the interrupt controller +hardware. For more information on how to use GPIO to manage interrupts, +see GPIO Design +Considerations.

+

Not all hardware events are indicated by interrupts; hardware may +indicate a status change by setting a value in a register or sending +a command/signal over a bus.

+
What +is the Interrupt platform service

The Interrupt platform +service specifies certain APIs for attaching an Interrupt Service +Routine to an API. It is the low level interface between hardware/software +interrupts, and the kernel and kernel level device drivers.

+
Required +background

You should be familiar with the following:

    +
  • Writing a C++ +function that is either global or is in a static class so that the +function address can be used for the ISR.

  • +
  • The specification +for your hardware, including determining interrupt IDs.

  • +
+
Key +concepts and terms

The following concepts are relevant +to this component:

+ +
Interrupt ID
+

An identifier which says which interrupt has occurred. Typically +an unsigned integer.

+
+ +
Interrupt Service Routine (ISR)
+

An ISR is a static function which is called when an interrupt +is received. It should be very short, allocate no memory on the heap, +store any volatile information that needs to be captured for that +event, and, if required, queue a DFC for further processing.

+
+ +
Bind
+

Connects an Interrupt ID to an Interrupt Service Routine. Unbind +removes the connection.

+
+ +
Enable
+

When an interrupt occurs, execute the associated Interrupt +Service Routine.

+
+
+
The +Interrupt class

The interrupt interface is provided by +functions of the Interrupt class. The class is +defined in the os/kernelhwsrv/kernel/eka/include/kernel/arm/assp.h file.

+
Key +users

The key users of the Interrupt platform service are +kernel and kernel-level device driver writers, and anyone who needs +to specify code to be run when a system event occurs.

+
Limitations
    +
  • The ISR needs to complete in short and finite time to prevent +excessive interrupt latency.

  • +
  • To keep ISRs short, most of the event processing should be +delegated to a DFC. The DFC will execute in the context of a DFC thread +allocated to itself by the device driver.

  • +
  • It is safe to access the device driver objects using appropriate +synchronization techniques such as spin-locks.

  • +
  • The ISR should store critical data which may not be available +later.

  • +
  • Interrupts can happen in the middle of updating kernel heap +free list or other non-atomic actions. ISRs must be coded with that +in mind.

  • +

This means that ISRs cannot:

    +
  • access user process memory. This includes completing an asynchronous +request.

  • +
  • perform any allocation / de-allocation on heaps. The current +interrupt might have occurred when a heap operation is already in +progress.

  • +

It is therefore necessary that ISRs must only use pre-allocated +objects on the kernel heap.

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