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