|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * e32test\device\d_lddturnaoundtimertest.cpp |
|
16 * LDD for getting the timer count & ticks for testing turnaround timer implementation. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include <kernel.h> |
|
22 #include "d_lddturnaroundtimertest.h" |
|
23 |
|
24 class DTest1; |
|
25 class DTestFactory : public DLogicalDevice |
|
26 // |
|
27 // Test LDD factory |
|
28 // |
|
29 { |
|
30 public: |
|
31 DTestFactory(); |
|
32 virtual TInt Install(); //overriding pure virtual |
|
33 virtual void GetCaps(TDes8& aDes) const; //overriding pure virtual |
|
34 virtual TInt Create(DLogicalChannelBase*& aChannel); //overriding pure virtual |
|
35 }; |
|
36 |
|
37 class DTest1 : public DLogicalChannelBase |
|
38 // |
|
39 // Test logical channel |
|
40 // |
|
41 { |
|
42 public: |
|
43 virtual ~DTest1(); |
|
44 protected: |
|
45 virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); |
|
46 virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2); |
|
47 }; |
|
48 |
|
49 |
|
50 |
|
51 DECLARE_STANDARD_LDD() |
|
52 { |
|
53 return new DTestFactory; |
|
54 } |
|
55 |
|
56 // |
|
57 // Constructor |
|
58 // |
|
59 DTestFactory::DTestFactory() |
|
60 { |
|
61 |
|
62 } |
|
63 |
|
64 TInt DTestFactory::Create(DLogicalChannelBase*& aChannel) |
|
65 { |
|
66 // |
|
67 // Create new channel |
|
68 // |
|
69 aChannel=new DTest1; |
|
70 return aChannel?KErrNone:KErrNoMemory; |
|
71 } |
|
72 |
|
73 TInt DTestFactory::Install() |
|
74 // |
|
75 // Install the LDD - overriding pure virtual |
|
76 // |
|
77 { |
|
78 return SetName(&KLddName); |
|
79 } |
|
80 |
|
81 void DTestFactory::GetCaps(TDes8& /*aDes*/) const |
|
82 // |
|
83 // Get capabilities - overriding pure virtual |
|
84 // |
|
85 { |
|
86 } |
|
87 |
|
88 TInt DTest1::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/) |
|
89 // |
|
90 // Create channel |
|
91 // |
|
92 { |
|
93 return KErrNone; |
|
94 } |
|
95 |
|
96 DTest1::~DTest1() |
|
97 // |
|
98 // Destructor |
|
99 // |
|
100 { |
|
101 } |
|
102 |
|
103 TInt DTest1::Request(TInt aReqNo, TAny* a1, TAny* /*a2*/) |
|
104 { |
|
105 // |
|
106 // Get the timer tick count & ticks |
|
107 // |
|
108 TUint temp = 0; |
|
109 switch(aReqNo) |
|
110 { |
|
111 case (RLddTest1::EGET_TIMERTICKS): |
|
112 { |
|
113 temp = (TInt)(*(TInt *)a1); |
|
114 temp = NKern::TimerTicks(temp); |
|
115 kumemput(a1, &temp, sizeof(temp)); |
|
116 return KErrNone; |
|
117 } |
|
118 case (RLddTest1::EGET_TIMERTICKCOUNT): |
|
119 { |
|
120 temp = NKern::TickCount(); |
|
121 kumemput(a1, &temp, sizeof(temp)); |
|
122 return KErrNone; |
|
123 } |
|
124 } |
|
125 return KErrNone; |
|
126 } |