diff -r c1f20ce4abcf -r 3e88ff8f41d5 kernel/eka/include/drivers/resource.h --- a/kernel/eka/include/drivers/resource.h Tue Aug 31 16:34:26 2010 +0300 +++ b/kernel/eka/include/drivers/resource.h Wed Sep 01 12:34:56 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of the License "Eclipse Public License v1.0" @@ -12,7 +12,7 @@ // // Description: // e32\include\drivers\resource.h -// +// // WARNING: This file contains some APIs which are internal and are subject // to change without notice. Such APIs should therefore not be used // outside the Kernel and Hardware Services package. @@ -26,18 +26,18 @@ #include //Definition for resource flag setting. Used by PSL. -const TUint KTypeMask = 0x3; -const TUint KUsageOffset = 0x1F; -const TUint KLongLatencySetOffset = 0x1E; -const TUint KLongLatencyGetOffset = 0x1D; -const TUint KClassOffset = 0x1C; -const TUint KSenseOffset = 0x1A; -const TUint KShared = 0x1u << KUsageOffset; -const TUint KLongLatencySet = 0x1u << KLongLatencySetOffset; -const TUint KLongLatencyGet = 0x1u << KLongLatencyGetOffset; -const TUint KLogical = 0x1u << KClassOffset; -const TUint KSenseNegative = 0x1u << KSenseOffset; -const TUint KSenseCustom = 0x2u << KSenseOffset; +static const TUint KTypeMask= 0x3; +static const TUint KUsageOffset=0x1F; +static const TUint KLongLatencySetOffset=0x1E; +static const TUint KLongLatencyGetOffset=0x1D; +static const TUint KClassOffset=0x1C; +static const TUint KSenseOffset=0x1A; +static const TUint KShared=0x1<TPowerResourceCb::DfcFunc ClientId = 0x%x, ResourceId = %d, Level = %d, \ LevelOwnerId = %d, Result = %d", pCb->iClientId, pCb->iResourceId, pCb->iLevel, \ pCb->iLevelOwnerId, pCb->iResult)); - - pCb->Lock(); - TUint ClientId = pCb->iClientId; - TUint ResourceId = pCb->iResourceId; - TInt Level = pCb->iLevel; - TInt LevelOwnerId = pCb->iLevelOwnerId; - TInt Result = pCb->iResult; - TAny* Param = pCb->iParam; - pCb->UnLock(); - - // Call the client specified callback function - pCb->iCallback(ClientId, ResourceId, Level, LevelOwnerId, Result, Param); - - pCb->Lock(); - pCb->iPendingRequestCount--; - if(pCb->iPendingRequestCount == 0) - pCb->iResult = KErrCompletion; //Mark the callback object to act properly during cancellation of this request. - pCb->UnLock(); + // Call the client specified callback function + pCb->iCallback(pCb->iClientId, pCb->iResourceId, pCb->iLevel, pCb->iLevelOwnerId, pCb->iResult, pCb->iParam); + pCb->iResult = KErrCompletion; //Mark the callback object to act properly during cancellation of this request. PRM_CALLBACK_COMPLETION_TRACE } private: - void Lock() - { - __ASSERT_DEBUG(iMutex, Kern::Fault("TPowerResourceCb::Lock", __LINE__)); - NKern::ThreadEnterCS(); - Kern::MutexWait(*iMutex); - } - void UnLock() - { - __ASSERT_DEBUG(iMutex, Kern::Fault("TPowerResourceCb::UnLock", __LINE__)); - Kern::MutexSignal(*iMutex); - NKern::ThreadLeaveCS(); - } TAny* iParam; //Stores the aPtr argument passed in the constructor, to be passed as 5th argument to the callback function - TInt iResult; //Used to store the result as well as binary usage count for the callback + TInt iResult; //Used to store the result aswell as binary usage count for the callback TInt iLevel; // Level of the resource TInt iLevelOwnerId; // Stores owner of the resource for asynchronous get operation TUint iResourceId; //Stores the ID of the resource whose state is changed/read asynchronously TUint iClientId; //Stores the ID of the client that requested the asynchronous operation TPowerResourceCbFn iCallback; //Callback function object - DMutex* iMutex; - TInt iPendingRequestCount; #ifdef PRM_CONTROLLER friend class DPowerResourceController; #endif