os/kernelhwsrv/kernel/eka/drivers/resourceman/resourceman.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\drivers\resourceman\resourceman.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <drivers/resourcecontrol.h>
sl@0
    19
#include <drivers/resourceman.h>
sl@0
    20
/**
sl@0
    21
@publishedPartner
sl@0
    22
@prototype 9.5
sl@0
    23
sl@0
    24
Register a client with the resource manager
sl@0
    25
sl@0
    26
@param aClientId  A reference to a client ID: returns a unique handle if registration was
sl@0
    27
                  successful, 0 otherwise.
sl@0
    28
@param aName      Descriptor with name for client. The descriptor is created by the client
sl@0
    29
                  in kernel heap or in kernel stack.
sl@0
    30
                  NOTE: Name should ideally relate to component name and should take care
sl@0
    31
                  of name uniqueness as this is not checked by resource manager unless 
sl@0
    32
				  DEBUG_VERSION macro is enabled.
sl@0
    33
@param aType      Defines ownership
sl@0
    34
                  EOwnerProcess - The client ID can be used by all thread in the process to
sl@0
    35
                  call the resource manager API's
sl@0
    36
                  EOwnerThread - The client ID can only be used by the thread that registered
sl@0
    37
                  the client to resource manager to call the PRM API's
sl@0
    38
                  By default this is set to EOwnerProcess.
sl@0
    39
sl@0
    40
@return           KErrNone     if the operation was successful,
sl@0
    41
                  KErrNoMemory if a new client link was needed but could not be created and 
sl@0
    42
                               added to the client list,
sl@0
    43
                  KErrTooBig   if the length of the descriptor passed is greater than 32.
sl@0
    44
				  KErrAlreadyExists if the specified name already exists. This is valid only if 
sl@0
    45
				                    DEBUG_VERSION macro is enabled. 
sl@0
    46
				  KErrNotSupported if the number of expected kernel side clients is set to zero
sl@0
    47
									by PSL during initialisation.
sl@0
    48
                  
sl@0
    49
@pre Interrupts must be enabled.
sl@0
    50
@pre Kernel must be unlocked.
sl@0
    51
@pre No fast mutex can be held.
sl@0
    52
@pre Call in a thread context, but not from null thread or DFC thread1.
sl@0
    53
@pre Can be used in a device driver
sl@0
    54
*/
sl@0
    55
EXPORT_C TInt PowerResourceManager::RegisterClient(TUint& aClientId, const TDesC8& aName, TOwnerType aType)
sl@0
    56
	{
sl@0
    57
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RegisterClient"));
sl@0
    58
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("Client Name %S", &aName));
sl@0
    59
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("OwnerType %d", aType));
sl@0
    60
    return TInterface::RegisterClient(aClientId, aName, aType);
sl@0
    61
	}
sl@0
    62
sl@0
    63
/**
sl@0
    64
@publishedPartner
sl@0
    65
@prototype 9.5
sl@0
    66
sl@0
    67
Deregister a client with the resource manager
sl@0
    68
sl@0
    69
@param aClientId    The ID of the client which is being deregistered
sl@0
    70
sl@0
    71
@return             KErrNone     if the operation was successful
sl@0
    72
                    KErrNotFound if this client ID could not be found in the current
sl@0
    73
                                 list of clients
sl@0
    74
		            KErrArgument if user side client ID is specified or client ID to be used
sl@0
    75
								 by Power Controller is specified.
sl@0
    76
		            KErrAccessDenied if client was registered to be thread relative and this API
sl@0
    77
						             is not called from the same thread. 
sl@0
    78
					
sl@0
    79
sl@0
    80
@pre Interrupts must be enabled
sl@0
    81
@pre Kernel must be unlocked
sl@0
    82
@pre No fast mutex can be held
sl@0
    83
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
    84
@pre Can be used in a device driver
sl@0
    85
*/
sl@0
    86
EXPORT_C TInt PowerResourceManager::DeRegisterClient(TUint aClientId)
sl@0
    87
	{
sl@0
    88
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::DeRegisterClient"));
sl@0
    89
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("Client ID %d", aClientId));
sl@0
    90
    return TInterface::DeRegisterClient(aClientId);
sl@0
    91
	}
sl@0
    92
sl@0
    93
/**
sl@0
    94
@publishedPartner
sl@0
    95
@prototype 9.5
sl@0
    96
sl@0
    97
Obtain the name of a registered client of the resource manager
sl@0
    98
sl@0
    99
@param aClientId       The ID of the client which is requesting the name of
sl@0
   100
                       another client whose ID is specified in aTargetClientId.
sl@0
   101
@param aTargetClientId The ID of the client whose name is being requested.
sl@0
   102
@param aName           Descriptor to be filled with the name of the client.
sl@0
   103
				       The descriptor is created by the client in kernel stack or heap.
sl@0
   104
sl@0
   105
@return                KErrNone if the operation was successful
sl@0
   106
                       KErrNotFound if this client ID (aTargetClientId) could not be
sl@0
   107
                                    found in the current list of registered clients.
sl@0
   108
                       KErrAccessDenied if the client ID (aClientId) could not be found
sl@0
   109
                                        in the current list of registered clients or if the client was 
sl@0
   110
				                        registered to be thread relative and this API is not called from 
sl@0
   111
				                        the same thread.
sl@0
   112
sl@0
   113
@pre Interrupts must be enabled
sl@0
   114
@pre Kernel must be unlocked
sl@0
   115
@pre No fast mutex can be held
sl@0
   116
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   117
@pre Can be used in a device driver
sl@0
   118
*/
sl@0
   119
EXPORT_C TInt PowerResourceManager::GetClientName(TUint aClientId, TUint aTargetClientId, TDes8&
sl@0
   120
 aName)
