author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 09 Jun 2010 11:10:19 +0300 | |
branch | RCL_3 |
changeset 36 | bbf8bed59bcb |
parent 0 | a41df078684a |
permissions | -rw-r--r-- |
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// hal\src\userhal.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include <kernel/hal_int.h> |
|
19 |
#include "u32std.h" |
|
20 |
#include <videodriver.h> |
|
21 |
||
22 |
||
23 |
||
24 |
_LIT(KLitHalUserHal,"HAL-UserHal"); |
|
25 |
||
26 |
enum THalUserHalPanic |
|
27 |
{ |
|
28 |
EInvalidStartupType=0, |
|
29 |
EInvalidAttributeDP=1, |
|
30 |
EInvalidAttributeDNM=2, |
|
31 |
EInvalidAttributeDM=3, |
|
32 |
EInvalidAttributeDS=4, |
|
33 |
EInvalidAttributeCMI=5, |
|
34 |
EInvalidAttributeSMI=6, |
|
35 |
EInvalidAttributeDC=7, |
|
36 |
EInvalidAttributeMB=8, |
|
37 |
EInvalidAttributeMC=9, |
|
38 |
EInvalidAttributeSMI2=10, |
|
39 |
EInvalidAttributeSD=11, |
|
40 |
EInvalidAttributeSDMA=12, |
|
41 |
EInvalidAttribKeybd=13, |
|
42 |
EInvalidAttribPen=14, |
|
43 |
EInvalidAttribMouse=15, |
|
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
EInvalidAttrib3DPointer=16, |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
EInvalidAttribDigitiserOrientation=17 |
0 | 46 |
}; |
47 |
||
48 |
void Panic(THalUserHalPanic aPanic) |
|
49 |
{ |
|
50 |
User::Panic(KLitHalUserHal,aPanic); |
|
51 |
} |
|
52 |
||
53 |
// ECPUSpeed |
|
54 |
TInt GetCPUSpeed(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
55 |
{ |
|
56 |
||
57 |
TVariantInfoV01 info; |
|
58 |
TPckg<TVariantInfoV01> infoPckg(info); |
|
59 |
TInt r=UserSvr::HalFunction(EHalGroupVariant, EVariantHalVariantInfo, (TAny*)&infoPckg, NULL); |
|
60 |
if (r==KErrNone) |
|
61 |
{ |
|
62 |
*(TInt*)aInOut=info.iProcessorClockInKHz; |
|
63 |
} |
|
64 |
return r; |
|
65 |
} |
|
66 |
||
67 |
// ECpuProfilingDefaultInterruptBase |
|
68 |
TInt GetCPUProfilerInterrupt(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
69 |
{ |
|
70 |
||
71 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalProfilingDefaultInterruptBase, aInOut, NULL); |
|
72 |
} |
|
73 |
||
74 |
||
75 |
// ESystemStartupReason |
|
76 |
TInt GetSystemStartupReason(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
77 |
{ |
|
78 |
TInt reason; |
|
79 |
TInt r=UserSvr::HalFunction(EHalGroupKernel, EKernelHalStartupReason, (TAny*)&reason, NULL); |
|
80 |
if (r==KErrNone) |
|
81 |
{ |
|
82 |
switch (reason) |
|
83 |
{ |
|
84 |
case EStartupCold: |
|
85 |
case EStartupColdReset: |
|
86 |
case EStartupNewOs: |
|
87 |
*(TInt*)aInOut=HAL::ESystemStartupReason_Cold; |
|
88 |
break; |
|
89 |
case EStartupPowerFail: |
|
90 |
case EStartupWarmReset: |
|
91 |
case EStartupSafeReset: |
|
92 |
*(TInt*)aInOut=HAL::ESystemStartupReason_Warm; |
|
93 |
break; |
|
94 |
case EStartupKernelFault: |
|
95 |
*(TInt*)aInOut=HAL::ESystemStartupReason_Fault; |
|
96 |
break; |
|
97 |
default: |
|
98 |
Panic(EInvalidStartupType); |
|
99 |
break; |
|
100 |
} |
|
101 |
} |
|
102 |
return r; |
|
103 |
} |
|
104 |
||
105 |
// ESystemException |
|
106 |
TInt GetSystemException(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
107 |
{ |
|
108 |
return UserSvr::HalFunction(EHalGroupKernel, EKernelHalExceptionId, aInOut, NULL); |
|
109 |
} |
|
110 |
||
111 |
// EMemoryRAM |
|
112 |
TInt GetRAMSize(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
113 |
{ |
|
114 |
TMemoryInfoV1 info; |
|
115 |
TPckg<TMemoryInfoV1> infoPckg(info); |
|
116 |
TInt r=UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemoryInfo, (TAny*)&infoPckg, NULL); |
|
117 |
if (r==KErrNone) |
|
118 |
{ |
|
119 |
*(TInt*)aInOut=info.iTotalRamInBytes; |
|
120 |
} |
|
121 |
return r; |
|
122 |
} |
|
123 |
||
124 |
// EMemoryRAMFree |
|
125 |
TInt GetFreeRAM(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
126 |
{ |
|
127 |
TMemoryInfoV1 info; |
|
128 |
TPckg<TMemoryInfoV1> infoPckg(info); |
|
129 |
TInt r=UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemoryInfo, (TAny*)&infoPckg, NULL); |
|
130 |
if (r==KErrNone) |
|
131 |
{ |
|
132 |
*(TInt*)aInOut=info.iFreeRamInBytes; |
|
133 |
} |
|
134 |
return r; |
|
135 |
} |
|
136 |
||
137 |
// EMemoryROM |
|
138 |
TInt GetROMSize(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
139 |
{ |
|
140 |
TMemoryInfoV1 info; |
|
141 |
TPckg<TMemoryInfoV1> infoPckg(info); |
|
142 |
TInt r=UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemoryInfo, (TAny*)&infoPckg, NULL); |
|
143 |
if (r==KErrNone) |
|
144 |
{ |
|
145 |
*(TInt*)aInOut=info.iTotalRomInBytes; |
|
146 |
} |
|
147 |
return r; |
|
148 |
} |
|
149 |
||
150 |
// EPowerGood |
|
151 |
TInt GetPowerGoodState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
152 |
{ |
|
153 |
TSupplyInfoV1 info; |
|
154 |
TPckg<TSupplyInfoV1> infoPckg(info); |
|
155 |
TInt r=UserSvr::HalFunction(EHalGroupPower, EPowerHalSupplyInfo, (TAny*)&infoPckg, NULL); |
|
156 |
if (r==KErrNone) |
|
157 |
{ |
|
158 |
TBool state=info.iExternalPowerPresent||(info.iMainBatteryStatus>=ELow); |
|
159 |
*(TBool*)aInOut=state; |
|
160 |
} |
|
161 |
return r; |
|
162 |
} |
|
163 |
||
164 |
// EPowerBatteryStatus |
|
165 |
TInt GetBatteryStatus(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
166 |
{ |
|
167 |
TSupplyInfoV1 info; |
|
168 |
TPckg<TSupplyInfoV1> infoPckg(info); |
|
169 |
TInt r=UserSvr::HalFunction(EHalGroupPower, EPowerHalSupplyInfo, (TAny*)&infoPckg, NULL); |
|
170 |
if (r==KErrNone) |
|
171 |
{ |
|
172 |
*(TInt*)aInOut=(TInt)info.iMainBatteryStatus; |
|
173 |
} |
|
174 |
return r; |
|
175 |
} |
|
176 |
||
177 |
// EAccessoryPower |
|
178 |
TInt GetAccessoryPowerPresent(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
179 |
{ |
|
180 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalAcessoryPowerPresent, aInOut, NULL); |
|
181 |
} |
|
182 |
||
183 |
// EPowerBackup |
|
184 |
TInt GetBackupPresent(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
185 |
{ |
|
186 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalBackupPresent, aInOut, NULL); |
|
187 |
} |
|
188 |
||
189 |
// EPowerBackupStatus |
|
190 |
TInt GetBackupStatus(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
191 |
{ |
|
192 |
TSupplyInfoV1 info; |
|
193 |
TPckg<TSupplyInfoV1> infoPckg(info); |
|
194 |
TInt r=UserSvr::HalFunction(EHalGroupPower, EPowerHalSupplyInfo, (TAny*)&infoPckg, NULL); |
|
195 |
if (r==KErrNone) |
|
196 |
{ |
|
197 |
*(TInt*)aInOut=(TInt)info.iBackupBatteryStatus; |
|
198 |
} |
|
199 |
return r; |
|
200 |
} |
|
201 |
||
202 |
// EPowerExternal |
|
203 |
TInt GetPowerExternalState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
204 |
{ |
|
205 |
TSupplyInfoV1 info; |
|
206 |
TPckg<TSupplyInfoV1> infoPckg(info); |
|
207 |
TInt r=UserSvr::HalFunction(EHalGroupPower, EPowerHalSupplyInfo, (TAny*)&infoPckg, NULL); |
|
208 |
if (r==KErrNone) |
|
209 |
{ |
|
210 |
*(TInt*)aInOut=(TInt)info.iExternalPowerPresent; |
|
211 |
} |
|
212 |
return r; |
|
213 |
} |
|
214 |
||
215 |
// EKeyboardState |
|
216 |
TInt ProcessKeyboardState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
217 |
{ |
|
218 |
if (aSet) |
|
219 |
return UserSvr::HalFunction(EHalGroupKeyboard, EKeyboardHalSetKeyboardState, aInOut, NULL); |
|
220 |
return UserSvr::HalFunction(EHalGroupKeyboard, EKeyboardHalKeyboardState, aInOut, NULL); |
|
221 |
} |
|
222 |
||
223 |
// EKeyboard, EKeyboardDeviceKeys and EKeyboardAppKeys |
|
224 |
TInt ProcessKeyboardInfo(TInt /*aDeviceNumber*/, TInt aAttrib, TBool /*aSet*/, TAny* aInOut) |
|
225 |
{ |
|
226 |
TKeyboardInfoV01 info; |
|
227 |
TPckg<TKeyboardInfoV01> infoPckg(info); |
|
228 |
TInt r=UserSvr::HalFunction(EHalGroupKeyboard, EKeyboardHalKeyboardInfo, (TAny*)&infoPckg, NULL); |
|
229 |
if (KErrNone == r) |
|
230 |
{ |
|
231 |
switch (aAttrib) |
|
232 |
{ |
|
233 |
case HAL::EKeyboard: |
|
234 |
*(TInt*)aInOut=(TInt)info.iKeyboardType; |
|
235 |
break; |
|
236 |
case HAL::EKeyboardDeviceKeys: |
|
237 |
*(TInt*)aInOut = info.iDeviceKeys; |
|
238 |
break; |
|
239 |
case HAL::EKeyboardAppKeys: |
|
240 |
*(TInt*)aInOut = info.iAppsKeys; |
|
241 |
break; |
|
242 |
default: |
|
243 |
__ASSERT_DEBUG(EFalse, Panic(EInvalidAttribKeybd)); |
|
244 |
break; |
|
245 |
} |
|
246 |
} |
|
247 |
return r; |
|
248 |
} |
|
249 |
||
250 |
// EKeyboardClick |
|
251 |
TInt GetKeyboardClickPresent(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
252 |
{ |
|
253 |
TInt state=0; |
|
254 |
TInt r=UserSvr::HalFunction(EHalGroupSound, ESoundHalKeyClickEnabled, (TAny*)state, NULL); |
|
255 |
*(TInt*)aInOut=(r==KErrNone)?1:0; // if there is a clicking device we should be able to get its state |
|
256 |
return KErrNone; |
|
257 |
} |
|
258 |
||
259 |
// EKeyboardClickVolumeMax |
|
260 |
TInt GetKeyboardClickVolumeMax(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
261 |
{ |
|
262 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalKeyClickVolumeMax, aInOut, NULL); |
|
263 |
} |
|
264 |
||
265 |
// EKeyboardClickState |
|
266 |
TInt ProcessKeyboardClickState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
267 |
{ |
|
268 |
if (aSet) |
|
269 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalSetKeyClickEnabled, aInOut, NULL); |
|
270 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalKeyClickEnabled, aInOut, NULL); |
|
271 |
} |
|
272 |
||
273 |
// EKeyboardClickVolume |
|
274 |
TInt ProcessKeyboardClickVolume(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
275 |
{ |
|
276 |
TInt r; |
|
277 |
if (aSet) |
|
278 |
{ |
|
279 |
TInt vol=(TInt)aInOut; |
|
280 |
TInt volMax=0; |
|
281 |
r=UserSvr::HalFunction(EHalGroupSound, ESoundHalKeyClickVolumeMax, (TAny*)volMax, NULL); |
|
282 |
if (r!=KErrNone) |
|
283 |
return r; |
|
284 |
if (vol<0 || vol>volMax) |
|
285 |
return KErrArgument; |
|
286 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalSetKeyClickLoud, (TAny*)vol, NULL); |
|
287 |
} |
|
288 |
TBool state; |
|
289 |
r=UserSvr::HalFunction(EHalGroupSound, ESoundHalKeyClickLoud, (TAny*)&state, NULL); |
|
290 |
if (r==KErrNone) |
|
291 |
{ |
|
292 |
*(TInt*)aInOut=state?1:0; |
|
293 |
} |
|
294 |
return r; |
|
295 |
} |
|
296 |
||
297 |
// EDisplayContrast |
|
298 |
TInt ProcessDisplayContrast(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
299 |
{ |
|
300 |
if (aSet) |
|
301 |
{ |
|
302 |
TInt x=(TInt)aInOut; |
|
303 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSetDisplayContrast, (TAny*)x, NULL, aDeviceNumber); |
|
304 |
} |
|
305 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalDisplayContrast, aInOut, NULL, aDeviceNumber); |
|
306 |
} |
|
307 |
||
308 |
// EDisplayBrightness |
|
309 |
TInt ProcessDisplayBrightness(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
310 |
{ |
|
311 |
if (aSet) |
|
312 |
{ |
|
313 |
TInt x=(TInt)aInOut; |
|
314 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSetDisplayBrightness, (TAny*)x, NULL, aDeviceNumber); |
|
315 |
} |
|
316 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalDisplayBrightness, aInOut, NULL, aDeviceNumber); |
|
317 |
} |
|
318 |
||
319 |
||
320 |
// EDisplayPaletteEntry |
|
321 |
TInt ProcessDisplayPaletteEntry(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool aSet, TAny* aInOut) |
|
322 |
{ |
|
323 |
||
324 |
__ASSERT_DEBUG(HAL::EDisplayPaletteEntry == aAttrib, Panic(EInvalidAttributeDP)); |
|
325 |
||
326 |
if (aSet) |
|
327 |
{ |
|
328 |
TInt entry = ((TInt)aInOut >> 24) & 0xFF; |
|
329 |
TInt color = ((TInt)aInOut) & 0xFFFFFF; |
|
330 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSetPaletteEntry, (TAny*)entry, (TAny*)color, aDeviceNumber); |
|
331 |
} |
|
332 |
TInt e = (*(TInt*)aInOut) & 0xFF; |
|
333 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalPaletteEntry, &e, aInOut, aDeviceNumber); |
|
334 |
} |
|
335 |
||
336 |
// EDisplayNumModes |
|
337 |
TInt ProcessDisplayNumModes(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool /*aSet*/, TAny* aInOut) |
|
338 |
{ |
|
339 |
__ASSERT_DEBUG(HAL::EDisplayNumModes == aAttrib, Panic(EInvalidAttributeDNM)); |
|
340 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalModeCount, aInOut, NULL, aDeviceNumber); |
|
341 |
} |
|
342 |
||
343 |
// EDisplayMode |
|
344 |
TInt ProcessDisplayMode(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool aSet, TAny* aInOut) |
|
345 |
{ |
|
346 |
__ASSERT_DEBUG(HAL::EDisplayMode == aAttrib, Panic(EInvalidAttributeDM)); |
|
347 |
return UserSvr::HalFunction(EHalGroupDisplay, aSet?EDisplayHalSetMode:EDisplayHalMode, aInOut, NULL, aDeviceNumber); |
|
348 |
} |
|
349 |
||
350 |
// EDisplayState |
|
351 |
TInt ProcessDisplayState(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool aSet, TAny* aInOut) |
|
352 |
{ |
|
353 |
__ASSERT_DEBUG(HAL::EDisplayState == aAttrib, Panic(EInvalidAttributeDS)); |
|
354 |
||
355 |
if (aSet) |
|
356 |
{ |
|
357 |
TBool on = (TBool)aInOut; |
|
358 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSetState, (TAny*)on, NULL, aDeviceNumber); |
|
359 |
} |
|
360 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalState, aInOut, NULL, aDeviceNumber); |
|
361 |
||
362 |
} |
|
363 |
||
364 |
// EDisplayColors |
|
365 |
TInt ProcessDisplayColors(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool /*aSet*/, TAny* aInOut) |
|
366 |
{ |
|
367 |
__ASSERT_DEBUG(HAL::EDisplayColors == aAttrib, Panic(EInvalidAttributeDC)); |
|
368 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalColors, aInOut, NULL, aDeviceNumber); |
|
369 |
} |
|
370 |
||
371 |
// EDisplayBrightnessMax |
|
372 |
TInt ProcessDisplayMaxBrightness(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool /*aSet*/, TAny* aInOut) |
|
373 |
{ |
|
374 |
__ASSERT_DEBUG(HAL::EDisplayBrightnessMax == aAttrib, Panic(EInvalidAttributeMB)); |
|
375 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalMaxDisplayBrightness, aInOut, NULL, aDeviceNumber); |
|
376 |
} |
|
377 |
||
378 |
// EDisplayContrastMax |
|
379 |
TInt ProcessDisplayMaxContrast(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool /*aSet*/, TAny* aInOut) |
|
380 |
{ |
|
381 |
__ASSERT_DEBUG(HAL::EDisplayContrastMax == aAttrib, Panic(EInvalidAttributeMC)); |
|
382 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalMaxDisplayContrast, aInOut, NULL, aDeviceNumber); |
|
383 |
} |
|
384 |
||
385 |
/* |
|
386 |
TInt ProcessSecureDisplayCurrentModeInfo(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool aSet, TAny* aInOut) |
|
387 |
{ |
|
388 |
//only info obtainable about secure display is the address |
|
389 |
__ASSERT_DEBUG(HAL::ESecureDisplayMemoryAddress == aAttrib, Panic(EInvalidAttributeSDMA)); |
|
390 |
||
391 |
TVideoInfoV01 info; |
|
392 |
TPckg<TVideoInfoV01> infoPckg(info); |
|
393 |
TInt r=UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&infoPckg, (TAny*)ETrue, aDeviceNumber); |
|
394 |
if (KErrNone == r) |
|
395 |
*(TInt*)aInOut = info.iVideoAddress; |
|
396 |
||
397 |
return r; |
|
398 |
} |
|
399 |
*/ |
|
400 |
||
401 |
TInt ProcessDisplayCurrentModeInfo(TInt aDeviceNumber, TInt aAttrib, TBool /*aSet*/, TAny* aInOut) |
|
402 |
{ |
|
403 |
TVideoInfoV01 info; |
|
404 |
TPckg<TVideoInfoV01> infoPckg(info); |
|
405 |
TInt r=UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&infoPckg, (TAny*)EFalse, aDeviceNumber); |
|
406 |
if (KErrNone == r) |
|
407 |
{ |
|
408 |
switch (aAttrib) |
|
409 |
{ |
|
410 |
case HAL::EDisplayXPixels: |
|
411 |
*(TInt*)aInOut = info.iSizeInPixels.iWidth; |
|
412 |
break; |
|
413 |
||
414 |
case HAL::EDisplayYPixels: |
|
415 |
*(TInt*)aInOut = info.iSizeInPixels.iHeight; |
|
416 |
break; |
|
417 |
||
418 |
case HAL::EDisplayXTwips: |
|
419 |
*(TInt*)aInOut = info.iSizeInTwips.iWidth; |
|
420 |
break; |
|
421 |
||
422 |
case HAL::EDisplayYTwips: |
|
423 |
*(TInt*)aInOut = info.iSizeInTwips.iHeight; |
|
424 |
break; |
|
425 |
||
426 |
case HAL::EDisplayMemoryAddress: |
|
427 |
if (info.iVideoAddress == 0) //if this is true, the actual address is returned by EDisplayHalGetDisplayMemoryAddress |
|
428 |
{ |
|
429 |
r = UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalGetDisplayMemoryAddress, aInOut, (TAny*)EFalse, aDeviceNumber); |
|
430 |
} |
|
431 |
else |
|
432 |
{ |
|
433 |
*(TInt*)aInOut = info.iVideoAddress; |
|
434 |
} |
|
435 |
break; |
|
436 |
||
437 |
case HAL::EDisplayIsPixelOrderRGB: |
|
438 |
*(TInt*)aInOut = info.iIsPixelOrderRGB; |
|
439 |
break; |
|
440 |
||
441 |
case HAL::EDisplayIsPixelOrderLandscape: |
|
442 |
*(TInt*)aInOut = info.iIsPixelOrderLandscape; |
|
443 |
break; |
|
444 |
||
445 |
default: |
|
446 |
__ASSERT_DEBUG(EFalse, Panic(EInvalidAttributeCMI)); |
|
447 |
break; |
|
448 |
||
449 |
} |
|
450 |
} |
|
451 |
return r; |
|
452 |
} |
|
453 |
||
454 |
||
455 |
TInt ProcessDisplaySpecifiedModeInfo(TInt aDeviceNumber, TInt aAttrib, TBool __DEBUG_ONLY(aSet), TAny* aInOut) |
|
456 |
{ |
|
457 |
||
458 |
__ASSERT_DEBUG(!aSet, Panic(EInvalidAttributeSMI2)); |
|
459 |
||
460 |
||
461 |
TVideoInfoV01 info; |
|
462 |
TPckg<TVideoInfoV01> infoPckg(info); |
|
463 |
TInt r=UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSpecifiedModeInfo, aInOut, (TAny*)&infoPckg, aDeviceNumber); |
|
464 |
if (KErrNone == r) |
|
465 |
{ |
|
466 |
switch (aAttrib) |
|
467 |
{ |
|
468 |
case HAL::EDisplayIsMono: |
|
469 |
*(TInt*)aInOut = info.iIsMono; |
|
470 |
break; |
|
471 |
||
472 |
case HAL::EDisplayIsPalettized: |
|
473 |
*(TInt*)aInOut = info.iIsPalettized; |
|
474 |
break; |
|
475 |
||
476 |
case HAL::EDisplayBitsPerPixel: |
|
477 |
*(TInt*)aInOut = info.iBitsPerPixel; |
|
478 |
break; |
|
479 |
||
480 |
case HAL::EDisplayOffsetToFirstPixel: |
|
481 |
*(TInt*)aInOut = info.iOffsetToFirstPixel; |
|
482 |
break; |
|
483 |
||
484 |
case HAL::EDisplayOffsetBetweenLines: |
|
485 |
*(TInt*)aInOut = info.iOffsetBetweenLines; |
|
486 |
break; |
|
487 |
||
488 |
default: |
|
489 |
__ASSERT_DEBUG(EFalse, Panic(EInvalidAttributeSMI)); |
|
490 |
break; |
|
491 |
} |
|
492 |
} |
|
493 |
return r; |
|
494 |
} |
|
495 |
||
496 |
//ESecureDisplay |
|
497 |
/* |
|
498 |
TInt ProcessSecureDisplay(TInt aDeviceNumber, TInt __DEBUG_ONLY(aAttrib), TBool aSet, TAny* aInOut) |
|
499 |
{ |
|
500 |
__ASSERT_DEBUG(HAL::ESecureDisplay == aAttrib, Panic(EInvalidAttributeSD)); |
|
501 |
||
502 |
if (aSet) |
|
503 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSetSecure, aInOut, NULL, aDeviceNumber); |
|
504 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSecure, aInOut, NULL, aDeviceNumber); |
|
505 |
} |
|
506 |
*/ |
|
507 |
||
508 |
// EBacklight |
|
509 |
TInt GetBacklightPresent(TInt aDeviceNumber, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
510 |
{ |
|
511 |
TInt state=0; |
|
512 |
TInt r=UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalBacklightOn, (TAny*)&state, NULL, aDeviceNumber); |
|
513 |
*(TInt*)aInOut=(r==KErrNone)?1:0; // if there is a backlight we should be able to get its state |
|
514 |
return KErrNone; |
|
515 |
} |
|
516 |
||
517 |
// EBacklightState |
|
518 |
TInt ProcessBacklightState(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
519 |
{ |
|
520 |
if (aSet) |
|
521 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalSetBacklightOn, aInOut, NULL, aDeviceNumber); |
|
522 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalBacklightOn, aInOut, NULL, aDeviceNumber); |
|
523 |
} |
|
524 |
||
525 |
// EPen |
|
526 |
TInt GetPenPresent(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
527 |
{ |
|
528 |
TDigitiserInfoV01Buf buf; |
|
529 |
TInt r=UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHalXYInfo, (TAny*)&buf, NULL); |
|
530 |
*(TInt*)aInOut=(r==KErrNone)?1:0; // if there is a pen device we should be able to get info out of it |
|
531 |
return KErrNone; |
|
532 |
} |
|
533 |
||
534 |
// EPenX and EPenY |
|
535 |
TInt ProcessPenInfo(TInt /*aDeviceNumber*/, TInt aAttrib, TBool /*aSet*/, TAny* aInOut) |
|
536 |
{ |
|
537 |
TDigitiserInfoV01 info; |
|
538 |
TPckg<TDigitiserInfoV01> infoPckg(info); |
|
539 |
TInt r=UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHalXYInfo, (TAny*)&infoPckg, NULL); |
|
540 |
if (KErrNone == r) |
|
541 |
{ |
|
542 |
switch (aAttrib) |
|
543 |
{ |
|
544 |
case HAL::EPenX: |
|
545 |
*(TInt*)aInOut=(TInt)info.iDigitiserSize.iWidth; |
|
546 |
break; |
|
547 |
case HAL::EPenY: |
|
548 |
*(TInt*)aInOut = info.iDigitiserSize.iHeight; |
|
549 |
break; |
|
550 |
default: |
|
551 |
__ASSERT_DEBUG(EFalse, Panic(EInvalidAttribPen)); |
|
552 |
break; |
|
553 |
} |
|
554 |
} |
|
555 |
return r; |
|
556 |
} |
|
557 |
||
558 |
// EPenState |
|
559 |
TInt ProcessPenState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
560 |
{ |
|
561 |
if (aSet) |
|
562 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHalSetXYState, aInOut, NULL); |
|
563 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHalXYState, aInOut, NULL); |
|
564 |
} |
|
565 |
||
566 |
// EPenDisplayOn |
|
567 |
TInt ProcessPenDisplayOnState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
568 |
{ |
|
569 |
if (aSet) |
|
570 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalSetPointerSwitchesOn, aInOut, NULL); |
|
571 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalPointerSwitchesOn, aInOut, NULL); |
|
572 |
} |
|
573 |
||
574 |
// EPenClick |
|
575 |
TInt GetPenClickPresent(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
576 |
{ |
|
577 |
TInt state=0; |
|
578 |
TInt r=UserSvr::HalFunction(EHalGroupSound, ESoundHalPointerClickEnabled, (TAny*)state, NULL); |
|
579 |
*(TInt*)aInOut=(r==KErrNone)?1:0; // if there is a clicking device we should be able to get its state |
|
580 |
return KErrNone; |
|
581 |
} |
|
582 |
||
583 |
// EPenClickVolumeMax |
|
584 |
TInt GetPenClickVolumeMax(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
585 |
{ |
|
586 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalPointerClickVolumeMax, aInOut, NULL); |
|
587 |
} |
|
588 |
||
589 |
// EPenClickState |
|
590 |
TInt ProcessPenClickState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
591 |
{ |
|
592 |
if (aSet) |
|
593 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalSetPointerClickEnabled, aInOut, NULL); |
|
594 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalPointerClickEnabled, aInOut, NULL); |
|
595 |
} |
|
596 |
||
597 |
// EPenClickVolume |
|
598 |
TInt ProcessPenClickVolume(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
599 |
{ |
|
600 |
TInt r; |
|
601 |
if (aSet) |
|
602 |
{ |
|
603 |
TInt vol=(TInt)aInOut; |
|
604 |
TInt volMax=0; |
|
605 |
r=UserSvr::HalFunction(EHalGroupSound, ESoundHalPointerClickVolumeMax, (TAny*)volMax, NULL); |
|
606 |
if (r!=KErrNone) |
|
607 |
return r; |
|
608 |
if (vol<0 || vol>volMax) |
|
609 |
return KErrArgument; |
|
610 |
return UserSvr::HalFunction(EHalGroupSound, ESoundHalSetPointerClickLoud, (TAny*)vol, NULL); |
|
611 |
} |
|
612 |
TBool state; |
|
613 |
r=UserSvr::HalFunction(EHalGroupSound, ESoundHalPointerClickLoud, (TAny*)&state, NULL); |
|
614 |
if (r==KErrNone) |
|
615 |
{ |
|
616 |
*(TInt*)aInOut=state?1:0; |
|
617 |
} |
|
618 |
return r; |
|
619 |
} |
|
620 |
||
621 |
// ECaseSwitchDisplayOn |
|
622 |
TInt ProcessCaseSwitchDisplayOnState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
623 |
{ |
|
624 |
if (aSet) |
|
625 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalSetCaseOpenSwitchesOn, aInOut, NULL); |
|
626 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalCaseOpenSwitchesOn, aInOut, NULL); |
|
627 |
} |
|
628 |
||
629 |
// ECaseSwitchDisplayOff |
|
630 |
TInt ProcessCaseSwitchDisplayOffState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
631 |
{ |
|
632 |
if (aSet) |
|
633 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalSetCaseCloseSwitchesOff, aInOut, NULL); |
|
634 |
return UserSvr::HalFunction(EHalGroupPower, EPowerHalCaseCloseSwitchesOff, aInOut, NULL); |
|
635 |
} |
|
636 |
||
637 |
// ELEDs |
|
638 |
TInt GetLedCaps(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
639 |
{ |
|
640 |
TVariantInfoV01 info; |
|
641 |
TPckg<TVariantInfoV01> infoPckg(info); |
|
642 |
TInt r=UserSvr::HalFunction(EHalGroupVariant, EVariantHalVariantInfo, (TAny*)&infoPckg, NULL); |
|
643 |
if (r==KErrNone) |
|
644 |
{ |
|
645 |
*(TInt*)aInOut=(info.iLedCapabilities)>>16; // upper half for number of Leds, lower half for colour capabilities |
|
646 |
} |
|
647 |
return r; |
|
648 |
} |
|
649 |
||
650 |
// ELEDmask |
|
651 |
TInt ProcessLEDMask(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
652 |
{ |
|
653 |
if (aSet) |
|
654 |
{ |
|
655 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalLedMaskSet, aInOut, NULL); |
|
656 |
} |
|
657 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalLedMaskGet, aInOut, NULL); |
|
658 |
} |
|
659 |
||
660 |
// ESwitches |
|
661 |
TInt GetSwitches(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
662 |
{ |
|
663 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalSwitches, aInOut, NULL); |
|
664 |
} |
|
665 |
||
666 |
// EMouse |
|
667 |
TInt GetMousePresent(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
668 |
{ |
|
669 |
TMouseInfoV01Buf buf; |
|
670 |
TInt r=UserSvr::HalFunction(EHalGroupMouse, EMouseHalMouseInfo, (TAny*)&buf, NULL); |
|
671 |
*(TInt*)aInOut=(r==KErrNone)?1:0; // if there is a mouse device we should be able to get info out of it |
|
672 |
return KErrNone; |
|
673 |
} |
|
674 |
||
675 |
// EMouseX, EMouseY and EMouseButtons |
|
676 |
TInt ProcessMouseInfo(TInt /*aDeviceNumber*/, TInt aAttrib, TBool /*aSet*/, TAny* aInOut) |
|
677 |
{ |
|
678 |
TMouseInfoV01 info; |
|
679 |
TPckg<TMouseInfoV01> infoPckg(info); |
|
680 |
TInt r=UserSvr::HalFunction(EHalGroupMouse, EMouseHalMouseInfo, (TAny*)&infoPckg, NULL); |
|
681 |
if (KErrNone == r) |
|
682 |
{ |
|
683 |
switch (aAttrib) |
|
684 |
{ |
|
685 |
case HAL::EMouseX: |
|
686 |
*(TInt*)aInOut=(TInt)info.iMouseAreaSize.iWidth; |
|
687 |
break; |
|
688 |
case HAL::EMouseY: |
|
689 |
*(TInt*)aInOut = info.iMouseAreaSize.iHeight; |
|
690 |
break; |
|
691 |
case HAL::EMouseButtons: |
|
692 |
*(TInt*)aInOut=(TInt)info.iMouseButtons; |
|
693 |
break; |
|
694 |
default: |
|
695 |
__ASSERT_DEBUG(EFalse, Panic(EInvalidAttribMouse)); |
|
696 |
break; |
|
697 |
} |
|
698 |
} |
|
699 |
return r; |
|
700 |
} |
|
701 |
||
702 |
// EMouseState |
|
703 |
TInt ProcessMouseState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
704 |
{ |
|
705 |
if (aSet) |
|
706 |
return UserSvr::HalFunction(EHalGroupMouse, EMouseHalSetMouseState, aInOut, NULL); |
|
707 |
return UserSvr::HalFunction(EHalGroupMouse, EMouseHalMouseState, aInOut, NULL); |
|
708 |
} |
|
709 |
||
710 |
// EMouseSpeed |
|
711 |
TInt ProcessMouseSpeed(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
712 |
{ |
|
713 |
if (aSet) |
|
714 |
{ |
|
715 |
TInt speed=(TInt)aInOut; |
|
716 |
if (speed<0 || speed>255) |
|
717 |
return KErrArgument; |
|
718 |
return UserSvr::HalFunction(EHalGroupMouse, EMouseHalSetMouseSpeed, (TAny*)speed, NULL); |
|
719 |
} |
|
720 |
return UserSvr::HalFunction(EHalGroupMouse, EMouseHalMouseSpeed, aInOut, NULL); |
|
721 |
} |
|
722 |
||
723 |
// EMouseAcceleration |
|
724 |
TInt ProcessMouseAcceleration(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
725 |
{ |
|
726 |
if (aSet) |
|
727 |
{ |
|
728 |
TInt acc=(TInt)aInOut; |
|
729 |
if (acc<0 || acc>255) |
|
730 |
return KErrArgument; |
|
731 |
return UserSvr::HalFunction(EHalGroupMouse, EMouseHalSetMouseAcceleration, (TAny*)acc, NULL); |
|
732 |
} |
|
733 |
return UserSvr::HalFunction(EHalGroupMouse, EMouseHalMouseAcceleration, aInOut, NULL); |
|
734 |
} |
|
735 |
||
736 |
// EMouseButtonState |
|
737 |
TInt GetMouseButtonState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* /*aInOut*/) |
|
738 |
{ |
|
739 |
return KErrNotSupported; |
|
740 |
} |
|
741 |
||
742 |
// EDebugPort |
|
743 |
TInt ProcessDebugPort(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
744 |
{ |
|
745 |
return UserSvr::HalFunction(EHalGroupVariant, aSet ? EVariantHalDebugPortSet : EVariantHalDebugPortGet, aInOut, NULL); |
|
746 |
} |
|
747 |
||
748 |
// ECustomRestart |
|
749 |
TInt ProcessCustomRestart(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
750 |
{ |
|
751 |
if (!aSet) |
|
752 |
return KErrNotSupported; |
|
753 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalCustomRestart, aInOut, NULL); |
|
754 |
} |
|
755 |
||
756 |
// ECustomRestartReason |
|
757 |
TInt ProcessCustomRestartReason(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
758 |
{ |
|
759 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalCustomRestartReason, aInOut, NULL); |
|
760 |
} |
|
761 |
||
762 |
// EHardwareFloatingPoint |
|
763 |
TInt GetHardwareFloatingPoint(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
764 |
{ |
|
765 |
return UserSvr::HalFunction(EHalGroupKernel, EKernelHalHardwareFloatingPoint, aInOut, NULL); |
|
766 |
} |
|
767 |
||
768 |
// ETimeNonSecureOffset |
|
769 |
TInt NonsecureClockOffset(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
770 |
{ |
|
771 |
TInt kernelHalFnId = aSet ? EKernelHalSetNonsecureClockOffset : EKernelHalGetNonsecureClockOffset; |
|
772 |
return UserSvr::HalFunction(EHalGroupKernel, kernelHalFnId, aInOut, NULL); |
|
773 |
} |
|
774 |
||
775 |
// ECaseState |
|
776 |
TInt GetCaseState(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
777 |
{ |
|
778 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalCaseState, aInOut, NULL); |
|
779 |
} |
|
780 |
||
781 |
// EPersistStartupModeKernel |
|
782 |
TInt ProcessPersistStartupMode(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
783 |
{ |
|
784 |
return UserSvr::HalFunction(EHalGroupVariant, aSet ? EVariantHalPersistStartupMode : EVariantHalGetPersistedStartupMode, aInOut, NULL); |
|
785 |
} |
|
786 |
||
787 |
// EAvailableCustomRestartReasons |
|
788 |
TInt GetMaximumCustomRestartReasons(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
789 |
{ |
|
790 |
if (aSet) |
|
791 |
return KErrNotSupported; |
|
792 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalGetMaximumCustomRestartReasons, aInOut, NULL); |
|
793 |
} |
|
794 |
||
795 |
// EMaximumRestartStartupModes |
|
796 |
TInt GetMaximumRestartStartupModes(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
797 |
{ |
|
798 |
if (aSet) |
|
799 |
return KErrNotSupported; |
|
800 |
return UserSvr::HalFunction(EHalGroupVariant, EVariantHalGetMaximumRestartStartupModes, aInOut, NULL); |
|
801 |
} |
|
802 |
||
803 |
||
804 |
// EPointer3DThetaSupported, EPointer3PhiSupported, EPointer3DRotationSupported, EPointer3DPressureSupported, |
|
805 |
//EPointer3DProximityStep,EPointerMaxPointers,EPointer3DMaxPressure,EPointer3DPressureStep |
|
806 |
||
807 |
TInt ProcessAdvancedPointer(TInt aDeviceNumber, TInt aAttrib, TBool /*aSet*/, TAny* aInOut) |
|
808 |
{ |
|
809 |
TDigitiserInfoV02 info; |
|
810 |
TPckg<TDigitiserInfoV02> infoPckg(info); |
|
811 |
||
812 |
TInt r=UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHal3DInfo,(TAny*)&infoPckg, NULL,aDeviceNumber); |
|
813 |
if (KErrNone == r) |
|
814 |
{ |
|
815 |
switch (aAttrib) |
|
816 |
{ |
|
817 |
case HAL::EPointer3DThetaSupported: |
|
818 |
*(TInt*)aInOut=(TInt)info.iThetaSupported; |
|
819 |
break; |
|
820 |
||
821 |
case HAL::EPointer3DPhiSupported: |
|
822 |
*(TInt*)aInOut = info.iPhiSupported; |
|
823 |
break; |
|
824 |
||
825 |
case HAL::EPointer3DRotationSupported: |
|
826 |
*(TInt*)aInOut = info.iAlphaSupported; |
|
827 |
break; |
|
828 |
||
829 |
case HAL::EPointer3DPressureSupported: |
|
830 |
*(TInt*)aInOut = info.iPressureSupported; |
|
831 |
break; |
|
832 |
||
833 |
case HAL::EPointer3DProximityStep: |
|
834 |
*(TInt*)aInOut = info.iProximityStep; |
|
835 |
break; |
|
836 |
||
837 |
case HAL::EPointerMaxPointers: |
|
838 |
*(TInt*)aInOut = info.iMaxPointers; |
|
839 |
break; |
|
840 |
||
841 |
case HAL::EPointer3DMaxPressure: |
|
842 |
*(TInt*)aInOut = info.iMaxPressure; |
|
843 |
break; |
|
844 |
||
845 |
case HAL::EPointer3DPressureStep: |
|
846 |
*(TInt*)aInOut = info.iPressureStep; |
|
847 |
break; |
|
848 |
||
849 |
default: |
|
850 |
__ASSERT_DEBUG(EFalse, Panic(EInvalidAttrib3DPointer)); |
|
851 |
break; |
|
852 |
} |
|
853 |
} |
|
854 |
return r; |
|
855 |
} |
|
856 |
||
857 |
// EPointer3D |
|
858 |
TInt Get3DPointerPresent(TInt aDeviceNumber, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
859 |
{ |
|
860 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHal3DPointer, aInOut, NULL, aDeviceNumber); |
|
861 |
} |
|
862 |
||
863 |
//EPointer3DMaxProximity |
|
864 |
TInt Process3DRange(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
865 |
{ |
|
866 |
if (aSet) |
|
867 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHalSetZRange, aInOut, NULL, aDeviceNumber); |
|
868 |
else |
|
869 |
{ |
|
870 |
TDigitiserInfoV02 info; |
|
871 |
||
872 |
TPckg<TDigitiserInfoV02> infoPckg(info); |
|
873 |
TInt r =UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHal3DInfo,(TAny*)&infoPckg, NULL, aDeviceNumber); |
|
874 |
if(r==KErrNone) |
|
875 |
{ |
|
876 |
*(TInt*)aInOut=info.iZRange; |
|
877 |
} |
|
878 |
return r; |
|
879 |
} |
|
880 |
} |
|
881 |
||
882 |
// EPointerNumberOfPointers |
|
883 |
TInt ProcessNumberOfPointers(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
884 |
{ |
|
885 |
if (aSet) |
|
886 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHalSetNumberOfPointers, aInOut, NULL, aDeviceNumber); |
|
887 |
else |
|
888 |
{ |
|
889 |
TDigitiserInfoV02 info; |
|
890 |
TPckg<TDigitiserInfoV02> infoPckg(info); |
|
891 |
TInt r =UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserHal3DInfo, (TAny*)&infoPckg, NULL, aDeviceNumber); |
|
892 |
if(r==KErrNone) |
|
893 |
{ |
|
894 |
*(TInt*)aInOut=info.iNumberOfPointers; |
|
895 |
} |
|
896 |
return r; |
|
897 |
} |
|
898 |
} |
|
899 |
||
900 |
// ENanoTickPeriod |
|
901 |
TInt ProcessNanoTickPeriod(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
902 |
{ |
|
903 |
return UserSvr::HalFunction(EHalGroupKernel,EKernelHalNTickPeriod, aInOut, NULL); |
|
904 |
} |
|
905 |
||
906 |
// EFastCounterFrequency |
|
907 |
TInt ProcessFastCounterFrequency(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool /*aSet*/, TAny* aInOut) |
|
908 |
{ |
|
909 |
return UserSvr::HalFunction(EHalGroupKernel,EKernelHalFastCounterFrequency, aInOut, NULL); |
|
910 |
} |
|
911 |
||
912 |
//EDisplayMemoryHandle |
|
913 |
TInt GetDisplayMemoryHandle(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
914 |
{ |
|
915 |
if (aSet) |
|
916 |
{ |
|
917 |
return KErrNotSupported; |
|
918 |
} |
|
919 |
return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalGetDisplayMemoryHandle, aInOut, NULL, aDeviceNumber); |
|
920 |
} |
|
921 |
||
922 |
//ENumCpus |
|
923 |
TInt GetNumCpus(TInt /*aDeviceNumber*/, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
|
924 |
{ |
|
925 |
if (aSet) |
|
926 |
{ |
|
927 |
return KErrNotSupported; |
|
928 |
} |
|
929 |
*(TInt*)aInOut=UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, NULL, NULL); |
|
930 |
return KErrNone; |
|
931 |
} |
|
932 |
||
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
933 |
// EDigitiserOrientation |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
934 |
#if defined(_DEBUG) |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
935 |
TInt DigitiserOrientation(TInt aDeviceNumber, TInt aAttrib, TBool aSet, TAny* aInOut) |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
936 |
#else |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
937 |
TInt DigitiserOrientation(TInt aDeviceNumber, TInt /*aAttrib*/, TBool aSet, TAny* aInOut) |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
938 |
#endif |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
939 |
{ |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
940 |
__ASSERT_DEBUG(aAttrib == HALData::EDigitiserOrientation, Panic(EInvalidAttribDigitiserOrientation)); |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
941 |
__ASSERT_DEBUG(aDeviceNumber >= 0, Panic(EInvalidAttribDigitiserOrientation)); |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
942 |
|
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
943 |
if (aSet) |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
944 |
{ |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
945 |
//Set |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
946 |
if ( ((TInt)aInOut) < 0 || ((TInt)aInOut) > HALData::EDigitiserOrientation_270) |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
947 |
return KErrArgument; |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
948 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserOrientation, aInOut, (TAny*)ETrue, aDeviceNumber); |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
949 |
} |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
950 |
|
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
951 |
//Get |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
952 |
__ASSERT_DEBUG(aInOut != 0, Panic(EInvalidAttribDigitiserOrientation)); |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
953 |
return UserSvr::HalFunction(EHalGroupDigitiser, EDigitiserOrientation, aInOut, (TAny*)EFalse, aDeviceNumber); |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
954 |
} |
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
955 |
|
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
956 |