1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32resmanus.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,193 @@
1.4 +// Copyright (c) 1995-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 +// e32\include\d32resmanus.inl
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without noticed. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +#ifndef __KERNEL_H__
1.25 +
1.26 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
1.27 +#ifdef PRM_ENABLE_EXTENDED_VERSION2
1.28 +_LIT(KPddName, "resourcecontrollerextendedcore.pdd");
1.29 +#elif defined(PRM_ENABLE_EXTENDED_VERSION)
1.30 +_LIT(KPddName,"resourcecontrollerextended.pdd"); // To support testing of the Extended version of the PDD
1.31 +#else
1.32 +_LIT(KPddName,"resourcecontroller.pdd");
1.33 +#endif
1.34 +#else
1.35 +#ifdef PRM_ENABLE_EXTENDED_VERSION2
1.36 +_LIT(KPddName, "resmanextendedcore.pdd");
1.37 +#elif defined(PRM_ENABLE_EXTENDED_VERSION)
1.38 +_LIT(KPddName, "resmanextended.pdd"); // To enable operation with the extended version of the PDD
1.39 +#else
1.40 +_LIT(KPddName, "ResMan.pdd"); // To enable operation with the basic PDD
1.41 +#endif
1.42 +#endif
1.43 +
1.44 +inline TInt RBusDevResManUs::Open(TDesC8& aClientName)
1.45 + {return(DoCreate(KLddRootName,VersionRequired(),-1,&KPddName,(TDesC8*)&(aClientName),EOwnerThread));}
1.46 +
1.47 +inline TVersion RBusDevResManUs::VersionRequired() const
1.48 + {return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));}
1.49 +
1.50 +inline TInt RBusDevResManUs::Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes)
1.51 + {TUint8 stateRes[3]; \
1.52 + stateRes[0]=aNumGetStateRes; \
1.53 + stateRes[1]=aNumSetStateRes; \
1.54 + stateRes[2]=aNumListenableRes; \
1.55 + TInt r= DoControl(EInitialise,(TAny *)&stateRes); \
1.56 + return r;}
1.57 +
1.58 + // Synchronous methods
1.59 +inline TInt RBusDevResManUs::GetNoOfResources(TUint& aNumResources, const TBool aInfoRead)
1.60 + {return(DoControl(EGetNoOfResources,(TAny*)&aNumResources, (TAny*)aInfoRead));}
1.61 +
1.62 +inline TInt RBusDevResManUs::GetAllResourcesInfo(RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, TUint& aNumResources, const TBool aRefresh)
1.63 + {TUint* parms[2]; \
1.64 + parms[0]=&aNumResources; \
1.65 + parms[1]=(TUint*)aRefresh; \
1.66 + return(DoControl(EGetAllResourcesInfo,(TAny*)aInfoPtrs,(TAny*)&parms));}
1.67 +
1.68 +inline TInt RBusDevResManUs::GetNoOfClients(TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
1.69 + {TUint parms[3]; \
1.70 + parms[0]=(TUint)aIncludeKern; \
1.71 + parms[1]=0; /* 0 represents all clients */ \
1.72 + parms[2]=(TUint)aInfoRead; \
1.73 + return(DoControl(EGetNoOfClients,(TAny*)&aNumClients,(TAny*)&parms));}
1.74 +
1.75 +inline TInt RBusDevResManUs::GetNamesAllClients(RSimplePointerArray<TClientName>* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh)
1.76 + {TUint* parms[4]; \
1.77 + parms[0]=&aNumClients; \
1.78 + parms[1]=(TUint*)aIncludeKern; \
1.79 + parms[2]=(TUint*)0; /* 0 represents all clients */ \
1.80 + parms[3]=(TUint*)aRefresh; \
1.81 + return(DoControl(EGetNamesAllClients,(TAny*)aInfoPtrs,(TAny*)&parms));}
1.82 +
1.83 +inline TInt RBusDevResManUs::GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
1.84 + {TUint parms[3]; \
1.85 + parms[0]=(TUint)aIncludeKern; \
1.86 + parms[1]=aResourceId; \
1.87 + parms[2]=(TUint)aInfoRead; \
1.88 + return(DoControl(EGetNumClientsUsingResource,(TAny*)&aNumClients,(TAny*)&parms));}
1.89 +
1.90 +inline TInt RBusDevResManUs::GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray<TClientInfoBuf>* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh)
1.91 + {TUint* parms[4]; \
1.92 + parms[0]=&aNumClients; \
1.93 + parms[1]=(TUint*)aIncludeKern; \
1.94 + parms[2]=(TUint*)aResourceId; \
1.95 + parms[3]=(TUint*)aRefresh; \
1.96 + return(DoControl(EGetInfoOnClientsUsingResource,(TAny*)aInfoPtrs,(TAny*)&parms));}
1.97 +
1.98 +inline TInt RBusDevResManUs::GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead)
1.99 + {TUint* parms[2]; \
1.100 + parms[0]=&aNumResources; \
1.101 + parms[1]=(TUint*)aInfoRead; \
1.102 + return(DoControl(EGetNumResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
1.103 +
1.104 +inline TInt RBusDevResManUs::GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, const TBool aRefresh)
1.105 + {TUint* parms[3]; \
1.106 + parms[0]=&aNumResources; \
1.107 + parms[1]=(TUint*)aInfoPtrs; \
1.108 + parms[2]=(TUint*)aRefresh; \
1.109 + return(DoControl(EGetInfoOnResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
1.110 +
1.111 +inline TInt RBusDevResManUs::GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId)
1.112 + {return(DoControl(EGetResourceIdByName,(TAny*)&aResourceName,(TAny*)&aResourceId));}
1.113 +
1.114 +inline TInt RBusDevResManUs::GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo)
1.115 + {return(DoControl(EGetResourceInfo,(TAny*)aResourceId,aInfo));}
1.116 +
1.117 +inline TInt RBusDevResManUs::GetResourceControllerVersion(TUint& aVer)
1.118 + {return(DoControl(EGetResourceControllerVersion,(TAny*)&aVer,NULL));}
1.119 +
1.120 +inline TInt RBusDevResManUs::GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead)
1.121 + {TUint parms[2]; \
1.122 + parms[0]=aResourceId; \
1.123 + parms[1]=(TUint)aInfoRead; \
1.124 + return(DoControl(EGetNumDependentsForResource,(TAny*)aNumDependents,(TAny*)&parms));}
1.125 +
1.126 +inline TInt RBusDevResManUs::GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh)
1.127 + {
1.128 + TUint parms[3]; \
1.129 + parms[0]=aResourceId; \
1.130 + parms[1]=(TUint)(&aResIdArray); \
1.131 + parms[2]=(TUint)aRefresh; \
1.132 + return(DoControl(EGetDependentsIdForResource,(TAny*)aNumDepResources,(TAny*)&parms));}
1.133 +
1.134 + //Asynchronous methods
1.135 +inline void RBusDevResManUs::ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState)
1.136 + {DoRequest(EChangeResourceState,aStatus,(TAny*)aResourceId,(TAny*)aNewState);}
1.137 +
1.138 +inline void RBusDevResManUs::GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId)
1.139 + {TInt* parms[3]; \
1.140 + parms[0]=(TInt*)aCached; \
1.141 + parms[1]=aState; \
1.142 + parms[2]=aLevelOwnerId; \
1.143 + DoRequest(EGetResourceState,aStatus,(TAny*)aResourceId,(TAny*)&parms);}
1.144 +
1.145 +inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId)
1.146 + {DoRequest(ERequestChangeNotification,aStatus,(TAny*)aResourceId);}
1.147 +
1.148 +inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId,
1.149 + const TInt aThreshold, const TBool aDirection)
1.150 + {TUint parms[2]; \
1.151 + parms[0]=aResourceId; \
1.152 + parms[1]=(TUint)aDirection; \
1.153 + DoRequest(ERequestQualifiedChangeNotification, aStatus, (TAny*)aThreshold, (TAny*)(&parms[0]));}
1.154 +
1.155 + // Specific request cancellation functions
1.156 +inline TInt RBusDevResManUs::CancelChangeResourceState (TRequestStatus& aStatus)
1.157 + {return(DoControl(ECancelChangeResourceState,(TAny*)&aStatus));}
1.158 +
1.159 +inline TInt RBusDevResManUs::CancelGetResourceState(TRequestStatus& aStatus)
1.160 + {return(DoControl(ECancelGetResourceState,(TAny*)&aStatus));}
1.161 +
1.162 +inline TInt RBusDevResManUs::CancelRequestNotification(TRequestStatus& aStatus)
1.163 + {return(DoControl(ECancelRequestChangeNotification,(TAny*)&aStatus));}
1.164 +
1.165 + // Resource-specific request cancellation functions
1.166 +inline TInt RBusDevResManUs::CancelChangeResourceStateRequests (const TUint aResourceId)
1.167 + {return(DoControl(ECancelChangeResourceStateRequests,(TAny*)aResourceId));}
1.168 +
1.169 +inline TInt RBusDevResManUs::CancelGetResourceStateRequests(const TUint aResourceId)
1.170 + {return(DoControl(ECancelGetResourceStateRequests,(TAny*)aResourceId));}
1.171 +
1.172 +inline TInt RBusDevResManUs::CancelNotificationRequests(const TUint aResourceId)
1.173 + {return(DoControl(ECancelChangeNotificationRequests,(TAny*)aResourceId));}
1.174 +
1.175 + // Generic Cancel function
1.176 +inline void RBusDevResManUs::CancelAsyncOperation(TRequestStatus* aStatus)
1.177 + {DoCancel((TInt)aStatus);}
1.178 +
1.179 +
1.180 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
1.181 + // Requests to support testing
1.182 +inline TInt RBusDevResManUs::GetNumCandidateAsyncResources(TUint& aNumResources)
1.183 + {return(DoControl(EGetNumCandidateAsyncResources,(TAny*)&aNumResources));}
1.184 +
1.185 +inline TInt RBusDevResManUs::GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId)
1.186 + {return(DoControl(EGetCandidateAsyncResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
1.187 +
1.188 +inline TInt RBusDevResManUs::GetNumCandidateSharedResources(TUint& aNumResources)
1.189 + {return(DoControl(EGetNumCandidateSharedResources,(TAny*)&aNumResources));}
1.190 +
1.191 +inline TInt RBusDevResManUs::GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId)
1.192 + {return(DoControl(EGetCandidateSharedResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
1.193 +
1.194 +#endif
1.195 +
1.196 +#endif