| 0 |      1 | // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
|  |      2 | // All rights reserved.
 | 
|  |      3 | // This component and the accompanying materials are made available
 | 
|  |      4 | // under the terms of the License "Eclipse Public License v1.0"
 | 
|  |      5 | // which accompanies this distribution, and is available
 | 
|  |      6 | // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 | 
|  |      7 | //
 | 
|  |      8 | // Initial Contributors:
 | 
|  |      9 | // Nokia Corporation - initial contribution.
 | 
|  |     10 | //
 | 
|  |     11 | // Contributors:
 | 
|  |     12 | //
 | 
|  |     13 | // Description:
 | 
|  |     14 | // e32test\system\d_tick.h
 | 
|  |     15 | // 
 | 
|  |     16 | //
 | 
|  |     17 | 
 | 
|  |     18 | #if !defined(__D_TICK_H__)
 | 
|  |     19 | #define __D_TICK_H__
 | 
|  |     20 | #include <e32cmn.h>
 | 
|  |     21 | #ifndef __KERNEL_MODE__
 | 
|  |     22 | #include <e32std.h>
 | 
|  |     23 | #endif
 | 
|  |     24 | 
 | 
|  |     25 | _LIT(KTickTestLddName,"TickTest");
 | 
|  |     26 | 
 | 
|  |     27 | const TInt KMaxTimers=8;
 | 
|  |     28 | 
 | 
|  |     29 | class TCapsTickTestV01
 | 
|  |     30 | 	{
 | 
|  |     31 | public:
 | 
|  |     32 | 	TVersion	iVersion;
 | 
|  |     33 | 	};
 | 
|  |     34 | 
 | 
|  |     35 | struct STickTestInfo
 | 
|  |     36 | 	{
 | 
|  |     37 | 	TInt iMinErr;
 | 
|  |     38 | 	TInt iMaxErr;
 | 
|  |     39 | 	TInt iAvgErr;
 | 
|  |     40 | 	TUint iTotalTime;
 | 
|  |     41 | 	TInt iCount;
 | 
|  |     42 | 	TInt iRequestedCount;
 | 
|  |     43 | 	};
 | 
|  |     44 | 
 | 
|  |     45 | struct STimerStartInfo
 | 
|  |     46 | 	{
 | 
|  |     47 | 	TInt iMode;
 | 
|  |     48 | 	TInt iMin;
 | 
|  |     49 | 	TInt iRange;
 | 
|  |     50 | 	TInt iCount;
 | 
|  |     51 | 	TRequestStatus* iStatus;
 | 
|  |     52 | 	};
 | 
|  |     53 | 
 | 
|  |     54 | #define PERIODIC(i,s,iv,c)	\
 | 
|  |     55 | 	STimerStartInfo i; i.iStatus=&s; i.iMin=iv; i.iRange=1; i.iCount=c; i.iMode=EPeriodic
 | 
|  |     56 | #define NSHOTREL(i,s,m,r,c)	\
 | 
|  |     57 | 	STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EOneShot
 | 
|  |     58 | #define NSHOTABS(i,s,m,r,c)	\
 | 
|  |     59 | 	STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EAbsolute
 | 
|  |     60 | #define NSHOTDLY(i,s,p,d,c)	\
 | 
|  |     61 | 	STimerStartInfo i; i.iStatus=&s; i.iMin=p; i.iRange=d; i.iCount=c; i.iMode=ETickDelay
 | 
|  |     62 | 
 | 
|  |     63 | class RTickTest : public RBusLogicalChannel
 | 
|  |     64 | 	{
 | 
|  |     65 | public:
 | 
|  |     66 | 	enum TControl
 | 
|  |     67 | 		{
 | 
|  |     68 | 		EControlStart,
 | 
|  |     69 | 		EControlStop,
 | 
|  |     70 | 		EControlGetInfo,
 | 
|  |     71 | 		EControlReadRtc,
 | 
|  |     72 | 		EControlGetTickPeriod,
 | 
|  |     73 | 		};
 | 
|  |     74 | 
 | 
|  |     75 | 	enum TMode
 | 
|  |     76 | 		{
 | 
|  |     77 | 		EOneShot,
 | 
|  |     78 | 		EPeriodic,
 | 
|  |     79 | 		EAbsolute,
 | 
|  |     80 | 		ETickDelay,
 | 
|  |     81 | 		};
 | 
|  |     82 | public:
 | 
|  |     83 | #ifndef __KERNEL_MODE__
 | 
|  |     84 | 	inline TInt Open()
 | 
|  |     85 | 		{ return DoCreate(KTickTestLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); }
 | 
|  |     86 | 	inline TInt StartPeriodic(TRequestStatus& aStatus, TInt aId, TInt aInterval, TInt aCount)
 | 
|  |     87 | 		{ aStatus=KRequestPending; PERIODIC(info,aStatus,aInterval,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
 | 
|  |     88 | 	inline TInt StartNShotRel(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount)
 | 
|  |     89 | 		{ aStatus=KRequestPending; NSHOTREL(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
 | 
|  |     90 | 	inline TInt StartNShotAbs(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount)
 | 
|  |     91 | 		{ aStatus=KRequestPending; NSHOTABS(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
 | 
|  |     92 | 	inline TInt StartNShotDelay(TRequestStatus& aStatus, TInt aId, TInt aPeriod, TInt aDelay, TInt aCount)
 | 
|  |     93 | 		{ aStatus=KRequestPending; NSHOTDLY(info,aStatus,aPeriod,aDelay,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
 | 
|  |     94 | 	inline TInt Stop(TInt aId)
 | 
|  |     95 | 		{ return DoControl(EControlStop, (TAny*)aId); }
 | 
|  |     96 | 	inline TInt GetInfo(TInt aId, STickTestInfo& anInfo)
 | 
|  |     97 | 		{ return DoControl(EControlGetInfo, (TAny*)aId, &anInfo); }
 | 
|  |     98 | 	inline TInt ReadRtc(TTime& aSwRtc, TTime& aHwRtc)
 | 
|  |     99 | 		{ return DoControl(EControlReadRtc, &aSwRtc, &aHwRtc); }
 | 
|  |    100 | 	inline TInt TickPeriodUs()
 | 
|  |    101 | 		{ return DoControl(EControlGetTickPeriod); }
 | 
|  |    102 | #endif
 | 
|  |    103 | 	};
 | 
|  |    104 | 
 | 
|  |    105 | #endif
 |