author | Dominic Pinkman <dominic.pinkman@nokia.com> |
Fri, 13 Aug 2010 16:47:46 +0100 | |
changeset 14 | 578be2adaf3e |
parent 5 | f345bda72bc4 |
permissions | -rw-r--r-- |
14
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
1 |
<?xml version="1.0" encoding="utf-8"?> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
2 |
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
3 |
<!-- This component and the accompanying materials are made available under the terms of the License |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
4 |
"Eclipse Public License v1.0" which accompanies this distribution, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
5 |
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
6 |
<!-- Initial Contributors: |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
7 |
Nokia Corporation - initial contribution. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
8 |
Contributors: |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
9 |
--> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
10 |
<!DOCTYPE concept |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
11 |
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
12 |
<concept id="GUID-F09740DA-015B-449D-A124-0BEABBDDCB52" xml:lang="en"><title>Enabling |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
13 |
and Disabling</title><shortdesc>This document describes how device drivers enable and disable interrupts.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
14 |
<p>Drivers can enable and disable the interrupts on the relevant interrupt |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
15 |
sources while handling the interrupts using the <xref href="GUID-E7A7083C-97B9-39B9-A147-4A6E314EE3A3.dita"><apiname>Interrupt</apiname></xref> class. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
16 |
Typically, handling an interrupt is done with disabled interrupts. The interrupt |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
17 |
is then enabled after the completion of interrupt handling. </p> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
18 |
<codeblock id="GUID-7805933A-51F6-5169-81D0-C1A8E9647C0D" xml:space="preserve">Interrupt::Disable(aIntId); |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
19 |
... |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
20 |
// handle interrupt |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
21 |
... |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
22 |
Interrupt::Enable(aIntId); |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
23 |
</codeblock> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
24 |
<codeblock id="GUID-87C0A4CF-BA67-58DE-A180-EA30189BEDF4" xml:space="preserve">/** |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
25 |
Interrupt Service Routine (ISR) for the UART driver. This function |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
26 |
is associated with the UART interrupt, EUartIrq (value obtained from |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
27 |
TRM). This function is called whenever there is an interrupt on this |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
28 |
interrupt line and the interrupt source is enabled. The ISR must be a |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
29 |
static void function, taking a single TAny* parameter, which is an |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
30 |
object passed at the time of binding, usually a pointer to the owning |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
31 |
class. Interrupt::Enable() must be called to start receiving |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
32 |
interrupts. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
33 |
|
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
34 |
The ISR implementation is hardware and driver specific. The ISR must |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
35 |
be self-contained as the state of the system is indeterminate. It |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
36 |
should not signal threads, allocate or de-allocate memory, copy |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
37 |
memory to or from user processes, or call most Kernel functions. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
38 |
Also the whole system is blocked while the ISR is running, so it must be |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
39 |
kept as short as possible. Any lengthy processing must be done in a |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
40 |
delayed function call (DFC). |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
41 |
|
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
42 |
A typical ISR would, |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
43 |
Clear the interrupt in the peripheral. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
44 |
Disable the interrupt. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
45 |
Read or write peripheral registers, e.g. to determine errors, or |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
46 |
to start a new task. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
47 |
Read data from, or write data to, the peripheral. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
48 |
Start or stop NTimers or DMA transfer operations. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
49 |
Queue DFCs. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
50 |
|
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
51 |
@param aParam |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
52 |
pointer to object passed as parameter while binding |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
53 |
*/ |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
54 |
|
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
55 |
void DExUartPhysicalChannelH4::UartIsr(TAny* aParam) |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
56 |
{ |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
57 |
// Do the high priority device specific interrupt handling |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
58 |
// i.e. read the interrupt type from device, clear the |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
59 |
// interrupt. |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
60 |
... |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
61 |
// Defer the remaining processing by queuing the respective |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
62 |
// DFC based on the interrupt type |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
63 |
... |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
64 |
}</codeblock> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
65 |
<p>Some operations may need to be performed with all the interrupts, not just |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
66 |
the particular interrupt source, disabled. In this case, the <xref href="GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02.dita"><apiname>NKern</apiname></xref> class |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
67 |
must be used to disable and enable all interrupts globally at the Interrupt |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
68 |
controller. <xref href="GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02.dita#GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02/GUID-8C251C65-FDE7-3161-8D2B-61401FB6487F"><apiname>NKern::DisableAllInterrupts()</apiname></xref> can disable all |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
69 |
IRQs, or IRQs and FIQs. <xref href="GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02.dita#GUID-3A3C08F3-3D33-3D9E-80E7-7855C7B21E02/GUID-2D328082-3A9F-3467-81CF-B1C68866E163"><apiname>NKern::RestoreInterrupts()</apiname></xref> can |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
70 |
restore the interrupts to their state before disabling. </p> |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
71 |
<codeblock id="GUID-A34A1AEB-9B00-556D-A280-9BFF7A6BAA8C" xml:space="preserve">alevel = 1; // 1 to disable IRQs and 2 to disable IRQs and FIQs |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
72 |
state = NKern::DisableAllInterrupts(aLevel); |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
73 |
... |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
74 |
// perform the required operations |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
75 |
... |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
76 |
NKern::RestoreInterrupts(state); |
578be2adaf3e
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
5
diff
changeset
|
77 |
</codeblock> |
1
25a17d01db0c
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
78 |
</conbody></concept> |