sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\drivers\resourceman.inl sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without noticed. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: /** sl@0: sl@0: @publishedPartner sl@0: @released 9.5 sl@0: sl@0: Request to get the resource controller version sl@0: sl@0: @param aClientId ID of the client which is requesting the resource controller version. sl@0: @param aVersion On Success, returns the version of PRM sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread. sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::GetResourceControllerVersion(TUint aClientId, TUint& aVersion) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::ResourceControllerVersion")); sl@0: return ControlIO(aClientId, KResManControlIoGetVersion, (TAny*)&aVersion, NULL); sl@0: } sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released 9.5 sl@0: sl@0: Request to register dynamic resource. This is also used to register dynamic resource with dependency sl@0: sl@0: @param aClientId ID of the client which is requesting the dynamic resource registration. sl@0: @param aResource Dynamic resource to register. sl@0: @param aResourceId On success, updates with resource id corresponding to this resource sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread or if ID is user side client id. sl@0: KErrNotSupported if this API is called before PRM is fully intialised or if the resource ID does not sl@0: correspond to dynamic resource or dynamic resource which support depedency sl@0: KErrAlreadyExists if resource is already registered. sl@0: sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::RegisterDynamicResource(TUint aClientId, DDynamicPowerResource* aResource, sl@0: TUint& aResourceId) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RegisterDynamicResource")); sl@0: return ControlIO(aClientId, KResManControlIoRegisterDynamicResource, (TAny*)aResource, (TAny*)&aResourceId); sl@0: } sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released 9.5 sl@0: sl@0: Request to deregister dynamic resource. This is also used to deregister dynamic resource with dependency sl@0: sl@0: @param aClientId ID of the client which is requesting the dynamic resource deregistration. sl@0: @param aResourceId Id of dynamic resource to deregister. sl@0: @param aState Pointer to the required final state. This is optional and if left NULL, resource sl@0: will be moved to its default state. sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread or if ID is user side client id or if the client sl@0: is not the same that registered the resource. sl@0: KErrNotSupported if this API is called before PRM is fully intialised or if the resource ID does not sl@0: correspond to dynamic resource or dynamic resource which support depedency sl@0: KErrNotFound if the resource could not found in the resource list. sl@0: KErrInUse if the some other operation is in progress or if the resource is shared and sl@0: another client holds requirement on this resource sl@0: sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt* aState) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::DeRegisterDynamicResource")); sl@0: return ControlIO(aClientId, KResManControlIoDeregisterDynamicResource, (TAny*)aResourceId, (TAny*)aState); sl@0: } sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released 9.5 sl@0: sl@0: Request to register resource dependency. This could be between 2 dynamic resource or between sl@0: dynamic and static resource. sl@0: sl@0: @param aClientId ID of the client which is requesting the resource dependency registration. sl@0: @param aResDependencyInfo1 Dependency information about the first resource in the dependency link. sl@0: @param aResDependencyInfo2 Dependency information about the second resource in the dependency link. sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread or if ID is user side client id sl@0: KErrNotSupported if any of the specified resource is not dynamic resource with depedency or sl@0: is not dependency resource or is instantaneous sl@0: KErrNotFound if any of the specified resource could not found in the resource list. sl@0: sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo* aResDependencyInfo1, sl@0: SResourceDependencyInfo* aResDependencyInfo2) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RegisterResourceDependency")); sl@0: return ControlIO(aClientId, KResManControlIoRegisterDependency, (TAny*)aResDependencyInfo1, (TAny*)aResDependencyInfo2); sl@0: } sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released 9.5 sl@0: sl@0: Request to deregister resource dependency. sl@0: sl@0: @param aClientId ID of the client which is requesting the resource dependency deregistration. sl@0: @param aResId1 Id of the first resource in the dependency link that is being deregistered. sl@0: @param aResId2 Id of the second resource in the dependency link that is being deregistered. sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread or if ID is user side client id sl@0: or if any of the specified resource does not support dependency. sl@0: KErrNotFound if any of the specified resource could not found in the resource list or sl@0: dependency link does not exist between the specified resources. sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::DeRegisterResourceDependency")); sl@0: return ControlIO(aClientId, KResManControlIoDeregisterDependency, (TAny*)aResourceId1, (TAny*)aResourceId2); sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released 9.5 sl@0: sl@0: Request to update with number of dependent resources for the specified resource. sl@0: sl@0: @param aResourceId Id of the resource whose number of dependents is requested sl@0: @param aNumDepResources On success will be updated with number of dependent resources. sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread or if ID is user side client id sl@0: KErrNotSupported if this API is called before PRM is fully intialised or if the resource ID sl@0: does not correspond to dependency resource sl@0: KErrNotFound if the resource could not be found in the resource list. sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetNumDependentsForResource")); sl@0: return ControlIO(aClientId, KResManControlIoGetNumDependents, (TAny*)aResourceId, (TAny*)&aNumDepResource); sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released 9.5 sl@0: sl@0: Request to update the specified array with dependent resource Id's of the specified resource. sl@0: sl@0: @param aResourceId Id of the resource whose dependent resource Id's are requested. sl@0: @param aResIdArray On success array will be updated with the dependent resource information. Client need to sl@0: create the array in kernel heap or data space. sl@0: @param aNumDepResources Specifies the size of array. On success, updated with actual number of dependent resources. sl@0: sl@0: @return KErrNone if successful sl@0: KErrAccessDenied if the client ID could not be found in the list of registered clients or sl@0: if the client was registered to be thread relative and this API is not sl@0: called from the same thread or if ID is user side client id sl@0: KErrNotSupported if this API is called before PRM is fully initialised or if the resource ID sl@0: does not correspond to dependency resource sl@0: KErrNotFound if the resource could not be found in the resource list. sl@0: KErrArgument if passed array is null or pass dependent resource number is 0. sl@0: sl@0: @pre Interrupts must be enabled sl@0: @pre Kernel must be unlocked sl@0: @pre No fast mutex can be held sl@0: @pre Call in a thread context but not from null thread or DFC thread1 sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: inline TInt PowerResourceManager::GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, sl@0: TUint& aNumDepResources) sl@0: { sl@0: __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetDependentsIdForResource")); sl@0: return ControlIO(aClientId, KResManControlIoGetDependentsId, (TAny*)aResourceId, (TAny*)aResIdArray, sl@0: (TAny*)&aNumDepResources); sl@0: } sl@0: sl@0: #endif