os/kernelhwsrv/kerneltest/e32test/system/d_tick.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/system/d_tick.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,105 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\system\d_tick.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#if !defined(__D_TICK_H__)
    1.22 +#define __D_TICK_H__
    1.23 +#include <e32cmn.h>
    1.24 +#ifndef __KERNEL_MODE__
    1.25 +#include <e32std.h>
    1.26 +#endif
    1.27 +
    1.28 +_LIT(KTickTestLddName,"TickTest");
    1.29 +
    1.30 +const TInt KMaxTimers=8;
    1.31 +
    1.32 +class TCapsTickTestV01
    1.33 +	{
    1.34 +public:
    1.35 +	TVersion	iVersion;
    1.36 +	};
    1.37 +
    1.38 +struct STickTestInfo
    1.39 +	{
    1.40 +	TInt iMinErr;
    1.41 +	TInt iMaxErr;
    1.42 +	TInt iAvgErr;
    1.43 +	TUint iTotalTime;
    1.44 +	TInt iCount;
    1.45 +	TInt iRequestedCount;
    1.46 +	};
    1.47 +
    1.48 +struct STimerStartInfo
    1.49 +	{
    1.50 +	TInt iMode;
    1.51 +	TInt iMin;
    1.52 +	TInt iRange;
    1.53 +	TInt iCount;
    1.54 +	TRequestStatus* iStatus;
    1.55 +	};
    1.56 +
    1.57 +#define PERIODIC(i,s,iv,c)	\
    1.58 +	STimerStartInfo i; i.iStatus=&s; i.iMin=iv; i.iRange=1; i.iCount=c; i.iMode=EPeriodic
    1.59 +#define NSHOTREL(i,s,m,r,c)	\
    1.60 +	STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EOneShot
    1.61 +#define NSHOTABS(i,s,m,r,c)	\
    1.62 +	STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EAbsolute
    1.63 +#define NSHOTDLY(i,s,p,d,c)	\
    1.64 +	STimerStartInfo i; i.iStatus=&s; i.iMin=p; i.iRange=d; i.iCount=c; i.iMode=ETickDelay
    1.65 +
    1.66 +class RTickTest : public RBusLogicalChannel
    1.67 +	{
    1.68 +public:
    1.69 +	enum TControl
    1.70 +		{
    1.71 +		EControlStart,
    1.72 +		EControlStop,
    1.73 +		EControlGetInfo,
    1.74 +		EControlReadRtc,
    1.75 +		EControlGetTickPeriod,
    1.76 +		};
    1.77 +
    1.78 +	enum TMode
    1.79 +		{
    1.80 +		EOneShot,
    1.81 +		EPeriodic,
    1.82 +		EAbsolute,
    1.83 +		ETickDelay,
    1.84 +		};
    1.85 +public:
    1.86 +#ifndef __KERNEL_MODE__
    1.87 +	inline TInt Open()
    1.88 +		{ return DoCreate(KTickTestLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); }
    1.89 +	inline TInt StartPeriodic(TRequestStatus& aStatus, TInt aId, TInt aInterval, TInt aCount)
    1.90 +		{ aStatus=KRequestPending; PERIODIC(info,aStatus,aInterval,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
    1.91 +	inline TInt StartNShotRel(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount)
    1.92 +		{ aStatus=KRequestPending; NSHOTREL(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
    1.93 +	inline TInt StartNShotAbs(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount)
    1.94 +		{ aStatus=KRequestPending; NSHOTABS(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
    1.95 +	inline TInt StartNShotDelay(TRequestStatus& aStatus, TInt aId, TInt aPeriod, TInt aDelay, TInt aCount)
    1.96 +		{ aStatus=KRequestPending; NSHOTDLY(info,aStatus,aPeriod,aDelay,aCount); return DoControl(EControlStart, (TAny*)aId, &info); }
    1.97 +	inline TInt Stop(TInt aId)
    1.98 +		{ return DoControl(EControlStop, (TAny*)aId); }
    1.99 +	inline TInt GetInfo(TInt aId, STickTestInfo& anInfo)
   1.100 +		{ return DoControl(EControlGetInfo, (TAny*)aId, &anInfo); }
   1.101 +	inline TInt ReadRtc(TTime& aSwRtc, TTime& aHwRtc)
   1.102 +		{ return DoControl(EControlReadRtc, &aSwRtc, &aHwRtc); }
   1.103 +	inline TInt TickPeriodUs()
   1.104 +		{ return DoControl(EControlGetTickPeriod); }
   1.105 +#endif
   1.106 +	};
   1.107 +
   1.108 +#endif