sl@0
   121
	{
sl@0
   122
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetClientName"));
sl@0
   123
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   124
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aTargetClientId 0x%08x", aTargetClientId));
sl@0
   125
    return TInterface::GetClientName(aClientId, aTargetClientId, aName);
sl@0
   126
	}
sl@0
   127
sl@0
   128
/**
sl@0
   129
@publishedPartner
sl@0
   130
@prototype 9.5
sl@0
   131
sl@0
   132
Obtain the Id of registered client of the resource manager
sl@0
   133
sl@0
   134
@param aClientId       ID of the client which is requesting the ID of the another
sl@0
   135
                       client whose name is specified in aClientName
sl@0
   136
@param aClientName     Descriptor containing the name of the client whose ID is being
sl@0
   137
                       requested. The client must create the descriptor in kernel stack
sl@0
   138
                       or heap.
sl@0
   139
                       NOTE: Resource manager does not check for uniqueness of client
sl@0
   140
                       name during registration, so if there are multiple clients registered
sl@0
   141
                       to PRM with same name it will return the ID of the first client encountered
sl@0
   142
				       with the specified name (order is not guaranteed).
sl@0
   143
@param aTargetClientId Updates with ID of the requested client on success
sl@0
   144
sl@0
   145
@return                KErrNone if the operation was successful
sl@0
   146
                       KErrNotFound if this client name could not be found in the current list 
sl@0
   147
					                of registered client.
sl@0
   148
                       KErrAccessDenied if the client ID (aClientId) could not be found in the current
sl@0
   149
                                       list of registered client or if the client was registered to 
sl@0
   150
									   be thread relative and this API is not called from the same thread.
sl@0
   151
                       KErrTooBig if the length of the descriptor passed is greater than 32.
sl@0
   152
sl@0
   153
@pre Interrupts must be enabled
sl@0
   154
@pre Kernel must be unlocked
sl@0
   155
@pre No fast mutex can be held
sl@0
   156
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   157
@pre Can be used in a device driver
sl@0
   158
*/
sl@0
   159
EXPORT_C TInt PowerResourceManager::GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId)
sl@0
   160
	{
sl@0
   161
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetClientId"));
sl@0
   162
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   163
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientName %S", &aClientName));
sl@0
   164
    return TInterface::GetClientId(aClientId, aClientName, aTargetClientId);
sl@0
   165
	}
sl@0
   166
sl@0
   167
/**
sl@0
   168
@publishedPartner
sl@0
   169
@prototype 9.5
sl@0
   170
sl@0
   171
Obtain the ID of registered resource of the resource manager.
sl@0
   172
NOTE: ID of the first matching name found in the resource list will be returned
sl@0
   173
sl@0
   174
@param aClientId      ID of the client which is requesting the ID of the
sl@0
   175
                      resource, by specifying its name.
sl@0
   176
@param aResourceName  Descriptor containing the name of the resource whose
sl@0
   177
                      ID is being requested.The client must create descriptor in 
sl@0
   178
					  kernel stack or heap.
sl@0
   179
@param aResourceId    Updates with ID of the requested resource on success
sl@0
   180
sl@0
   181
@return               KErrNone if the operation was successful
sl@0
   182
                      KErrAccessDenied if the ID of the client could not be found in the
sl@0
   183
                                       current list of registered clients or if the client was
sl@0
   184
						               registered to be thread relative and this API is not called
sl@0
   185
						               from the same thread. 
sl@0
   186
                      KErrNotFound if this resource name could not be found in the current
sl@0
   187
                                   list of registered resources.
sl@0
   188
		              KErrTooBig if the length of the descriptor passed is greater than 32. 
sl@0
   189
sl@0
   190
@pre Interrupts must be enabled
sl@0
   191
@pre Kernel must be unlocked
sl@0
   192
@pre No fast mutex can be held
sl@0
   193
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   194
@pre Can be used in a device driver
sl@0
   195
*/
sl@0
   196
EXPORT_C TInt PowerResourceManager::GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId)
sl@0
   197
	{
sl@0
   198
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetResourceId"));
sl@0
   199
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   200
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceName %S", &aResourceName));
sl@0
   201
    return TInterface::GetResourceId(aClientId, aResourceName, aResourceId);
sl@0
   202
	}
sl@0
   203
sl@0
   204
/**
sl@0
   205
@publishedPartner
sl@0
   206
@prototype 9.5
sl@0
   207
sl@0
   208
Request a structure containing information on a resource.
sl@0
   209
sl@0
   210
@param aClientId    ID of the client which is requesting the resource information
sl@0
   211
@param aResourceId  ID of the resource whose information is being requested.
sl@0
   212
@param aInfo        A pointer to descriptor containing resource information
sl@0
   213
                    structure (TPowerResourceInfoV01) to be filled in
sl@0
   214
                    with the requested resource information. The client must
sl@0
   215
                    create the descriptor in kernel stack or heap.
sl@0
   216
sl@0
   217
@return             KErrNone if the operation was successful
sl@0
   218
                    KErrAccessDenied if the client ID could not be found in the current list
sl@0
   219
                                     of registered clients or if the client was registered to be
sl@0
   220
						             thread relative and this API is not called from the same thread.
sl@0
   221
                    KErrNotFound if this resource ID could not be found in the current list
sl@0
   222
                                 of controllable resource.
sl@0
   223
                    KErrArgument if aInfo is NULL or size of descriptor passed is less than size of 
sl@0
   224
					             TPowerResourceInfoV01.
sl@0
   225
sl@0
   226
@pre Interrupts must be enabled
sl@0
   227
@pre Kernel must be unlocked
sl@0
   228
@pre No fast mutex can be held
sl@0
   229
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   230
@pre Can be used in a device driver
sl@0
   231
*/
sl@0
   232
