kernel/eka/include/drivers/gpio.h
branchRCL_3
changeset 256 c1f20ce4abcf
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
249:a179b74831c9 256:c1f20ce4abcf
    16 //
    16 //
    17 
    17 
    18 #ifndef __GPIO_H__
    18 #ifndef __GPIO_H__
    19 #define __GPIO_H__
    19 #define __GPIO_H__
    20 
    20 
       
    21 #include <dfcs.h>
       
    22 
       
    23 #ifdef __USE_GPIO_STATIC_EXTENSION__
       
    24 // test standard extension handler number. *DO NOT USE*
       
    25 #define KTestStaticExtension 0x80000000
       
    26 #include <staticextension.h>
       
    27 #endif
       
    28 
    21 class TGpioCallback;	//forward declaration
    29 class TGpioCallback;	//forward declaration
    22 
    30 
    23 /**
    31 /**
    24 @publishedPartner
    32 @publishedPartner
    25 @prototype 9.6
    33 @prototype 9.6
   106 		EEdgeFalling,
   114 		EEdgeFalling,
   107 		EEdgeRising,
   115 		EEdgeRising,
   108 		EEdgeBoth
   116 		EEdgeBoth
   109 		};
   117 		};
   110 
   118 
       
   119 	/**
       
   120 	 Enumeration TGpioBaseId defines the highest 16 bits of 32 bit GPIO Id 
       
   121 	 to identify the GPIO hardware block:
       
   122      - EInternalId    - The SOC GPIO hardware block (and any extender that is 
       
   123                         covered by the vendor supplied implementation) supports
       
   124 	                    pin ids from 0-65535
       
   125 	 - EExtender0-15  - Up to 16 3rd party extenders (each supporting up
       
   126 	                                to 65536 pins) can be used.
       
   127 	 */
       
   128 	enum TGpioBaseId
       
   129 	    {
       
   130 	    EInternalId = 0x00000000,
       
   131 	    EExtender0  = 0x00010000,        
       
   132 	    EExtender1  = 0x00020000,
       
   133 	    EExtender2  = 0x00040000,
       
   134 	    EExtender3  = 0x00080000,
       
   135 	    EExtender4  = 0x00100000,
       
   136 	    EExtender5  = 0x00200000,
       
   137 	    EExtender6  = 0x00400000,
       
   138 	    EExtender7  = 0x00800000,
       
   139 	    EExtender8  = 0x01000000,
       
   140 	    EExtender9  = 0x02000000,
       
   141 	    EExtender10 = 0x04000000,
       
   142 	    EExtender11 = 0x08000000,
       
   143 	    EExtender12 = 0x10000000,
       
   144 	    EExtender13 = 0x20000000,
       
   145 	    EExtender14 = 0x40000000,
       
   146 	    EExtender15 = 0x80000000
       
   147 	    };
       
   148 
       
   149 
       
   150 	
   111     /**
   151     /**
   112     Sets the pin mode.
   152     Sets the pin mode.
   113     
   153     
   114     @param aId   The pin Id.
   154     @param aId   The pin Id.
   115     @param aMode The pin mode.
   155     @param aMode The pin mode.
   198 	*/
   238 	*/
   199 	IMPORT_C static TInt SetPinIdleConfigurationAndState(TInt aId, TInt aConf);
   239 	IMPORT_C static TInt SetPinIdleConfigurationAndState(TInt aId, TInt aConf);
   200 
   240 
   201     /**
   241     /**
   202     Reads the pin idle configuration and state.
   242     Reads the pin idle configuration and state.
   203     
       
   204     @param aId    The pin Id.
   243     @param aId    The pin Id.
   205     @param aConf  On return contains the idle configuration and state previoulsy
   244     @param aConf  On return contains the idle configuration and state previoulsy
   206 				  set on the pin.
   245 				  set on the pin.
   207 
   246 
   208     @return KErrNone, if successful; 
   247     @return KErrNone, if successful; 
   240             KErrArgument, if aId is invalid;
   279             KErrArgument, if aId is invalid;
   241             KErrNotSupported if pin does not support interrupts;
   280             KErrNotSupported if pin does not support interrupts;
   242             KErrGeneral, if there is no ISR bound to this interrupt.
   281             KErrGeneral, if there is no ISR bound to this interrupt.
   243     */
   282     */
   244 	IMPORT_C static TInt UnbindInterrupt(TInt aId);
   283 	IMPORT_C static TInt UnbindInterrupt(TInt aId);
   245 
       
   246     /**
   284     /**
   247     Enables the interrupt on specified pin.
   285     Enables the interrupt on specified pin.
   248     
   286     
   249     @param aId  The pin Id.
   287     @param aId  The pin Id.
   250     
   288     
   252             KErrArgument, if aId is invalid;
   290             KErrArgument, if aId is invalid;
   253             KErrNotSupported if pin does not support interrupts;
   291             KErrNotSupported if pin does not support interrupts;
   254             KErrGeneral, if there is no ISR bound to this interrupt.
   292             KErrGeneral, if there is no ISR bound to this interrupt.
   255     */
   293     */
   256 	IMPORT_C static TInt EnableInterrupt(TInt aId);
   294 	IMPORT_C static TInt EnableInterrupt(TInt aId);
   257 
       
   258     /**
   295     /**
   259     Disables the interrupt on specified pin.
   296     Disables the interrupt on specified pin.
   260     
   297     
   261     @param aId  The pin Id.
   298     @param aId  The pin Id.
   262     
   299     
   456 
   493 
   457     @return KErrNone, if accepted;
   494     @return KErrNone, if accepted;
   458             KErrArgument, if aId is invalid.
   495             KErrArgument, if aId is invalid.
   459             KErrNotSupported, if reading the state asynchronously is not supported.
   496             KErrNotSupported, if reading the state asynchronously is not supported.
   460 
   497 
   461 	This API should be used with off-chip GPIO modules only;
       
   462 	The result of the read operation and the state of the input pin will be passed as an argument to the callback function;
   498 	The result of the read operation and the state of the input pin will be passed as an argument to the callback function;
   463     */
   499     */
   464 	IMPORT_C static TInt GetInputState(TInt aId, TGpioCallback* aCb);
   500 	IMPORT_C static TInt GetInputState(TInt aId, TGpioCallback* aCb);
   465 
   501 
   466     /**
   502     /**
   472 
   508 
   473     @return KErrNone, if accepted;
   509     @return KErrNone, if accepted;
   474 			KErrArgument, if aId is invalid;
   510 			KErrArgument, if aId is invalid;
   475             KErrNotSupported, if setting its state asynchronously is not supported.
   511             KErrNotSupported, if setting its state asynchronously is not supported.
   476 
   512 
   477     This API should be used with off-chip GPIO modules only;
   513 
   478 	The result of the set operation will be passed as an argument to the callback function;
   514 	The result of the set operation will be passed as an argument to the callback function;
   479     */
   515     */
   480 	IMPORT_C static TInt SetOutputState(TInt aId, TGpioState aState, TGpioCallback* aCb);
   516 	IMPORT_C static TInt SetOutputState(TInt aId, TGpioState aState, TGpioCallback* aCb);
   481 
   517 
   482 	/**
   518 	/**