epoc32/include/assp/omap3530_assp/gpio.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100 (2010-03-31)
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     2
// All rights reserved.
williamr@4
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of the License "Eclipse Public License v1.0"
williamr@4
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     7
//
williamr@4
     8
// Initial Contributors:
williamr@4
     9
// Nokia Corporation - initial contribution.
williamr@4
    10
//
williamr@4
    11
// Contributors:
williamr@4
    12
//
williamr@4
    13
// Description:
williamr@4
    14
//
williamr@4
    15
williamr@4
    16
#ifndef __GPIO_H__
williamr@4
    17
#define __GPIO_H__
williamr@4
    18
williamr@4
    19
class TGpioCallback;	//forward declaration
williamr@4
    20
williamr@4
    21
/**
williamr@4
    22
GPIO interrupt handler
williamr@4
    23
Takes a generic argument (TAny*)
williamr@4
    24
*/
williamr@4
    25
typedef void (*TGpioIsr)(TAny*);
williamr@4
    26
williamr@4
    27
class GPIO
williamr@4
    28
	{
williamr@4
    29
public:
williamr@4
    30
	/**
williamr@4
    31
	GPIO pin modes (to be requested on any pin):
williamr@4
    32
	- enabled,
williamr@4
    33
	- disabled,
williamr@4
    34
	- idling
williamr@4
    35
	*/
williamr@4
    36
	enum TGpioMode
williamr@4
    37
		{
williamr@4
    38
		EEnabled,
williamr@4
    39
		EDisabled,
williamr@4
    40
		EIdle
williamr@4
    41
		};
williamr@4
    42
williamr@4
    43
		/**
williamr@4
    44
	GPIO pin directions (to be requested on any pin):
williamr@4
    45
	- input,
williamr@4
    46
	- output,
williamr@4
    47
	- tristated
williamr@4
    48
	*/
williamr@4
    49
	enum TGpioDirection
williamr@4
    50
		{
williamr@4
    51
		EInput,
williamr@4
    52
		EOutput,
williamr@4
    53
		ETriStated
williamr@4
    54
		};
williamr@4
    55
williamr@4
    56
	/**
williamr@4
    57
	GPIO pin states (to be set on an output or read from an input or output):
williamr@4
    58
	- electrical Low,
williamr@4
    59
	- electrical High,
williamr@4
    60
	- state compatible with idling the pin (module)
williamr@4
    61
	*/
williamr@4
    62
	enum TGpioState
williamr@4
    63
		{
williamr@4
    64
		ELow,
williamr@4
    65
		EHigh,
williamr@4
    66
		EIdleState
williamr@4
    67
		};
williamr@4
    68
williamr@4
    69
	/**
williamr@4
    70
	GPIO programmable bias:
williamr@4
    71
	- no drive,
williamr@4
    72
	- pulled down (Low),
williamr@4
    73
	- pulled up (High)
williamr@4
    74
	*/
williamr@4
    75
	enum TGpioBias
williamr@4
    76
		{
williamr@4
    77
		ENoDrive,
williamr@4
    78
		EPullDown,
williamr@4
    79
		EPullUp
williamr@4
    80
		};
williamr@4
    81
williamr@4
    82
	/**
williamr@4
    83
	GPIO interrupt and/or wakeup triger configuration (to be requested on an input
williamr@4
    84
 						 that supports interrupts or wakeup function):
williamr@4
    85
	- Level triggered, low level,
williamr@4
    86
	- Level triggered, high level,
williamr@4
    87
	- Edge triggered, falling edge,
williamr@4
    88
	- Edge triggered, rising edge,
williamr@4
    89
	- Edge triggered, both edges,
williamr@4
    90
	*/
williamr@4
    91
	enum TGpioDetectionTrigger
williamr@4
    92
		{
williamr@4
    93
		ELevelLow,
williamr@4
    94
		ELevelHigh,
williamr@4
    95
		EEdgeFalling,
williamr@4
    96
		EEdgeRising,
williamr@4
    97
		EEdgeBoth
williamr@4
    98
		};
williamr@4
    99
williamr@4
   100
    /**
williamr@4
   101
    Sets the pin mode.
williamr@4
   102
    
williamr@4
   103
    @param aId   The pin Id.
williamr@4
   104
    @param aMode The pin mode.
williamr@4
   105
williamr@4
   106
    @return KErrNone, if successful; KErrArgument, if aId is invalid;
williamr@4
   107
            KErrNotReady, when a pin that has requested to be Idle is not ready to do
williamr@4
   108
 											     so;
williamr@4
   109
            KErrNotSupported, if a pin cannot be used as a GPIO because it  has been
williamr@4
   110
 							     assigned an alternative function.
williamr@4
   111
williamr@4
   112
	When disabling a pin, the module which the pin is a part of may not be disabled,
williamr@4
   113
 								but KErrNone is still returned.
williamr@4
   114
    */
williamr@4
   115
	IMPORT_C static TInt SetPinMode(TInt aId, TGpioMode aMode);
williamr@4
   116
williamr@4
   117
    /**
williamr@4
   118
    Reads the pin mode.
williamr@4
   119
    
williamr@4
   120
    @param aId   The pin Id.
williamr@4
   121
    @param aMode On return contains the pin mode.
williamr@4
   122
williamr@4
   123
    @return KErrNone, if successful; KErrArgument, if aId is invalid;
williamr@4
   124
            KErrNotSupported, if reading the pin mode is not supported.
williamr@4
   125
    */
williamr@4
   126
	IMPORT_C static TInt GetPinMode(TInt aId, TGpioMode& aMode);
williamr@4
   127
williamr@4
   128
    /**
williamr@4
   129
    Sets the pin direction.
williamr@4
   130
    
williamr@4
   131
    @param aId        The pin Id.
williamr@4
   132
    @param aDirection The pin direction.
williamr@4
   133
williamr@4
   134
    @return KErrNone, if successful; KErrArgument, if aId is invalid;
williamr@4
   135
            KErrNotSupported, if a pin cannot operate in the direction specified.
williamr@4
   136
    */
williamr@4
   137
	IMPORT_C static TInt SetPinDirection(TInt aId, TGpioDirection aDirection);
williamr@4
   138
williamr@4
   139
    /**
williamr@4
   140
    Reads the pin direction.
williamr@4
   141
    
williamr@4
   142
    @param aId        The pin Id.
williamr@4
   143
    @param aDirection On return contains the pin direction.
williamr@4
   144
williamr@4
   145
    @return KErrNone, if successful; KErrArgument, if aId is invalid;
williamr@4
   146
            KErrNotSupported, if reading the pin direction is not supported.
williamr@4
   147
    */
williamr@4
   148
	IMPORT_C static TInt GetPinDirection(TInt aId, TGpioDirection& aDirection);
williamr@4
   149
williamr@4
   150
    /**
williamr@4
   151
    Sets the bias on a pin.
williamr@4
   152
    
williamr@4
   153
    @param aId    The pin Id.
williamr@4
   154
    @param aBias  The drive on the pin.
williamr@4
   155
williamr@4
   156
    @return KErrNone, if successful; KErrArgument, if aId is invalid;
williamr@4
   157
		   KErrNotSupported, if a pin does not support setting the drive.
williamr@4
   158
    */
williamr@4
   159
	IMPORT_C static TInt SetPinBias(TInt aId, TGpioBias aBias);
williamr@4
   160
williamr@4
   161
    /**
williamr@4
   162
    Reads the bias on a pin.
williamr@4
   163
    
williamr@4
   164
    @param aId    The pin Id.
williamr@4
   165
    @param aBias  On return contains the bias previoulsy set on the pin (or the
williamr@4
   166
 								   default bias if first time).
williamr@4
   167
williamr@4
   168
    @return KErrNone, if successful; 
williamr@4
   169
            KErrArgument, if aId is invalid;
williamr@4
   170
            KErrNotSupported, if reading the pin bias is not supported.
williamr@4
   171
    */
williamr@4
   172
	IMPORT_C static TInt GetPinBias(TInt aId, TGpioBias& aBias);
williamr@4
   173
williamr@4
   174
	/**
williamr@4
   175
	Sets the idle configuration and state. The pin configuration is the 
williamr@4
   176
	same that the pin should have when setting the mode to EIdle and the
williamr@4
   177
	state same it should present when setting the output state to EIdleState.
williamr@4
   178
williamr@4
   179
	@param aId    The pin Id.
williamr@4
   180
	@param aConf  An implementation specific token specifying the idle
williamr@4
   181
				  configration and state.
williamr@4
   182
	
williamr@4
   183
	@return KErrNone, if successful; 
williamr@4
   184
            KErrArgument, if aId is invalid;
williamr@4
   185
            KErrNotSupported, if setting the pin idle configuration and state
williamr@4
   186
							  are not supported.
williamr@4
   187
	*/
williamr@4
   188
	IMPORT_C static TInt SetPinIdleConfigurationAndState(TInt aId, TInt aConf);
williamr@4
   189
williamr@4
   190
    /**
williamr@4
   191
    Reads the pin idle configuration and state.
williamr@4
   192
    
williamr@4
   193
    @param aId    The pin Id.
williamr@4
   194
    @param aConf  On return contains the idle configuration and state previoulsy
williamr@4
   195
				  set on the pin.
williamr@4
   196
williamr@4
   197
    @return KErrNone, if successful; 
williamr@4
   198
            KErrArgument, if aId is invalid;
williamr@4
   199
            KErrNotSupported, if reading the pin idle configuration and state
williamr@4
   200
							  is not supported.
williamr@4
   201
    */
williamr@4
   202
	IMPORT_C static TInt GetPinIdleConfigurationAndState(TInt aId, TInt& aConf);
williamr@4
   203
williamr@4
   204
    /**
williamr@4
   205
    Associates the specified interrupt service routine (ISR) function with the
williamr@4
   206
    								specified interrupt Id.
williamr@4
   207
    
williamr@4
   208
    @param aId     The pin Id.
williamr@4
   209
    @param anIsr   The address of the ISR function. 
williamr@4
   210
    @param aPtr    32-bit value that is passed to the ISR.
williamr@4
   211
                   This is designated a TAny* type as it is usually a pointer to the
williamr@4
   212
                   owning class or data to be used in the ISR, although it can be any
williamr@4
   213
                   32-bit value.
williamr@4
   214
                 
williamr@4
   215
    @return KErrNone, if successful;
williamr@4
   216
            KErrArgument, if aId is invalid;
williamr@4
   217
            KErrNotSupported if pin does not support interrupts;
williamr@4
   218
            KErrInUse, if an ISR is already bound to this interrupt.
williamr@4
   219
    */
williamr@4
   220
	IMPORT_C static TInt BindInterrupt(TInt aId, TGpioIsr aIsr, TAny* aPtr);
williamr@4
   221
williamr@4
   222
    /**
williamr@4
   223
    Unbinds the interrupt service routine (ISR) function from the specified interrupt
williamr@4
   224
    id.
williamr@4
   225
    
williamr@4
   226
    @param aId The pin Id.
williamr@4
   227
    
williamr@4
   228
    @return KErrNone, if successful; 
williamr@4
   229
            KErrArgument, if aId is invalid;
williamr@4
   230
            KErrNotSupported if pin does not support interrupts;
williamr@4
   231
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   232
    */
williamr@4
   233
	IMPORT_C static TInt UnbindInterrupt(TInt aId);
williamr@4
   234
williamr@4
   235
    /**
williamr@4
   236
    Enables the interrupt on specified pin.
williamr@4
   237
    
williamr@4
   238
    @param aId  The pin Id.
williamr@4
   239
    
williamr@4
   240
    @return KErrNone, if successful; 
williamr@4
   241
            KErrArgument, if aId is invalid;
williamr@4
   242
            KErrNotSupported if pin does not support interrupts;
williamr@4
   243
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   244
    */
williamr@4
   245
	IMPORT_C static TInt EnableInterrupt(TInt aId);
williamr@4
   246
williamr@4
   247
    /**
williamr@4
   248
    Disables the interrupt on specified pin.
williamr@4
   249
    
williamr@4
   250
    @param aId  The pin Id.
williamr@4
   251
    
williamr@4
   252
    @return KErrNone, if successful; 
williamr@4
   253
            KErrArgument, if aId is invalid;
williamr@4
   254
            KErrNotSupported if pin does not support interrupts;
williamr@4
   255
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   256
    */
williamr@4
   257
	IMPORT_C static TInt DisableInterrupt(TInt aId);
williamr@4
   258
williamr@4
   259
    /**
williamr@4
   260
    Checks if interrupt is enabled on pin.
williamr@4
   261
    
williamr@4
   262
    @param aId     The pin Id.
williamr@4
   263
    @param aEnable On return contains the enable/disable state of interrupt 
williamr@4
   264
 								       		 (TRUE=enabled).
williamr@4
   265
    
williamr@4
   266
    @return KErrNone, if successful; 
williamr@4
   267
            KErrArgument, if aId is invalid;
williamr@4
   268
            KErrNotSupported if pin does not support interrupts;
williamr@4
   269
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   270
    */
williamr@4
   271
	IMPORT_C static TInt IsInterruptEnabled(TInt aId, TBool& aEnable);
williamr@4
   272
williamr@4
   273
    /**
williamr@4
   274
    Clears any pending interrupt on the specified pin.
williamr@4
   275
    
williamr@4
   276
    @param aId The pin Id.
williamr@4
   277
    
williamr@4
   278
    @return KErrNone, if successful;
williamr@4
   279
            KErrArgument, if aId is invalid;
williamr@4
   280
            KErrNotSupported if clearing interrupt signal is not supported on this
williamr@4
   281
 											    pin;
williamr@4
   282
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   283
    */
williamr@4
   284
	IMPORT_C static TInt ClearInterrupt(TInt aId);
williamr@4
   285
williamr@4
   286
    /**
williamr@4
   287
    Reads the interrupt state as output by the GPIO interrupt controller.
williamr@4
   288
    
williamr@4
   289
    @param aId     The pin Id.
williamr@4
   290
    @param aActive On return contains the state of the interrupt signal as output by
williamr@4
   291
 						      GPIO interrupt controller (TRUE=active).
williamr@4
   292
williamr@4
   293
    @return KErrNone, if successful;
williamr@4
   294
            KErrArgument, if aId is invalid;
williamr@4
   295
            KErrNotSupported if reading interrupt state is not supported;
williamr@4
   296
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   297
    */
williamr@4
   298
	IMPORT_C static TInt GetMaskedInterruptState(TInt aId, TBool& aActive);
williamr@4
   299
williamr@4
   300
    /**
williamr@4
   301
    Reads the interrupt state on the specified pin before any masking.
williamr@4
   302
    
williamr@4
   303
    @param aId     The pin Id.
williamr@4
   304
    @param aActive On return contains state of the interrupt signal on the pin
williamr@4
   305
 										  (TRUE=active).
williamr@4
   306
williamr@4
   307
    @return KErrNone, if successful;
williamr@4
   308
            KErrArgument, if aId is invalid;
williamr@4
   309
            KErrNotSupported if reading raw interrupt state is not supported;
williamr@4
   310
            KErrGeneral, if there is no ISR bound to this interrupt.
williamr@4
   311
    */
williamr@4
   312
	IMPORT_C static TInt GetRawInterruptState(TInt aId, TBool& aActive);
williamr@4
   313
williamr@4
   314
    /**
williamr@4
   315
    Sets the interrupt trigger on the specified pin.
williamr@4
   316
    
williamr@4
   317
    @param aId      The pin Id.
williamr@4
   318
    @param aTrigger The trigger type.
williamr@4
   319
williamr@4
   320
    @return KErrNone, if successful;
williamr@4
   321
            KErrArgument, if aId is invalid;
williamr@4
   322
            KErrNotSupported if pin does not support interrupts.
williamr@4
   323
    */
williamr@4
   324
	IMPORT_C static TInt SetInterruptTrigger(TInt aId, TGpioDetectionTrigger aTrigger);
williamr@4
   325
williamr@4
   326
    /**
williamr@4
   327
    Enables the wakeup on specified pin.
williamr@4
   328
    
williamr@4
   329
    @param aId  The pin Id.
williamr@4
   330
    
williamr@4
   331
    @return KErrNone, if successful;
williamr@4
   332
            KErrArgument, if aId is invalid;
williamr@4
   333
            KErrNotSupported if pin does not support wakeup.
williamr@4
   334
    */
williamr@4
   335
	IMPORT_C static TInt EnableWakeup(TInt aId);
williamr@4
   336
williamr@4
   337
    /**
williamr@4
   338
    Disables the wakeup on specified pin.
williamr@4
   339
    
williamr@4
   340
    @param aId  The pin Id.
williamr@4
   341
    
williamr@4
   342
    @return KErrNone, if successful;
williamr@4
   343
            KErrArgument, if aId is invalid;
williamr@4
   344
            KErrNotSupported if pin does not support wakeup.
williamr@4
   345
    */
williamr@4
   346
	IMPORT_C static TInt DisableWakeup(TInt aId);
williamr@4
   347
williamr@4
   348
    /**
williamr@4
   349
    Checks if wakeup is enabled on pin.
williamr@4
   350
    
williamr@4
   351
    @param aId     The pin Id.
williamr@4
   352
    @param aEnable On return contains the enable/disable state of wakeup 
williamr@4
   353
 								       		 (TRUE=enabled).
williamr@4
   354
    
williamr@4
   355
    @return KErrNone, if successful; 
williamr@4
   356
            KErrArgument, if aId is invalid;
williamr@4
   357
            KErrNotSupported if pin does not support wakeups;
williamr@4
   358
    */
williamr@4
   359
	IMPORT_C static TInt IsWakeupEnabled(TInt aId, TBool& aEnable);
williamr@4
   360
williamr@4
   361
    /**
williamr@4
   362
    Sets the wakeup trigger on the specified pin.
williamr@4
   363
    
williamr@4
   364
    @param aId      The pin Id.
williamr@4
   365
    @param aTrigger The trigger type.
williamr@4
   366
williamr@4
   367
    @return KErrNone, if successful;
williamr@4
   368
            KErrArgument, if aId is invalid;
williamr@4
   369
            KErrNotSupported if pin does not support wakeup.
williamr@4
   370
    */
williamr@4
   371
	IMPORT_C static TInt SetWakeupTrigger(TInt aId, TGpioDetectionTrigger aTrigger);
williamr@4
   372
williamr@4
   373
    /**
williamr@4
   374
    Sets the debouncing time on the specified pin.
williamr@4
   375
    
williamr@4
   376
    @param aId    The pin Id.
williamr@4
   377
    @param aTime  The debouncing time in microseconds.
williamr@4
   378
williamr@4
   379
    @return KErrNone, if the time is succesfully changed or no change is needed (see
williamr@4
   380
                                                			         below);
williamr@4
   381
            KErrArgument, if aId is invalid;
williamr@4
   382
            KErrNotSupported if pin does not support debouncing.
williamr@4
   383
williamr@4
   384
    If the requested time is greater than the common value for the module, the latter
williamr@4
   385
    is increased to the value requested.
williamr@4
   386
    If the requested time is lesser than the common value for the module then the
williamr@4
   387
    common value is unchanged, unless it is set to the value requested on this pin.
williamr@4
   388
    */
williamr@4
   389
	IMPORT_C static TInt SetDebounceTime(TInt aId, TInt aTime);
williamr@4
   390
williamr@4
   391
    /**
williamr@4
   392
    Reads the debouncing time on the specified pin.
williamr@4
   393
    
williamr@4
   394
    @param aId    The pin Id.
williamr@4
   395
    @param aTime  On return contains the debouncing time in microseconds.
williamr@4
   396
williamr@4
   397
    @return KErrNone, if successful;
williamr@4
   398
            KErrArgument, if aId is invalid;
williamr@4
   399
            KErrNotSupported if pin does not support debouncing.
williamr@4
   400
    */
williamr@4
   401
	IMPORT_C static TInt GetDebounceTime(TInt aId, TInt& aTime);
williamr@4
   402
williamr@4
   403
    /**
williamr@4
   404
    Reads the state of an input (synchronously).
williamr@4
   405
    
williamr@4
   406
    @param aId    The pin Id.
williamr@4
   407
    @param aState On return contains the pin state.
williamr@4
   408
williamr@4
   409
    @return KErrNone, if successful;
williamr@4
   410
            KErrArgument, if aId is invalid.
williamr@4
   411
            KErrNotSupported, if reading the state synchronously is not supported.
williamr@4
   412
    */
williamr@4
   413
	IMPORT_C static TInt GetInputState(TInt aId, TGpioState& aState);
williamr@4
   414
williamr@4
   415
    /**
williamr@4
   416
    Sets the output pin to one of the supported states (synchronously).
williamr@4
   417
    
williamr@4
   418
    @param aId    The pin Id.
williamr@4
   419
    @param aState The pin state.
williamr@4
   420
williamr@4
   421
    @return KErrNone, if successful;
williamr@4
   422
			KErrArgument, if aId is invalid;
williamr@4
   423
            KErrNotSupported, if the state is not supported or if setting its state synchronously is not supported.
williamr@4
   424
    */
williamr@4
   425
	IMPORT_C static TInt SetOutputState(TInt aId, TGpioState aState);
williamr@4
   426
williamr@4
   427
    /**
williamr@4
   428
    Reads the output pin states (synchronously).
williamr@4
   429
    
williamr@4
   430
    @param aId    The pin Id.
williamr@4
   431
    @param aState On return contains the pin state. On systems where the state of an
williamr@4
   432
 			 ouptut pin cannot be read directly from hardware, or takes a non
williamr@4
   433
			 negligible time to be retrieved, the implementation must cache it.
williamr@4
   434
williamr@4
   435
    @return KErrNone, if successful; 
williamr@4
   436
            KErrArgument, if aId is invalid.
williamr@4
   437
    */
williamr@4
   438
	IMPORT_C static TInt GetOutputState(TInt aId, TGpioState& aState);
williamr@4
   439
williamr@4
   440
    /**
williamr@4
   441
    Reads the state of an input (asynchronously).
williamr@4
   442
    
williamr@4
   443
    @param aId    The pin Id.
williamr@4
   444
    @param aCb    A pointer to a GPIO callback object.
williamr@4
   445
williamr@4
   446
    @return KErrNone, if accepted;
williamr@4
   447
            KErrArgument, if aId is invalid.
williamr@4
   448
            KErrNotSupported, if reading the state asynchronously is not supported.
williamr@4
   449
williamr@4
   450
	This API should be used with off-chip GPIO modules only;
williamr@4
   451
	The result of the read operation and the state of the input pin will be passed as an argument to the callback function;
williamr@4
   452
    */
williamr@4
   453
	IMPORT_C static TInt GetInputState(TInt aId, TGpioCallback* aCb);
williamr@4
   454
williamr@4
   455
    /**
williamr@4
   456
    Sets the output pin to one of the supported states (asynchronously).
williamr@4
   457
    
williamr@4
   458
    @param aId    The pin Id.
williamr@4
   459
    @param aState The pin state.
williamr@4
   460
    @param aCb    A pointer to a GPIO callback object.
williamr@4
   461
williamr@4
   462
    @return KErrNone, if accepted;
williamr@4
   463
			KErrArgument, if aId is invalid;
williamr@4
   464
            KErrNotSupported, if setting its state asynchronously is not supported.
williamr@4
   465
williamr@4
   466
    This API should be used with off-chip GPIO modules only;
williamr@4
   467
	The result of the set operation will be passed as an argument to the callback function;
williamr@4
   468
    */
williamr@4
   469
	IMPORT_C static TInt SetOutputState(TInt aId, TGpioState aState, TGpioCallback* aCb);
williamr@4
   470
williamr@4
   471
	/**
williamr@4
   472
    Allows the platform specific implementation to extend the API.
williamr@4
   473
williamr@4
   474
    @param aId        The pin Id.
williamr@4
   475
	@param aCmd       A PSL extension function id.
williamr@4
   476
	@param aArg1      An argument to be passed to the PSL extension function.
williamr@4
   477
	@param aArg2      An argument to be passed to the PSL extension function.
williamr@4
   478
williamr@4
   479
    @return KErrNone, if accepted;
williamr@4
   480
			KErrArgument, if aId is invalid;
williamr@4
   481
            KErrNotSupported, if static extensions are not supported.
williamr@4
   482
			Any other system wide error code.
williamr@4
   483
    */
williamr@4
   484
	IMPORT_C static TInt StaticExtension(TInt aId, TInt aCmd, TAny* aArg1, TAny* aArg2);
williamr@4
   485
	};
