Adaptation/GUID-F4B2D20B-8F1D-4A4B-8ECB-65BE8E9824DD.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-F4B2D20B-8F1D-4A4B-8ECB-65BE8E9824DD" xml:lang="en"><title>Interrupt Overview</title><shortdesc>Hardware or software uses interrupts to indicate an event
       
    13 has occurred, such as a data buffer being ready or a key has been
       
    14 pressed.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>Interrupts are sent by hardware or software to indicate an event
       
    16 has occurred. Interrupts typically cause an Interrupt Service Routine
       
    17 (ISR) to be executed. The Interrupt platform service specifies the
       
    18 interface APIs for setting up the ISRs and connecting them to specific
       
    19 Interrupt IDs. </p>
       
    20 <p>Interrupts can be managed using the <xref href="GUID-A5D862E4-3EC3-45C0-B635-23A02E5BB11F.dita">GPIO</xref> platform
       
    21 service when an interrupt source is connected through GPIO pins. </p>
       
    22 <p>The Interrupt platform service is used by the device drivers that
       
    23 use an interrupt source routed directly to the interrupt controller
       
    24 hardware. For more information on how to use GPIO to manage interrupts,
       
    25 see <xref href="GUID-745273E3-BB3A-59BF-9C33-6C8BB3D850A9.dita">GPIO Design
       
    26 Considerations</xref>.</p>
       
    27 <p>Not all hardware events are indicated by interrupts; hardware may
       
    28 indicate a status change by setting a value in a register or sending
       
    29 a command/signal over a bus.</p>
       
    30 <section id="GUID-DEAC516A-6147-5EFE-A6F9-5069F4B3310C"><title>What
       
    31 is the Interrupt platform service</title> <p>The Interrupt platform
       
    32 service specifies certain APIs for attaching an Interrupt Service
       
    33 Routine to an API. It is the low level interface between hardware/software
       
    34 interrupts, and the kernel and kernel level device drivers.</p> </section>
       
    35 <section id="GUID-E075BEC5-7112-4280-A65D-67933977AE01"><title>Required
       
    36 background</title> <p>You should be familiar with the following: </p> <ul>
       
    37 <li id="GUID-D06AC743-F0CD-5EDB-807E-04498CC89C92"><p>Writing a C++
       
    38 function that is either global or is in a static class so that the
       
    39 function address can be used for the ISR.</p> </li>
       
    40 <li id="GUID-C81342F9-001D-5E17-ABC2-A44D4A7837D2"><p>The specification
       
    41 for your hardware, including determining interrupt IDs.</p> </li>
       
    42 </ul> </section>
       
    43 <section id="GUID-FE8CA9F1-F07D-4D41-B0BC-CE08FFA6C9C9"><title>Key
       
    44 concepts and terms</title> <p>The following concepts are relevant
       
    45 to this component: </p> <dl>
       
    46 <dlentry>
       
    47 <dt>Interrupt ID</dt>
       
    48 <dd><p>An identifier which says which interrupt has occurred. Typically
       
    49 an unsigned integer.</p> </dd>
       
    50 </dlentry>
       
    51 <dlentry>
       
    52 <dt>Interrupt Service Routine (ISR)</dt>
       
    53 <dd><p>An ISR is a static function which is called when an interrupt
       
    54 is received. It should be very short, allocate no memory on the heap,
       
    55 store any volatile information that needs to be captured for that
       
    56 event, and, if required, queue a DFC for further processing.</p> </dd>
       
    57 </dlentry>
       
    58 <dlentry>
       
    59 <dt>Bind</dt>
       
    60 <dd><p>Connects an Interrupt ID to an Interrupt Service Routine. Unbind
       
    61 removes the connection.</p> </dd>
       
    62 </dlentry>
       
    63 <dlentry>
       
    64 <dt>Enable</dt>
       
    65 <dd><p>When an interrupt occurs, execute the associated Interrupt
       
    66 Service Routine.</p> </dd>
       
    67 </dlentry>
       
    68 </dl> </section>
       
    69 <section id="GUID-FE6584D8-C6E9-43F4-AF97-0DBBA0240E88-GENID-1-2-1-10-1-5-1-7-1-1-4-1-3-8"><title>The
       
    70 Interrupt class</title> <p>The interrupt interface is provided by
       
    71 functions of the <xref href="GUID-E7A7083C-97B9-39B9-A147-4A6E314EE3A3.dita"><apiname>Interrupt</apiname></xref> class. The class is
       
    72 defined in the <filepath>os/kernelhwsrv/kernel/eka/include/kernel/arm/assp.h</filepath> file. </p> </section>
       
    73 <section id="GUID-3D6816E8-2B1E-4709-81B5-D0A469A2A268"><title>Key
       
    74 users</title> <p>The key users of the Interrupt platform service are
       
    75 kernel and kernel-level device driver writers, and anyone who needs
       
    76 to specify code to be run when a system event occurs. </p> </section>
       
    77 <section id="GUID-FE6584D8-C6E9-43F4-AF97-0DBBA0240E88-GENID-1-2-1-10-1-5-1-7-1-1-4-1-3-10"><title>Limitations</title><ul>
       
    78 <li><p>The ISR needs to complete in short and finite time to prevent
       
    79 excessive interrupt latency.</p></li>
       
    80 <li><p>To keep ISRs short, most of the event processing should be
       
    81 delegated to a DFC. The DFC will execute in the context of a DFC thread
       
    82 allocated to itself by the device driver.</p></li>
       
    83 <li><p>It is safe to access the device driver objects using appropriate
       
    84 synchronization techniques such as spin-locks.</p></li>
       
    85 <li><p>The ISR should store critical data which may not be available
       
    86 later. </p></li>
       
    87 <li><p>Interrupts can happen in the middle of updating kernel heap
       
    88 free list or other non-atomic actions. ISRs must be coded with that
       
    89 in mind.</p></li>
       
    90 </ul><p>This means that ISRs cannot:</p><ul>
       
    91 <li><p>access user process memory.  This includes completing an asynchronous
       
    92 request.</p></li>
       
    93 <li><p>perform any allocation / de-allocation on heaps.  The current
       
    94 interrupt might have occurred when a heap operation is already in
       
    95 progress.</p></li>
       
    96 </ul><p>It is therefore necessary that ISRs must only use pre-allocated
       
    97 objects on the kernel heap.</p> </section>
       
    98 </conbody><related-links>
       
    99 <link href="GUID-862CA4C4-C6E8-4D60-8DD0-F3590C92E15D.dita"><linktext>Interrupt
       
   100 Client Interface</linktext></link>
       
   101 <link href="GUID-2E54DA7D-1094-41C6-AFB0-9999471991F8.dita"><linktext>Interrupt
       
   102 Implementation Guide</linktext></link>
       
   103 </related-links></concept>