os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/inc/template_power.inl
Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // template\template_variant\inc\template_power.inl
15 // Template Power Management Inline file
16 // -/-/-/-/-/-/-/-/-/ class TTemplatePowerController /-/-/-/-/-/-/-/-/-/
20 inline void TTemplatePowerController::RegisterPowerController(DTemplatePowerController* aPowerController)
21 {iPowerController = aPowerController;}
23 //-/-/-/-/-/-/-/-/-/ class TemplateResourceManager /-/-/-/-/-/-/-/-/-/
25 inline TemplateResourceManager::TSleepModes TemplateResourceManager::MapSleepMode(TInt aSleepPeriod)
30 // Investigate what resources are On or Off, or used at what level and with the expected duration
31 // of Sleep map this to platform-specific Sleep mode
36 inline void TemplateResourceManager::Modify(TResource aResource, TBool aOnOff)
41 // This function is used to modify non-shared binary resources
42 // The following is an EXAMPLE ONLY:
46 case SynchBinResourceUsedByZOnly:
51 // Modify hardware register bit or bits to switch the resource On or Off as defined by aOnOff
52 // If the resource is only accessed by a driver and not from an ISR, there's no need to stop
53 // preemption. If it can be accessed from an ISR need to disable/enable interrupts around it.
58 case AsynchBinResourceUsedByZOnly:
62 // Modify hardware register bit or bits to switch the resource On or Off as defined by aOnOff
63 // and then wait until it has been modified.
64 // If the waits is only a few uS you could consider spinning, If it is considerable larger then
65 // you may need to use Kern::PollingWait passing a polling function, a pointer to a owning
66 // object a poll period in milliseconds and a maximum number of attempts. This will sleep
67 // the driver thread so if your driver is multithreaded and the resource can be accessed
68 // from more than one thread you may need to lock accesses to it with a fast Mutex.
69 // The completion of the change may be indicated by an interrupt: you still need to guarantee
70 // that the resource is not accessed until the change takes place.
78 inline void TemplateResourceManager::ModifyToLevel(TResource aResource, TInt aLevel)
83 // This function is used to modify non-shared multilevel resources
84 // The following is an EXAMPLE ONLY:
88 case SynchMlResourceUsedByXOnly:
93 // Modify hardware register bits to set the level of the resource to aLevel
94 // If the resource is only accessed by a driver and not from an ISR, there's no need to stop
95 // preemption. If it can be accessed from an ISR need to disable/enable interrupts around it.
100 case AsynchMlResourceUsedByXOnly:
104 // Modify hardware register bits to set the level of the resource to aLevel
105 // and then wait until it has been modified.
106 // If the waits is only a few uS you could consider spinning, If it is considerable larger then
107 // you may need to use Kern::PollingWait passing a polling function, a pointer to a owning
108 // object a poll period in milliseconds and a maximum number of attempts. This will sleep
109 // the driver thread so if your driver is multithreaded and the resource can be accessed
110 // from more than one thread you may need to lock accesses to it with a fast Mutex.
111 // The completion of the change may be indicated by an interrupt: you still need to guarantee
112 // that the resource is not accessed until the change takes place.
120 inline TBool TemplateResourceManager::GetResourceState(TResource aResource)
125 // Read from hardware (or from follower variable) and return the state of non-shared binary resource
132 inline TUint TemplateResourceManager::GetResourceLevel(TResource aResource)
137 // Read from hardware (or from follower variable) and return the level of non-shared multilevel resource
144 inline SharedBinaryResource1* TemplateResourceManager::SharedBResource1()
145 {return &iSharedBResource1;}
147 inline SharedMultilevelResource1* TemplateResourceManager::SharedMlResource1()
148 {return &iSharedMlResource1;}