1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32resmanus.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,241 @@
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.h
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @publishedPartner
1.24 + @released
1.25 +*/
1.26 +
1.27 +
1.28 +#ifndef __D32RESMANUS_H__
1.29 +#define __D32RESMANUS_H__
1.30 +#include <e32cmn.h>
1.31 +#include <e32ver.h>
1.32 +
1.33 +#include <drivers/resource_category.h>
1.34 +
1.35 +// Name lengths repesent byte length (2 bytes per character for Unicode)
1.36 +#define MAX_RESOURCE_NAME_LENGTH 32 // 8-bit operation
1.37 +#define MAX_NAME_LENGTH_IN_RESMAN 32 // Maximum length of 8-bit name in Resource Controller
1.38 +#define MAX_CLIENT_NAME_LENGTH 256 // 8-bit operation
1.39 +
1.40 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
1.41 +#define LEVEL_GAP_REQUIRED_FOR_ASYNC_TESTING 10 // Semi-arbitrary
1.42 +#define LEVEL_GAP_REQUIRED_FOR_SHARED_TESTING 3 // Semi-arbitrary
1.43 +#endif
1.44 +
1.45 +//Structure to pass the dependency information
1.46 +#ifndef __KERNEL_MODE__
1.47 +struct SResourceDependencyInfo
1.48 + {
1.49 + TUint iResourceId;
1.50 + TUint8 iDependencyPriority;
1.51 + };
1.52 +#endif
1.53 +
1.54 +struct TCapsDevResManUs
1.55 + {
1.56 + /**
1.57 + * The device version
1.58 + */
1.59 + TVersion version;
1.60 + };
1.61 +
1.62 +struct TResourceInfo
1.63 + {
1.64 + TBuf8<MAX_RESOURCE_NAME_LENGTH>iName;
1.65 + TUint iId;
1.66 + TResourceClass iClass;
1.67 + TResourceType iType;
1.68 + TResourceUsage iUsage;
1.69 + TResourceSense iSense;
1.70 + TInt iMinLevel;
1.71 + TInt iMaxLevel;
1.72 + };
1.73 +typedef TPckgBuf<TResourceInfo> TResourceInfoBuf;
1.74 +
1.75 +
1.76 +typedef TBuf8<MAX_NAME_LENGTH_IN_RESMAN> TClientName;
1.77 +
1.78 +struct TClientInfo
1.79 + {
1.80 + TClientName iName;
1.81 + TUint iId;
1.82 + };
1.83 +
1.84 +typedef TPckgBuf<TClientInfo> TClientInfoBuf;
1.85 +
1.86 +template <class T>
1.87 +class RSimplePointerArray : private RPointerArrayBase
1.88 + {
1.89 + public:
1.90 + inline RSimplePointerArray();
1.91 + inline explicit RSimplePointerArray(TInt aGranularity);
1.92 +
1.93 + inline void Close() {RPointerArrayBase::Close();};
1.94 + inline TInt Count() const {return RPointerArrayBase::Count();};
1.95 + inline T* const& operator[](TInt anIndex) const {return (T* const&)At(anIndex);};
1.96 + inline T*& operator[](TInt anIndex) {return (T*&)At(anIndex);};
1.97 + inline TInt Append(const T* anEntry) {return RPointerArrayBase::Append(anEntry);};
1.98 + inline TInt Insert(const T* anEntry, TInt aPos) {return RPointerArrayBase::Insert(anEntry,aPos);};
1.99 + inline void Remove(TInt anIndex){RPointerArrayBase::Remove(anIndex);};
1.100 +
1.101 + inline T** Entries() {return (T**)(RPointerArrayBase::Entries());};
1.102 + };
1.103 +
1.104 +template <class T>
1.105 +inline RSimplePointerArray<T>::RSimplePointerArray()
1.106 + : RPointerArrayBase()
1.107 + {}
1.108 +
1.109 +template <class T>
1.110 +inline RSimplePointerArray<T>::RSimplePointerArray(TInt aGranularity)
1.111 + : RPointerArrayBase(aGranularity)
1.112 + {}
1.113 +
1.114 +
1.115 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
1.116 +#ifdef PRM_ENABLE_EXTENDED_VERSION2
1.117 + _LIT(KLddRootName, "resourcecontrollerextendedcore");
1.118 +#elif defined (PRM_ENABLE_EXTENDED_VERSION)
1.119 + _LIT(KLddRootName,"resourcecontrollerextended"); // To support testing of the Extended version
1.120 +#else
1.121 + _LIT(KLddRootName,"resourcecontroller"); // To support testing of the basic version
1.122 +#endif
1.123 +#else
1.124 +#ifdef PRM_ENABLE_EXTENDED_VERSION2
1.125 + _LIT(KLddRootName, "resmanextendedcore");
1.126 + _LIT(KLddName, "resmanextendedcore.ldd");
1.127 +#elif defined(PRM_ENABLE_EXTENDED_VERSION)
1.128 + _LIT(KLddRootName,"resmanextended"); // To enable operation with both the basic and Extended PDD
1.129 + _LIT(KLddName, "resmanextended.ldd"); // LDD will support the Extended funcitonality
1.130 +#else
1.131 + _LIT(KLddRootName,"ResMan"); // To enable operation with both the basic and Extended PDD
1.132 + _LIT(KLddName, "ResMan.ldd"); // LDD will support the Extended funcitonality
1.133 +#endif
1.134 +#endif
1.135 +
1.136 +class RBusDevResManUs : public RBusLogicalChannel
1.137 + {
1.138 + enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber};
1.139 +
1.140 + public:
1.141 + /**
1.142 + * Control requests
1.143 + */
1.144 + enum TControl
1.145 + {
1.146 + EInitialise, /**< Specify resource requirement and register */
1.147 + EGetNoOfResources, /**< Read the total number of resources */
1.148 + EGetAllResourcesInfo, /**< Read the info for all resources into a buffer */
1.149 + EGetNoOfClients, /**< Read the total number of (Rsource Manager) clients */
1.150 + EGetNamesAllClients, /**< Read the names of all clients into a buffer */
1.151 + EGetNumClientsUsingResource, /**< Read the number of clients for specified resource */
1.152 + EGetInfoOnClientsUsingResource, /**< Read the info for clients for specified resource */
1.153 + EGetNumResourcesInUseByClient, /**< Read the number of resources registered by a client*/
1.154 + EGetInfoOnResourcesInUseByClient, /**< Read the info for all resources registered by the
1.155 + named client into a buffer */
1.156 + EGetResourceIdByName, /**< Read the ID for a named resource */
1.157 + EGetResourceInfo, /**< Read the info for specified resource to a buffer */
1.158 + ECancelChangeResourceStateRequests, /**< Cancel all change state requests for a resource */
1.159 + ECancelGetResourceStateRequests, /**< Cancel all get state requests for a resource */
1.160 + ECancelChangeNotificationRequests, /**< Cancel all notification requests for a resource */
1.161 + ECancelChangeResourceState, /**< Cancel a specific change state request */
1.162 + ECancelGetResourceState, /**< Cancel a specific get state request */
1.163 + ECancelRequestChangeNotification, /**< Cancel a specific notification request */
1.164 + EGetResourceControllerVersion, /**< Read the version of the Resource Controller */
1.165 + EGetNumDependentsForResource, /**< Read the number of dependents for a resource */
1.166 + EGetDependentsIdForResource /**< Read the dependency information for a resource */
1.167 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
1.168 + ,
1.169 + // Requests to support testing
1.170 + EGetNumCandidateAsyncResources,
1.171 + EGetCandidateAsyncResourceId,
1.172 + EGetNumCandidateSharedResources,
1.173 + EGetCandidateSharedResourceId
1.174 +#endif
1.175 + };
1.176 +
1.177 + /**
1.178 + * Asynchronous requests
1.179 + */
1.180 + enum TRequest
1.181 + {
1.182 + EChangeResourceState, /**< Change the state of a resource */
1.183 + EGetResourceState, /**< Get the state of a resource */
1.184 + ERequestChangeNotification, /**< Register for resource change notifications */
1.185 + ERequestQualifiedChangeNotification /**< Register for qualified resource change notifications */
1.186 + };
1.187 +
1.188 +#ifndef __KERNEL_MODE__
1.189 + public:
1.190 +
1.191 + inline TInt Open(TDesC8& aClientName);
1.192 + inline TInt Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes);
1.193 + inline TVersion VersionRequired() const;
1.194 +
1.195 + // Synchronous requests
1.196 + inline TInt GetNoOfResources(TUint& aNumResources, const TBool aInfoRead=ETrue);
1.197 + inline TInt GetAllResourcesInfo(RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, TUint& aNumResources, const TBool aRefresh=EFalse);
1.198 + inline TInt GetNoOfClients(TUint& aNumClients,const TBool aIncludeKern,const TBool aInfoRead=ETrue);
1.199 + inline TInt GetNamesAllClients(RSimplePointerArray<TClientName>* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh=EFalse);
1.200 + inline TInt GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern,const TBool aInfoRead=ETrue);
1.201 + inline TInt GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray<TClientInfoBuf>* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh=EFalse);
1.202 + inline TInt GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead=ETrue);
1.203 + inline TInt GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, const TBool aRefresh=EFalse);
1.204 +
1.205 + inline TInt GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId);
1.206 + inline TInt GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo);
1.207 + inline TInt GetResourceControllerVersion(TUint& aVer);
1.208 + inline TInt GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead=ETrue);
1.209 + inline TInt GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh=EFalse);
1.210 + // Asynchronous requests
1.211 + inline void ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState);
1.212 + inline void GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId);
1.213 + inline void RequestNotification(TRequestStatus& aStatus, const TUint aResourceId);
1.214 + inline void RequestNotification(TRequestStatus& aStatus, const TUint aResourceId, const TInt aThreshold, const TBool aDirection);
1.215 +
1.216 + // Cancel requests
1.217 + inline TInt CancelChangeResourceStateRequests(const TUint aResourceId);
1.218 + inline TInt CancelGetResourceStateRequests(const TUint aResourceId);
1.219 + inline TInt CancelNotificationRequests(const TUint aResourceId);
1.220 + //
1.221 + inline TInt CancelChangeResourceState(TRequestStatus& aStatus);
1.222 + inline TInt CancelGetResourceState(TRequestStatus& aStatus);
1.223 + inline TInt CancelRequestNotification(TRequestStatus& aStatus);
1.224 + //
1.225 + inline void CancelAsyncOperation(TRequestStatus* aStatus);
1.226 +
1.227 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
1.228 + // Requests to support testing
1.229 + inline TInt GetNumCandidateAsyncResources(TUint& aNumResources);
1.230 + inline TInt GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId);
1.231 + inline TInt GetNumCandidateSharedResources(TUint& aNumResources);
1.232 + inline TInt GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId);
1.233 +#endif
1.234 +
1.235 +#endif
1.236 + };
1.237 +
1.238 +
1.239 +#ifndef __KERNEL_MODE__
1.240 +#include <d32resmanus.inl>
1.241 +#endif
1.242 +
1.243 +
1.244 +#endif