os/kernelhwsrv/kernel/eka/include/d32resmanus.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1995-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 // e32\include\d32resmanus.inl
    15 // 
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without noticed. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    19 //
    20 
    21 #ifndef __KERNEL_H__
    22 
    23 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
    24 #ifdef PRM_ENABLE_EXTENDED_VERSION2
    25 _LIT(KPddName, "resourcecontrollerextendedcore.pdd");
    26 #elif defined(PRM_ENABLE_EXTENDED_VERSION)
    27 _LIT(KPddName,"resourcecontrollerextended.pdd");	// To support testing of the Extended version of the PDD
    28 #else
    29 _LIT(KPddName,"resourcecontroller.pdd");
    30 #endif
    31 #else
    32 #ifdef PRM_ENABLE_EXTENDED_VERSION2
    33 _LIT(KPddName, "resmanextendedcore.pdd");
    34 #elif defined(PRM_ENABLE_EXTENDED_VERSION)
    35 _LIT(KPddName, "resmanextended.pdd");			// To enable operation with the extended version of the PDD
    36 #else
    37 _LIT(KPddName, "ResMan.pdd");				// To enable operation with the basic PDD
    38 #endif
    39 #endif
    40 
    41 inline TInt RBusDevResManUs::Open(TDesC8& aClientName)
    42 	 {return(DoCreate(KLddRootName,VersionRequired(),-1,&KPddName,(TDesC8*)&(aClientName),EOwnerThread));}
    43 
    44 inline TVersion RBusDevResManUs::VersionRequired() const
    45 	{return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));}
    46 
    47 inline TInt RBusDevResManUs::Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes)
    48 	{TUint8 stateRes[3]; \
    49 	stateRes[0]=aNumGetStateRes; \
    50 	stateRes[1]=aNumSetStateRes; \
    51 	stateRes[2]=aNumListenableRes; \
    52 	TInt r= DoControl(EInitialise,(TAny *)&stateRes); \
    53 	return r;}
    54 
    55 	// Synchronous methods
    56 inline TInt RBusDevResManUs::GetNoOfResources(TUint& aNumResources, const TBool aInfoRead)
    57 	{return(DoControl(EGetNoOfResources,(TAny*)&aNumResources, (TAny*)aInfoRead));}
    58 
    59 inline TInt RBusDevResManUs::GetAllResourcesInfo(RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, TUint& aNumResources, const TBool aRefresh)
    60 	{TUint* parms[2]; \
    61 	parms[0]=&aNumResources; \
    62 	parms[1]=(TUint*)aRefresh; \
    63 	return(DoControl(EGetAllResourcesInfo,(TAny*)aInfoPtrs,(TAny*)&parms));}
    64 
    65 inline TInt RBusDevResManUs::GetNoOfClients(TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
    66 	{TUint parms[3]; \
    67 	parms[0]=(TUint)aIncludeKern; \
    68 	parms[1]=0; /* 0 represents all clients */ \
    69 	parms[2]=(TUint)aInfoRead; \
    70 	return(DoControl(EGetNoOfClients,(TAny*)&aNumClients,(TAny*)&parms));}
    71 
    72 inline TInt RBusDevResManUs::GetNamesAllClients(RSimplePointerArray<TClientName>* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh)
    73 	{TUint* parms[4]; \
    74 	parms[0]=&aNumClients; \
    75 	parms[1]=(TUint*)aIncludeKern; \
    76 	parms[2]=(TUint*)0; /* 0 represents all clients */ \
    77 	parms[3]=(TUint*)aRefresh; \
    78 	return(DoControl(EGetNamesAllClients,(TAny*)aInfoPtrs,(TAny*)&parms));}
    79 
    80 inline TInt RBusDevResManUs::GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
    81 	{TUint parms[3]; \
    82 	parms[0]=(TUint)aIncludeKern; \
    83 	parms[1]=aResourceId; \
    84 	parms[2]=(TUint)aInfoRead; \
    85 	return(DoControl(EGetNumClientsUsingResource,(TAny*)&aNumClients,(TAny*)&parms));}
    86 
    87 inline TInt RBusDevResManUs::GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray<TClientInfoBuf>* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh)
    88 	{TUint* parms[4]; \
    89 	parms[0]=&aNumClients; \
    90 	parms[1]=(TUint*)aIncludeKern; \
    91 	parms[2]=(TUint*)aResourceId; \
    92 	parms[3]=(TUint*)aRefresh; \
    93 	return(DoControl(EGetInfoOnClientsUsingResource,(TAny*)aInfoPtrs,(TAny*)&parms));}
    94 
    95 inline TInt RBusDevResManUs::GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead)
    96 	{TUint* parms[2]; \
    97 	parms[0]=&aNumResources; \
    98 	parms[1]=(TUint*)aInfoRead; \
    99 	return(DoControl(EGetNumResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
   100 
   101 inline TInt RBusDevResManUs::GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, const TBool aRefresh)
   102 	{TUint* parms[3]; \
   103 	parms[0]=&aNumResources; \
   104 	parms[1]=(TUint*)aInfoPtrs; \
   105 	parms[2]=(TUint*)aRefresh; \
   106 	return(DoControl(EGetInfoOnResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
   107 
   108 inline TInt RBusDevResManUs::GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId)
   109 	{return(DoControl(EGetResourceIdByName,(TAny*)&aResourceName,(TAny*)&aResourceId));}
   110 
   111 inline TInt RBusDevResManUs::GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo)
   112 	{return(DoControl(EGetResourceInfo,(TAny*)aResourceId,aInfo));}
   113 
   114 inline TInt RBusDevResManUs::GetResourceControllerVersion(TUint& aVer)
   115 	{return(DoControl(EGetResourceControllerVersion,(TAny*)&aVer,NULL));}
   116 
   117 inline TInt RBusDevResManUs::GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead)
   118 	{TUint parms[2]; \
   119 	parms[0]=aResourceId; \
   120 	parms[1]=(TUint)aInfoRead; \
   121 	return(DoControl(EGetNumDependentsForResource,(TAny*)aNumDependents,(TAny*)&parms));}
   122 
   123 inline TInt RBusDevResManUs::GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh)
   124 	{
   125 	TUint parms[3]; \
   126 	parms[0]=aResourceId; \
   127 	parms[1]=(TUint)(&aResIdArray); \
   128 	parms[2]=(TUint)aRefresh; \
   129 	return(DoControl(EGetDependentsIdForResource,(TAny*)aNumDepResources,(TAny*)&parms));}
   130 
   131 	//Asynchronous methods
   132 inline void RBusDevResManUs::ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState)
   133 	{DoRequest(EChangeResourceState,aStatus,(TAny*)aResourceId,(TAny*)aNewState);}
   134 
   135 inline void RBusDevResManUs::GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId)
   136 	{TInt* parms[3]; \
   137 	parms[0]=(TInt*)aCached; \
   138 	parms[1]=aState; \
   139 	parms[2]=aLevelOwnerId; \
   140 	DoRequest(EGetResourceState,aStatus,(TAny*)aResourceId,(TAny*)&parms);}
   141 
   142 inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId)
   143 	{DoRequest(ERequestChangeNotification,aStatus,(TAny*)aResourceId);}
   144 
   145 inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId, 
   146 											const TInt aThreshold, const TBool aDirection)
   147 	{TUint parms[2]; \
   148 	parms[0]=aResourceId; \
   149 	parms[1]=(TUint)aDirection; \
   150 	DoRequest(ERequestQualifiedChangeNotification, aStatus, (TAny*)aThreshold, (TAny*)(&parms[0]));}
   151 
   152 	// Specific request cancellation functions
   153 inline TInt RBusDevResManUs::CancelChangeResourceState (TRequestStatus& aStatus)
   154 	{return(DoControl(ECancelChangeResourceState,(TAny*)&aStatus));}
   155 
   156 inline TInt RBusDevResManUs::CancelGetResourceState(TRequestStatus& aStatus)
   157 	{return(DoControl(ECancelGetResourceState,(TAny*)&aStatus));}
   158 
   159 inline TInt RBusDevResManUs::CancelRequestNotification(TRequestStatus& aStatus)
   160 	{return(DoControl(ECancelRequestChangeNotification,(TAny*)&aStatus));}
   161 
   162 	// Resource-specific request cancellation functions
   163 inline TInt RBusDevResManUs::CancelChangeResourceStateRequests (const TUint aResourceId)
   164 	{return(DoControl(ECancelChangeResourceStateRequests,(TAny*)aResourceId));}
   165 
   166 inline TInt RBusDevResManUs::CancelGetResourceStateRequests(const TUint aResourceId)
   167 	{return(DoControl(ECancelGetResourceStateRequests,(TAny*)aResourceId));}
   168 
   169 inline TInt RBusDevResManUs::CancelNotificationRequests(const TUint aResourceId)
   170 	{return(DoControl(ECancelChangeNotificationRequests,(TAny*)aResourceId));}
   171 
   172 	// Generic Cancel function
   173 inline void RBusDevResManUs::CancelAsyncOperation(TRequestStatus* aStatus)
   174 	{DoCancel((TInt)aStatus);}
   175 
   176 
   177 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
   178 	// Requests to support testing
   179 inline	TInt RBusDevResManUs::GetNumCandidateAsyncResources(TUint& aNumResources)
   180 	{return(DoControl(EGetNumCandidateAsyncResources,(TAny*)&aNumResources));}
   181 
   182 inline	TInt RBusDevResManUs::GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId)
   183 	{return(DoControl(EGetCandidateAsyncResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
   184 
   185 inline	TInt RBusDevResManUs::GetNumCandidateSharedResources(TUint& aNumResources)
   186 	{return(DoControl(EGetNumCandidateSharedResources,(TAny*)&aNumResources));}
   187 
   188 inline	TInt RBusDevResManUs::GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId)
   189 	{return(DoControl(EGetCandidateSharedResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
   190 
   191 #endif
   192 
   193 #endif