kerneltest/e32test/power/d_frqchg.h
author hgs
Mon, 11 Oct 2010 17:54:41 +0100
changeset 286 48e57fb1237e
parent 177 a232af6b0b1f
permissions -rw-r--r--
201039_11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
177
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     1
// Copyright (c) 2010-2010 Nokia Corporation and/or its subsidiary(-ies).
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     2
// All rights reserved.
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     7
//
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     8
// Initial Contributors:
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    10
//
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    11
// Contributors:
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    12
//
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    13
// Description:
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    14
// e32test\power\d_frqchg.h
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    15
// 
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    16
//
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    17
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    18
#if !defined(__D_FRQCHG_H__)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    19
#define __D_FRQCHG_H__
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    20
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    21
#include <e32cmn.h>
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    22
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    23
struct SRatio;
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    24
struct SRatioInv;
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    25
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    26
#ifndef __KERNEL_MODE__
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    27
#include <e32std.h>
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    28
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    29
struct SRatio
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    30
	{
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    31
	TUint32		iM;		// mantissa, normalised so bit 31=1
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    32
	TInt16		iX;		// -exponent.
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    33
	TUint8		iSpare1;
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    34
	TUint8		iSpare2;
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    35
	};
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    36
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    37
struct SRatioInv
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    38
	{
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    39
	SRatio		iR;
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    40
	SRatio		iI;
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    41
	};
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    42
#endif
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    43
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    44
_LIT(KLddName,"D_FRQCHG.LDD");
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    45
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    46
class RFrqChg : public RBusLogicalChannel
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    47
	{
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    48
public:
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    49
	enum TControl
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    50
		{
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    51
		EControl_RatioSet,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    52
		EControl_RatioReciprocal,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    53
		EControl_RatioMult,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    54
		EControl_RatioInvSet,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    55
		EControl_FrqChgTestPresent,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    56
		EControl_SetCurrentThreadPriority,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    57
		EControl_SetCurrentThreadCpu,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    58
		EControl_SetCurrentThreadTimeslice,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    59
		EControl_SetLocalTimerPrescaler,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    60
		EControl_ReadGlobalTimerAndTimestamp,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    61
		EControl_SetGlobalTimerPrescaler,
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    62
		ENumControls
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    63
		};
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    64
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    65
public:
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    66
	inline TInt Open();
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    67
	inline TInt RatioSet(SRatio& aRatio, TUint32 aInt, TInt aDivisorExp=0);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    68
	inline TInt RatioReciprocal(SRatio& aRatio);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    69
	inline TInt RatioMult(SRatio& aRatio, TUint32& aInt32);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    70
	inline TInt RatioInvSet(SRatioInv& aRI, const SRatio* aR);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    71
	inline TInt FrqChgTestPresent();
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    72
	inline TInt SetCurrentThreadPriority(TInt aPri);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    73
	inline TInt SetCurrentThreadCpu(TUint32 aCpu, TUint32* aOldAffinity = NULL);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    74
	inline TInt SetCurrentThreadTimeslice(TInt aSlice);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    75
	inline TInt SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    76
	inline TInt ReadGlobalTimerAndTimestamp(TUint64& aTimerValue, TUint64& aTimestamp);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    77
	inline TInt SetGlobalTimerPrescaler(TInt aPrescale);
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    78
	};
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    79
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    80
#ifndef __KERNEL_MODE__
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    81
inline TInt RFrqChg::Open()
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    82
	{ return DoCreate(KLddName,TVersion(0,1,1),KNullUnit,NULL,NULL); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    83
inline TInt RFrqChg::RatioSet(SRatio& aR, TUint32 aInt, TInt aDivisorExp)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    84
	{ aR.iM=aInt; return DoControl(EControl_RatioSet, (TAny*)&aR, (TAny*)aDivisorExp); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    85
inline TInt RFrqChg::RatioReciprocal(SRatio& aR)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    86
	{ return DoControl(EControl_RatioReciprocal, (TAny*)&aR); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    87
inline TInt RFrqChg::RatioMult(SRatio& aR, TUint32& aInt32)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    88
	{ return DoControl(EControl_RatioMult, (TAny*)&aR, (TAny*)&aInt32); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    89
inline TInt RFrqChg::RatioInvSet(SRatioInv& aRI, const SRatio* aR)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    90
	{ return DoControl(EControl_RatioInvSet, (TAny*)&aRI, (TAny*)aR); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    91
inline TInt RFrqChg::FrqChgTestPresent()
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    92
	{ return DoControl(EControl_FrqChgTestPresent); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    93
inline TInt RFrqChg::SetCurrentThreadPriority(TInt aPri)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    94
	{ return DoControl(EControl_SetCurrentThreadPriority, (TAny*)aPri); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    95
inline TInt RFrqChg::SetCurrentThreadCpu(TUint32 aCpu, TUint32* aOldAffinity)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    96
	{ return DoControl(EControl_SetCurrentThreadCpu, (TAny*)aCpu, (TAny*) aOldAffinity); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    97
inline TInt RFrqChg::SetCurrentThreadTimeslice(TInt aSlice)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    98
	{ return DoControl(EControl_SetCurrentThreadTimeslice, (TAny*)aSlice); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
    99
inline TInt RFrqChg::SetLocalTimerPrescaler(TUint32 aCpus, TInt aPrescale)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   100
	{ return DoControl(EControl_SetLocalTimerPrescaler, (TAny*)aCpus, (TAny*)aPrescale); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   101
inline TInt RFrqChg::ReadGlobalTimerAndTimestamp(TUint64& aTimerValue, TUint64& aTimestamp)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   102
	{ return DoControl(EControl_ReadGlobalTimerAndTimestamp, (TAny*)&aTimerValue, (TAny*) &aTimestamp); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   103
inline TInt RFrqChg::SetGlobalTimerPrescaler(TInt aPrescale)
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   104
	{ return DoControl(EControl_SetGlobalTimerPrescaler, (TAny*)aPrescale); }
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   105
#endif
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   106
a232af6b0b1f 201023_15
hgs
parents:
diff changeset
   107
#endif   //__D_FRQCHG_H__