os/kernelhwsrv/kerneltest/e32test/emi/d_emitest.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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\emi\d_emitest.h
    15 // 
    16 //
    17 
    18 #ifndef __EMITEST_H__
    19 #define __EMITEST_H__
    20 
    21 #include <e32cmn.h>
    22 #include <e32ver.h>
    23 #ifndef __KERNEL_MODE__
    24 #include <e32std.h>
    25 #endif
    26 
    27 
    28 struct TUserTaskEventRecord
    29 	{
    30 	TUint8	iType;		//	Type of event, 	0 = Reschedule
    31 						//	1..127 = Reserved
    32 						//	> 127 = User Defined
    33 	TUint8	iFlags;		//	Includes:	
    34 						//Bit 0 - Events lost before this event. (All types) 
    35 	 					//Bit 1 - Previous thread now waiting. (Reschedule only)
    36 	TUint16	iExtra;		//This has no use in reschedule events, but may be used by other event types.
    37 	TUint32	iUserState;	//The state variable at the time of the event, which will probably indicate the clock frequency at the time of the event.
    38 	TUint32	iTime;		//Time that the event occurred.  Units defined by the GET_HIGH_RES_TICK macro.
    39 	TAny*	iPrevious;	//	The NThread that was executing before the switch.
    40 	TAny*	iNext;		//The NThread that was executing after the switch.
    41 	
    42 	};
    43 
    44 const TInt KEMI_EventLost  =1;
    45 const TInt KEMI_PrevWaiting=2;
    46 
    47 _LIT(KEMITestName,"EMITEST");
    48 
    49 enum TMonitors
    50 	{
    51 	ENone,
    52 	ENormal,
    53 	EStressFirst,
    54 	EStressSecond
    55 	};
    56 
    57 class REMITest : public RBusLogicalChannel
    58 	{
    59 public:
    60 
    61 	enum TControl
    62 		{
    63 		ETaskEventLogging,
    64 		EGetTaskEvent,
    65 		EAddTaskEvent,
    66 		EGetIdleThread,
    67 		EGetSigmaThread,
    68 		ESetVEMSData,
    69 		EGetVEMSData,
    70 		ESetThreadLoggable,
    71 		EGetThreadLoggable,
    72 		ESetThreadTag,
    73 		EGetThreadTag,
    74 		ESetMask,
    75 		EGetMask,		
    76 		ESetDFC,
    77 		ESetState,
    78 		EGetState,
    79 		EGetNThread,
    80 		EAfterIdle
    81 		};
    82 
    83 	enum TRequest
    84 		{
    85 		ENumRequests,
    86 		EAllRequests = (1<<ENumRequests)-1
    87 		};
    88 		
    89  public:
    90 	inline TInt Open();
    91 	inline TInt TaskEventLogging(TBool, TInt, TMonitors);
    92 	inline TBool GetTaskEvent(TUserTaskEventRecord&);
    93 	inline TBool AddTaskEvent(TUserTaskEventRecord&);
    94 	inline TAny* GetIdleThread();
    95 	inline TAny* GetSigmaThread();
    96 	inline void SetVEMSData(TAny* aThread, TAny* aData);
    97 	inline TAny* GetVEMSData(TAny* aThread);
    98 	inline void SetThreadLoggable(TAny* aThread, TBool aLoggable);
    99 	inline TBool GetThreadLoggable(TAny* aThread);
   100 	inline void SetThreadTag(TAny* aThread,TUint32 aTag);
   101 	inline TUint32 GetThreadTag(TAny* aThread);
   102 	inline void SetMask(TUint32 aMask);
   103 	inline TUint32 GetMask();	
   104 	inline void SetDfc();
   105 	inline void SetState(TInt);
   106 	inline TInt GetState();
   107 	
   108 	inline TAny* GetNThread(const RThread&);
   109 	inline void AfterIdle(TInt);
   110 	};
   111 
   112 #ifndef __KERNEL_MODE__
   113 
   114 inline TInt REMITest::Open()
   115 	{ return DoCreate(KEMITestName,TVersion(1,0,1),KNullUnit,NULL,NULL); }
   116 
   117 inline TInt REMITest::TaskEventLogging(TBool aLogging, TInt aSize, TMonitors aMon)
   118 	{
   119 	 TInt param= aLogging?1:0;
   120 	 param |= (aMon<<1);	
   121 	 return DoControl(ETaskEventLogging,(TAny*)param,(TAny*)aSize); }  
   122 
   123 inline TBool REMITest::GetTaskEvent(TUserTaskEventRecord& aTask)
   124 	{ return (TBool) DoControl(EGetTaskEvent,&aTask); }	
   125 
   126 inline TBool REMITest::AddTaskEvent(TUserTaskEventRecord& aTask)
   127 	{ return (TBool) DoControl(EAddTaskEvent,&aTask); }	
   128 
   129 inline TAny* REMITest::GetIdleThread()
   130 	{ return (TAny*) DoControl(EGetIdleThread,NULL); }	
   131 
   132 inline TAny* REMITest::GetSigmaThread()
   133 	{ return (TAny*) DoControl(EGetSigmaThread,NULL); }	
   134 
   135 inline void REMITest::SetVEMSData(TAny* aThread, TAny* aData)
   136 	{ DoControl(ESetVEMSData,aThread, aData); }		
   137 
   138 inline TAny* REMITest::GetVEMSData(TAny* aThread)
   139 	{ return (TAny*) DoControl(EGetVEMSData,aThread); } 
   140 
   141 inline void REMITest::SetThreadLoggable(TAny* aThread, TBool aLoggable)
   142 	{ DoControl(ESetThreadLoggable,aThread, (TAny*) aLoggable); }	
   143 
   144 inline TBool REMITest::GetThreadLoggable(TAny* aThread)
   145 	{ return (TBool) DoControl(EGetThreadLoggable,aThread); }	
   146 
   147 inline void REMITest::SetThreadTag(TAny* aThread,TUint32 aTag)
   148 	{ DoControl(ESetThreadTag,aThread, (TAny*) aTag); }	
   149 
   150 inline TUint32 REMITest::GetThreadTag(TAny* aThread)
   151 	{ return DoControl(EGetThreadTag,aThread); }	
   152 
   153 inline void REMITest::SetMask(TUint32 aMask)
   154 	{ DoControl(ESetMask,(TAny*) aMask); }
   155 
   156 inline TUint32 REMITest::GetMask()
   157 	{ return DoControl(EGetMask,NULL); }		
   158 
   159 inline void REMITest::SetDfc()
   160 	{ DoControl(ESetDFC,NULL); }	
   161 
   162 inline void REMITest::SetState(TInt aState)
   163 	{ DoControl(ESetState,(TAny*) aState); }	
   164 
   165 inline TInt REMITest::GetState()
   166 	{ return DoControl(EGetState,NULL); }
   167 
   168 inline TAny* REMITest::GetNThread(const RThread& aRThread)
   169 	{return (TAny*) DoControl(EGetNThread,(TAny*)aRThread.Handle());}
   170 
   171 inline void REMITest::AfterIdle(TInt aDelay)
   172 	{ DoControl(EAfterIdle,(TAny*)aDelay);}
   173 
   174 
   175 #endif
   176 
   177 #endif