kerneltest/e32test/system/d_mstim.h
changeset 9 96e5fb8b040d
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     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_mstim.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #if !defined(__D_MSTIM_H__)
       
    19 #define __D_MSTIM_H__
       
    20 #include <e32cmn.h>
       
    21 #ifndef __KERNEL_MODE__
       
    22 #include <e32std.h>
       
    23 #endif
       
    24 
       
    25 _LIT(KMsTimerLddName,"MsTim");
       
    26 
       
    27 class TCapsMsTimV01
       
    28 	{
       
    29 public:
       
    30 	TVersion	iVersion;
       
    31 	};
       
    32 
       
    33 struct SMsTimerInfo
       
    34 	{
       
    35 	TInt iMin;
       
    36 	TInt iMax;
       
    37 	TInt iAvg;
       
    38 	TInt iCount;
       
    39 	};
       
    40 
       
    41 struct SRandomTestInfo
       
    42 	{
       
    43 	TInt iMin;
       
    44 	TInt iMax;
       
    45 	TInt iXferC;
       
    46 	TInt iCritC;
       
    47 	TInt iStartFail;
       
    48 	TInt iCallBacks;
       
    49 	TInt iCompletions;
       
    50 	};
       
    51 
       
    52 class RMsTim : public RBusLogicalChannel
       
    53 	{
       
    54 public:
       
    55 	enum TControl
       
    56 		{
       
    57 		EControlStartPeriodicInt,
       
    58 		EControlStartPeriodicDfc,
       
    59 		EControlStopPeriodic,
       
    60 		EControlGetInfo,
       
    61 		EControlBeginRandomTest,
       
    62 		EControlEndRandomTest,
       
    63 		EControlGetRandomTestInfo,
       
    64 		EControlGetIdleTime,
       
    65 		};
       
    66 
       
    67 	enum TRequest
       
    68 		{
       
    69 		ERequestOneShotInt,
       
    70 		ERequestOneShotDfc,
       
    71 		ERequestIntCancel,
       
    72 		ERequestOneShotIntAgain,
       
    73 		ERequestOneShotUserDfc,
       
    74 		ERequestOneShotUserDfcAgain
       
    75 		};
       
    76 public:
       
    77 #ifndef __KERNEL_MODE__
       
    78 	inline TInt Open()
       
    79 		{ return DoCreate(KMsTimerLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); }
       
    80 	inline TInt StartPeriodicInt(TInt aId, TInt aInterval)
       
    81 		{ return DoControl(EControlStartPeriodicInt, (TAny*)aId, (TAny*)aInterval); }
       
    82 	inline TInt StartPeriodicDfc(TInt aId, TInt aInterval)
       
    83 		{ return DoControl(EControlStartPeriodicDfc, (TAny*)aId, (TAny*)aInterval); }
       
    84 	inline TInt StopPeriodic(TInt aId)
       
    85 		{ return DoControl(EControlStopPeriodic, (TAny*)aId); }
       
    86 	inline TInt GetInfo(TInt aId, SMsTimerInfo& anInfo)
       
    87 		{ return DoControl(EControlGetInfo, (TAny*)aId, &anInfo); }
       
    88 	inline TInt BeginRandomTest()
       
    89 		{ return DoControl(EControlBeginRandomTest); }
       
    90 	inline TInt EndRandomTest()
       
    91 		{ return DoControl(EControlEndRandomTest); }
       
    92 	inline TInt GetRandomTestInfo(SRandomTestInfo& anInfo)
       
    93 		{ return DoControl(EControlGetRandomTestInfo, &anInfo); }
       
    94 	inline TInt GetIdleTime()
       
    95 		{ return DoControl(EControlGetIdleTime); }
       
    96 	inline void StartOneShotInt(TRequestStatus& aStatus, TInt aId, TInt aInterval)
       
    97 		{ DoRequest(ERequestOneShotInt, aStatus, (TAny*)aId, (TAny*)aInterval); }
       
    98 	inline void StartOneShotDfc(TRequestStatus& aStatus, TInt aId, TInt aInterval)
       
    99 		{ DoRequest(ERequestOneShotDfc, aStatus, (TAny*)aId, (TAny*)aInterval); }
       
   100 	inline void IntCancel(TRequestStatus& aStatus, TInt aId, TInt aInterval)
       
   101 		{ DoRequest(ERequestIntCancel, aStatus, (TAny*)aId, (TAny*)aInterval); }
       
   102 	inline void StartOneShotIntAgain(TRequestStatus& aStatus, TInt aId, TInt aInterval)
       
   103 		{ DoRequest(ERequestOneShotIntAgain, aStatus, (TAny*)aId, (TAny*)aInterval); }
       
   104 	inline void StartOneShotUserDfc(TRequestStatus& aStatus, TInt aId, TInt aInterval)
       
   105 		{ DoRequest(ERequestOneShotUserDfc, aStatus, (TAny*)aId, (TAny*)aInterval); }
       
   106 	inline void StartOneShotUserDfcAgain(TRequestStatus& aStatus, TInt aId, TInt aInterval)
       
   107 		{ DoRequest(ERequestOneShotUserDfcAgain, aStatus, (TAny*)aId, (TAny*)aInterval); }
       
   108 #endif
       
   109 	};
       
   110 
       
   111 #endif