EXPORT_C TInt PowerResourceManager::GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aInfo)
sl@0
   233
	{
sl@0
   234
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetResourceInfo"));
sl@0
   235
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   236
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   237
    return TInterface::GetResourceInfo(aClientId, aResourceId, aInfo);
sl@0
   238
	}
sl@0
   239
sl@0
   240
sl@0
   241
/**
sl@0
   242
@publishedPartner
sl@0
   243
@prototype 9.5
sl@0
   244
sl@0
   245
Request number of resources that the specified client (aTargetClientId) has
sl@0
   246
requirement on resource level. Client ID starts from 1, so if 0 is specified in
sl@0
   247
aTargetClientId, returns the total number of controllable resources registered with PRM.
sl@0
   248
sl@0
   249
@param aClientId       ID of the client that is requesting the number of resources for which
sl@0
   250
                       the specified client (aTargetClientId) holds requirement on the
sl@0
   251
                       resource level change.
sl@0
   252
@param aTargetClientId ID of the client for which the number of resources that it 
sl@0
   253
					   has requested a level on is to be returned.
sl@0
   254
@param aNumResource    Updated with the number of resources that the specified client
sl@0
   255
                       has requirement on resource level change, if valid client
sl@0
   256
                       ID is passed. If client ID is 0, updates the total number
sl@0
   257
                       of resources registered with resource manager.
sl@0
   258
sl@0
   259
@return                KErrNone if the operation was successful.
sl@0
   260
                       KErrAccessDenied if the client ID (aClientId) could not be found in the
sl@0
   261
                                        current list of registered clients or if the client was registered
sl@0
   262
						                to be thread relative and this API is not called from the same thread.
sl@0
   263
                       KErrNotFound if the client ID (aTargetClientId) could not be found in the
sl@0
   264
                                    current list of registered clients and is not 0.
sl@0
   265
sl@0
   266
@pre Interrupts must be enabled
sl@0
   267
@pre Kernel must be unlocked
sl@0
   268
@pre No fast mutex can be held
sl@0
   269
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   270
@pre Can be used in a device driver
sl@0
   271
*/
sl@0
   272
EXPORT_C TInt PowerResourceManager::GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, 
sl@0
   273
																 TUint& aNumResource)
sl@0
   274
	{
sl@0
   275
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetNumResourcesInUseByClient"));
sl@0
   276
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   277
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aTargetClientId 0x%08x", aTargetClientId));
sl@0
   278
    return TInterface::GetNumResourcesInUseByClient(aClientId, aTargetClientId, aNumResource);
sl@0
   279
	}
sl@0
   280
sl@0
   281
/**
sl@0
   282
@publishedPartner
sl@0
   283
@prototype 9.5
sl@0
   284
sl@0
   285
Request information on resources.
sl@0
   286
If client ID (aTargetClientId) is valid, aInfo is updated with the information 
sl@0
   287
of the resources that this client requested a resource level.
sl@0
   288
If client ID (aTargetClientId) is 0, aInfo is updated with the information of all the resources 
sl@0
   289
registered with resource controller.
sl@0
   290
The number of resources for which information will be provided will be equal or less than 
sl@0
   291
the number specified in aNumResources.
sl@0
   292
sl@0
   293
@param aClientId       ID of the client which is requesting the resource information.
sl@0
   294
@param aTargetClientId ID of the client. The information of all the resources on
sl@0
   295
                       which it has requirement on resource level change is requested.
sl@0
   296
                       Client ID starts from 1, so calling this API with client ID 0 will
sl@0
   297
                       fill the details of all the controllable resource registered with
sl@0
   298
                       resource manager starting from resource ID 1.
sl@0
   299
@param aNumResources   Number of resource whose information needs to be filled in aInfo i.e,
sl@0
   300
                       it specifies the size of aInfo array.
sl@0
   301
@param aInfo           A pointer to an array of descriptor containing an information structure
sl@0
   302
                       (TPowerResourceInfoV01) to be filled in with the information
sl@0
   303
                       on the resources. It will be assumed that array allocated will be equal
sl@0
   304
                       to the number passed in aNumResources. The client must create the array
sl@0
   305
                       in Kernel stack or heap.
sl@0
   306
sl@0
   307
@return                KErrNone if the operation was successful
sl@0
   308
                       KErrAccessDenied if client ID (aClientId) could not be found in the registered
sl@0
   309
                                        client list or if the client was registered to be thread relative
sl@0
   310
										and this API is not called from the same thread.
sl@0
   311
                       KErrNotFound if client ID (aTargetClientId) could not be found in the current list
sl@0
   312
                                    of registered client and is also not 0.
sl@0
   313
                       KErrArgument if aNumResources is 0 or aInfo is NULL or if size of aInfo is not 
sl@0
   314
					                sufficient to hold the resource information of number of resources 
sl@0
   315
									specified in aNumResource.
sl@0
   316
sl@0
   317
@pre Interrupts must be enabled
sl@0
   318
@pre Kernel must be unlocked
sl@0
   319
@pre No fast mutex can be held
sl@0
   320
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   321
@pre Can be used in a device driver
sl@0
   322
*/
sl@0
   323
EXPORT_C TInt PowerResourceManager::GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, 
sl@0
   324
																	TUint& aNumResource, TAny* aInfo)
sl@0
   325
	{
sl@0
   326
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetInfoOnResourcesInUseByClient"));
sl@0
   327
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   328
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aTargetClientId 0x%08x", aTargetClientId));
sl@0
   329
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aNumResource 0x%08x", aNumResource));
sl@0
   330
    return TInterface::GetInfoOnResourcesInUseByClient(aClientId, aTargetClientId, aNumResource, aInfo);
sl@0
   331
	}
