|
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-660A8E4C-F930-415C-8CCC-CB1DCCAA2442" xml:lang="en"><title>Interrupts</title><shortdesc>This document describes how device drivers use interrupts.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
13 <section id="GUID-7B450286-637E-4BAB-9D36-9228764CD0D4"> |
|
14 <p>Devices generate interrupts to indicate hardware events. Generally |
|
15 drivers provide an interrupt service routine (ISR) to handle the interrupts |
|
16 and perform the required responses to the events. Symbian provides an <xref href="GUID-E7A7083C-97B9-39B9-A147-4A6E314EE3A3.dita"><apiname>Interrupt</apiname></xref> class |
|
17 (implemented by the ASSP) with an API to bind and unbind an interrupt source |
|
18 and an ISR. </p> <codeblock id="GUID-9EB4BFFE-55A2-56D4-BCF3-6D278C3EC4F4" xml:space="preserve">// Bind the interrupt source ID and interrupt service routine |
|
19 TInt Bind(TInt aId, TIsr aIsr, TAny* aPtr); |
|
20 // Unbind the interrupt |
|
21 TInt Unbind(TInt aId); |
|
22 // Enable interrupts on device interrupt source |
|
23 TInt Enable(TInt aId); |
|
24 // Disable interrupts on device interrupt source |
|
25 TInt Disable(TInt aId); |
|
26 // Clear the device interrupt |
|
27 TInt Clear(TInt aId); |
|
28 // Set the priority of the interrupt |
|
29 TInt SetPriority(TInt aId, TInt aPriority);</codeblock> <p>Interrupt handling |
|
30 is typically done in a PDD, as device hardware access is done at that level. |
|
31 Interrupt handling is generally done in two stages in the driver. High priority |
|
32 and short time running tasks are done in the ISR, and the remaining processing |
|
33 is deferred for handling later. </p> <p>Interrupt handling is a blocking high |
|
34 priority task and needs to take a minimal amount of time. The Kernel will |
|
35 be in an indeterminate state and puts restrictions on doing various operations. </p> |
|
36 </section> |
|
37 </conbody></concept> |