sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\system\d_tick.h sl@0: // sl@0: // sl@0: sl@0: #if !defined(__D_TICK_H__) sl@0: #define __D_TICK_H__ sl@0: #include sl@0: #ifndef __KERNEL_MODE__ sl@0: #include sl@0: #endif sl@0: sl@0: _LIT(KTickTestLddName,"TickTest"); sl@0: sl@0: const TInt KMaxTimers=8; sl@0: sl@0: class TCapsTickTestV01 sl@0: { sl@0: public: sl@0: TVersion iVersion; sl@0: }; sl@0: sl@0: struct STickTestInfo sl@0: { sl@0: TInt iMinErr; sl@0: TInt iMaxErr; sl@0: TInt iAvgErr; sl@0: TUint iTotalTime; sl@0: TInt iCount; sl@0: TInt iRequestedCount; sl@0: }; sl@0: sl@0: struct STimerStartInfo sl@0: { sl@0: TInt iMode; sl@0: TInt iMin; sl@0: TInt iRange; sl@0: TInt iCount; sl@0: TRequestStatus* iStatus; sl@0: }; sl@0: sl@0: #define PERIODIC(i,s,iv,c) \ sl@0: STimerStartInfo i; i.iStatus=&s; i.iMin=iv; i.iRange=1; i.iCount=c; i.iMode=EPeriodic sl@0: #define NSHOTREL(i,s,m,r,c) \ sl@0: STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EOneShot sl@0: #define NSHOTABS(i,s,m,r,c) \ sl@0: STimerStartInfo i; i.iStatus=&s; i.iMin=m; i.iRange=r; i.iCount=c; i.iMode=EAbsolute sl@0: #define NSHOTDLY(i,s,p,d,c) \ sl@0: STimerStartInfo i; i.iStatus=&s; i.iMin=p; i.iRange=d; i.iCount=c; i.iMode=ETickDelay sl@0: sl@0: class RTickTest : public RBusLogicalChannel sl@0: { sl@0: public: sl@0: enum TControl sl@0: { sl@0: EControlStart, sl@0: EControlStop, sl@0: EControlGetInfo, sl@0: EControlReadRtc, sl@0: EControlGetTickPeriod, sl@0: }; sl@0: sl@0: enum TMode sl@0: { sl@0: EOneShot, sl@0: EPeriodic, sl@0: EAbsolute, sl@0: ETickDelay, sl@0: }; sl@0: public: sl@0: #ifndef __KERNEL_MODE__ sl@0: inline TInt Open() sl@0: { return DoCreate(KTickTestLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); } sl@0: inline TInt StartPeriodic(TRequestStatus& aStatus, TInt aId, TInt aInterval, TInt aCount) sl@0: { aStatus=KRequestPending; PERIODIC(info,aStatus,aInterval,aCount); return DoControl(EControlStart, (TAny*)aId, &info); } sl@0: inline TInt StartNShotRel(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount) sl@0: { aStatus=KRequestPending; NSHOTREL(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); } sl@0: inline TInt StartNShotAbs(TRequestStatus& aStatus, TInt aId, TInt aMin, TInt aRange, TInt aCount) sl@0: { aStatus=KRequestPending; NSHOTABS(info,aStatus,aMin,aRange,aCount); return DoControl(EControlStart, (TAny*)aId, &info); } sl@0: inline TInt StartNShotDelay(TRequestStatus& aStatus, TInt aId, TInt aPeriod, TInt aDelay, TInt aCount) sl@0: { aStatus=KRequestPending; NSHOTDLY(info,aStatus,aPeriod,aDelay,aCount); return DoControl(EControlStart, (TAny*)aId, &info); } sl@0: inline TInt Stop(TInt aId) sl@0: { return DoControl(EControlStop, (TAny*)aId); } sl@0: inline TInt GetInfo(TInt aId, STickTestInfo& anInfo) sl@0: { return DoControl(EControlGetInfo, (TAny*)aId, &anInfo); } sl@0: inline TInt ReadRtc(TTime& aSwRtc, TTime& aHwRtc) sl@0: { return DoControl(EControlReadRtc, &aSwRtc, &aHwRtc); } sl@0: inline TInt TickPeriodUs() sl@0: { return DoControl(EControlGetTickPeriod); } sl@0: #endif sl@0: }; sl@0: sl@0: #endif