sl@0
   332
sl@0
   333
/**
sl@0
   334
@publishedPartner
sl@0
   335
@prototype 9.5
sl@0
   336
sl@0
   337
Request number of clients which has requirements on the resource level change of the specified
sl@0
   338
resource. Resource ID starts from 1, so 0 can be used to get the number of clients
sl@0
   339
registered with resource manager.
sl@0
   340
sl@0
   341
@param aClientId         ID of the client which is requesting number of clients
sl@0
   342
                         holding requirement on specified resource.
sl@0
   343
@param aResourceId       ID of the resource.
sl@0
   344
@param aNumClient        Upon success, updated with number of clients having a requirement
sl@0
   345
                         on resource level for the specified resource, if valid resource ID is specified.
sl@0
   346
                         If resource ID is 0, then it is updated with number of clients
sl@0
   347
                         registered with PRM.
sl@0
   348
sl@0
   349
@return                  KErrNone if the operation was successful
sl@0
   350
                         KErrAccessDenied if the client ID could not found in the current list of
sl@0
   351
                                          registered clients or if the client was registered to be thread 
sl@0
   352
						                  relative and this API is not called from the same thread.
sl@0
   353
                         KErrNotFound If this resource ID could not be found in the current list
sl@0
   354
                                      of registered resource and is also not 0.
sl@0
   355
sl@0
   356
@pre Interrupts must be enabled
sl@0
   357
@pre Kernel must be unlocked
sl@0
   358
@pre No fast mutex can be held
sl@0
   359
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   360
@pre Can be used in a device driver
sl@0
   361
*/
sl@0
   362
EXPORT_C TInt PowerResourceManager::GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients)
sl@0
   363
	{
sl@0
   364
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetNumClientsUsingResource"));
sl@0
   365
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   366
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   367
    return TInterface::GetNumClientsUsingResource(aClientId, aResourceId, aNumClients);
sl@0
   368
	}
sl@0
   369
sl@0
   370
/**
sl@0
   371
@publishedPartner
sl@0
   372
@prototype 9.5
sl@0
   373
sl@0
   374
Request information on clients
sl@0
   375
If resource ID is valid, aInfo is updated with the information of the clients
sl@0
   376
which have a requirements on the resource level for the specified resource
sl@0
   377
If resource ID is 0, aInfo is updated with the information of the clients registered
sl@0
   378
with resource manager, starting from client ID 1.
sl@0
   379
The number of clients for which information will be provided will be equal to or less
sl@0
   380
than the number specified in a NumClients.
sl@0
   381
sl@0
   382
@param aClientId        ID of the client which is requesting the information 
sl@0
   383
@param aResourceId      Id of the resource.
sl@0
   384
@param aNumClients		Number of clients whose information needs to be filled in aInfo
sl@0
   385
						ie, it specifies the size of aInfo array.
sl@0
   386
@param aInfo            A pointer to an array of descriptor containing an information
sl@0
   387
                        structure (TPowerClientInfoV01) to be filled in with
sl@0
   388
                        the information on the client. It will be assumed that array
sl@0
   389
                        allocated will be equal to the number passed in aNumClients.
sl@0
   390
                        The Client must create the array of descriptors in kernel stack
sl@0
   391
                        or heap.
sl@0
   392
sl@0
   393
@return                 KErrNone if the operation was successful.
sl@0
   394
                        KErrNotFound if resource ID could not be found in the registered resource list and is 
sl@0
   395
						             also not 0.
sl@0
   396
		                KErrAccessDenied if client ID (aClientId) could not be found in the registered client list
sl@0
   397
						                 or if the client was registered to be thread relative and this API is not 
sl@0
   398
						                 called from the same thread. 
sl@0
   399
                        KErrArgument if aNumClients is 0 or aInfo is NULL or if size of aInfo is not sufficient 
sl@0
   400
						             to hold client information of specified client number in aNumClients.
sl@0
   401
sl@0
   402
@pre Interrupts must be enabled
sl@0
   403
@pre Kernel must be unlocked
sl@0
   404
@pre No fast mutex can be held
sl@0
   405
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   406
@pre Can be used in a device driver
sl@0
   407
*/
sl@0
   408
EXPORT_C TInt PowerResourceManager::GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, 
sl@0
   409
																  TUint& aNumClients, TAny* aInfo)
sl@0
   410
	{
sl@0
   411
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetInfoOnClientsUsingResource"));
sl@0
   412
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   413
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   414
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aNumClients 0x%08x", aNumClients));
sl@0
   415
    return TInterface::GetInfoOnClientsUsingResource(aClientId, aResourceId, aNumClients, aInfo);
sl@0
   416
	}
sl@0
   417
sl@0
   418
