|
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-C3C89BD7-A56D-4597-8804-01A25BC71581" xml:lang="en"><title>Data |
|
13 Transfer between LDD and PDD</title><shortdesc>This document describes how LDDs and PDDs exchange data.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-F65FC583-DDC7-40B6-B875-44A8D11A2971"> |
|
15 <p>The device driver framework supplies each LDD with a pointer, <xref href="GUID-E7550422-5121-3393-A85E-BB797969CD2A.dita#GUID-E7550422-5121-3393-A85E-BB797969CD2A/GUID-CF58D3F1-8185-3A91-A7E8-338B43D329A5"><apiname>DLogicalChannelBase::iPdd</apiname></xref>, |
|
16 through which it can access PDD functions. The pointer is initialised by the |
|
17 Kernel while creating a physical channel. </p> <p>An example of this pointer |
|
18 in use: </p> <codeblock id="GUID-55814834-E7CD-5F19-BA09-B91DA25C8FE3" xml:space="preserve">inline DExUartPhysicalChannel * DExDriverLogicalChannel::Pdd() |
|
19 { return (DExUartPhysicalChannel *)iPdd; } |
|
20 |
|
21 // example use |
|
22 Pdd()->SetDfcQ();</codeblock> <p>Similarly, a PDD can access a LDD, though |
|
23 this access must be initialised by the LDD. In the following example, the |
|
24 physical channel declares a pointer to a logical channel, which the LDD sets. |
|
25 Callbacks to the LDD are done using this pointer. </p> <codeblock id="GUID-A4A52268-B5B9-53D4-9F69-B506F268201D" xml:space="preserve">// PDD channel class |
|
26 class DExH4PhysicalChannel: public DBase |
|
27 { |
|
28 ... |
|
29 public: |
|
30 DExDriverLogicalChannel* iLdd; |
|
31 } |
|
32 |
|
33 // Second stage constructor of Logical channel |
|
34 TInt DExDriverLogicalChannel::DoCreate(TInt /*aUnit*/, const TDesC8* |
|
35 /*anInfo*/, const TVersion& aVer) |
|
36 { |
|
37 ... |
|
38 Pdd()->iLdd=this; |
|
39 } |
|
40 |
|
41 // example use in PDD |
|
42 iLdd->ReceiveDataComplete(KErrNone);</codeblock> <p>The logical channel class, <xref href="GUID-E7550422-5121-3393-A85E-BB797969CD2A.dita"><apiname>DLogicalChannelBase</apiname></xref>, |
|
43 also has pointers to a logical device (<codeph>iDevice</codeph>) and a physical |
|
44 device (<codeph>iPhysicalDevice</codeph>). These pointers are initialised |
|
45 during the driver loading and channel open operations, so they can also be |
|
46 used to pass information between the LDD and PDD. </p> <codeblock id="GUID-4B86BED0-22CB-53BC-A1C7-9BEB0CEA1EDE" xml:space="preserve">class DLogicalChannelBase: public DObject |
|
47 { |
|
48 ... |
|
49 public: |
|
50 DLogicalDevice* iDevice; |
|
51 DPhysicalDevice* iPhysicalDevice; |
|
52 DBase* iPdd; |
|
53 } |
|
54 |
|
55 // example use |
|
56 TDynamicDfcQue* DExUartPhysicalChannelH4::DfcQ(TInt aUnit) |
|
57 { |
|
58 ... |
|
59 return ((DExH4PhysicalDevice*) |
|
60 (iLdd->iPhysicalDevice))->iDfcQueue; |
|
61 }</codeblock> </section> |
|
62 </conbody></concept> |