williamr@4
   486
williamr@4
   487
/**
williamr@4
   488
GPIO asynchronous callback function
williamr@4
   489
*/
williamr@4
   490
typedef void (*TGpioCbFn)(TInt				/*aPinId*/,
williamr@4
   491
						  GPIO::TGpioState	/*aState*/,
williamr@4
   492
                          TInt				/*aResult*/,
williamr@4
   493
                          TAny*				/*aParam*/);
williamr@4
   494
/**
williamr@4
   495
GPIO asynchronous callback DFC
williamr@4
   496
The client must create one of these to be passed to each asynchronous call to GetInputState and SetOutputState
williamr@4
   497
The callback function is called in the context supplied by the client when creating an object of this kind (aQue)
williamr@4
   498
The callback function takes as arguments the pin id and the state, so it can be common to all TGpioCallback
williamr@4
   499
*/
williamr@4
   500
class TGpioCallback : public TDfc
williamr@4
   501
	{
williamr@4
   502
public:
williamr@4
   503
	inline TGpioCallback(TGpioCbFn aFn, TAny* aPtr, TDfcQue* aQue, TInt aPriority) : TDfc(DfcFunc, this, aQue, aPriority), iParam(aPtr), iCallback(aFn) 
williamr@4
   504
			{}
williamr@4
   505
private:
williamr@4
   506
    inline static void DfcFunc(TAny* aPtr)
williamr@4
   507
        {
williamr@4
   508
        TGpioCallback* pCb = (TGpioCallback*) aPtr;
williamr@4
   509
        pCb->iCallback(pCb->iPinId, pCb->iState, pCb->iResult, pCb->iParam);
williamr@4
   510
        }
williamr@4
   511
public:
williamr@4
   512
	TInt iPinId;		// the Id of the pin on which the asynchronous operation is performed
williamr@4
   513
	GPIO::TGpioState iState;	// either the state the output pin should be moved to or the state the input pin is at
williamr@4
   514
	TInt iResult;		// the result of this transaction as a system wide error
williamr@4
   515
	TAny* iParam;
williamr@4
   516
	TGpioCbFn iCallback;
williamr@4
   517
	};
williamr@4
   518
#endif