/**
sl@0
   419
@publishedPartner
sl@0
   420
@prototype 9.5
sl@0
   421
sl@0
   422
Request changing the state of a resource
sl@0
   423
NOTE: If a resource callback is specified for instantaneous resource, then callback
sl@0
   424
      will be called after resource change and will be executed in the context of the
sl@0
   425
      client thread.
sl@0
   426
      If a resource callback is specified for long latency reosurces, then it will be
sl@0
   427
      executed asynchronously.
sl@0
   428
      When the request is accepted the API returns immediately and the calling thread
sl@0
   429
      is unblocked: the callback (called in the client's context) will be invoked when
sl@0
   430
      the resource change finally takes place.
sl@0
   431
      If aCb is not specified (NULL by default) the API executes synchronously and will
sl@0
   432
      only return when the resource change has taken place for long latency resource.
sl@0
   433
      The client thread is blocked throughout
sl@0
   434
      When state change for a shared resource is requested, only minimum state that
sl@0
   435
      satisfy the requirement is guaranteed and it is not guaranteed for the absolute
sl@0
   436
      value change.
sl@0
   437
sl@0
   438
@param aClientId   ID of the client which is requesting the resource change.
sl@0
   439
@param aResourceId ID of the resource whose state is to be changed.
sl@0
   440
@param aNewState   The new state of the resource. This could be a binary value for a
sl@0
   441
                   binary resource, an integer level for a multilevel resource or some
sl@0
   442
                   platform specific token for a multi-property resource.
sl@0
   443
@param aCb         For Long latency resource
sl@0
   444
                       A pointer to a resource callback object which encapsulates a
sl@0
   445
                       callback function to be called whenever the resource state change
sl@0
   446
                       happens (if left NULL the API will execute synchrounously).
sl@0
   447
                   For Instantaneous resource
sl@0
   448
                       A pointer to a resource callback object which encapsulates a callback
sl@0
   449
                       function to be called after resource change. This executes in the
sl@0
   450
                       context of the client thread.
sl@0
   451
sl@0
   452
@return            KErrNone If the API is to be executed synchronously it indicates the change was
sl@0
   453
                            successful, if the API is to be executed asynchronously it indicates
sl@0
   454
                            the request to change the resource state has been accepted.
sl@0
   455
                   KErrNotFound if the resource ID could not be found in the current list of
sl@0
   456
                                controllable resources.
sl@0
   457
                   KErrAccessDenied if the client ID could not be found in the list of
sl@0
   458
                                    registered clients or if the client was registered to be thread 
sl@0
   459
						            relative and this API is not called from the same thread.
sl@0
   460
                   KErrNotReady if the request is issued before the resource controller completes its
sl@0
   461
                                internal initialisation.
sl@0
   462
                   KErrUnderflow if the client has exceeded the reserved number of
sl@0
   463
                                 SPowerResourceClientLevel and the free pool is empty or if it is
sl@0
   464
                                 an asynchronous operation on long latency resource and the client has exceeded 
sl@0
   465
					             the reserved number of TPowerRequest and the free pool is empty.
sl@0
   466
				   KErrArgument if requested level is out of range (outside of min and max levels)
sl@0
   467
				   KErrPermissionDenied if the requested state of the resource is not accepted by its dependents.
sl@0
   468
				                        This error is valid only for dependent resource state change in extened
sl@0
   469
										version of PRM.
sl@0
   470
sl@0
   471
@pre Interrupts must be enabled
sl@0
   472
@pre Kernel must be unlocked
sl@0
   473
@pre No fast mutex can be held
sl@0
   474
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   475
@pre Can be used in a device driver
sl@0
   476
@pre Do not call synchronous version from DFC thread 0 for long latency resource
sl@0
   477
*/
sl@0
   478
EXPORT_C TInt PowerResourceManager::ChangeResourceState(TUint aClientId , TUint aResourceId, 
sl@0
   479
														TInt aNewState, TPowerResourceCb* aCb)
sl@0
   480
	{
sl@0
   481
	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::ChangeResourceState"));
sl@0
   482
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   483
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   484
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aNewState 0x%08x", aNewState));
sl@0
   485
	return TInterface::ChangeResourceState(aClientId, aResourceId, aNewState, aCb);
sl@0
   486
	}
sl@0
   487
sl@0
   488
/**
sl@0
   489
@publishedPartner
sl@0
   490
@prototype 9.5
sl@0
   491
sl@0
   492
Request the state of the resource synchronously. Client thread will be blocked throughout.
sl@0
   493
sl@0
   494
@param aClientId     ID of the client which is requesting the resource state.
sl@0
   495
@param aResourceId   ID of the resource whose state is being requested.
sl@0
   496
@param aCached       If ETrue, cached value will be updated in aState.
sl@0
   497
                     If EFalse, aState will be updated after the resource
sl@0
   498
                     state is read from resource.
sl@0
   499
@param aState        Returns the resource state if operation was successful. This
sl@0
   500
                     could be a binary value for a binary resource, an integer level
sl@0
   501
                     for a multilevel resource or some platform specific tolen for a
sl@0
   502
                     multi-property resource.
sl@0
   503
@param aLevelOwnerId Returns the Id of the client that is currently the owner of the resource.
sl@0
   504
					 -1	is returned when no client is owner of the resource.
sl@0
   505
sl@0
   506
@return              KErrNone if operation was successful
sl@0
   507
                     KErrAccessDenied if the client ID could not be found in the current list
sl@0
   508
                                      of registered clients or if the client was registered to be thread
sl@0
   509
						              relative and this API is not called from the same thread.
sl@0
   510
                     KErrNotFound if this resource ID could not be found in the current list
sl@0
   511
                                  of controllable resources.
sl@0
   512
                     KErrNotReady if the request is issued before the resource controller completes
sl@0
   513
                                  its internal initialization.
sl@0
   514
sl@0
   515
@pre Interrupts must be enabled
sl@0
   516
@pre Kernel must be unlocked
sl@0
   517
@pre No fast mutex can be held
sl@0
   518
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   519
@pre Can be used in a device driver
sl@0
   520
@pre Do not call from DFC thread 0 for long latency resource with caching disabled.
sl@0
   521
*/
sl@0
   522
EXPORT_C TInt PowerResourceManager::GetResourceState(TUint aClientId, TUint aResourceId, TBool aCached, 
sl@0
   523
													 TInt& aState, TInt& aLevelOwnerId)
sl@0
   524
	{
sl@0
   525
	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetResourceState"));
sl@0
   526
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   527
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   528
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aCached 0x%08x", aCached));
sl@0
   529
	return TInterface::GetResourceState(aClientId, aResourceId, aCached, aState, aLevelOwnerId);
sl@0
   530
	}
