kernel/eka/drivers/resourceman/resourcecontrol.cpp
changeset 252 0a40b8675b23
parent 244 a77889bee936
equal deleted inserted replaced
245:647ab20fee2e 252:0a40b8675b23
   732 		DDynamicPowerResourceD* pDRes;
   732 		DDynamicPowerResourceD* pDRes;
   733 		if(aReq->ClientId() & KIdMaskDynamic)
   733 		if(aReq->ClientId() & KIdMaskDynamic)
   734 			pDRes = pRC->iDynamicResDependencyList[(aReq->ClientId() & ID_INDEX_BIT_MASK)];	
   734 			pDRes = pRC->iDynamicResDependencyList[(aReq->ClientId() & ID_INDEX_BIT_MASK)];	
   735 		else
   735 		else
   736 			pDRes = (DDynamicPowerResourceD*)pRC->iStaticResDependencyArray[(aReq->ClientId() & ID_INDEX_BIT_MASK) - 1];
   736 			pDRes = (DDynamicPowerResourceD*)pRC->iStaticResDependencyArray[(aReq->ClientId() & ID_INDEX_BIT_MASK) - 1];
   737 		pC->iName = pDRes->iName;
   737 		
       
   738 		if (pDRes != NULL)
       
   739 		    {
       
   740             pC->iName = pDRes->iName;
       
   741 		    }
       
   742 		else
       
   743 		    {
       
   744             pC->iName = &KNullDesC;
       
   745 		    }
   738 		}
   746 		}
   739 	else if((aReq->ClientId() == -1) || (aReq->ClientId() == KDynamicResourceDeRegistering))
   747 	else if((aReq->ClientId() == -1) || (aReq->ClientId() == KDynamicResourceDeRegistering))
   740 		{
   748 		{
   741         pC = &tRes;
   749         pC = &tRes;
   742         pC->iClientId = (TUint)-1;
   750         pC->iClientId = (TUint)-1;
  1382 			//Store the current thread Id;
  1390 			//Store the current thread Id;
  1383 			pC->iThreadId = thread.iId;
  1391 			pC->iThreadId = thread.iId;
  1384 			}
  1392 			}
  1385 		pC->iName = &aName;
  1393 		pC->iName = &aName;
  1386 		aClientId = pC->iClientId;
  1394 		aClientId = pC->iClientId;
  1387 		}
  1395 	    PRM_CLIENT_REGISTER_TRACE
  1388     PRM_CLIENT_REGISTER_TRACE
  1396 	    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DPowerResourceController::RegisterClient, clientId = 0x%x", aClientId));
  1389 	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">DPowerResourceController::RegisterClient, clientId = 0x%x", aClientId));
  1397 		}
  1390 	return(req->ReturnCode());
  1398 	return(req->ReturnCode());
  1391 	}
  1399 	}
  1392 
  1400 
  1393 #ifdef PRM_ENABLE_EXTENDED_VERSION
  1401 #ifdef PRM_ENABLE_EXTENDED_VERSION
  1394 TInt DPowerResourceController::HandleResourceRegistration(TPowerRequest& aReq)
  1402 TInt DPowerResourceController::HandleResourceRegistration(TPowerRequest& aReq)
  1565 			}
  1573 			}
  1566 #else
  1574 #else
  1567 		pR = iStaticResourceArray[pCL->iResourceId - 1];
  1575 		pR = iStaticResourceArray[pCL->iResourceId - 1];
  1568 #endif
  1576 #endif
  1569 #ifdef PRM_ENABLE_EXTENDED_VERSION
  1577 #ifdef PRM_ENABLE_EXTENDED_VERSION
  1570 		if(((pR->Sense() == DStaticPowerResource::ECustom) || ((TInt)pCL->iClientId == pR->iLevelOwnerId)) && (!(pCL->iResourceId & KIdMaskDynamic) ||
  1578 		if(pR  &&  (((pR->Sense() == DStaticPowerResource::ECustom) || ((TInt)pCL->iClientId == pR->iLevelOwnerId)) && (!(pCL->iResourceId & KIdMaskDynamic) ||
  1571 			         ((pCL->iResourceId & KIdMaskDynamic) && (((DDynamicPowerResource*)pR)->LockCount() != 0))))
  1579 			         ((pCL->iResourceId & KIdMaskDynamic) && (((DDynamicPowerResource*)pR)->LockCount() != 0)))))
  1572 #else
  1580 #else
  1573 		if((pR->Sense() == DStaticPowerResource::ECustom) || ((TInt)pCL->iClientId == pR->iLevelOwnerId)) 
  1581 		if(pR  &&  ((pR->Sense() == DStaticPowerResource::ECustom) || ((TInt)pCL->iClientId == pR->iLevelOwnerId))) 
  1574 #endif
  1582 #endif
  1575 		    {
  1583 		    {
  1576             pReq->ReqType() = TPowerRequest::ESetDefaultLevel;
  1584             pReq->ReqType() = TPowerRequest::ESetDefaultLevel;
  1577             pReq->ResourceId() = pCL->iResourceId;
  1585             pReq->ResourceId() = pCL->iResourceId;
  1578             pReq->ClientId() = pCL->iClientId;
  1586             pReq->ClientId() = pCL->iClientId;
  3684 		pC = iUserSideClientList[(req->ClientId() & ID_INDEX_BIT_MASK)];
  3692 		pC = iUserSideClientList[(req->ClientId() & ID_INDEX_BIT_MASK)];
  3685 		pC->iName=&aName;
  3693 		pC->iName=&aName;
  3686 		//Store the current thread Id;
  3694 		//Store the current thread Id;
  3687 		pC->iThreadId = t.iId;
  3695 		pC->iThreadId = t.iId;
  3688 		aClientId = pC->iClientId;
  3696 		aClientId = pC->iClientId;
  3689 		}
  3697 	    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DPowerResourceController::RegisterProxyClient, clientId = 0x%x", aClientId));
  3690 	__KTRACE_OPT(KRESMANAGER, Kern::Printf(">DPowerResourceController::RegisterProxyClient, clientId = 0x%x", aClientId));
  3698 	    PRM_CLIENT_REGISTER_TRACE
  3691     PRM_CLIENT_REGISTER_TRACE
  3699 		}
  3692 	LOCK_AND_CRITICAL_SECTION_COUNT_CHECK
  3700 	LOCK_AND_CRITICAL_SECTION_COUNT_CHECK
  3693 	return KErrNone;
  3701 	return KErrNone;
  3694 	}
  3702 	}
  3695 
  3703 
  3696 /*  Deregister the specified user side client from resource controller.
  3704 /*  Deregister the specified user side client from resource controller.
  3829 		pS->iCurrentLevel = pR->iCachedLevel;
  3837 		pS->iCurrentLevel = pR->iCachedLevel;
  3830 		pR->iIdleListEntry=pS;
  3838 		pR->iIdleListEntry=pS;
  3831 		pS++;
  3839 		pS++;
  3832 		}
  3840 		}
  3833 	iListForIdle=(SIdleResourceInfo*)aBuf->Ptr();
  3841 	iListForIdle=(SIdleResourceInfo*)aBuf->Ptr();
  3834 	pS = (SIdleResourceInfo*)aBuf->Ptr();
       
  3835 	UnLock();
  3842 	UnLock();
  3836 	LOCK_AND_CRITICAL_SECTION_COUNT_CHECK
  3843 	LOCK_AND_CRITICAL_SECTION_COUNT_CHECK
  3837 	return KErrNone;
  3844 	return KErrNone;
  3838 	}
  3845 	}
  3839 	
  3846