sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // hal\inc\hal_int.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #ifndef __HAL_INT_H__ sl@0: #define __HAL_INT_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // Work around data import/export restriction of X86 compilers sl@0: #if defined(__X86__) || defined(__WINS__) sl@0: #undef IMPORT_D sl@0: #undef EXPORT_D sl@0: #define IMPORT_D IMPORT_C sl@0: #define EXPORT_D sl@0: #endif sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The signature for accessor functions for derived attributes sl@0: sl@0: @param aDeviceNumber A device number is applicable when a system has sl@0: multiple instances of a device. The parameter specifies which one to sl@0: interrogate. Eg. a phone may have 2 displays, so it's HAL accessor functions sl@0: would access different information depending on whether aDeviceNumber was 0 or 1. sl@0: sl@0: @param aAttrib The HAL attribute to access. sl@0: @param aSet ETrue if the specified attribute should be modified; EFalse for a read. sl@0: @param aInOut A pointer to a TInt. If aSet is: sl@0: - ETrue it points to the new value to be written. sl@0: - EFalse it is used to return the value read. sl@0: It may also be used to pass an argument in, sl@0: in order to select one of multiple values to retreive. sl@0: If it is equal to -1 then the function must sl@0: return KErrArgument so that callers can identify that sl@0: the function uses aInOut as an input even when aSet is false. sl@0: sl@0: @return An error code sl@0: - KErrNone sl@0: - KErrArgument aInOut was invalid (may occur for aSet true or false) sl@0: */ sl@0: typedef TInt (*THalImplementation)(TInt aDeviceNumber, TInt aAttrib, TBool aSet, TAny* aInOut); sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: class HalInternal sl@0: { sl@0: public: sl@0: static const TUint8 Properties[HAL::ENumHalAttributes]; sl@0: static const TInt Offset[HAL::ENumHalAttributes]; sl@0: // InitialValue[] is only exported for patchdata purposes (other executables sl@0: // must not import this array; all access should be through the published Hal sl@0: // APIs). IMPORT_D needs to be on the declaration here so that it has external sl@0: // linkage (class data is treated differently to non-class data). sl@0: IMPORT_D static const TInt InitialValue[HAL::ENumHalAttributes]; sl@0: static const THalImplementation Implementation[HAL::ENumHalAttributes]; sl@0: static const TInt HalDataSize; sl@0: sl@0: enum THalPanic sl@0: { sl@0: EReadOffsetInvalid=0, sl@0: EWriteOffsetInvalid=1, sl@0: EInitialAllocFailed1=2, sl@0: EInitialAllocFailed2=3, sl@0: EInitialWriteFailed=4, sl@0: EInitialWriteFailed2=5, sl@0: ETlsSizeInvalid=6, sl@0: ENoSuchHalProp=7, sl@0: EGetPropFailed=8, sl@0: ESetPropFailed=9 sl@0: }; sl@0: sl@0: static void Panic(THalPanic aPanic); sl@0: static void InitialiseData(); sl@0: static TInt ReadWord(TInt anOffset); sl@0: static TInt WriteWord(TInt anOffset, TInt aValue); sl@0: }; sl@0: sl@0: #endif