311 { |
311 { |
312 __KTRACE_OPT(KRESMANAGER, Kern::Printf(">TInterface::ControlIO")); |
312 __KTRACE_OPT(KRESMANAGER, Kern::Printf(">TInterface::ControlIO")); |
313 return PowerResourceController->GetInterface(aClientId, aFunction, aParam1, aParam2, aParam3); |
313 return PowerResourceController->GetInterface(aClientId, aFunction, aParam1, aParam2, aParam3); |
314 } |
314 } |
315 |
315 |
316 /** Resouce controller panic */ |
316 /** Resource controller panic */ |
317 void DPowerResourceController::Panic(TUint8 aPanic) |
317 void DPowerResourceController::Panic(TUint8 aPanic) |
318 { |
318 { |
319 Kern::Fault("Power Resource Controller", aPanic); |
319 Kern::Fault("Power Resource Controller", aPanic); |
320 } |
320 } |
321 |
321 |
322 /** Constructor for power controller. Creates message queue and generates ID for power controller to use. */ |
322 /** Constructor for power controller. Creates message queue and generates ID for power controller to use. */ |
|
323 extern RPointerArray <DStaticPowerResource> *StaticResourceArrayPtr; |
|
324 #ifdef PRM_ENABLE_EXTENDED_VERSION |
|
325 extern RPointerArray <DStaticPowerResourceD> *StaticResourceDependencyArrayPtr; |
|
326 #endif |
323 DPowerResourceController::DPowerResourceController() |
327 DPowerResourceController::DPowerResourceController() |
324 { |
328 { |
325 __KTRACE_OPT(KRESMANAGER, Kern::Printf("DPowerResourceController::DPowerResouceController()")); |
329 __KTRACE_OPT(KRESMANAGER, Kern::Printf("DPowerResourceController::DPowerResouceController()")); |
326 //Constructor is expected to invoke multiple times (during creation, variant init 0 and extension init 1) |
330 // Constructor is expected to invoke multiple times, i.e.: |
327 if(PowerResourceController) |
331 // during creation: variant init 0(KModuleEntryReasonVariantInit0) and later extension init 1 (KModuleEntryReasonExtensionInit1) |
|
332 if(PowerResourceController) |
|
333 { |
|
334 // If InitController() was called in the Init3() static resource arrays were populated already and invocation of this |
|
335 // constructor has zeroed the dynamic pointer arrays (calling their default constructors). In such case we need to |
|
336 // restore these arrays from their temporary shadow copies (i.e. copies of RPointerArray objects, not their content) |
|
337 // (See comments in RegisterStaticResources()) |
|
338 if(StaticResourceArrayPtr) |
|
339 { |
|
340 // by making a (binary) copy of RPointerArray object (compiler's auto-generated code) |
|
341 // we are taking the ownership of content (pointers stored/owned by that array) of this temporary array |
|
342 iStaticResourceArray = *StaticResourceArrayPtr; |
|
343 } |
|
344 #ifdef PRM_ENABLE_EXTENDED_VERSION |
|
345 // the same applies to static resources with dependencies for extended version. |
|
346 // Temporary object are de-allocated in InitResources() |
|
347 if(StaticResourceDependencyArrayPtr) |
|
348 { |
|
349 iStaticResDependencyArray = *StaticResourceDependencyArrayPtr; |
|
350 } |
|
351 #endif |
328 return; |
352 return; |
|
353 } |
329 PowerResourceController = this; |
354 PowerResourceController = this; |
330 iClientList.Initialise(0); |
355 iClientList.Initialise(0); |
331 iUserSideClientList.Initialise(0); |
356 iUserSideClientList.Initialise(0); |
332 iInitialised = EResConCreated; |
357 iInitialised = EResConCreated; |
333 #ifdef PRM_ENABLE_EXTENDED_VERSION |
358 #ifdef PRM_ENABLE_EXTENDED_VERSION |
334 iDynamicResourceList.Initialise(0); |
359 iDynamicResourceList.Initialise(0); |
335 iDynamicResDependencyList.Initialise(0); |
360 iDynamicResDependencyList.Initialise(0); |
336 #endif |
361 #endif |
337 } |
|
338 |
|
339 /** Destructor for power controller. Frees the memory allocated in kernel heap. */ |
|
340 DPowerResourceController::~DPowerResourceController() |
|
341 { |
|
342 __KTRACE_OPT(KRESMANAGER, Kern::Printf("DPowerResourceController::~DPowerResourceController()")); |
|
343 #ifdef RESOURCE_MANAGER_SIMULATED_PSL |
|
344 iCleanList.ResetAndDestroy(); |
|
345 #endif |
|
346 iClientList.Delete(); |
|
347 iUserSideClientList.Delete(); |
|
348 |
|
349 |
|
350 |
|
351 #ifdef PRM_ENABLE_EXTENDED_VERSION |
|
352 iDynamicResourceList.Delete(); |
|
353 iDynamicResDependencyList.Delete(); |
|
354 #endif |
|
355 |
|
356 SPowerResourceClientLevel *pCL = iClientLevelPool; |
|
357 while(iClientLevelPool) //Find the starting position of array to delete |
|
358 { |
|
359 if(iClientLevelPool < pCL) |
|
360 pCL = iClientLevelPool; |
|
361 iClientLevelPool = iClientLevelPool->iNextInList; |
|
362 } |
|
363 //delete pCL; |
|
364 delete []pCL; |
|
365 SPowerRequest *pReq = iRequestPool; |
|
366 while(iRequestPool) //Find the starting position of array to delete |
|
367 { |
|
368 if(iRequestPool < pReq) |
|
369 pReq = iRequestPool; |
|
370 iRequestPool = iRequestPool->iNext; |
|
371 } |
|
372 //delete pR |
|
373 delete []pReq; |
|
374 #ifdef PRM_ENABLE_EXTENDED_VERSION |
|
375 pCL = iResourceLevelPool; |
|
376 while(iResourceLevelPool) |
|
377 { |
|
378 if(iResourceLevelPool < pCL) |
|
379 pCL = iResourceLevelPool; |
|
380 iResourceLevelPool = iResourceLevelPool->iNextInList; |
|
381 } |
|
382 //delete resource pool |
|
383 delete []pCL; |
|
384 //delete Message Queue dependency |
|
385 delete iMsgQDependency; |
|
386 #endif |
|
387 //delete Message Queue |
|
388 delete iMsgQ; |
|
389 } |
362 } |
390 |
363 |
391 /** Send notificatins to clients registered for it for the specified resource. */ |
364 /** Send notificatins to clients registered for it for the specified resource. */ |
392 void DPowerResourceController::CompleteNotifications(TInt aClientId, DStaticPowerResource* aResource, TInt aState, |
365 void DPowerResourceController::CompleteNotifications(TInt aClientId, DStaticPowerResource* aResource, TInt aState, |
393 TInt aReturnCode, TInt aLevelOwnerId, TBool aLock) |
366 TInt aReturnCode, TInt aLevelOwnerId, TBool aLock) |
854 Finally mark resource controller as fully initialised (ready to accept state change and get request) |
827 Finally mark resource controller as fully initialised (ready to accept state change and get request) |
855 and start the message queue if exists. */ |
828 and start the message queue if exists. */ |
856 TInt DPowerResourceController::InitResources() |
829 TInt DPowerResourceController::InitResources() |
857 { |
830 { |
858 __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DPowerResourceController::InitResources()")); |
831 __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DPowerResourceController::InitResources()")); |
859 TUint16 count; |
832 TInt count; |
860 //Create a Kernel client object for Power Controller |
833 //Create a Kernel client object for Power Controller |
861 Lock(); |
834 Lock(); |
862 SPowerResourceClient * pC = NULL; |
835 SPowerResourceClient * pC = NULL; |
863 // By now client pool should be created |
836 // By now client pool should be created |
864 LIST_POP(iClientPool, pC, iNextInList); |
837 LIST_POP(iClientPool, pC, iNextInList); |
865 TUint16 growBy = iClientList.GrowBy(); |
838 TInt growBy = iClientList.GrowBy(); |
866 if(!pC) |
839 if(!pC) |
867 { |
840 { |
868 UnLock(); |
841 UnLock(); |
869 // coverity[alloc_fn] |
842 // coverity[alloc_fn] |
870 SPowerResourceClient *pCL = new SPowerResourceClient[growBy]; |
843 SPowerResourceClient *pCL = new SPowerResourceClient[growBy]; |
898 iClientList.Add(pC, iPowerControllerId); |
871 iClientList.Add(pC, iPowerControllerId); |
899 pC->iClientId = iPowerControllerId | CLIENT_POWER_CONTROLLER_BIT_MASK; |
872 pC->iClientId = iPowerControllerId | CLIENT_POWER_CONTROLLER_BIT_MASK; |
900 iPowerControllerId = pC->iClientId; |
873 iPowerControllerId = pC->iClientId; |
901 iClientCount++; |
874 iClientCount++; |
902 if(TPowerController::PowerController()) |
875 if(TPowerController::PowerController()) |
903 TPowerController::PowerController()->RegisterResourceController(this, iPowerControllerId); |
876 { |
|
877 if(TPowerController::PowerController()->RegisterResourceController(this, iPowerControllerId)) |
|
878 { |
|
879 #ifndef RESOURCE_MANAGER_SIMULATED_PSL |
|
880 Panic(EControllerAlreadyExists); // Panic with this error for any error returned by RegisterResourceController |
|
881 #endif |
|
882 } |
|
883 } |
|
884 |
904 iInitialised =EResConStartupCompleted; |
885 iInitialised =EResConStartupCompleted; |
905 UnLock(); |
886 UnLock(); |
906 //Check the resource for postboot level and send notifications to clients registered for it. |
887 //Check the resource for postboot level and send notifications to clients registered for it. |
907 DStaticPowerResource *pR = NULL; |
888 DStaticPowerResource *pR = NULL; |
908 TInt r; |
889 TInt r; |
909 TPowerRequest req = TPowerRequest::Get(); |
890 TPowerRequest req = TPowerRequest::Get(); |
910 //For Static resource with no dependencies |
891 //For Static resource with no dependencies |
911 for(count = 0; count< iStaticResourceArrayEntries; count++) |
892 for(count = 0; count < iStaticResourceArray.Count(); count++) |
912 { |
893 { |
913 pR = iStaticResourceArray[count]; |
894 pR = iStaticResourceArray[count]; |
914 if(pR && (pR->iFlags & SET_VALID_POST_BOOT_LEVEL)) |
895 if(pR && (pR->iFlags & SET_VALID_POST_BOOT_LEVEL)) |
915 { |
896 { |
916 //Form the request message |
897 //Form the request message |
944 req.ResourceCb() = NULL; |
925 req.ResourceCb() = NULL; |
945 req.RequiresChange() = ETrue; |
926 req.RequiresChange() = ETrue; |
946 //Form the request message |
927 //Form the request message |
947 ((DStaticPowerResourceD*)pR)->HandleChangePropagation(req, EChangeStart, req.ClientId(), KNoClient); |
928 ((DStaticPowerResourceD*)pR)->HandleChangePropagation(req, EChangeStart, req.ClientId(), KNoClient); |
948 } |
929 } |
|
930 } |
|
931 #endif |
|
932 |
|
933 // delete the temporary copy of static resource array used during initialization. |
|
934 if(StaticResourceArrayPtr) |
|
935 { |
|
936 delete StaticResourceArrayPtr; |
|
937 StaticResourceArrayPtr = NULL; |
|
938 } |
|
939 #ifdef PRM_ENABLE_EXTENDED_VERSION |
|
940 // the same applies to dependency resources array for extended version. |
|
941 if(StaticResourceDependencyArrayPtr) |
|
942 { |
|
943 delete StaticResourceDependencyArrayPtr; |
|
944 StaticResourceDependencyArrayPtr = NULL; |
949 } |
945 } |
950 #endif |
946 #endif |
951 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::InitResources()")); |
947 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::InitResources()")); |
952 return KErrNone; |
948 return KErrNone; |
953 } |
949 } |
1277 } |
1273 } |
1278 #ifdef RESOURCE_MANAGER_SIMULATED_PSL |
1274 #ifdef RESOURCE_MANAGER_SIMULATED_PSL |
1279 iCleanList.Append(pC); |
1275 iCleanList.Append(pC); |
1280 #endif |
1276 #endif |
1281 Lock(); |
1277 Lock(); |
1282 TUint16 c; |
1278 TInt c; |
1283 for(c = 0; c < iStaticResDependencyCount; c++) |
1279 for(c = 0; c < iStaticResDependencyArray.Count(); c++) |
1284 { |
1280 { |
1285 LIST_PUSH(iResourceLevelPool, &pRL[c], iNextInList); |
1281 LIST_PUSH(iResourceLevelPool, &pRL[c], iNextInList); |
1286 } |
1282 } |
1287 iResourceLevelPoolCount = iStaticResDependencyCount; |
1283 iResourceLevelPoolCount = (TUint16)iStaticResDependencyArray.Count(); |
1288 #else |
1284 #else |
1289 #ifdef RESOURCE_MANAGER_SIMULATED_PSL |
1285 #ifdef RESOURCE_MANAGER_SIMULATED_PSL |
1290 iCleanList.Append(pC); |
1286 iCleanList.Append(pC); |
1291 #endif |
1287 #endif |
1292 Lock(); |
1288 Lock(); |
1293 TUint16 c; |
1289 TUint16 c; |
1294 #endif |
1290 #endif |
1295 // Create Client pool list |
1291 // Create Client pool list |
1296 for(c = 0; c< (aKClients + aUClients); c++) |
1292 for(c = 0; c < TUint16(aKClients + aUClients); c++) |
1297 { |
1293 { |
1298 LIST_PUSH(iClientPool, &pC[c], iNextInList); |
1294 LIST_PUSH(iClientPool, &pC[c], iNextInList); |
1299 } |
1295 } |
1300 // Create client level pool list |
1296 // Create client level pool list |
1301 for(c = 0; c < aNClientLevels; c++) |
1297 for(c = 0; c < aNClientLevels; c++) |
1550 SPowerResourceClientLevel* pCLL = NULL; |
1546 SPowerResourceClientLevel* pCLL = NULL; |
1551 while(pCL != NULL) |
1547 while(pCL != NULL) |
1552 { |
1548 { |
1553 __KTRACE_OPT(KRESMANAGER, Kern::Printf("Client 0x%x has requirement on resource %d", pCL->iClientId, pCL->iResourceId)); |
1549 __KTRACE_OPT(KRESMANAGER, Kern::Printf("Client 0x%x has requirement on resource %d", pCL->iClientId, pCL->iResourceId)); |
1554 #ifdef PRM_ENABLE_EXTENDED_VERSION |
1550 #ifdef PRM_ENABLE_EXTENDED_VERSION |
1555 switch((pCL->iResourceId >>RESOURCE_BIT_IN_ID_CHECK) & 0x3) |
1551 switch((pCL->iResourceId >>RESOURCE_BIT_IN_ID_CHECK) & 0x3) |
1556 { |
1552 { |
1557 case PRM_STATIC_RESOURCE: |
1553 case PRM_STATIC_RESOURCE: |
1558 pR = iStaticResourceArray[pCL->iResourceId - 1]; |
1554 pR = iStaticResourceArray[pCL->iResourceId - 1]; |
1559 break; |
1555 break; |
1560 case PRM_DYNAMIC_RESOURCE: |
1556 case PRM_DYNAMIC_RESOURCE: |
1561 pR = (iDynamicResourceList[(TUint16)(pCL->iResourceId & ID_INDEX_BIT_MASK)]); |
1557 pR = (iDynamicResourceList[(pCL->iResourceId & ID_INDEX_BIT_MASK)]); |
1562 break; |
1558 break; |
1563 case PRM_STATIC_DEPENDENCY_RESOURCE: |
1559 case PRM_STATIC_DEPENDENCY_RESOURCE: |
1564 pR = (iStaticResDependencyArray[(TUint16)(pCL->iResourceId & ID_INDEX_BIT_MASK) - 1]); |
1560 pR = (iStaticResDependencyArray[(pCL->iResourceId & ID_INDEX_BIT_MASK) - 1]); |
1565 break; |
1561 break; |
1566 case PRM_DYNAMIC_DEPENDENCY_RESOURCE: |
1562 case PRM_DYNAMIC_DEPENDENCY_RESOURCE: |
1567 pR = (iDynamicResDependencyList[(TUint16)(pCL->iResourceId & ID_INDEX_BIT_MASK)]); |
1563 pR = (iDynamicResDependencyList[(pCL->iResourceId & ID_INDEX_BIT_MASK)]); |
1568 break; |
1564 break; |
1569 } |
1565 } |
1570 #else |
1566 #else |
1571 pR = iStaticResourceArray[pCL->iResourceId -1]; |
1567 pR = iStaticResourceArray[pCL->iResourceId - 1]; |
1572 #endif |
1568 #endif |
1573 #ifdef PRM_ENABLE_EXTENDED_VERSION |
1569 #ifdef PRM_ENABLE_EXTENDED_VERSION |
1574 if(((pR->Sense() == DStaticPowerResource::ECustom) || ((TInt)pCL->iClientId == pR->iLevelOwnerId)) && (!(pCL->iResourceId & KIdMaskDynamic) || |
1570 if(((pR->Sense() == DStaticPowerResource::ECustom) || ((TInt)pCL->iClientId == pR->iLevelOwnerId)) && (!(pCL->iResourceId & KIdMaskDynamic) || |
1575 ((pCL->iResourceId & KIdMaskDynamic) && (((DDynamicPowerResource*)pR)->LockCount() != 0)))) |
1571 ((pCL->iResourceId & KIdMaskDynamic) && (((DDynamicPowerResource*)pR)->LockCount() != 0)))) |
1576 #else |
1572 #else |
1735 ResourceStateChangeOfClientLevels(pC); |
1731 ResourceStateChangeOfClientLevels(pC); |
1736 // Add reserved request to pool |
1732 // Add reserved request to pool |
1737 iRequestPoolCount = (TUint16)(iRequestPoolCount + (TUint16)pC->iReservedRm); |
1733 iRequestPoolCount = (TUint16)(iRequestPoolCount + (TUint16)pC->iReservedRm); |
1738 PRM_CLIENT_DEREGISTER_TRACE |
1734 PRM_CLIENT_DEREGISTER_TRACE |
1739 //Increment the free pool count for client level and request level. |
1735 //Increment the free pool count for client level and request level. |
1740 iClientList.Remove(pC, (TUint16)(pC->iClientId & ID_INDEX_BIT_MASK)); |
1736 iClientList.Remove(pC, (pC->iClientId & ID_INDEX_BIT_MASK)); |
1741 pC->iName = NULL; |
1737 pC->iName = NULL; |
1742 iClientCount--; //Decrement client count |
1738 iClientCount--; //Decrement client count |
1743 LIST_PUSH(iClientPool, pC, iNextInList); |
1739 LIST_PUSH(iClientPool, pC, iNextInList); |
1744 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::DeRegisterClient")); |
1740 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::DeRegisterClient")); |
1745 UNLOCK_RETURN(KErrNone); |
1741 UNLOCK_RETURN(KErrNone); |
1894 aResourceId = pDR->iResourceId; |
1890 aResourceId = pDR->iResourceId; |
1895 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::GetResourceId, ResourceId = 0x%x", aResourceId)); |
1891 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::GetResourceId, ResourceId = 0x%x", aResourceId)); |
1896 UNLOCK_RETURN(KErrNone); |
1892 UNLOCK_RETURN(KErrNone); |
1897 } |
1893 } |
1898 //Search in static resource with dependencies (if exists) for specified resource name |
1894 //Search in static resource with dependencies (if exists) for specified resource name |
1899 for(count = 0; count < iStaticResDependencyCount; count++) |
1895 for(count = 0; count < iStaticResDependencyArray.Count(); count++) |
1900 { |
1896 { |
1901 if(!(aResourceName.Compare(*(const TDesC8*)iStaticResDependencyArray[count]->iName))) |
1897 if(!(aResourceName.Compare(*(const TDesC8*)iStaticResDependencyArray[count]->iName))) |
1902 { |
1898 { |
1903 aResourceId = iStaticResDependencyArray[count]->iResourceId; |
1899 aResourceId = iStaticResDependencyArray[count]->iResourceId; |
1904 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::GetResourceId, ResourceId = 0x%x", aResourceId)); |
1900 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DPowerResourceController::GetResourceId, ResourceId = 0x%x", aResourceId)); |
2113 TDes8 *pInfo = (TDes8*)anInfo; |
2109 TDes8 *pInfo = (TDes8*)anInfo; |
2114 if((TUint)(pInfo->MaxLength() - pInfo->Length()) < (sizeof(TPowerResourceInfoV01) * aNumResources)) |
2110 if((TUint)(pInfo->MaxLength() - pInfo->Length()) < (sizeof(TPowerResourceInfoV01) * aNumResources)) |
2115 UNLOCK_RETURN(KErrArgument); |
2111 UNLOCK_RETURN(KErrArgument); |
2116 TPowerResourceInfoBuf01 buf; |
2112 TPowerResourceInfoBuf01 buf; |
2117 |
2113 |
2118 TUint16 count = 0; |
2114 TInt count = 0; |
2119 TInt r = KErrNone; |
2115 TInt r = KErrNone; |
2120 //Special case, if aTargetClientId is 0 fill with all the resource |
2116 //Special case, if aTargetClientId is 0 fill with all the resource |
2121 if(!aTargetClientId) |
2117 if(!aTargetClientId) |
2122 { |
2118 { |
2123 TUint numResources = aNumResources; |
2119 TInt numResources = aNumResources; |
2124 #ifndef PRM_ENABLE_EXTENDED_VERSION |
2120 #ifndef PRM_ENABLE_EXTENDED_VERSION |
2125 aNumResources = iStaticResourceCount; |
2121 aNumResources = iStaticResourceCount; |
2126 #else |
2122 #else |
2127 aNumResources = iStaticResourceCount + iDynamicResourceCount + iStaticResDependencyCount + |
2123 aNumResources = iStaticResourceCount + iDynamicResourceCount + iStaticResDependencyArray.Count() + |
2128 iDynamicResDependencyCount; |
2124 iDynamicResDependencyCount; |
2129 #endif |
2125 #endif |
2130 UnLock(); |
2126 UnLock(); |
2131 while(count < iStaticResourceArrayEntries) |
2127 while(count < iStaticResourceArray.Count()) |
2132 { |
2128 { |
2133 if(numResources <=0) |
2129 if(numResources == 0) |
2134 return KErrNone; |
2130 return KErrNone; |
2135 pR = iStaticResourceArray[count++]; |
2131 pR = iStaticResourceArray[count++]; |
2136 if(!pR) |
2132 if(!pR) |
2137 continue; |
2133 continue; |
2138 r = pR->GetInfo((TDes8*)buf.Ptr()); |
2134 r = pR->GetInfo((TDes8*)buf.Ptr()); |
2403 |
2399 |
2404 Request changing the state of a resource |
2400 Request changing the state of a resource |
2405 NOTE: If a resource callback is specified for instantaneous resource, then callback |
2401 NOTE: If a resource callback is specified for instantaneous resource, then callback |
2406 will be called after resource change and will be executed in the context of the |
2402 will be called after resource change and will be executed in the context of the |
2407 client thread. |
2403 client thread. |
2408 If a resource callback is specified for long latency reosurces, then it will be |
2404 If a resource callback is specified for long latency resources, then it will be |
2409 executed asynchronously.When the request is accepted the API returns immediately |
2405 executed asynchronously.When the request is accepted the API returns immediately |
2410 and the calling thread is unblocked: the callback (called in the client's context) |
2406 and the calling thread is unblocked: the callback (called in the client's context) |
2411 will be invoked when the resource change finally takes place. |
2407 will be invoked when the resource change finally takes place. |
2412 If aCb is not specified (NULL by default) the API executes synchronously and will |
2408 If aCb is not specified (NULL by default) the API executes synchronously and will |
2413 only return when the resource change has taken place for long latency resource. |
2409 only return when the resource change has taken place for long latency resource. |
2422 binary resource, an integer level for a multilevel resource or some |
2418 binary resource, an integer level for a multilevel resource or some |
2423 platform specific token for a multi-property resource. |
2419 platform specific token for a multi-property resource. |
2424 @param aCb For Long latency resource |
2420 @param aCb For Long latency resource |
2425 A pointer to a resource callback object which encapsulates a |
2421 A pointer to a resource callback object which encapsulates a |
2426 callback function to be called whenever the resource state change |
2422 callback function to be called whenever the resource state change |
2427 happens (if left NULL the API will execute synchrounously). |
2423 happens (if left NULL the API will execute synchronously). |
2428 For Instantaneous resource |
2424 For Instantaneous resource |
2429 A pointer to a resource callback object which encapsulates a callback |
2425 A pointer to a resource callback object which encapsulates a callback |
2430 function to be called after resource change. This executes in the |
2426 function to be called after resource change. This executes in the |
2431 context of the client thread. |
2427 context of the client thread. |
2432 |
2428 |
2766 @param aCached If ETrue, cached value will be updated in aState. |
2762 @param aCached If ETrue, cached value will be updated in aState. |
2767 If EFalse, aState will be updated after the resource |
2763 If EFalse, aState will be updated after the resource |
2768 state is read from resource. |
2764 state is read from resource. |
2769 @param aState Returns the resource state if operation was successful. This |
2765 @param aState Returns the resource state if operation was successful. This |
2770 could be a binary value for a binary resource, an integer level |
2766 could be a binary value for a binary resource, an integer level |
2771 for a multilevel resource or some platform specific tolen for a |
2767 for a multilevel resource or some platform specific token for a |
2772 multi-property resource. |
2768 multi-property resource. |
2773 @param aLevelOwnerId Returns the Id of the client that is currently holding the resource. |
2769 @param aLevelOwnerId Returns the Id of the client that is currently holding the resource. |
2774 -1 is returned when no client is holding the resource. |
2770 -1 is returned when no client is holding the resource. |
2775 |
2771 |
2776 @return KErrNone if operation was successful |
2772 @return KErrNone if operation was successful |
3096 @prototype 9.5 |
3092 @prototype 9.5 |
3097 |
3093 |
3098 Cancel an asynchronous request(or its callback). |
3094 Cancel an asynchronous request(or its callback). |
3099 |
3095 |
3100 @param aClientId ID of the client which is requesting the cancellation of the request. |
3096 @param aClientId ID of the client which is requesting the cancellation of the request. |
3101 @param aResourceId ID for the resource which the request that is being cancelled operates |
3097 @param aResourceId ID for the resource which the request that is being canceled operates |
3102 upon. |
3098 upon. |
3103 @param aCb A reference to the resource callback object specified with the request |
3099 @param aCb A reference to the resource callback object specified with the request |
3104 that is being cancelled. |
3100 that is being canceled. |
3105 |
3101 |
3106 @return KErrCancel if the request was cancelled. |
3102 @return KErrCancel if the request was canceled. |
3107 KErrNotFound if this resource ID could not be found in the current list of controllable |
3103 KErrNotFound if this resource ID could not be found in the current list of controllable |
3108 resources. |
3104 resources. |
3109 KErrCompletion if request is no longer pending. |
3105 KErrCompletion if request is no longer pending. |
3110 KErrAccessDenied if the client ID could not be found in the current list of registered |
3106 KErrAccessDenied if the client ID could not be found in the current list of registered |
3111 clients or if the client was registered to be thread relative and this API is not called |
3107 clients or if the client was registered to be thread relative and this API is not called |
3112 from the same thread or if client is not the same that requested the resource state change. |
3108 from the same thread or if client is not the same that requested the resource state change. |
3113 KErrInUse if the request cannot be cancelled as processing of the request already started |
3109 KErrInUse if the request cannot be canceled as processing of the request already started |
3114 and will run to completion. |
3110 and will run to completion. |
3115 |
3111 |
3116 @pre Interrupts must be enabled |
3112 @pre Interrupts must be enabled |
3117 @pre Kernel must be unlocked |
3113 @pre Kernel must be unlocked |
3118 @pre No fast mutex can be held |
3114 @pre No fast mutex can be held |
3228 thread relative and this API is not called from the same thread. |
3224 thread relative and this API is not called from the same thread. |
3229 KErrInUse if the passed notification object is used already. |
3225 KErrInUse if the passed notification object is used already. |
3230 NOTE: This API should return immediately; however the notification will |
3226 NOTE: This API should return immediately; however the notification will |
3231 only happen when a resource change occurs.Notification request is idempotent, |
3227 only happen when a resource change occurs.Notification request is idempotent, |
3232 if the same notification has already been requested for this resource ID, |
3228 if the same notification has already been requested for this resource ID, |
3233 the API returns with no further action.Notifications remain queued until they are cancelled. |
3229 the API returns with no further action.Notifications remain queued until they are canceled. |
3234 |
3230 |
3235 @pre Interrupts must be enabled |
3231 @pre Interrupts must be enabled |
3236 @pre Kernel must be unlocked |
3232 @pre Kernel must be unlocked |
3237 @pre No fast mutex can be held |
3233 @pre No fast mutex can be held |
3238 @pre Call in a thread context but not from null thread or DFC thread1 |
3234 @pre Call in a thread context but not from null thread or DFC thread1 |
3320 |
3316 |
3321 |
3317 |
3322 |
3318 |
3323 @return KErrNone if the operation of requesting a notification was successful. |
3319 @return KErrNone if the operation of requesting a notification was successful. |
3324 KErrNotFound if this resource ID could not be found in the current list |
3320 KErrNotFound if this resource ID could not be found in the current list |
3325 of controllable reosurces. |
3321 of controllable resources. |
3326 KErrAccessDenied if the client ID could not be found in the list of |
3322 KErrAccessDenied if the client ID could not be found in the list of |
3327 registered clients or if the client was registered to be thread |
3323 registered clients or if the client was registered to be thread |
3328 relative and this API is not called from the same thread. |
3324 relative and this API is not called from the same thread. |
3329 KErrInUse if the passed notification object is used already. |
3325 KErrInUse if the passed notification object is used already. |
3330 KErrArgument if the specified threshold is out of range. |
3326 KErrArgument if the specified threshold is out of range. |
3331 NOTE: This API should return immediately; however the notification will only |
3327 NOTE: This API should return immediately; however the notification will only |
3332 happen when a resource change occurs. Notification request is idempotent, |
3328 happen when a resource change occurs. Notification request is idempotent, |
3333 if the same notification has already been requested for this resource ID, |
3329 if the same notification has already been requested for this resource ID, |
3334 the API returns with no further action. Notification remain queued until they are cancelled. |
3330 the API returns with no further action. Notification remain queued until they are canceled. |
3335 |
3331 |
3336 @pre Interrupts must be enabled |
3332 @pre Interrupts must be enabled |
3337 @pre Kernel must be unlocked |
3333 @pre Kernel must be unlocked |
3338 @pre No fast mutex can be held |
3334 @pre No fast mutex can be held |
3339 @pre Call in a thread context but not from null thread or DFC thread1 |
3335 @pre Call in a thread context but not from null thread or DFC thread1 |
3423 Cancel and remove from queue a previously issued request for notification on a |
3419 Cancel and remove from queue a previously issued request for notification on a |
3424 resource state change. |
3420 resource state change. |
3425 |
3421 |
3426 @param aClientId ID of the client which is requesting to cancel the notification |
3422 @param aClientId ID of the client which is requesting to cancel the notification |
3427 @param aResourceId for the resource whose pending notification of state changes |
3423 @param aResourceId for the resource whose pending notification of state changes |
3428 is being cancelled. |
3424 is being canceled. |
3429 @param aN A reference to the notification object that was associated with |
3425 @param aN A reference to the notification object that was associated with |
3430 the notification request that is being cancelled. This will be |
3426 the notification request that is being canceled. This will be |
3431 used to identify the notification that is being cancelled. |
3427 used to identify the notification that is being canceled. |
3432 |
3428 |
3433 @return KErrCancel if the notification request was successfully cancelled. |
3429 @return KErrCancel if the notification request was successfully canceled. |
3434 KErrNotFound if the specified notification object is |
3430 KErrNotFound if the specified notification object is |
3435 not found in the current list of notification objects for the |
3431 not found in the current list of notification objects for the |
3436 specified resource. |
3432 specified resource. |
3437 KErrAccessDenied if the client requesting the cancellation is not the same |
3433 KErrAccessDenied if the client requesting the cancellation is not the same |
3438 which registered the notification or if the resource id does not match or |
3434 which registered the notification or if the resource id does not match or |
3756 ResourceStateChangeOfClientLevels(pC); |
3752 ResourceStateChangeOfClientLevels(pC); |
3757 //Add reserved request to pool |
3753 //Add reserved request to pool |
3758 iRequestPoolCount = (TUint16)(iRequestPoolCount + pC->iReservedRm); |
3754 iRequestPoolCount = (TUint16)(iRequestPoolCount + pC->iReservedRm); |
3759 PRM_CLIENT_DEREGISTER_TRACE |
3755 PRM_CLIENT_DEREGISTER_TRACE |
3760 //Increment the free pool count for client level and request level. |
3756 //Increment the free pool count for client level and request level. |
3761 iUserSideClientList.Remove(pC, (TUint16)(pC->iClientId & ID_INDEX_BIT_MASK)); |
3757 iUserSideClientList.Remove(pC, (pC->iClientId & ID_INDEX_BIT_MASK)); |
3762 pC->iName = NULL; |
3758 pC->iName = NULL; |
3763 iUserSideClientCount--; //Decrement client count |
3759 iUserSideClientCount--; //Decrement client count |
3764 LIST_PUSH(iClientPool, pC, iNextInList); |
3760 LIST_PUSH(iClientPool, pC, iNextInList); |
3765 UnLock(); |
3761 UnLock(); |
3766 LOCK_AND_CRITICAL_SECTION_COUNT_CHECK |
3762 LOCK_AND_CRITICAL_SECTION_COUNT_CHECK |