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