sl@0
   531
sl@0
   532
/**
sl@0
   533
@publishedPartner
sl@0
   534
@prototype 9.5
sl@0
   535
sl@0
   536
Request the state of the resource asynchrounously.
sl@0
   537
sl@0
   538
@param aClientId   ID of the client which is requesting the resource state.
sl@0
   539
@param aResourceId ID of the resource whose state is being requested.
sl@0
   540
@param aCached     If ETrue, cached value will be updated in aState
sl@0
   541
                   If EFalse, will be updated after the resource state is read from resource
sl@0
   542
@param aCb         For long latency resource:
sl@0
   543
                      A pointer to a resource callback object which encapsulates a callback function
sl@0
   544
                      to be called whenever the state of the resource is available for the long
sl@0
   545
                      latency resource (executes in the context of resource manager)
sl@0
   546
                   For instantaneous resource:
sl@0
   547
                      A pointer to a resource callback object which encapsulates a callback
sl@0
   548
                      function to be called after the resource state is read. This is executed
sl@0
   549
                      synchronously in the context of the calling thread.
sl@0
   550
                      NOTE: The client must create the callback object in kernel heap or
sl@0
   551
                            data section.
sl@0
   552
sl@0
   553
@return            KErrNone if the operation was successful
sl@0
   554
                   KErrAccessDenied if the client ID could not be found in the current list
sl@0
   555
                                    of registered clients or if the client was registered to be
sl@0
   556
						            thread relative and this API is not called from the same thread.
sl@0
   557
                   KErrNotFound if this resource ID could not be found in the current list
sl@0
   558
                                of controllable resources.
sl@0
   559
                   KErrNotReady if the request is issued before the resource controller completes
sl@0
   560
                                its internal initialisation
sl@0
   561
                   KErrUnderflow if the client has exceeded the reserved number of TPowerRequest
sl@0
   562
                                 and the TPowerRequest free pool is empty for long latency resource.
sl@0
   563
		           KErrArgument if callback object is NULL.
sl@0
   564
sl@0
   565
@pre Interrupts must be enabled
sl@0
   566
@pre Kernel must be unlocked
sl@0
   567
@pre No fast mutex can be held
sl@0
   568
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   569
@pre Can be used in a device driver
sl@0
   570
*/
sl@0
   571
EXPORT_C TInt PowerResourceManager::GetResourceState(TUint aClientId, TUint aResourceId, TBool aCached, TPowerResourceCb& aCb)
sl@0
   572
	{
sl@0
   573
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::GetResourceState"));
sl@0
   574
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   575
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   576
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aCached 0x%08x", aCached));
sl@0
   577
    return TInterface::GetResourceState(aClientId, aResourceId, aCached, aCb);
sl@0
   578
	}
sl@0
   579
sl@0
   580
/**
sl@0
   581
@publishedPartner
sl@0
   582
@prototype 9.5  
sl@0
   583
sl@0
   584
Cancel an asynchronous request(or its callback).
sl@0
   585
sl@0
   586
@param aClientId       ID of the client which is requesting the cancellation of the request.
sl@0
   587
@param aResourceId     ID for the resource which the request that is being cancelled operates
sl@0
   588
                       upon.
sl@0
   589
@param aCb             A reference to the resource callback object specified with the request
sl@0
   590
                       that is being cancelled.
sl@0
   591
sl@0
   592
@return                KErrCancel if the request was cancelled.
sl@0
   593
                       KErrNotFound if this resource ID could not be found in the current list of 
sl@0
   594
					                controllable resources.
sl@0
   595
                       KErrCompletion if request is no longer pending.
sl@0
   596
                       KErrAccessDenied if the client ID could not be found in the current list of registered
sl@0
   597
		                                clients or if the client was registered to be thread relative and this API
sl@0
   598
						                is not called from the same thread or if client is not the same that 
sl@0
   599
						                requested the resource state change.
sl@0
   600
		               KErrInUse if the request cannot be cancelled as processing of the request already started 
sl@0
   601
				                 and will run to completion. 
sl@0
   602
sl@0
   603
@pre Interrupts must be enabled
sl@0
   604
@pre Kernel must be unlocked
sl@0
   605
@pre No fast mutex can be held
sl@0
   606
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   607
@pre Can be used in a device driver
sl@0
   608
*/
sl@0
   609
EXPORT_C TInt PowerResourceManager::CancelAsyncRequestCallBack(TUint aClientId, TUint aResourceId, TPowerResourceCb& aCb)
sl@0
   610
	{
sl@0
   611
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::CancelAsyncRequestCallback"));
sl@0
   612
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   613
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   614
    return TInterface::CancelAsyncRequestCallBack(aClientId, aResourceId, aCb);
sl@0
   615
	}
sl@0
   616
sl@0
   617
/**
sl@0
   618
@publishedPartner
sl@0
   619
@prototype 9.5
sl@0
   620
sl@0
   621
Request notification of changes to the state of a resource.
sl@0
   622
sl@0
   623
NOTE: This API should return immediately; however the notification will
sl@0
   624
only happen when a resource change occurs.Notification request is idempotent, 
sl@0
   625
if the same notification has already been requested for this resource ID, 
sl@0
   626
the API returns with no further action. Notifications remain queued until 
sl@0
   627
they are cancelled.
sl@0
   628
sl@0
   629
@param aClientId     ID of the client which is requesting the notification.
sl@0
   630
@param aResourceId   ID of the resource for which notification of state changes
sl@0
   631
                     is being requested.
sl@0
   632
@param aN            A reference to a notification object which encapsulates a callback
sl@0
   633
                     function to be called whenever a resource state change takes place.
sl@0
   634
                     NOTE: The client must create the notification object in kernel heap
sl@0
   635
                           or data section.
sl@0
   636
sl@0
   637
@return              KErrNone if the operation of requesting a notification was successful.
sl@0
   638
                     KErrNotFound if this resource ID could not be found in the current list
sl@0
   639
                                  of controllable resources.
sl@0
   640
                     KErrAccessDenied if the client ID could not be found in the current
sl@0
   641
                                      list of registered clients or if the client was registered to be thread
sl@0
   642
						              relative and this API is not called from the same thread.
sl@0
   643
		             KErrInUse if the passed notification object is used already.
sl@0
   644
sl@0
   645
@pre Interrupts must be enabled
sl@0
   646
@pre Kernel must be unlocked
sl@0
   647
@pre No fast mutex can be held
sl@0
   648
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   649
@pre Can be used in a device driver
sl@0
   650
*/
sl@0
   651
