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