sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\mmu\d_export.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <kernel/kern_priv.h>
|
sl@0
|
19 |
#include "d_export.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
//
|
sl@0
|
22 |
// Class definitions
|
sl@0
|
23 |
//
|
sl@0
|
24 |
|
sl@0
|
25 |
class DExportFactory : public DLogicalDevice
|
sl@0
|
26 |
{
|
sl@0
|
27 |
public:
|
sl@0
|
28 |
~DExportFactory();
|
sl@0
|
29 |
virtual TInt Install();
|
sl@0
|
30 |
virtual void GetCaps(TDes8& aDes) const;
|
sl@0
|
31 |
virtual TInt Create(DLogicalChannelBase*& aChannel);
|
sl@0
|
32 |
};
|
sl@0
|
33 |
|
sl@0
|
34 |
class DExportChannel : public DLogicalChannelBase
|
sl@0
|
35 |
{
|
sl@0
|
36 |
public:
|
sl@0
|
37 |
DExportChannel();
|
sl@0
|
38 |
~DExportChannel();
|
sl@0
|
39 |
virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
|
sl@0
|
40 |
virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
DExportFactory* iFactory;
|
sl@0
|
43 |
};
|
sl@0
|
44 |
|
sl@0
|
45 |
//
|
sl@0
|
46 |
// DExportFactory
|
sl@0
|
47 |
//
|
sl@0
|
48 |
|
sl@0
|
49 |
TInt DExportFactory::Install()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
return SetName(&KExportTestLddName);
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
DExportFactory::~DExportFactory()
|
sl@0
|
55 |
{
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
void DExportFactory::GetCaps(TDes8& /*aDes*/) const
|
sl@0
|
59 |
{
|
sl@0
|
60 |
// Not used but required as DLogicalDevice::GetCaps is pure virtual
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
TInt DExportFactory::Create(DLogicalChannelBase*& aChannel)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
aChannel = NULL;
|
sl@0
|
66 |
DExportChannel* channel=new DExportChannel;
|
sl@0
|
67 |
if(!channel)
|
sl@0
|
68 |
return KErrNoMemory;
|
sl@0
|
69 |
channel->iFactory = this;
|
sl@0
|
70 |
aChannel = channel;
|
sl@0
|
71 |
return KErrNone;
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
DECLARE_STANDARD_LDD()
|
sl@0
|
75 |
{
|
sl@0
|
76 |
return new DExportFactory;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
//
|
sl@0
|
80 |
// DExportChannel
|
sl@0
|
81 |
//
|
sl@0
|
82 |
|
sl@0
|
83 |
TInt DExportChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
return KErrNone;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
DExportChannel::DExportChannel()
|
sl@0
|
89 |
{
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
DExportChannel::~DExportChannel()
|
sl@0
|
93 |
{
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
|
sl@0
|
97 |
TInt DExportChannel::Request(TInt aFunction, TAny* a1, TAny* a2)
|
sl@0
|
98 |
{
|
sl@0
|
99 |
TInt r=KErrNotSupported;
|
sl@0
|
100 |
|
sl@0
|
101 |
switch(aFunction)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
case RExportLdd::ERunExport:
|
sl@0
|
104 |
r = ExportMultiplyFunction((TUint)a1, (TUint)a2);
|
sl@0
|
105 |
break;
|
sl@0
|
106 |
}
|
sl@0
|
107 |
return r;
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
EXPORT_C TInt ExportMultiplyFunction(TUint aNum0, TUint aNum1)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
return aNum0 * aNum1;
|
sl@0
|
113 |
}
|