os/kernelhwsrv/kerneltest/e32test/resourceman/acctst/d_prmacctst.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/resourceman/acctst/d_prmacctst.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,120 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef D_PRMACCTST_H
    1.20 +#define D_PRMACCTST_H
    1.21 +
    1.22 +// The name of the device driver
    1.23 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
    1.24 +_LIT(KPrmIfLddName, "D_PRMACCTSTSIM");
    1.25 +#else
    1.26 +_LIT(KPrmIfLddName, "D_PRMACCTST");
    1.27 +#endif
    1.28 +
    1.29 +// The maximum length of a resource name (should always be 32 characters)
    1.30 +const TInt KNameMaxLength = 32;
    1.31 +
    1.32 +// This is a copy of TPowerResourceInfoV01 meant to be used by the user-side
    1.33 +// test application.
    1.34 +struct TResInfo
    1.35 +	{
    1.36 +	enum TType		{ EBinary, EMultiLevel, EMultiProperty };
    1.37 +	enum TUsage		{ ESingleUse, EShared };
    1.38 +	enum TLatency	{ EInstantaneous, ELongLatency };
    1.39 +	enum TClass		{ EPhysical, ELogical };
    1.40 +	enum TSense		{ EPositive, ENegative, ECustom };
    1.41 +	TClass		iClass;
    1.42 +	TLatency	iLatencyGet;
    1.43 +	TLatency	iLatencySet;
    1.44 +	TType		iType;
    1.45 +	TUsage		iUsage;
    1.46 +	TSense		iSense;
    1.47 +	TDesC8*		iResourceName;
    1.48 +	TInt		iResourceId;
    1.49 +	TInt		iDefaultLevel;
    1.50 +	TInt		iMinLevel;
    1.51 +	TInt		iMaxLevel;
    1.52 +	TInt		iReserved1;
    1.53 +	TInt		iReserved2;
    1.54 +	TInt		iReserved3;
    1.55 +	TInt		iPslReserved1;
    1.56 +	TInt		iPslReserved2;
    1.57 +	TInt		iPslReserved3;
    1.58 +	};
    1.59 +typedef TPckgBuf<TResInfo> TTestResourceInfoBuf01;
    1.60 +
    1.61 +
    1.62 +// To be used with ChangeResourceStateAndGetState()
    1.63 +class TTestResourceState
    1.64 +	{
    1.65 +public:
    1.66 +	TUint iResourceId;
    1.67 +	TInt  iNewState;
    1.68 +	};
    1.69 +typedef TPckgBuf<TTestResourceState> TTestResourceStateBuf;
    1.70 +
    1.71 +class RPrmIf : public RBusLogicalChannel
    1.72 +	{
    1.73 +public:
    1.74 +	enum TControl
    1.75 +		{
    1.76 +		EControlOpenClient,
    1.77 +		EControlGetKernelExtClientId,
    1.78 +		EControlRegisterClient,
    1.79 +		EControlDeRegisterClient,
    1.80 +		EControlGetInfoOnResourcesInUseByClient,
    1.81 +		EControlChangeResourceState,
    1.82 +		EControlGetResourceState,
    1.83 +		EControlGetResourceStateCached,
    1.84 +		EControlGetLevelOwner,
    1.85 +		EControlGetTotalNumberOfResources,
    1.86 +		EControlGetResourceDependencies
    1.87 +		};
    1.88 +	enum TRequest
    1.89 +		{
    1.90 +		ERequestChangeResourceStateAndGetState
    1.91 +		};
    1.92 +#ifndef __KERNEL_MODE__
    1.93 +public:
    1.94 +	inline TInt Open()
    1.95 +		{ return DoCreate(KPrmIfLddName, TVersion(), KNullUnit, NULL, NULL); }
    1.96 +	inline TInt OpenClient(TUint aClientId)
    1.97 +		{ return DoControl(EControlOpenClient, (TAny*) aClientId); }
    1.98 +	inline TInt GetKernelExtClientId(TUint& aClientId)
    1.99 +		{ return DoControl(EControlGetKernelExtClientId, (TAny*) &aClientId); }
   1.100 +	inline TInt RegisterClient(const TDesC8& aClientName)
   1.101 +		{ return DoControl(EControlRegisterClient, (TAny*) &aClientName); }
   1.102 +	inline TInt DeRegisterClient()
   1.103 +		{ return DoControl(EControlDeRegisterClient); }
   1.104 +	inline TInt GetInfoOnResourcesInUseByClient(TUint aClientId, RBuf8& aInfo)
   1.105 +		{ return DoControl(EControlGetInfoOnResourcesInUseByClient, (TAny*) aClientId, (TAny*) &aInfo); }
   1.106 +	inline TInt ChangeResourceState(TUint aResourceId, TInt aNewState)
   1.107 +		{ return DoControl(EControlChangeResourceState, (TAny*) aResourceId, (TAny*) aNewState); }
   1.108 +	inline TInt GetResourceState(TUint aResourceId, TInt& aState)
   1.109 +		{ return DoControl(EControlGetResourceState, (TAny*) aResourceId, (TAny*) &aState); }
   1.110 +	inline TInt GetResourceStateCached(TUint aResourceId, TInt& aState)
   1.111 +		{ return DoControl(EControlGetResourceStateCached, (TAny*) aResourceId, (TAny*) &aState); }
   1.112 +	inline TInt GetLevelOwner(TUint aResourceId, TInt& aLevelOwner)
   1.113 +		{ return DoControl(EControlGetLevelOwner, (TAny*) aResourceId, (TAny*) &aLevelOwner); }
   1.114 +	inline TInt GetTotalNumberOfResources(TUint& aNumResources)
   1.115 +		{ return DoControl(EControlGetTotalNumberOfResources, (TAny*) &aNumResources); }
   1.116 +	inline TInt GetResourceDependencies(TUint aResourceId, RBuf8& aDeps)
   1.117 +		{ return DoControl(EControlGetResourceDependencies, (TAny*) aResourceId, (TAny*) &aDeps); }
   1.118 +	inline void ChangeResourceStateAndGetState(TRequestStatus& aRs, TTestResourceStateBuf& aState, TInt& aTmpState)
   1.119 +		{ DoRequest(ERequestChangeResourceStateAndGetState, aRs, (TAny*) &aState, (TAny*) &aTmpState); }
   1.120 +
   1.121 +#endif // __KERNEL_MODE__
   1.122 +	};
   1.123 +#endif // D_PRMACCTST_H