EXPORT_C TInt PowerResourceManager::RequestNotification(TUint aClientId, TUint aResourceId, DPowerResourceNotification& aN)
sl@0
   652
	{
sl@0
   653
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RequestNotification"));
sl@0
   654
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   655
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   656
    return TInterface::RequestNotification(aClientId, aResourceId, aN);
sl@0
   657
	}
sl@0
   658
sl@0
   659
/**
sl@0
   660
@publishedPartner
sl@0
   661
@prototype 9.5
sl@0
   662
sl@0
   663
Request notification when the state of a resource reaches a specified threshold or
sl@0
   664
goes above or below that threshold (for multilevel resource only) based on direction.
sl@0
   665
In other words it is issued when a threshold on the specified resource state is crossed
sl@0
   666
in the direction specified.
sl@0
   667
sl@0
   668
NOTE:This API should return immediately; however the notification will only
sl@0
   669
happen when a resource change occurs. Notification request is idempotent, 
sl@0
   670
if the same notification has already been requested for this resource ID, 
sl@0
   671
the API returns with no further action. Notification remain queued until 
sl@0
   672
they are cancelled.
sl@0
   673
sl@0
   674
@param aClientId    ID of the client which is requesting the notification.
sl@0
   675
@param aResourceId  ID for the resource whose notification of state changes is
sl@0
   676
                    being requested.
sl@0
   677
@param aN           A reference to a notification object which encapsulates a callback
sl@0
   678
                    function to be called whenever the conditions to issue the notification
sl@0
   679
                    (specified in the API) are met.
sl@0
   680
                    NOTE: The client must create the notification object in kernel heap
sl@0
   681
                          or data section.
sl@0
   682
@param aThreshold   The level of the resource state that will trigger the notification
sl@0
   683
                    when reached.
sl@0
   684
@param aDirection   Specifies the direction of change of the resource state that will
sl@0
   685
                    trigger a notification. EFalse means the notification will be issued
sl@0
   686
                    when the resource state change to a specified threshold value or below
sl@0
   687
                    the specified threshold, ETrue means the notification will be issued
sl@0
   688
                    when the resource state change to a specified threshold value or above
sl@0
   689
                    the specified threshold.
sl@0
   690
sl@0
   691
@return             KErrNone if the operation of requesting a notification was successful.
sl@0
   692
                    KErrNotFound if this resource ID could not be found in the current list
sl@0
   693
                                 of controllable reosurces.
sl@0
   694
                    KErrAccessDenied if the client ID could not be found in the list of
sl@0
   695
                                     registered clients or if the client was registered to be
sl@0
   696
						             thread relative and this API is not called from the same thread.
sl@0
   697
		            KErrInUse if the passed notification object is used already.
sl@0
   698
		            KErrArgument if the specified threshold is out of range.
sl@0
   699
sl@0
   700
@pre Interrupts must be enabled
sl@0
   701
@pre Kernel must be unlocked
sl@0
   702
@pre No fast mutex can be held
sl@0
   703
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   704
@pre Can be used in a device driver
sl@0
   705
*/
sl@0
   706
EXPORT_C TInt PowerResourceManager::RequestNotification(TUint aClientId, TUint aResourceId, DPowerResourceNotification& aN,
sl@0
   707
														TInt aThreshold, TBool aDirection)
sl@0
   708
	{
sl@0
   709
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::RequestNotification"));
sl@0
   710
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   711
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   712
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aThreshold 0x%08x", aThreshold));
sl@0
   713
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aDirection 0x%08x", aDirection));
sl@0
   714
    return TInterface::RequestNotification(aClientId, aResourceId, aN, aThreshold, aDirection);
sl@0
   715
	}
sl@0
   716
sl@0
   717
/**
sl@0
   718
@publishedPartner
sl@0
   719
@prototype 9.5
sl@0
   720
sl@0
   721
Cancel and remove from queue a previously issued request for notification on a
sl@0
   722
resource state change.
sl@0
   723
sl@0
   724
@param aClientId    ID of the client which is requesting to cancel the notification
sl@0
   725
@param aResourceId  ID of the resource whose pending notification of state changes
sl@0
   726
                    is being cancelled.
sl@0
   727
@param aN           A reference to the notification object that was associated with
sl@0
   728
                    the notification request that is being cancelled. This will be
sl@0
   729
                    used to identify the notification that is being cancelled.
sl@0
   730
sl@0
   731
@return             KErrCancel if the notification request was successfully cancelled.
sl@0
   732
                    KErrNotFound if the specified notification object is not found in the current list
sl@0
   733
					             of notification objects for the specified resource.
sl@0
   734
                    KErrAccessDenied if the client requesting the cancellation is not the same
sl@0
   735
                                     which registered the notification or if the resource id does not
sl@0
   736
						             match or if the client ID could not be found in the list of 
sl@0
   737
             						 registered clients or if the client was registered to be 
sl@0
   738
			             			 thread relative and this API is not called from the same thread.
sl@0
   739
sl@0
   740
@pre Interrupts must be enabled
sl@0
   741
@pre Kernel must be unlocked
sl@0
   742
@pre No fast mutex can be held
sl@0
   743
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   744
@pre Can be used in a device driver
sl@0
   745
*/
sl@0
   746
