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