Adaptation/GUID-583F70B4-5C8C-54FA-A869-E6F073DE1FD6.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-583F70B4-5C8C-54FA-A869-E6F073DE1FD6" xml:lang="en"><title>Interrupt::Enable()
       
    13 and Interrupt::Disable()</title><shortdesc>The functions <codeph>Interrupt::Enable()</codeph> and <codeph>Interrupt::Disable()</codeph> are
       
    14 used by device drivers to enable and disable the interrupt source in the interrupt
       
    15 controller hardware. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    16 <p/>
       
    17 <p>An <xref href="GUID-76A30EC4-4B99-5471-9E80-F853C91485BC.dita#GUID-76A30EC4-4B99-5471-9E80-F853C91485BC/GUID-8E58F4C9-0290-55E0-A4FD-B6C2361BE205">Interrupt
       
    18 ID</xref> is passed to the functions to identify the interrupt source. All
       
    19 requests for enabling and disabling interrupts should go to these functions
       
    20 in the <xref href="GUID-E7A7083C-97B9-39B9-A147-4A6E314EE3A3.dita"><apiname>Interrupt</apiname></xref> class so that device drivers should never
       
    21 need to know where the interrupt is actually implemented. The general rule
       
    22 is that the interrupt ID is tagged in some way to allow these functions to
       
    23 decide whether the interrupt refers to the ASSP layer or to the Variant layer.
       
    24 These functions are implemented in the ASSP layer. </p>
       
    25 <p>The implementation of these functions is completely dependent on the interrupt
       
    26 hardware. In the template port, <codeph>Interrupt::Enable()</codeph> is implemented
       
    27 in <filepath>...\template_assp\interrupts.cpp</filepath>. The relevant part
       
    28 is: </p>
       
    29 <codeblock id="GUID-8A99386B-5681-5ABA-B4BB-735DF2C2695A" xml:space="preserve">EXPORT_C TInt Interrupt::Enable(TInt anId)
       
    30     {
       
    31      __KTRACE_OPT(KEXTENSION,Kern::Printf("Interrupt::Enable id=%d",anId));
       
    32      TInt r=KErrNone;
       
    33      // if ID indicates a chained interrupt, call variant...
       
    34      if (anId&lt;0 &amp;&amp; ((((TUint)anId)&gt;&gt;16)&amp;0x7fff)&lt;(TUint)KNumTemplateInts)
       
    35          r=TemplateAssp::Variant-&gt;InterruptEnable(anId);
       
    36      else if ((TUint)anId&gt;=(TUint)KNumTemplateInts)
       
    37          r=KErrArgument;
       
    38      else if (TemplateInterrupt::Handlers[anId].iIsr==TemplateInterrupt::Spurious)
       
    39          r=KErrNotReady;
       
    40      else
       
    41          {
       
    42          //
       
    43          // TO DO: (mandatory)
       
    44          //
       
    45          // Enable the corresponding Hardware Interrupt source
       
    46          //
       
    47          }
       
    48      return r;
       
    49     }
       
    50           </codeblock>
       
    51 <p>Interrupts that 'belong' to the Variant Layer are passed to that layer
       
    52 through the call to: </p>
       
    53 <codeblock id="GUID-05C36364-3912-5EEE-B851-82803A731950" xml:space="preserve">r =TemplateAssp::Variant-&gt;InterruptEnable(anId);</codeblock>
       
    54 <p> <codeph>Interrupt::Disable()</codeph> follows the same general pattern. </p>
       
    55 <p>The Variant layer equivalent of this function, <codeph>Template::InterruptEnable()</codeph>,
       
    56 in <filepath>...\template_variant\specific\variant.cpp</filepath>, also follows
       
    57 the same pattern. </p>
       
    58 </conbody></concept>