EXPORT_C TInt PowerResourceManager::CancelNotification(TUint aClientId, TUint aResourceId, DPowerResourceNotification& aN)
sl@0
   747
	{
sl@0
   748
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::CancelNotification"));
sl@0
   749
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   750
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   751
    return TInterface::CancelNotification(aClientId, aResourceId, aN);
sl@0
   752
	}
sl@0
   753
sl@0
   754
/**
sl@0
   755
@publishedPartner
sl@0
   756
@prototype 9.5
sl@0
   757
sl@0
   758
Request pre-allocation of specified number of client level and request message objects.
sl@0
   759
sl@0
   760
@param aClientId  ID of the client which is requesting the pre-allocation.
sl@0
   761
@param aNumCl     Number of client level objects that needs to be pre-allocated
sl@0
   762
                  for this client.
sl@0
   763
@param aNumRm     Number of request message objects that needs to be pre-allocated
sl@0
   764
                  for this client.
sl@0
   765
sl@0
   766
@return           KErrNone if the allocation was successful
sl@0
   767
                  KErrAccessDenied if the client ID could not be found in the list of
sl@0
   768
                                   registered clients or if the client was registered to be 
sl@0
   769
						           thread relative and this API is not called from the same thread.
sl@0
   770
                  KErrNoMemory if there is no sufficient memory for allocation of requested
sl@0
   771
                               number of objects.
sl@0
   772
sl@0
   773
@pre Interrupts must be enabled
sl@0
   774
@pre Kernel must be unlocked
sl@0
   775
@pre No fast mutex can be held
sl@0
   776
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   777
@pre Can be used in a device driver
sl@0
   778
*/
sl@0
   779
EXPORT_C TInt PowerResourceManager::AllocReserve(TUint aClientId, TUint8 aNumCl, TUint8 aNumRm)
sl@0
   780
	{
sl@0
   781
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::AllocReserve"));
sl@0
   782
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   783
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aNumCl 0x%02x", aNumCl));
sl@0
   784
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aNumRm 0x%02x", aNumRm));
sl@0
   785
    return TInterface::AllocReserve(aClientId, aNumCl, aNumRm);
sl@0
   786
	}
sl@0
   787
sl@0
   788
/**
sl@0
   789
@publishedPartner
sl@0
   790
@prototype 9.5
sl@0
   791
sl@0
   792
Request to deregister client level from the specified resource for the specified client.
sl@0
   793
sl@0
   794
@param aClientId	ID of the client which is requesting the deregistration of client level.
sl@0
   795
@param aResourceId	ID of the resource from which to remove the specified clients 'client level'.
sl@0
   796
sl@0
   797
@return             KErrNone if successful
sl@0
   798
		            KErrAccessDenied if the client ID could not be found in the list of registered clients or
sl@0
   799
							         if the client was registered to be thread relative and this API is not 
sl@0
   800
							         called from the same thread.
sl@0
   801
		            KErrNotFound if the resource ID could not be found in the current list of controllable 
sl@0
   802
							     resources or if the client is not holding any level with the specified 
sl@0
   803
							     resource (no client level found for the specified client).
sl@0
   804
sl@0
   805
@pre Interrupts must be enabled
sl@0
   806
@pre Kernel must be unlocked
sl@0
   807
@pre No fast mutex can be held
sl@0
   808
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   809
@pre Can be used in a device driver.
sl@0
   810
*/
sl@0
   811
EXPORT_C TInt PowerResourceManager::DeRegisterClientLevelFromResource(TUint aClientId, TUint aResourceId)
sl@0
   812
	{
sl@0
   813
	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::DeRegisterClientLevelFromResource"));
sl@0
   814
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   815
	__KTRACE_OPT(KRESMANAGER, Kern::Printf("aResourceId 0x%08x", aResourceId));
sl@0
   816
	return TInterface::DeRegisterClientLevelFromResource(aClientId, aResourceId);
sl@0
   817
	}
sl@0
   818
sl@0
   819
/**
sl@0
   820
@publishedPartner
sl@0
   821
@prototype 9.5
sl@0
   822
sl@0
   823
Interface to provide extended functionality.This provides support
sl@0
   824
to register and deregister dynamic resources and handling of resource dependency, registering
sl@0
   825
and deregistering resource dependency.
sl@0
   826
This is not supported in basic version
sl@0
   827
It is used for getting version (supported in both version). 
sl@0
   828
sl@0
   829
@pre Interrupts must be enabled
sl@0
   830
@pre Kernel must be unlocked
sl@0
   831
@pre No fast mutex can be held
sl@0
   832
@pre Call in a thread context but not from null thread or DFC thread1
sl@0
   833
@pre Can be used in a device driver.
sl@0
   834
*/
sl@0
   835
EXPORT_C TInt PowerResourceManager::ControlIO(TUint aClientId, TUint aFunction, TAny* aParam1, TAny* aParam2, 
sl@0
   836
											  TAny* aParam3)
sl@0
   837
    {
sl@0
   838
    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">PowerResourceManager::ControlIO"));
sl@0
   839
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aClientId 0x%08x", aClientId));
sl@0
   840
    __KTRACE_OPT(KRESMANAGER, Kern::Printf("aFunction %d", aFunction));
sl@0
   841
    return TInterface::ControlIO(aClientId, aFunction, aParam1, aParam2, aParam3);
sl@0
   842
	}
sl@0
   843
sl@0
   844