os/kernelhwsrv/kernel/eka/include/drivers/resourceman.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/resourceman.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,242 @@
     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 +// e32\include\drivers\resourceman.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 +/**
    1.25 + 
    1.26 + @publishedPartner
    1.27 + @released 9.5
    1.28 + 
    1.29 + Request to get the resource controller version
    1.30 + 
    1.31 + @param aClientId	ID of the client which is requesting the resource controller version.
    1.32 + @param aVersion		On Success, returns the version of PRM
    1.33 + 
    1.34 + @return KErrNone			if successful
    1.35 + KErrAccessDenied	if the client ID could not be found in the list of registered clients or
    1.36 + if the client was registered to be thread relative and this API is not 
    1.37 + called from the same thread.
    1.38 + 
    1.39 + @pre Interrupts must be enabled
    1.40 + @pre Kernel must be unlocked
    1.41 + @pre No fast mutex can be held
    1.42 + @pre Call in a thread context but not from null thread or DFC thread1
    1.43 + @pre Can be used in a device driver.
    1.44 +*/
    1.45 +inline TInt PowerResourceManager::GetResourceControllerVersion(TUint aClientId, TUint& aVersion)
    1.46 +	{
    1.47 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::ResourceControllerVersion"));
    1.48 +	return ControlIO(aClientId, KResManControlIoGetVersion, (TAny*)&aVersion, NULL);
    1.49 +	}
    1.50 +#ifdef PRM_ENABLE_EXTENDED_VERSION
    1.51 +
    1.52 +/**
    1.53 +@publishedPartner
    1.54 +@released 9.5
    1.55 +
    1.56 +Request to register dynamic resource. This is also used to register dynamic resource with dependency
    1.57 +
    1.58 +@param aClientId	ID of the client which is requesting the dynamic resource registration.
    1.59 +@param aResource	Dynamic resource to register.
    1.60 +@param aResourceId	On success, updates with resource id corresponding to this resource
    1.61 +
    1.62 +@return KErrNone			if successful
    1.63 +		KErrAccessDenied	if the client ID could not be found in the list of registered clients or
    1.64 +							if the client was registered to be thread relative and this API is not 
    1.65 +							called from the same thread or if ID is user side client id.
    1.66 +		KErrNotSupported	if this API is called before PRM is fully intialised or if the resource ID does not
    1.67 +		                    correspond to dynamic resource or dynamic resource which support depedency
    1.68 +		KErrAlreadyExists	if resource is already registered.
    1.69 +
    1.70 +
    1.71 +@pre Interrupts must be enabled
    1.72 +@pre Kernel must be unlocked
    1.73 +@pre No fast mutex can be held
    1.74 +@pre Call in a thread context but not from null thread or DFC thread1
    1.75 +@pre Can be used in a device driver.
    1.76 +*/
    1.77 +inline TInt PowerResourceManager::RegisterDynamicResource(TUint aClientId, DDynamicPowerResource* aResource, 
    1.78 +																						TUint& aResourceId)
    1.79 +	{
    1.80 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RegisterDynamicResource"));
    1.81 +	return ControlIO(aClientId, KResManControlIoRegisterDynamicResource, (TAny*)aResource, (TAny*)&aResourceId);
    1.82 +	}
    1.83 +
    1.84 +/**
    1.85 +@publishedPartner
    1.86 +@released 9.5
    1.87 +
    1.88 +Request to deregister dynamic resource. This is also used to deregister dynamic resource with dependency
    1.89 +
    1.90 +@param aClientId	ID of the client which is requesting the dynamic resource deregistration.
    1.91 +@param aResourceId	Id of dynamic resource to deregister.
    1.92 +@param aState		Pointer to the required final state. This is optional and if left NULL, resource
    1.93 +					will be moved to its default state.
    1.94 +
    1.95 +@return KErrNone			if successful
    1.96 +		KErrAccessDenied	if the client ID could not be found in the list of registered clients or
    1.97 +							if the client was registered to be thread relative and this API is not 
    1.98 +							called from the same thread or if ID is user side client id or if the client
    1.99 +							is not the same that registered the resource.
   1.100 +		KErrNotSupported	if this API is called before PRM is fully intialised or if the resource ID does not 
   1.101 +		                    correspond to dynamic resource or dynamic resource which support depedency
   1.102 +		KErrNotFound		if the resource could not found in the resource list. 
   1.103 +		KErrInUse			if the some other operation is in progress or if the resource is shared and
   1.104 +							another client holds requirement on this resource
   1.105 +
   1.106 +
   1.107 +@pre Interrupts must be enabled
   1.108 +@pre Kernel must be unlocked
   1.109 +@pre No fast mutex can be held
   1.110 +@pre Call in a thread context but not from null thread or DFC thread1
   1.111 +@pre Can be used in a device driver.
   1.112 +*/
   1.113 +inline TInt PowerResourceManager::DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt* aState)
   1.114 +	{
   1.115 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::DeRegisterDynamicResource"));
   1.116 +	return ControlIO(aClientId, KResManControlIoDeregisterDynamicResource, (TAny*)aResourceId, (TAny*)aState);
   1.117 +	}
   1.118 +
   1.119 +/**
   1.120 +@publishedPartner
   1.121 +@released 9.5
   1.122 +
   1.123 +Request to register resource dependency. This could be between 2 dynamic resource or between
   1.124 +dynamic and static resource.
   1.125 +
   1.126 +@param aClientId	ID of the client which is requesting the resource dependency registration.
   1.127 +@param aResDependencyInfo1 Dependency information about the first resource in the dependency link.
   1.128 +@param aResDependencyInfo2 Dependency information about the second resource in the dependency link.
   1.129 +
   1.130 +@return KErrNone			if successful
   1.131 +		KErrAccessDenied	if the client ID could not be found in the list of registered clients or
   1.132 +							if the client was registered to be thread relative and this API is not 
   1.133 +							called from the same thread or if ID is user side client id 
   1.134 +		KErrNotSupported	if any of the specified resource is not dynamic resource with depedency or 
   1.135 +		                    is not dependency resource or is instantaneous
   1.136 +		KErrNotFound		if any of the specified resource could not found in the resource list. 
   1.137 +
   1.138 +
   1.139 +@pre Interrupts must be enabled
   1.140 +@pre Kernel must be unlocked
   1.141 +@pre No fast mutex can be held
   1.142 +@pre Call in a thread context but not from null thread or DFC thread1
   1.143 +@pre Can be used in a device driver.
   1.144 +*/
   1.145 +inline TInt PowerResourceManager::RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo* aResDependencyInfo1, 
   1.146 +																			SResourceDependencyInfo* aResDependencyInfo2)
   1.147 +	{
   1.148 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RegisterResourceDependency"));
   1.149 +	return ControlIO(aClientId, KResManControlIoRegisterDependency, (TAny*)aResDependencyInfo1, (TAny*)aResDependencyInfo2);
   1.150 +	}
   1.151 +
   1.152 +/**
   1.153 +@publishedPartner
   1.154 +@released 9.5
   1.155 +
   1.156 +Request to deregister resource dependency.
   1.157 + 
   1.158 +@param aClientId	ID of the client which is requesting the resource dependency deregistration.
   1.159 +@param aResId1 Id of the first resource in the dependency link that is being deregistered.
   1.160 +@param aResId2 Id of the second resource in the dependency link that is being deregistered.
   1.161 +
   1.162 +@return KErrNone			if successful
   1.163 +		KErrAccessDenied	if the client ID could not be found in the list of registered clients or
   1.164 +							if the client was registered to be thread relative and this API is not 
   1.165 +							called from the same thread or if ID is user side client id 
   1.166 +							or if any of the specified resource does not support dependency.
   1.167 +		KErrNotFound		if any of the specified resource could not found in the resource list or 
   1.168 +		                    dependency link does not exist between the specified resources.
   1.169 +
   1.170 +@pre Interrupts must be enabled
   1.171 +@pre Kernel must be unlocked
   1.172 +@pre No fast mutex can be held
   1.173 +@pre Call in a thread context but not from null thread or DFC thread1
   1.174 +@pre Can be used in a device driver.
   1.175 +*/
   1.176 +inline TInt PowerResourceManager::DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2)
   1.177 +	{
   1.178 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::DeRegisterResourceDependency"));
   1.179 +	return ControlIO(aClientId, KResManControlIoDeregisterDependency, (TAny*)aResourceId1, (TAny*)aResourceId2);
   1.180 +	}
   1.181 +
   1.182 +/**
   1.183 +@internalComponent
   1.184 +@released 9.5
   1.185 +
   1.186 +Request to update with number of dependent resources for the specified resource. 
   1.187 +
   1.188 +@param aResourceId Id of the resource whose number of dependents is requested
   1.189 +@param aNumDepResources On success will be updated with number of dependent resources.
   1.190 +
   1.191 +@return KErrNone			if successful
   1.192 +		KErrAccessDenied	if the client ID could not be found in the list of registered clients or
   1.193 +							if the client was registered to be thread relative and this API is not 
   1.194 +							called from the same thread or if ID is user side client id 
   1.195 +		KErrNotSupported	if this API is called before PRM is fully intialised or if the resource ID 
   1.196 +		                    does not correspond to dependency resource 
   1.197 +		KErrNotFound		if the resource could not be found in the resource list. 
   1.198 +
   1.199 +@pre Interrupts must be enabled
   1.200 +@pre Kernel must be unlocked
   1.201 +@pre No fast mutex can be held
   1.202 +@pre Call in a thread context but not from null thread or DFC thread1
   1.203 +@pre Can be used in a device driver.
   1.204 +*/
   1.205 +inline TInt PowerResourceManager::GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource)
   1.206 +	{
   1.207 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetNumDependentsForResource"));
   1.208 +	return ControlIO(aClientId, KResManControlIoGetNumDependents, (TAny*)aResourceId, (TAny*)&aNumDepResource);
   1.209 +	}
   1.210 +
   1.211 +/**
   1.212 +@internalComponent
   1.213 +@released 9.5
   1.214 +
   1.215 +Request to update the specified array with dependent resource Id's of the specified resource. 
   1.216 +
   1.217 +@param aResourceId Id of the resource whose dependent resource Id's are requested.
   1.218 +@param aResIdArray On success array will be updated with the dependent resource information. Client need to 
   1.219 +					create the array in kernel heap or data space.
   1.220 +@param aNumDepResources Specifies the size of array. On success, updated with actual number of dependent resources.
   1.221 +
   1.222 +@return KErrNone			if successful
   1.223 +		KErrAccessDenied	if the client ID could not be found in the list of registered clients or
   1.224 +							if the client was registered to be thread relative and this API is not 
   1.225 +							called from the same thread or if ID is user side client id 
   1.226 +		KErrNotSupported	if this API is called before PRM is fully initialised or if the resource ID 
   1.227 +		                    does not correspond to dependency resource 
   1.228 +		KErrNotFound		if the resource could not be found in the resource list. 
   1.229 +		KErrArgument		if passed array is null or pass dependent resource number is 0.
   1.230 +
   1.231 +@pre Interrupts must be enabled
   1.232 +@pre Kernel must be unlocked
   1.233 +@pre No fast mutex can be held
   1.234 +@pre Call in a thread context but not from null thread or DFC thread1
   1.235 +@pre Can be used in a device driver.
   1.236 +*/
   1.237 +inline TInt PowerResourceManager::GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, 
   1.238 +																							TUint& aNumDepResources)
   1.239 +	{
   1.240 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetDependentsIdForResource"));
   1.241 +	return ControlIO(aClientId, KResManControlIoGetDependentsId, (TAny*)aResourceId, (TAny*)aResIdArray, 
   1.242 +																							(TAny*)&aNumDepResources);
   1.243 +	}
   1.244 +
   1.245 +#endif