os/kernelhwsrv/halservices/hal/inc/hal_int.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1995-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\inc\hal_int.h
    15 // 
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without notice. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    19 //
    20 
    21 #ifndef __HAL_INT_H__
    22 #define __HAL_INT_H__
    23 
    24 #include <hal.h>
    25 #include <e32svr.h>
    26 
    27 // Work around data import/export restriction of X86 compilers
    28 #if defined(__X86__) || defined(__WINS__)
    29 #undef IMPORT_D
    30 #undef EXPORT_D
    31 #define IMPORT_D IMPORT_C
    32 #define EXPORT_D
    33 #endif
    34 
    35 /**
    36 @publishedPartner
    37 @released
    38 
    39 The signature for accessor functions for derived attributes
    40 
    41 @param aDeviceNumber A device number is applicable when a system has
    42 multiple instances of a device. The parameter specifies which one to
    43 interrogate. Eg. a phone may have 2 displays, so it's HAL accessor functions
    44 would access different information depending on whether aDeviceNumber was 0 or 1.
    45 
    46 @param aAttrib The HAL attribute to access.
    47 @param aSet ETrue if the specified attribute should be modified; EFalse for a read.
    48 @param aInOut A pointer to a TInt. If aSet is:
    49 	- ETrue it points to the new value to be written.
    50 	- EFalse it is used to return the value read.
    51 	  It may also be used to pass an argument in,
    52 	  in order to select one of multiple values to retreive.
    53 	  If it is equal to -1 then the function must
    54 	  return KErrArgument so that callers can identify that
    55 	  the function uses aInOut as an input even when aSet is false.
    56 
    57 @return An error code
    58 	- KErrNone
    59 	- KErrArgument aInOut was invalid (may occur for aSet true or false)
    60 */
    61 typedef TInt (*THalImplementation)(TInt aDeviceNumber, TInt aAttrib, TBool aSet, TAny* aInOut);
    62 
    63 /**
    64 @internalComponent
    65 */
    66 class HalInternal
    67 	{
    68 public:
    69 	static const TUint8 Properties[HAL::ENumHalAttributes];
    70 	static const TInt Offset[HAL::ENumHalAttributes];
    71 	// InitialValue[] is only exported for patchdata purposes (other executables
    72 	// must not import this array; all access should be through the published Hal
    73 	// APIs).  IMPORT_D needs to be on the declaration here so that it has external
    74 	// linkage (class data is treated differently to non-class data).
    75 	IMPORT_D static const TInt InitialValue[HAL::ENumHalAttributes];
    76 	static const THalImplementation Implementation[HAL::ENumHalAttributes];
    77 	static const TInt HalDataSize;
    78 
    79 	enum THalPanic
    80 		{
    81 		EReadOffsetInvalid=0,
    82 		EWriteOffsetInvalid=1,
    83 		EInitialAllocFailed1=2,
    84 		EInitialAllocFailed2=3,
    85 		EInitialWriteFailed=4,
    86 		EInitialWriteFailed2=5,
    87 		ETlsSizeInvalid=6,
    88 		ENoSuchHalProp=7,
    89 		EGetPropFailed=8,
    90 		ESetPropFailed=9
    91 		};
    92 
    93 	static void Panic(THalPanic aPanic);
    94 	static void InitialiseData();
    95 	static TInt ReadWord(TInt anOffset);
    96 	static TInt WriteWord(TInt anOffset, TInt aValue);
    97 	};
    98 
    99 #endif