kernel/eka/include/drivers/gpio.h
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #ifndef __GPIO_H__
    18 #ifndef __GPIO_H__
    19 #define __GPIO_H__
    19 #define __GPIO_H__
    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 
    20 
    29 class TGpioCallback;	//forward declaration
    21 class TGpioCallback;	//forward declaration
    30 
    22 
    31 /**
    23 /**
    32 @publishedPartner
    24 @publishedPartner
   114 		EEdgeFalling,
   106 		EEdgeFalling,
   115 		EEdgeRising,
   107 		EEdgeRising,
   116 		EEdgeBoth
   108 		EEdgeBoth
   117 		};
   109 		};
   118 
   110 
   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 	
       
   151     /**
   111     /**
   152     Sets the pin mode.
   112     Sets the pin mode.
   153     
   113     
   154     @param aId   The pin Id.
   114     @param aId   The pin Id.
   155     @param aMode The pin mode.
   115     @param aMode The pin mode.
   238 	*/
   198 	*/
   239 	IMPORT_C static TInt SetPinIdleConfigurationAndState(TInt aId, TInt aConf);
   199 	IMPORT_C static TInt SetPinIdleConfigurationAndState(TInt aId, TInt aConf);
   240 
   200 
   241     /**
   201     /**
   242     Reads the pin idle configuration and state.
   202     Reads the pin idle configuration and state.
       
   203     
   243     @param aId    The pin Id.
   204     @param aId    The pin Id.
   244     @param aConf  On return contains the idle configuration and state previoulsy
   205     @param aConf  On return contains the idle configuration and state previoulsy
   245 				  set on the pin.
   206 				  set on the pin.
   246 
   207 
   247     @return KErrNone, if successful; 
   208     @return KErrNone, if successful; 
   279             KErrArgument, if aId is invalid;
   240             KErrArgument, if aId is invalid;
   280             KErrNotSupported if pin does not support interrupts;
   241             KErrNotSupported if pin does not support interrupts;
   281             KErrGeneral, if there is no ISR bound to this interrupt.
   242             KErrGeneral, if there is no ISR bound to this interrupt.
   282     */
   243     */
   283 	IMPORT_C static TInt UnbindInterrupt(TInt aId);
   244 	IMPORT_C static TInt UnbindInterrupt(TInt aId);
       
   245 
   284     /**
   246     /**
   285     Enables the interrupt on specified pin.
   247     Enables the interrupt on specified pin.
   286     
   248     
   287     @param aId  The pin Id.
   249     @param aId  The pin Id.
   288     
   250     
   290             KErrArgument, if aId is invalid;
   252             KErrArgument, if aId is invalid;
   291             KErrNotSupported if pin does not support interrupts;
   253             KErrNotSupported if pin does not support interrupts;
   292             KErrGeneral, if there is no ISR bound to this interrupt.
   254             KErrGeneral, if there is no ISR bound to this interrupt.
   293     */
   255     */
   294 	IMPORT_C static TInt EnableInterrupt(TInt aId);
   256 	IMPORT_C static TInt EnableInterrupt(TInt aId);
       
   257 
   295     /**
   258     /**
   296     Disables the interrupt on specified pin.
   259     Disables the interrupt on specified pin.
   297     
   260     
   298     @param aId  The pin Id.
   261     @param aId  The pin Id.
   299     
   262     
   493 
   456 
   494     @return KErrNone, if accepted;
   457     @return KErrNone, if accepted;
   495             KErrArgument, if aId is invalid.
   458             KErrArgument, if aId is invalid.
   496             KErrNotSupported, if reading the state asynchronously is not supported.
   459             KErrNotSupported, if reading the state asynchronously is not supported.
   497 
   460 
       
   461 	This API should be used with off-chip GPIO modules only;
   498 	The result of the read operation and the state of the input pin will be passed as an argument to the callback function;
   462 	The result of the read operation and the state of the input pin will be passed as an argument to the callback function;
   499     */
   463     */
   500 	IMPORT_C static TInt GetInputState(TInt aId, TGpioCallback* aCb);
   464 	IMPORT_C static TInt GetInputState(TInt aId, TGpioCallback* aCb);
   501 
   465 
   502     /**
   466     /**
   508 
   472 
   509     @return KErrNone, if accepted;
   473     @return KErrNone, if accepted;
   510 			KErrArgument, if aId is invalid;
   474 			KErrArgument, if aId is invalid;
   511             KErrNotSupported, if setting its state asynchronously is not supported.
   475             KErrNotSupported, if setting its state asynchronously is not supported.
   512 
   476 
   513 
   477     This API should be used with off-chip GPIO modules only;
   514 	The result of the set operation will be passed as an argument to the callback function;
   478 	The result of the set operation will be passed as an argument to the callback function;
   515     */
   479     */
   516 	IMPORT_C static TInt SetOutputState(TInt aId, TGpioState aState, TGpioCallback* aCb);
   480 	IMPORT_C static TInt SetOutputState(TInt aId, TGpioState aState, TGpioCallback* aCb);
   517 
   481 
   518 	/**
   482 	/**