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\d_tick.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#if !defined(__D_TICK_H__)
|
sl@0
|
19 |
#define __D_TICK_H__
|
sl@0
|
20 |
#include <e32cmn.h>
|
sl@0
|
21 |
#ifndef __KERNEL_MODE__
|
sl@0
|
22 |
#include <e32std.h>
|
sl@0
|
23 |
#endif
|
sl@0
|
24 |
|
sl@0
|
25 |
_LIT(KTickTestLddName,"TickTest");
|
sl@0
|
26 |
|
sl@0
|
27 |
const TInt KMaxTimers=8;
|
sl@0
|
28 |
|
sl@0
|
29 |
class TCapsTickTestV01
|
sl@0
|
30 |
{
|
sl@0
|
31 |
public:
|
sl@0
|
32 |
TVersion iVersion;
|
sl@0
|
33 |
};
|
sl@0
|
34 |
|
sl@0
|
35 |
struct STickTestInfo
|
sl@0
|
36 |
{
|
sl@0
|
37 |
TInt iMinErr;
|
sl@0
|
38 |
TInt iMaxErr;
|
sl@0
|
39 |
TInt iAvgErr;
|
sl@0
|
40 |
TUint iTotalTime;
|
sl@0
|
41 |
TInt iCount;
|
sl@0
|
42 |
TInt iRequestedCount;
|
sl@0
|
43 |
};
|
sl@0
|
44 |
|
sl@0
|
45 |
struct STimerStartInfo
|
sl@0
|
46 |
{
|
sl@0
|
47 |
TInt iMode;
|
sl@0
|
48 |
TInt iMin;
|
sl@0
|
49 |
TInt iRange;
|
sl@0
|
50 |
TInt iCount;
|
sl@0
|
51 |
TRequestStatus* iStatus;
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
#define PERIODIC(i,s,iv,c) \
|
sl@0
|
55 |
STimerStartInfo i; i.iStatus=&s; i.iMin=iv; i.iRange=1; i.iCount=c; i.iMode=EPeriodic
|
sl@0
|
56 |
#define NSHOTREL(i,s,m,r,c) \
|
sl@0
|
57 |
STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EOneShot
|
sl@0
|
58 |
#define NSHOTABS(i,s,m,r,c) \
|
sl@0
|
59 |
STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EAbsolute
|
sl@0
|
60 |
#define NSHOTDLY(i,s,p,d,c) \
|
sl@0
|
61 |
STimerStartInfo i; i.iStatus=&s; i.iMin=p; i.iRange=d; i.iCount=c; i.iMode=ETickDelay
|
sl@0
|
62 |
|
sl@0
|
63 |
class RTickTest : public RBusLogicalChannel
|
sl@0
|
64 |
{
|
sl@0
|
65 |
public:
|
sl@0
|
66 |
enum TControl
|
sl@0
|
67 |
{
|
sl@0
|
68 |
EControlStart,
|
sl@0
|
69 |
EControlStop,
|
sl@0
|
70 |
EControlGetInfo,
|
sl@0
|
71 |
EControlReadRtc,
|
sl@0
|
72 |
EControlGetTickPeriod,
|
sl@0
|
73 |
};
|
sl@0
|
74 |
|
sl@0
|
75 |
enum TMode
|
sl@0
|
76 |
{
|
sl@0
|
77 |
EOneShot,
|
sl@0
|
78 |
EPeriodic,
|
sl@0
|
79 |
EAbsolute,
|
sl@0
|
80 |
ETickDelay,
|
sl@0
|
81 |
};
|
sl@0
|
82 |
public:
|
sl@0
|
83 |
#ifndef __KERNEL_MODE__
|
sl@0
|
84 |
inline TInt Open()
|
sl@0
|
85 |
{ return DoCreate(KTickTestLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); }
|
sl@0
|
86 |
inline TInt StartPeriodic(TRequestStatus& aStatus, TInt aId, TInt aInterval, TInt aCount)
|
sl@0
|
87 |
{ aStatus=KRequestPending; PERIODIC(info,aStatus,aInterval,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
|
sl@0
|
88 |
inline TInt StartNShotRel(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount)
|
sl@0
|
89 |
{ aStatus=KRequestPending; NSHOTREL(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
|
sl@0
|
90 |
inline TInt StartNShotAbs(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount)
|
sl@0
|
91 |
{ aStatus=KRequestPending; NSHOTABS(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
|
sl@0
|
92 |
inline TInt StartNShotDelay(TRequestStatus& aStatus, TInt aId, TInt aPeriod, TInt aDelay, TInt aCount)
|
sl@0
|
93 |
{ aStatus=KRequestPending; NSHOTDLY(info,aStatus,aPeriod,aDelay,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
|
sl@0
|
94 |
inline TInt Stop(TInt aId)
|
sl@0
|
95 |
{ return DoControl(EControlStop, (TAny*)aId); }
|
sl@0
|
96 |
inline TInt GetInfo(TInt aId, STickTestInfo& anInfo)
|
sl@0
|
97 |
{ return DoControl(EControlGetInfo, (TAny*)aId, &anInfo); }
|
sl@0
|
98 |
inline TInt ReadRtc(TTime& aSwRtc, TTime& aHwRtc)
|
sl@0
|
99 |
{ return DoControl(EControlReadRtc, &aSwRtc, &aHwRtc); }
|
sl@0
|
100 |
inline TInt TickPeriodUs()
|
sl@0
|
101 |
{ return DoControl(EControlGetTickPeriod); }
|
sl@0
|
102 |
#endif
|
sl@0
|
103 |
};
|
sl@0
|
104 |
|
sl@0
|
105 |
#endif
|