sl@0
|
1 |
// Copyright (c) 1997-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\system\t_mstim.cpp
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Test millisecond timers
|
sl@0
|
17 |
// API Information:
|
sl@0
|
18 |
// NTimer
|
sl@0
|
19 |
// Details:
|
sl@0
|
20 |
// - Create and start a number of periodic timers, verify results are
|
sl@0
|
21 |
// as expected.
|
sl@0
|
22 |
// - Attempt to start a timer that has already been started. Verify returned
|
sl@0
|
23 |
// error results.
|
sl@0
|
24 |
// - Start one shot interrupt and one shot DFC timers and verify that the
|
sl@0
|
25 |
// delay time is correct.
|
sl@0
|
26 |
// - Start additional one shot interrupt timers with various values and verify
|
sl@0
|
27 |
// results are as expected.
|
sl@0
|
28 |
// - Calculate and print the elapsed time.
|
sl@0
|
29 |
// - Start some timers, display min. max, avg and count information on each.
|
sl@0
|
30 |
// Verify results are as expected.
|
sl@0
|
31 |
// - Cancel a periodic timer and reuse it in a variety of conditions. Time how
|
sl@0
|
32 |
// long it takes for each to complete.
|
sl@0
|
33 |
// - Perform some random timer tests and display the results.
|
sl@0
|
34 |
// - Check idle time while a variety of one shot timers run. Verify results are
|
sl@0
|
35 |
// within the expected range.
|
sl@0
|
36 |
// Platforms/Drives/Compatibility:
|
sl@0
|
37 |
// All.
|
sl@0
|
38 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
39 |
// Failures and causes:
|
sl@0
|
40 |
// Base Port information:
|
sl@0
|
41 |
//
|
sl@0
|
42 |
//
|
sl@0
|
43 |
|
sl@0
|
44 |
#include <e32test.h>
|
sl@0
|
45 |
#include <e32uid.h>
|
sl@0
|
46 |
#include "d_mstim.h"
|
sl@0
|
47 |
|
sl@0
|
48 |
RTest test(_L("T_MSTIM"));
|
sl@0
|
49 |
RMsTim mstim;
|
sl@0
|
50 |
|
sl@0
|
51 |
TBool PauseOnError = 0;
|
sl@0
|
52 |
#define GETCH() (PauseOnError&&test.Getch())
|
sl@0
|
53 |
|
sl@0
|
54 |
#define TEST(c) ((void)((c)||(test.Printf(_L("Failed at line %d\n"),__LINE__),GETCH(),test(0),0)))
|
sl@0
|
55 |
#define CHECK(c) ((void)(((c)==0)||(test.Printf(_L("Error %d at line %d\n"),(c),__LINE__),GETCH(),test(0),0)))
|
sl@0
|
56 |
#ifdef __WINS__
|
sl@0
|
57 |
#define TESTTIME(v,min,max) test.Printf(_L("Expected range [%d,%d]\n"),min,max+1)
|
sl@0
|
58 |
#else
|
sl@0
|
59 |
#define TESTTIME(v,min,max) TEST(v>=min && v<max)
|
sl@0
|
60 |
#endif
|
sl@0
|
61 |
|
sl@0
|
62 |
const TPtrC KLddFileName=_L("D_MSTIM.LDD");
|
sl@0
|
63 |
|
sl@0
|
64 |
void GetInfo(TInt aId)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
SMsTimerInfo info;
|
sl@0
|
67 |
TInt r=mstim.GetInfo(aId,info);
|
sl@0
|
68 |
CHECK(r);
|
sl@0
|
69 |
test.Printf(_L("%1d: min=%-6d max=%-6d avg=%-6d count=%d\n"),aId,info.iMin,info.iMax,info.iAvg,info.iCount);
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
void GetAllInfo()
|
sl@0
|
73 |
{
|
sl@0
|
74 |
GetInfo(0);
|
sl@0
|
75 |
GetInfo(1);
|
sl@0
|
76 |
GetInfo(2);
|
sl@0
|
77 |
GetInfo(3);
|
sl@0
|
78 |
test.Printf(_L("\n"));
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
TInt GetOneShotTime(TInt aId)
|
sl@0
|
82 |
{
|
sl@0
|
83 |
SMsTimerInfo info;
|
sl@0
|
84 |
TInt r=mstim.GetInfo(aId,info);
|
sl@0
|
85 |
CHECK(r);
|
sl@0
|
86 |
TEST(info.iCount==1);
|
sl@0
|
87 |
return info.iMin/1000;
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
GLDEF_C TInt E32Main()
|
sl@0
|
91 |
//
|
sl@0
|
92 |
// Test millisecond timers
|
sl@0
|
93 |
//
|
sl@0
|
94 |
{
|
sl@0
|
95 |
// test.SetLogged(EFalse);
|
sl@0
|
96 |
test.Title();
|
sl@0
|
97 |
|
sl@0
|
98 |
test.Start(_L("Load test LDD"));
|
sl@0
|
99 |
TInt r=User::LoadLogicalDevice(KLddFileName);
|
sl@0
|
100 |
TEST(r==KErrNone || r==KErrAlreadyExists);
|
sl@0
|
101 |
|
sl@0
|
102 |
r=mstim.Open();
|
sl@0
|
103 |
CHECK(r);
|
sl@0
|
104 |
|
sl@0
|
105 |
test.Next(_L("Start periodics"));
|
sl@0
|
106 |
TUint init_count=User::NTickCount();
|
sl@0
|
107 |
r=mstim.StartPeriodicInt(0,31);
|
sl@0
|
108 |
CHECK(r);
|
sl@0
|
109 |
r=mstim.StartPeriodicInt(1,32);
|
sl@0
|
110 |
CHECK(r);
|
sl@0
|
111 |
r=mstim.StartPeriodicInt(4,7);
|
sl@0
|
112 |
CHECK(r);
|
sl@0
|
113 |
r=mstim.StartPeriodicInt(5,43);
|
sl@0
|
114 |
CHECK(r);
|
sl@0
|
115 |
r=mstim.StartPeriodicDfc(6,19);
|
sl@0
|
116 |
CHECK(r);
|
sl@0
|
117 |
r=mstim.StartPeriodicDfc(7,71);
|
sl@0
|
118 |
CHECK(r);
|
sl@0
|
119 |
|
sl@0
|
120 |
test.Next(_L("Start while started"));
|
sl@0
|
121 |
TRequestStatus s;
|
sl@0
|
122 |
mstim.StartOneShotInt(s,0,100);
|
sl@0
|
123 |
User::WaitForRequest(s);
|
sl@0
|
124 |
TEST(s==KErrInUse);
|
sl@0
|
125 |
|
sl@0
|
126 |
test.Next(_L("One shot interrupt"));
|
sl@0
|
127 |
mstim.StartOneShotInt(s,2,100);
|
sl@0
|
128 |
User::WaitForRequest(s);
|
sl@0
|
129 |
TUint fc1=User::NTickCount();
|
sl@0
|
130 |
TEST(s==KErrNone);
|
sl@0
|
131 |
TInt time=GetOneShotTime(2);
|
sl@0
|
132 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
133 |
TESTTIME(time,100,102);
|
sl@0
|
134 |
|
sl@0
|
135 |
test.Next(_L("One shot DFC"));
|
sl@0
|
136 |
mstim.StartOneShotDfc(s,3,200);
|
sl@0
|
137 |
User::WaitForRequest(s);
|
sl@0
|
138 |
TUint fc3=User::NTickCount();
|
sl@0
|
139 |
TEST(s==KErrNone);
|
sl@0
|
140 |
time=GetOneShotTime(3);
|
sl@0
|
141 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
142 |
TESTTIME(time,200,202);
|
sl@0
|
143 |
|
sl@0
|
144 |
test.Next(_L("One shot interrupt again"));
|
sl@0
|
145 |
TUint fc2=User::NTickCount();
|
sl@0
|
146 |
mstim.StartOneShotIntAgain(s,2,300);
|
sl@0
|
147 |
User::WaitForRequest(s);
|
sl@0
|
148 |
TEST(s==KErrNone);
|
sl@0
|
149 |
TInt time2=GetOneShotTime(2);
|
sl@0
|
150 |
test.Printf(_L("Took %dms, delay %dms\n"),time2,fc2-fc1);
|
sl@0
|
151 |
time2+=TInt(fc2-fc1);
|
sl@0
|
152 |
TESTTIME(time2,295,306);
|
sl@0
|
153 |
|
sl@0
|
154 |
test.Next(_L("One shot interrupt again too late"));
|
sl@0
|
155 |
mstim.StartOneShotIntAgain(s,3,10);
|
sl@0
|
156 |
User::WaitForRequest(s);
|
sl@0
|
157 |
TEST(s==KErrArgument);
|
sl@0
|
158 |
|
sl@0
|
159 |
test.Next(_L("One shot interrupt again"));
|
sl@0
|
160 |
fc2=User::NTickCount();
|
sl@0
|
161 |
mstim.StartOneShotIntAgain(s,3,300);
|
sl@0
|
162 |
User::WaitForRequest(s);
|
sl@0
|
163 |
TEST(s==KErrNone);
|
sl@0
|
164 |
time=GetOneShotTime(3);
|
sl@0
|
165 |
test.Printf(_L("Took %dms, delay %dms\n"),time,fc2-fc3);
|
sl@0
|
166 |
time+=TInt(fc2-fc3);
|
sl@0
|
167 |
TESTTIME(time,295,306);
|
sl@0
|
168 |
|
sl@0
|
169 |
test.Printf(_L("Please wait...\n"));
|
sl@0
|
170 |
User::After(10000000);
|
sl@0
|
171 |
|
sl@0
|
172 |
SMsTimerInfo info[8];
|
sl@0
|
173 |
TInt i;
|
sl@0
|
174 |
for (i=0; i<8; i++)
|
sl@0
|
175 |
{
|
sl@0
|
176 |
r=mstim.GetInfo(i,info[i]);
|
sl@0
|
177 |
CHECK(r);
|
sl@0
|
178 |
}
|
sl@0
|
179 |
|
sl@0
|
180 |
TUint final_count=User::NTickCount();
|
sl@0
|
181 |
TInt elapsed=TInt(final_count-init_count);
|
sl@0
|
182 |
test.Printf(_L("Elapsed time %dms\n"),elapsed);
|
sl@0
|
183 |
|
sl@0
|
184 |
const TInt period[8]={31,32,0,0,7,43,19,71};
|
sl@0
|
185 |
for (i=0; i<8; i++)
|
sl@0
|
186 |
{
|
sl@0
|
187 |
TInt p=period[i];
|
sl@0
|
188 |
if (p==0)
|
sl@0
|
189 |
continue;
|
sl@0
|
190 |
SMsTimerInfo& z=info[i];
|
sl@0
|
191 |
test.Printf(_L("%1d: min=%-6d max=%-6d avg=%-6d count=%d\n"),i,z.iMin,z.iMax,z.iAvg,z.iCount);
|
sl@0
|
192 |
TInt count=elapsed/p;
|
sl@0
|
193 |
TInt cdiff=count-z.iCount;
|
sl@0
|
194 |
TEST(cdiff>=0 && cdiff<=2);
|
sl@0
|
195 |
#ifndef __WINS__
|
sl@0
|
196 |
TEST(Abs(z.iMin-1000*p)<1000);
|
sl@0
|
197 |
TEST(Abs(z.iMax-1000*p)<1000);
|
sl@0
|
198 |
#endif
|
sl@0
|
199 |
TEST(Abs(z.iAvg-1000*p)<1000);
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
test.Next(_L("Cancel periodic"));
|
sl@0
|
203 |
r=mstim.StopPeriodic(7);
|
sl@0
|
204 |
CHECK(r);
|
sl@0
|
205 |
r=mstim.GetInfo(7,info[7]);
|
sl@0
|
206 |
CHECK(r);
|
sl@0
|
207 |
User::After(1000000);
|
sl@0
|
208 |
r=mstim.GetInfo(7,info[6]);
|
sl@0
|
209 |
CHECK(r);
|
sl@0
|
210 |
TEST(info[6].iCount==info[7].iCount);
|
sl@0
|
211 |
|
sl@0
|
212 |
test.Next(_L("Reuse cancelled"));
|
sl@0
|
213 |
mstim.StartOneShotInt(s,7,128);
|
sl@0
|
214 |
User::WaitForRequest(s);
|
sl@0
|
215 |
TEST(s==KErrNone);
|
sl@0
|
216 |
time=GetOneShotTime(7);
|
sl@0
|
217 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
218 |
TESTTIME(time,128,130);
|
sl@0
|
219 |
|
sl@0
|
220 |
TRequestStatus s2;
|
sl@0
|
221 |
test.Next(_L("Timed Cancel"));
|
sl@0
|
222 |
mstim.StartOneShotInt(s,2,128);
|
sl@0
|
223 |
mstim.IntCancel(s2,2,130);
|
sl@0
|
224 |
User::WaitForRequest(s);
|
sl@0
|
225 |
TEST(s==KErrNone);
|
sl@0
|
226 |
User::WaitForRequest(s2);
|
sl@0
|
227 |
TEST(s2==KErrNone);
|
sl@0
|
228 |
time=GetOneShotTime(2);
|
sl@0
|
229 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
230 |
TESTTIME(time,128,130);
|
sl@0
|
231 |
time=GetOneShotTime(7);
|
sl@0
|
232 |
test.Printf(_L("Cancel Took %dms\n"),time);
|
sl@0
|
233 |
TESTTIME(time,130,132);
|
sl@0
|
234 |
|
sl@0
|
235 |
mstim.StartOneShotInt(s,2,128);
|
sl@0
|
236 |
mstim.IntCancel(s2,2,126);
|
sl@0
|
237 |
User::WaitForRequest(s);
|
sl@0
|
238 |
TEST(s==KErrAbort);
|
sl@0
|
239 |
User::WaitForRequest(s2);
|
sl@0
|
240 |
TEST(s2==KErrNone);
|
sl@0
|
241 |
time=GetOneShotTime(7);
|
sl@0
|
242 |
test.Printf(_L("Cancel Took %dms\n"),time);
|
sl@0
|
243 |
TESTTIME(time,126,128);
|
sl@0
|
244 |
|
sl@0
|
245 |
test.Next(_L("Reuse cancelled"));
|
sl@0
|
246 |
mstim.StartOneShotInt(s,2,64);
|
sl@0
|
247 |
User::WaitForRequest(s);
|
sl@0
|
248 |
TEST(s==KErrNone);
|
sl@0
|
249 |
time=GetOneShotTime(2);
|
sl@0
|
250 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
251 |
TESTTIME(time,64,66);
|
sl@0
|
252 |
|
sl@0
|
253 |
#ifdef _DEBUG
|
sl@0
|
254 |
test.Next(_L("Random test"));
|
sl@0
|
255 |
r=mstim.BeginRandomTest();
|
sl@0
|
256 |
CHECK(r);
|
sl@0
|
257 |
#endif
|
sl@0
|
258 |
|
sl@0
|
259 |
test.Printf(_L("Please wait...\n"));
|
sl@0
|
260 |
User::After(10000000);
|
sl@0
|
261 |
|
sl@0
|
262 |
#ifdef _DEBUG
|
sl@0
|
263 |
r=mstim.EndRandomTest();
|
sl@0
|
264 |
CHECK(r);
|
sl@0
|
265 |
SRandomTestInfo rInfo;
|
sl@0
|
266 |
r=mstim.GetRandomTestInfo(rInfo);
|
sl@0
|
267 |
test.Printf(_L("min error = %d\n"),rInfo.iMin);
|
sl@0
|
268 |
test.Printf(_L("max error = %d\n"),rInfo.iMax);
|
sl@0
|
269 |
test.Printf(_L("xfer cancel = %d\n"),rInfo.iXferC);
|
sl@0
|
270 |
test.Printf(_L("crit cancel = %d\n"),rInfo.iCritC);
|
sl@0
|
271 |
test.Printf(_L("start fails = %d\n"),rInfo.iStartFail);
|
sl@0
|
272 |
test.Printf(_L("debug calls = %d\n"),rInfo.iCallBacks);
|
sl@0
|
273 |
test.Printf(_L("completions = %d\n"),rInfo.iCompletions);
|
sl@0
|
274 |
#endif
|
sl@0
|
275 |
|
sl@0
|
276 |
for (i=0; i<8; i++)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
r=mstim.GetInfo(i,info[i]);
|
sl@0
|
279 |
CHECK(r);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
final_count=User::NTickCount();
|
sl@0
|
283 |
elapsed=TInt(final_count-init_count);
|
sl@0
|
284 |
test.Printf(_L("Elapsed time %dms\n"),elapsed);
|
sl@0
|
285 |
|
sl@0
|
286 |
const TInt period2[8]={31,32,0,0,7,43,19,0};
|
sl@0
|
287 |
for (i=0; i<8; i++)
|
sl@0
|
288 |
{
|
sl@0
|
289 |
TInt p=period2[i];
|
sl@0
|
290 |
if (p==0)
|
sl@0
|
291 |
continue;
|
sl@0
|
292 |
r=mstim.StopPeriodic(i);
|
sl@0
|
293 |
CHECK(r);
|
sl@0
|
294 |
SMsTimerInfo& z=info[i];
|
sl@0
|
295 |
test.Printf(_L("%1d: min=%-6d max=%-6d avg=%-6d count=%d\n"),i,z.iMin,z.iMax,z.iAvg,z.iCount);
|
sl@0
|
296 |
TInt count=elapsed/p;
|
sl@0
|
297 |
TInt cdiff=count-z.iCount;
|
sl@0
|
298 |
TEST(cdiff>=0 && cdiff<=2);
|
sl@0
|
299 |
#ifndef __WINS__
|
sl@0
|
300 |
TEST(Abs(z.iMin-1000*p)<=1000);
|
sl@0
|
301 |
TEST(Abs(z.iMax-1000*p)<=1000);
|
sl@0
|
302 |
#endif
|
sl@0
|
303 |
TEST(Abs(z.iAvg-1000*p)<=1000);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
test.Next(_L("Idle time"));
|
sl@0
|
307 |
time=0;
|
sl@0
|
308 |
TInt idle=0;
|
sl@0
|
309 |
while (time<3000)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
idle=mstim.GetIdleTime();
|
sl@0
|
312 |
if (idle>=1000)
|
sl@0
|
313 |
break;
|
sl@0
|
314 |
if (idle<32)
|
sl@0
|
315 |
idle=32;
|
sl@0
|
316 |
User::AfterHighRes(idle*1000);
|
sl@0
|
317 |
time+=idle;
|
sl@0
|
318 |
}
|
sl@0
|
319 |
if (time>=3000)
|
sl@0
|
320 |
test.Printf(_L("Never got long enough idle time\n"));
|
sl@0
|
321 |
else
|
sl@0
|
322 |
{
|
sl@0
|
323 |
mstim.StartOneShotInt(s,0,900);
|
sl@0
|
324 |
TUint fc0=User::NTickCount();
|
sl@0
|
325 |
User::AfterHighRes(20000);
|
sl@0
|
326 |
idle=mstim.GetIdleTime();
|
sl@0
|
327 |
test.Printf(_L("Idle time %dms\n"),idle);
|
sl@0
|
328 |
TESTTIME(idle,860,881);
|
sl@0
|
329 |
mstim.StartOneShotInt(s2,1,200);
|
sl@0
|
330 |
fc1=User::NTickCount();
|
sl@0
|
331 |
User::AfterHighRes(20000);
|
sl@0
|
332 |
idle=mstim.GetIdleTime();
|
sl@0
|
333 |
test.Printf(_L("Idle time %dms\n"),idle);
|
sl@0
|
334 |
TESTTIME(idle,160,181);
|
sl@0
|
335 |
TRequestStatus s3;
|
sl@0
|
336 |
mstim.StartOneShotInt(s3,2,10);
|
sl@0
|
337 |
idle=mstim.GetIdleTime();
|
sl@0
|
338 |
test.Printf(_L("Idle time %dms\n"),idle);
|
sl@0
|
339 |
TEST(idle==0);
|
sl@0
|
340 |
User::WaitForRequest(s3);
|
sl@0
|
341 |
fc2=User::NTickCount();
|
sl@0
|
342 |
idle=mstim.GetIdleTime();
|
sl@0
|
343 |
elapsed=fc2-fc1;
|
sl@0
|
344 |
test.Printf(_L("Idle time %dms elapsed %dms\n"),idle,elapsed);
|
sl@0
|
345 |
TESTTIME(idle,180-elapsed,201-elapsed);
|
sl@0
|
346 |
User::WaitForRequest(s2);
|
sl@0
|
347 |
fc2=User::NTickCount();
|
sl@0
|
348 |
idle=mstim.GetIdleTime();
|
sl@0
|
349 |
elapsed=fc2-fc0;
|
sl@0
|
350 |
test.Printf(_L("Idle time %dms elapsed %dms\n"),idle,elapsed);
|
sl@0
|
351 |
TESTTIME(idle,880-elapsed,900-elapsed);
|
sl@0
|
352 |
User::WaitForRequest(s);
|
sl@0
|
353 |
}
|
sl@0
|
354 |
|
sl@0
|
355 |
TUint fc4, fc5;
|
sl@0
|
356 |
test.Next(_L("One shot int "));
|
sl@0
|
357 |
mstim.StartOneShotInt(s,8,100);
|
sl@0
|
358 |
User::WaitForRequest(s);
|
sl@0
|
359 |
TEST(s==KErrNone);
|
sl@0
|
360 |
time=GetOneShotTime(8);
|
sl@0
|
361 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
362 |
TESTTIME(time,100,102);
|
sl@0
|
363 |
|
sl@0
|
364 |
test.Next(_L("One shot int "));
|
sl@0
|
365 |
mstim.StartOneShotInt(s,8,300);
|
sl@0
|
366 |
User::WaitForRequest(s);
|
sl@0
|
367 |
fc4=User::NTickCount();
|
sl@0
|
368 |
TEST(s==KErrNone);
|
sl@0
|
369 |
time=GetOneShotTime(8);
|
sl@0
|
370 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
371 |
TESTTIME(time,300,302);
|
sl@0
|
372 |
|
sl@0
|
373 |
test.Next(_L("One shot int again"));
|
sl@0
|
374 |
fc5=User::NTickCount();
|
sl@0
|
375 |
mstim.StartOneShotIntAgain(s,8,300);
|
sl@0
|
376 |
User::WaitForRequest(s);
|
sl@0
|
377 |
TEST(s==KErrNone);
|
sl@0
|
378 |
time2=GetOneShotTime(8);
|
sl@0
|
379 |
test.Printf(_L("Took %dms, delay %dms\n"),time2,fc5-fc4);
|
sl@0
|
380 |
time2+=TInt(fc5-fc4);
|
sl@0
|
381 |
TESTTIME(time2,295,306);
|
sl@0
|
382 |
|
sl@0
|
383 |
test.Next(_L("One shot with provided Dfc queue"));
|
sl@0
|
384 |
mstim.StartOneShotUserDfc(s,8,100);
|
sl@0
|
385 |
User::WaitForRequest(s);
|
sl@0
|
386 |
TEST(s==KErrNone);
|
sl@0
|
387 |
time=GetOneShotTime(8);
|
sl@0
|
388 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
389 |
TESTTIME(time,100,102);
|
sl@0
|
390 |
|
sl@0
|
391 |
test.Next(_L("One shot with provided Dfc queue"));
|
sl@0
|
392 |
mstim.StartOneShotUserDfc(s,8,300);
|
sl@0
|
393 |
User::WaitForRequest(s);
|
sl@0
|
394 |
fc4=User::NTickCount();
|
sl@0
|
395 |
TEST(s==KErrNone);
|
sl@0
|
396 |
time=GetOneShotTime(8);
|
sl@0
|
397 |
test.Printf(_L("Took %dms\n"),time);
|
sl@0
|
398 |
TESTTIME(time,300,302);
|
sl@0
|
399 |
|
sl@0
|
400 |
test.Next(_L("One shot with provided Dfc queue again"));
|
sl@0
|
401 |
fc5=User::NTickCount();
|
sl@0
|
402 |
mstim.StartOneShotUserDfcAgain(s,8,300);
|
sl@0
|
403 |
User::WaitForRequest(s);
|
sl@0
|
404 |
TEST(s==KErrNone);
|
sl@0
|
405 |
time2=GetOneShotTime(8);
|
sl@0
|
406 |
test.Printf(_L("Took %dms, delay %dms\n"),time2,fc5-fc4);
|
sl@0
|
407 |
time2+=TInt(fc5-fc4);
|
sl@0
|
408 |
TESTTIME(time2,295,306);
|
sl@0
|
409 |
|
sl@0
|
410 |
test.End();
|
sl@0
|
411 |
return(KErrNone);
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|