3
|
1 |
/*
|
|
2 |
pm_services_chipset_api.h
|
|
3 |
|
|
4 |
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
5 |
All rights reserved.
|
|
6 |
|
|
7 |
This program and the accompanying materials are made available
|
|
8 |
under the terms of the Eclipse Public License v1.0 which accompanies
|
|
9 |
this distribution, and is available at
|
|
10 |
http://www.eclipse.org/legal/epl-v10.html
|
|
11 |
|
|
12 |
Initial Contributors:
|
|
13 |
Nokia Corporation - initial contribution.
|
|
14 |
|
|
15 |
Contributors:
|
|
16 |
*/
|
|
17 |
|
|
18 |
/** @file
|
|
19 |
@brief PM Services Chipset API H
|
|
20 |
|
|
21 |
The purpose of this interface is to enable Nokia to test power management
|
|
22 |
functionalities implemented below the Chipset API. This interface is meant to be
|
|
23 |
used only by Symbian kernel side clients.
|
|
24 |
|
|
25 |
@publishedDeviceAbstraction
|
|
26 |
*/
|
|
27 |
|
|
28 |
#ifndef PM_SERVICES_CHIPSET_API_H
|
|
29 |
#define PM_SERVICES_CHIPSET_API_H
|
|
30 |
|
|
31 |
// Include files
|
|
32 |
|
|
33 |
#include <kern_priv.h>
|
|
34 |
#include "pm_definitions_chipset_api.h"
|
|
35 |
|
|
36 |
// Data types
|
|
37 |
|
|
38 |
/**
|
|
39 |
Dvfs monitor callback function
|
|
40 |
@param aMonitor monitor id
|
|
41 |
@param aLoad load (casted in case of non-integer types)
|
|
42 |
*/
|
|
43 |
typedef void (*TDvfsMonitorCbFn)(TDvfsMonitor aMonitor, TUint32 aLoad);
|
|
44 |
|
|
45 |
/**
|
|
46 |
Idle entry callback function
|
|
47 |
@param aMode Target sleep mode
|
|
48 |
@param aPtr Client parameter
|
|
49 |
*/
|
|
50 |
typedef void (*TIdleEntryCbFn)(TInt aMode, TAny* aPtr);
|
|
51 |
|
|
52 |
/**
|
|
53 |
Idle exit callback function
|
|
54 |
@param aMode Sleep mode just exited
|
|
55 |
@param aPtr Client parameter
|
|
56 |
*/
|
|
57 |
typedef void (*TIdleExitCbFn)(TInt aMode, TUint32 aIdleTime, TAny* aPtr);
|
|
58 |
|
|
59 |
// Class declaration
|
|
60 |
|
|
61 |
/**
|
|
62 |
@brief Class description
|
|
63 |
|
|
64 |
This class contains static methods to set and get certain power management
|
|
65 |
services parameters. There are no data members.
|
|
66 |
*/
|
|
67 |
class PMServices
|
|
68 |
{
|
|
69 |
public:
|
|
70 |
/**
|
|
71 |
The integer aLevel will be passed and this will represent the forced
|
|
72 |
OPP.
|
|
73 |
@param aRes The ID for a power resource(CPU, DMA) that will be forced to
|
|
74 |
an OPP.
|
|
75 |
@param aLevel An integer, which represents the forced OPP level.
|
|
76 |
@return One of the system wide Symbian error codes according to the API
|
|
77 |
error handling specification.
|
|
78 |
@pre Called from thread context with interrupts enabled.
|
|
79 |
*/
|
|
80 |
IMPORT_C static TInt ForceSystemOPP(TPerfRes aRes, TInt aLevel);
|
|
81 |
|
|
82 |
/**
|
|
83 |
A resource is no longer forced to a particular OPP. The OPP will now be
|
|
84 |
based on the DVFS algorithms. If the system was not forced then no
|
|
85 |
action need take place.
|
|
86 |
@param aRes resource id.
|
|
87 |
@return One of the system wide Symbian error codes according to the API
|
|
88 |
error handling specification.
|
|
89 |
@pre Called from thread context with interrupts enabled.
|
|
90 |
*/
|
|
91 |
IMPORT_C static TInt UnForceSystemOPP(TPerfRes aRes);
|
|
92 |
|
|
93 |
/**
|
|
94 |
Gets the number of supported global sleep states.
|
|
95 |
@return Number of sleep states supported
|
|
96 |
@pre Called from thread context with interrupts enabled.
|
|
97 |
*/
|
|
98 |
IMPORT_C static TInt GetNumSleepStates();
|
|
99 |
|
|
100 |
/**
|
|
101 |
Blocks a certain sleep state.
|
|
102 |
@param aSleepState The Sleep state to be blocked..
|
|
103 |
@return One of the system wide Symbian error codes according to the API
|
|
104 |
error handling specification.
|
|
105 |
@pre Called from thread context with interrupts enabled.
|
|
106 |
*/
|
|
107 |
IMPORT_C static TInt BlockSleepState(TInt aSleepState);
|
|
108 |
|
|
109 |
/**
|
|
110 |
Un-blocks a certain sleep state.
|
|
111 |
@param aSleepState The Sleep state to be un-blocked..
|
|
112 |
@return One of the system wide Symbian error codes according to the API
|
|
113 |
error handling specification.
|
|
114 |
@pre Called from thread context with interrupts enabled.
|
|
115 |
*/
|
|
116 |
IMPORT_C static TInt UnBlockSleepState(TInt aSleepState);
|
|
117 |
|
|
118 |
/**
|
|
119 |
Starts the monitoring and load prediction algorithms but does nothing to
|
|
120 |
the OPP.
|
|
121 |
@param aRes The ID for a power resource(CPU, DMA) that will now start to
|
|
122 |
use the DVFS algorithms.
|
|
123 |
@return One of the system wide Symbian error codes according to the API
|
|
124 |
error handling specification.
|
|
125 |
@pre Called from thread context with interrupts enabled.
|
|
126 |
*/
|
|
127 |
IMPORT_C static TInt EnableDVFS(TPerfRes aRes);
|
|
128 |
|
|
129 |
/**
|
|
130 |
Stops the monitoring and load prediction algorithms. This API will not
|
|
131 |
change the OPP. The OPP will remain the same as it was before this API
|
|
132 |
was called
|
|
133 |
@param aRes The ID for a power resource(CPU, DMA) that will no longer
|
|
134 |
use the DVFS algorithms.
|
|
135 |
@return One of the system wide Symbian error codes according to the API
|
|
136 |
error handling specification.
|
|
137 |
@pre Called from thread context with interrupts enabled.
|
|
138 |
*/
|
|
139 |
IMPORT_C static TInt DisableDVFS(TPerfRes aRes);
|
|
140 |
|
|
141 |
/**
|
|
142 |
Finds out if the DVFS algorithms are currently running for a given power
|
|
143 |
resource.
|
|
144 |
@param aRes Find out if the DVFS algorithms are working for this
|
|
145 |
particular power resource ID .
|
|
146 |
@return ETrue if DVFS enabled, EFalse otherwise.
|
|
147 |
@pre Called from thread context with interrupts enabled.
|
|
148 |
*/
|
|
149 |
IMPORT_C static TBool IsDVFSEnabled(TPerfRes aRes);
|
|
150 |
|
|
151 |
/**
|
|
152 |
Gets the current load of a given HW block.
|
|
153 |
@param aMon Monitor id
|
|
154 |
@param aLoad Load value (casted into TUint32 in case of non-integer
|
|
155 |
types)
|
|
156 |
@return One of the system wide Symbian error codes according to the API
|
|
157 |
error handling specification.
|
|
158 |
@pre Called from thread context with interrupts enabled.
|
|
159 |
*/
|
|
160 |
IMPORT_C static TInt GetCurrentLoad(TDvfsMonitor aMon, TUint32 aLoad);
|
|
161 |
|
|
162 |
/**
|
|
163 |
Register to receive notifications of a change in load for a given
|
|
164 |
monitor.
|
|
165 |
@param aCb callback function pointer
|
|
166 |
@param aMon monitor id.
|
|
167 |
@param aGranuality The percentage change at which notifications will be
|
|
168 |
sent. Zero will mean that notifications will be sent straight away.
|
|
169 |
@return One of the system wide Symbian error codes according to the API
|
|
170 |
error handling specification.
|
|
171 |
@pre Called from thread context with interrupts enabled. The preferable
|
|
172 |
way to call this function is from a thread context with interrupts
|
|
173 |
enabled after all the kernel extensions have been initialized in the
|
|
174 |
boot up.
|
|
175 |
*/
|
|
176 |
IMPORT_C static TInt RegisterForLoadObservations(TDvfsMonitorCbFn aCb,
|
|
177 |
TDvfsMonitor aMon, TInt aGranuality);
|
|
178 |
/**
|
|
179 |
Method to cancel any load observation callback.
|
|
180 |
@param aCb callback function pointer
|
|
181 |
@param aMon monitor id.
|
|
182 |
@return One of the system wide Symbian error codes according to the API
|
|
183 |
error handling specification.
|
|
184 |
@pre Called from thread context with interrupts enabled.
|
|
185 |
*/
|
|
186 |
IMPORT_C static TInt DeRegisterForLoadObservations(TDvfsMonitorCbFn
|
|
187 |
aCb, TDvfsMonitor aMon);
|
|
188 |
|
|
189 |
/**
|
|
190 |
Method to get the number of supported OPPs for a given performance
|
|
191 |
resource.
|
|
192 |
@param aRes performance resource id.
|
|
193 |
@return The resource’s available OPPs.
|
|
194 |
@pre Called from thread context with interrupts enabled.
|
|
195 |
*/
|
|
196 |
IMPORT_C static TInt GetNumOPPs(TPerfRes aRes);
|
|
197 |
|
|
198 |
/**
|
|
199 |
Get the workload prediction window buffer pointer (Symbian kernel data).
|
|
200 |
@return The window buffer pointer (casted into TUint32 type)
|
|
201 |
@pre Called from thread context with interrupts enabled.
|
|
202 |
*/
|
|
203 |
IMPORT_C static TUint32 GetWpWindowBuf();
|
|
204 |
|
|
205 |
/**
|
|
206 |
Request for idle entry callback.
|
|
207 |
@param aCbFn Callback function
|
|
208 |
@param aPtr A pointer to be passed to the callback function when called
|
|
209 |
@param aCore Core number. If -1, API applies to system idle
|
|
210 |
@return One of the system wide Symbian error codes according to the API
|
|
211 |
error handling specification.
|
|
212 |
@pre Called from thread context with interrupts enabled.
|
|
213 |
*/
|
|
214 |
IMPORT_C static TInt RequestIdleEntryCallback(TIdleEntryCbFn aCbFn,
|
|
215 |
TAny* aPtr, TInt aCore = -1);
|
|
216 |
|
|
217 |
/**
|
|
218 |
Request for idle exit callback
|
|
219 |
@param aCbFn Callback function
|
|
220 |
@param aPtr A pointer to be passed to the callback function when called
|
|
221 |
@param aCore Core number. If -1, API applies to system idle
|
|
222 |
@return One of the system wide Symbian error codes according to the API
|
|
223 |
error handling specification.
|
|
224 |
@pre Called from thread context with interrupts enabled.
|
|
225 |
*/
|
|
226 |
IMPORT_C static TInt RequestIdleExitCallback(TIdleExitCbFn aCbFn,
|
|
227 |
TAny* aPtr, TInt aCore = -1);
|
|
228 |
|
|
229 |
/**
|
|
230 |
Cancel idle entry callback
|
|
231 |
@param aCbFn Callback function
|
|
232 |
@param aCore Core number. If -1, API applies to system idle
|
|
233 |
@return One of the system wide Symbian error codes according to the API
|
|
234 |
error handling specification.
|
|
235 |
@pre Called from thread context with interrupts enabled.
|
|
236 |
*/
|
|
237 |
IMPORT_C static TInt CancelIdleEntryCallback(TIdleEntryCbFn aCbFn,
|
|
238 |
TInt aCore);
|
|
239 |
|
|
240 |
/**
|
|
241 |
Cancel idle exit callback
|
|
242 |
@param aCbFn Callback function
|
|
243 |
@param aCore Core number. If -1, API applies to system idle
|
|
244 |
@return One of the system wide Symbian error codes according to the API
|
|
245 |
error handling specification.
|
|
246 |
@pre Called from thread context with interrupts enabled.
|
|
247 |
*/
|
|
248 |
IMPORT_C static TInt CancelIdleExitCallback(TIdleExitCbFn aCbFn,
|
|
249 |
TInt aCore);
|
|
250 |
|
|
251 |
/**
|
|
252 |
Method to get the hardware time based on a real time clock.
|
|
253 |
@return Hardware time in microseconds.
|
|
254 |
@pre Called from thread context with interrupts enabled.
|
|
255 |
*/
|
|
256 |
IMPORT_C static TUint32 HwTime();
|
|
257 |
|
|
258 |
/**
|
|
259 |
Retire a given number of cores. It is possible that no cores can be
|
|
260 |
retired because all remaining running cores have features not available
|
|
261 |
on any other core; and so may not allow any to be retired ( even if
|
|
262 |
there are no threads in the ready list that may require those features);
|
|
263 |
when that happens this API will fail (and return as error code).
|
|
264 |
@param aCount number of cores to retire
|
|
265 |
@return One of the system wide Symbian error codes according to the API
|
|
266 |
error handling specification.
|
|
267 |
@pre Called from thread context with interrupts enabled.
|
|
268 |
*/
|
|
269 |
IMPORT_C static TInt RetireCore(TInt aCount);
|
|
270 |
|
|
271 |
/**
|
|
272 |
Enables any retired cores. If no cores can be engaged due to all cores
|
|
273 |
being on or for some other reason then this API returns an error.
|
|
274 |
@param aEngage The number of cores to Engage.
|
|
275 |
@return One of the system wide Symbian error codes according to the API
|
|
276 |
error handling specification.
|
|
277 |
@pre Called from thread context with interrupts enabled.
|
|
278 |
*/
|
|
279 |
IMPORT_C static TInt EngageCore(TInt aEngage);
|
|
280 |
};
|
|
281 |
|
|
282 |
|
|
283 |
#endif // PM_SERVICES_CHIPSET_API_H
|