bsptemplate/asspandvariant/template_assp/gpio.cpp
branchRCL_3
changeset 43 c1f20ce4abcf
parent 0 a41df078684a
child 44 3e88ff8f41d5
equal deleted inserted replaced
42:a179b74831c9 43:c1f20ce4abcf
    37 
    37 
    38 static GpioPin	GpioPins[KHwGpioPinMax+1];
    38 static GpioPin	GpioPins[KHwGpioPinMax+1];
    39 
    39 
    40 static TInt32	GpioInterruptId; // place to store interrupt handle returned from Interrupt::Bind()
    40 static TInt32	GpioInterruptId; // place to store interrupt handle returned from Interrupt::Bind()
    41 
    41 
       
    42 
       
    43 /**
       
    44 Calculate 16-bit device pin Id from 32-bit pin Id. Use DeviceId() to 
       
    45 get device Id.
       
    46 @param   aId         32-bit pin Id
       
    47 @return  16-bit device specific pin Id
       
    48  */
       
    49 static inline TUint16 DevicePinId(TInt aId)
       
    50     {return static_cast<TUint16>(aId & 0x0000FFFF);}
       
    51 
       
    52 
       
    53 //Commented out to satisfy compiler(as method is not used in the code) but can  
       
    54 //be usefull later
       
    55 /**
       
    56 Calculate and return GPIO device Id(either SOC or one of the extenders)
       
    57 defined in TGpioBaseId from the 32-bit pin Id
       
    58 @param   aId         32-bit pin Id
       
    59 @return
       
    60    - EInternalId              SOC GPIO 
       
    61    - EExtender0-15            GPIO extenders from 0-15
       
    62 
       
    63 static inline GPIO::TGpioBaseId ExtenderId(TInt aId)
       
    64     {return static_cast<GPIO::TGpioBaseId>((aId & 0xFFFF0000));}
       
    65 */
       
    66 
       
    67 //Commented out to satisfy compiler(as method is not used in the code) but can  
       
    68 //be usefull later
       
    69 /**
       
    70 Generate 32-bit pin Id from the device Id and device specific 16-bit 
       
    71 pin Id.
       
    72 @param   aExtenderId     Device Id is defined in TGpioBaseId
       
    73 @param   aPinId          16-bit device pin Id
       
    74 return   32-bit pin Id  
       
    75 
       
    76 static inline TInt Id(GPIO::TGpioBaseId aExtenderId, TUint16 aPinId)
       
    77     {return static_cast<TInt>(aExtenderId |aPinId);}
       
    78 */
       
    79 
       
    80 //Commented out to satisfy compiler(as method is not used in the code) but can  
       
    81 //be usefull later
       
    82 /**
       
    83 Find index in extender GPIO device table.
       
    84 @param   aExtenderId     Extender Id is defined in TGpioBaseId
       
    85 @return  singned 32-bit integer index device, possible value 
       
    86         from 0 to 15
       
    87  
       
    88 static TInt DeviceIndex(GPIO::TGpioBaseId aExtenderId)
       
    89     {
       
    90     TUint16 val = (TUint16)((aExtenderId & 0xFFFF0000) >> 16);
       
    91     if(val == 0) return GPIO::EInternalId;
       
    92 
       
    93     //The algorithm steps througth the value until first non-zero bit is
       
    94     //found.
       
    95     //
       
    96     TInt index = 0;
       
    97     if(val & 0xFF00) {index  = 8; val = val >> 8;} // 2 x 8-bits
       
    98     if(val & 0x00F0) {index += 4; val = val >> 4;} // 2 x 4-bits
       
    99     if(val & 0x000C) {index += 2; val = val >> 2;} // 2 x 2 bits
       
   100     if(val & 0x0002) {index += 1; val = val >> 1;} // 2 x 1 bits
       
   101 
       
   102     return index;
       
   103     }
       
   104 */
       
   105 
       
   106 
       
   107 //Commented out to satisfy compiler(as method is not used in the code) but can  
       
   108 //be usefull later
       
   109 /**
       
   110 Find index in extender GPIO device table.
       
   111 @param   aId    32-bit GPIO pin Id
       
   112 @return  singned 32-bit integer index device, possible value 
       
   113          from 0 to 15
       
   114 
       
   115 static TInt DeviceIndex(TInt aId){return DeviceIndex(ExtenderId(aId));}
       
   116 */
       
   117 
       
   118 
       
   119 
       
   120 
       
   121 
       
   122 
    42 /**
   123 /**
    43 GPIO interrupt handler
   124 GPIO interrupt handler
    44 generic argument (TAny*) is a pointer to the GpioPins array
   125 generic argument (TAny*) is a pointer to the GpioPins array
    45 */
   126 */
    46 void GpioIsrDispatch(TAny *aPtr)
   127 void GpioIsrDispatch(TAny *aPtr)
    70 	(
   151 	(
    71 	TInt      aId,
   152 	TInt      aId,
    72    	TGpioMode aMode
   153    	TGpioMode aMode
    73 	)
   154 	)
    74 	{
   155 	{
    75 	if (aId < 0 || aId > KHwGpioPinMax)
   156     TUint16 pinId = DevicePinId(aId);
       
   157 	if (pinId > KHwGpioPinMax)
    76 		{
   158 		{
    77 		return KErrArgument;
   159 		return KErrArgument;
    78 		}
   160 		}
    79 	// TO DO: store pin mode and return
   161 	// TO DO: store pin mode and return
    80 	return KErrNone;
   162 	return KErrNone;
    84 	(
   166 	(
    85 	TInt        aId,
   167 	TInt        aId,
    86    	TGpioMode & aMode
   168    	TGpioMode & aMode
    87 	)
   169 	)
    88 	{
   170 	{
    89 	if (aId < 0 || aId > KHwGpioPinMax)
   171     TUint16 pinId = DevicePinId(aId);
       
   172 	if (pinId > KHwGpioPinMax)
    90 		{
   173 		{
    91 		return KErrArgument;
   174 		return KErrArgument;
    92 		}
   175 		}
    93 	// TO DO: set aMode = pin mode
   176 	// TO DO: set aMode = pin mode
    94 	return KErrNone;
   177 	return KErrNone;
    98 	(
   181 	(
    99 	TInt           aId,
   182 	TInt           aId,
   100    	TGpioDirection aDirection
   183    	TGpioDirection aDirection
   101 	)
   184 	)
   102 	{
   185 	{
   103 	if (aId < 0 || aId > KHwGpioPinMax || aDirection == ETriStated)
   186     TUint16 pinId = DevicePinId(aId);
       
   187 	if (pinId > KHwGpioPinMax || aDirection == ETriStated)
   104 		{
   188 		{
   105 		return KErrArgument;
   189 		return KErrArgument;
   106 		}
   190 		}
   107 	// TO DO: if we support setting the pin direction then do it here
   191 	// TO DO: if we support setting the pin direction then do it here
   108 	return KErrNone;
   192 	return KErrNone;
   112 	(
   196 	(
   113 	TInt             aId,
   197 	TInt             aId,
   114    	TGpioDirection & aDirection
   198    	TGpioDirection & aDirection
   115 	)
   199 	)
   116 	{
   200 	{
   117 	if (aId < 0 || aId > KHwGpioPinMax)
   201     TUint16 pinId = DevicePinId(aId);
       
   202 	if (pinId > KHwGpioPinMax)
   118 		{
   203 		{
   119 		return KErrArgument;
   204 		return KErrArgument;
   120 		}
   205 		}
   121 	// TO DO: if we support getting the pin direction then do it here
   206 	// TO DO: if we support getting the pin direction then do it here
   122 	return KErrNone;
   207 	return KErrNone;
   126 	(
   211 	(
   127 	TInt      aId,
   212 	TInt      aId,
   128    	TGpioBias aBias
   213    	TGpioBias aBias
   129 	)
   214 	)
   130 	{
   215 	{
   131 	if (aId < 0 || aId > KHwGpioPinMax)
   216     TUint16 pinId = DevicePinId(aId);
       
   217 	if (pinId > KHwGpioPinMax)
   132 		{
   218 		{
   133 		return KErrArgument;
   219 		return KErrArgument;
   134 		}
   220 		}
   135 	// TO DO: if we support setting the pin bias then do it here
   221 	// TO DO: if we support setting the pin bias then do it here
   136 	return KErrNone;
   222 	return KErrNone;
   140 	(
   226 	(
   141 	TInt        aId,
   227 	TInt        aId,
   142    	TGpioBias & aBias
   228    	TGpioBias & aBias
   143 	)
   229 	)
   144 	{
   230 	{
   145 	if (aId < 0 || aId > KHwGpioPinMax)
   231     TUint16 pinId = DevicePinId(aId);
       
   232 	if (pinId > KHwGpioPinMax)
   146 		{
   233 		{
   147 		return KErrArgument;
   234 		return KErrArgument;
   148 		}
   235 		}
   149 	// TO DO: if we support getting the pin bias then do it here
   236 	// TO DO: if we support getting the pin bias then do it here
   150 	return KErrNone;
   237 	return KErrNone;
   154 	(
   241 	(
   155 	TInt        aId,
   242 	TInt        aId,
   156    	TInt		/*aConf*/
   243    	TInt		/*aConf*/
   157 	)
   244 	)
   158 	{
   245 	{
   159 	if (aId < 0 || aId > KHwGpioPinMax)
   246     TUint16 pinId = DevicePinId(aId);
       
   247 	if (pinId > KHwGpioPinMax)
   160 		{
   248 		{
   161 		return KErrArgument;
   249 		return KErrArgument;
   162 		}
   250 		}
   163 	// TO DO: if we support setting the pin idle config then do it here
   251 	// TO DO: if we support setting the pin idle config then do it here
   164 	return KErrNone;
   252 	return KErrNone;
   168 	(
   256 	(
   169 	TInt        aId,
   257 	TInt        aId,
   170    	TInt	  & aBias
   258    	TInt	  & aBias
   171 	)
   259 	)
   172 	{
   260 	{
   173 	if (aId < 0 || aId > KHwGpioPinMax)
   261     TUint16 pinId = DevicePinId(aId);
       
   262 	if (pinId > KHwGpioPinMax)
   174 		{
   263 		{
   175 		return KErrArgument;
   264 		return KErrArgument;
   176 		}
   265 		}
   177 	// TO DO: if we support getting the pin idle config then do it here
   266 	// TO DO: if we support getting the pin idle config then do it here
   178 	return KErrNone;
   267 	return KErrNone;
   183 	TInt     aId,
   272 	TInt     aId,
   184    	TGpioIsr aIsr,
   273    	TGpioIsr aIsr,
   185    	TAny *   aPtr
   274    	TAny *   aPtr
   186 	)
   275 	)
   187 	{
   276 	{
   188 	if (aId < 0 || aId > KHwGpioPinMax || aIsr == NULL)
   277     TUint16 pinId = DevicePinId(aId);
   189 		{
   278 	if (pinId > KHwGpioPinMax || aIsr == NULL)
   190 		return KErrArgument;
   279 		{
   191 		}
   280 		return KErrArgument;
   192 	if (GpioPins[aId].iIsr != NULL)
   281 		}
       
   282 	if (GpioPins[pinId].iIsr != NULL)
   193 		{
   283 		{
   194 		// already bound
   284 		// already bound
   195 		return KErrInUse;
   285 		return KErrInUse;
   196 		}
   286 		}
   197 	// record isr and arg bound to this pin
   287 	// record isr and arg bound to this pin
   198 	GpioPins[aId].iIsr = aIsr;
   288 	GpioPins[pinId].iIsr = aIsr;
   199 	GpioPins[aId].iPtr = aPtr;
   289 	GpioPins[pinId].iPtr = aPtr;
   200 	return KErrNone;
   290 	return KErrNone;
   201 	}
   291 	}
   202 
   292 
   203 EXPORT_C TInt GPIO::UnbindInterrupt
   293 EXPORT_C TInt GPIO::UnbindInterrupt
   204 	(
   294 	(
   205 	TInt aId
   295 	TInt aId
   206 	)
   296 	)
   207 	{
   297 	{
   208 	if (aId < 0 || aId > KHwGpioPinMax)
   298     TUint16 pinId = DevicePinId(aId);
   209 		{
   299 	if (pinId > KHwGpioPinMax)
   210 		return KErrArgument;
   300 		{
   211 		}
   301 		return KErrArgument;
   212 	if (GpioPins[aId].iIsr == NULL)
   302 		}
       
   303 	if (GpioPins[pinId].iIsr == NULL)
   213 		{
   304 		{
   214 		// nothing bound
   305 		// nothing bound
   215 		return KErrGeneral;
   306 		return KErrGeneral;
   216 		}
   307 		}
   217 	// NULL isr bound to this pin
   308 	// NULL isr bound to this pin
   218 	GpioPins[aId].iIsr = NULL;
   309 	GpioPins[pinId].iIsr = NULL;
   219 	GpioPins[aId].iPtr = NULL;
   310 	GpioPins[pinId].iPtr = NULL;
   220 	return KErrNone;
   311 	return KErrNone;
   221 	}
   312 	}
   222 
   313 
   223 EXPORT_C TInt GPIO::EnableInterrupt
   314 EXPORT_C TInt GPIO::EnableInterrupt
   224 	(
   315 	(
   225 	TInt aId
   316 	TInt aId
   226 	)
   317 	)
   227 	{
   318 	{
   228 	if (aId < 0 || aId > KHwGpioPinMax)
   319     TUint16 pinId = DevicePinId(aId);
   229 		{
   320 	if (pinId > KHwGpioPinMax)
   230 		return KErrArgument;
   321 		{
   231 		}
   322 		return KErrArgument;
   232 	if (GpioPins[aId].iIsr == NULL)
   323 		}
       
   324 	if (GpioPins[pinId].iIsr == NULL)
   233 		{
   325 		{
   234 		// nothing bound
   326 		// nothing bound
   235 		return KErrGeneral;
   327 		return KErrGeneral;
   236 		}
   328 		}
   237 	// TODO: enable interrupts on this pin
   329 	// TODO: enable interrupts on this pin
   241 EXPORT_C TInt GPIO::DisableInterrupt
   333 EXPORT_C TInt GPIO::DisableInterrupt
   242 	(
   334 	(
   243 	TInt aId
   335 	TInt aId
   244 	)
   336 	)
   245 	{
   337 	{
   246 	if (aId < 0 || aId > KHwGpioPinMax)
   338     TUint16 pinId = DevicePinId(aId);
   247 		{
   339 	if (pinId > KHwGpioPinMax)
   248 		return KErrArgument;
   340 		{
   249 		}
   341 		return KErrArgument;
   250 	if (GpioPins[aId].iIsr == NULL)
   342 		}
       
   343 	if (GpioPins[pinId].iIsr == NULL)
   251 		{
   344 		{
   252 		// nothing bound
   345 		// nothing bound
   253 		return KErrGeneral;
   346 		return KErrGeneral;
   254 		}
   347 		}
   255 	// TODO: disable interrupts on this pin
   348 	// TODO: disable interrupts on this pin
   260 	(
   353 	(
   261 	TInt    aId,
   354 	TInt    aId,
   262    	TBool & aEnable
   355    	TBool & aEnable
   263 	)
   356 	)
   264 	{
   357 	{
   265 	if (aId < 0 || aId > KHwGpioPinMax)
   358     TUint16 pinId = DevicePinId(aId);
   266 		{
   359 	if (pinId > KHwGpioPinMax)
   267 		return KErrArgument;
   360 		{
   268 		}
   361 		return KErrArgument;
   269 	if (GpioPins[aId].iIsr == NULL)
   362 		}
       
   363 	if (GpioPins[pinId].iIsr == NULL)
   270 		{
   364 		{
   271 		// nothing bound
   365 		// nothing bound
   272 		return KErrGeneral;
   366 		return KErrGeneral;
   273 		}
   367 		}
   274 	// TO DO: are interrupts enabled on this pin ?
   368 	// TO DO: are interrupts enabled on this pin ?
   278 EXPORT_C TInt GPIO::ClearInterrupt
   372 EXPORT_C TInt GPIO::ClearInterrupt
   279 	(
   373 	(
   280 	TInt aId
   374 	TInt aId
   281 	)
   375 	)
   282 	{
   376 	{
   283 	if (aId < 0 || aId > KHwGpioPinMax)
   377     TUint16 pinId = DevicePinId(aId);
   284 		{
   378 	if (pinId > KHwGpioPinMax)
   285 		return KErrArgument;
   379 		{
   286 		}
   380 		return KErrArgument;
   287 	if (GpioPins[aId].iIsr == NULL)
   381 		}
       
   382 	if (GpioPins[pinId].iIsr == NULL)
   288 		{
   383 		{
   289 		// nothing bound
   384 		// nothing bound
   290 		return KErrGeneral;
   385 		return KErrGeneral;
   291 		}
   386 		}
   292 	// TO DO: clear pin interrupt status
   387 	// TO DO: clear pin interrupt status
   297 	(
   392 	(
   298 	TInt    aId,
   393 	TInt    aId,
   299    	TBool & aActive
   394    	TBool & aActive
   300 	)
   395 	)
   301 	{
   396 	{
   302 	if (aId < 0 || aId > KHwGpioPinMax)
   397     TUint16 pinId = DevicePinId(aId);
       
   398 	if (pinId > KHwGpioPinMax)
   303 		{
   399 		{
   304 		return KErrArgument;
   400 		return KErrArgument;
   305 		}
   401 		}
   306 	// TO DO: set aActive to masked interrupt state
   402 	// TO DO: set aActive to masked interrupt state
   307 	return KErrNone;
   403 	return KErrNone;
   311 	(
   407 	(
   312 	TInt    aId,
   408 	TInt    aId,
   313    	TBool & aActive
   409    	TBool & aActive
   314 	)
   410 	)
   315 	{
   411 	{
   316 	if (aId < 0 || aId > KHwGpioPinMax)
   412     TUint16 pinId = DevicePinId(aId);
       
   413 	if (pinId > KHwGpioPinMax)
   317 		{
   414 		{
   318 		return KErrArgument;
   415 		return KErrArgument;
   319 		}
   416 		}
   320 	// TO DO: set aActive to raw (unmasked) interrupt state
   417 	// TO DO: set aActive to raw (unmasked) interrupt state
   321 	return KErrNone;
   418 	return KErrNone;
   325 	(
   422 	(
   326 	TInt                  aId,
   423 	TInt                  aId,
   327    	TGpioDetectionTrigger aTrigger
   424    	TGpioDetectionTrigger aTrigger
   328 	)
   425 	)
   329 	{
   426 	{
   330 	if (aId < 0 || aId > KHwGpioPinMax)
   427     TUint16 pinId = DevicePinId(aId);
       
   428 	if (pinId > KHwGpioPinMax)
   331 		{
   429 		{
   332 		return KErrArgument;
   430 		return KErrArgument;
   333 		}
   431 		}
   334 	// TO DO: set interrupt trigger on this pin
   432 	// TO DO: set interrupt trigger on this pin
   335 	return KErrNone;
   433 	return KErrNone;
   338 EXPORT_C TInt GPIO::EnableWakeup
   436 EXPORT_C TInt GPIO::EnableWakeup
   339 	(
   437 	(
   340 	TInt aId
   438 	TInt aId
   341 	)
   439 	)
   342 	{
   440 	{
   343 	if (aId < 0 || aId > KHwGpioPinMax)
   441     TUint16 pinId = DevicePinId(aId);
       
   442 	if (pinId > KHwGpioPinMax)
   344 		{
   443 		{
   345 		return KErrArgument;
   444 		return KErrArgument;
   346 		}
   445 		}
   347 	// TO DO: enable wakeup on this pin
   446 	// TO DO: enable wakeup on this pin
   348 	return KErrNone;
   447 	return KErrNone;
   351 EXPORT_C TInt GPIO::DisableWakeup
   450 EXPORT_C TInt GPIO::DisableWakeup
   352 	(
   451 	(
   353 	TInt aId
   452 	TInt aId
   354 	)
   453 	)
   355 	{
   454 	{
   356 	if (aId < 0 || aId > KHwGpioPinMax)
   455     TUint16 pinId = DevicePinId(aId);
       
   456 	if (pinId > KHwGpioPinMax)
   357 		{
   457 		{
   358 		return KErrArgument;
   458 		return KErrArgument;
   359 		}
   459 		}
   360 	// TO DO: disable wakeup on this pin
   460 	// TO DO: disable wakeup on this pin
   361 	return KErrNone;
   461 	return KErrNone;
   365 	(
   465 	(
   366 	TInt    aId,
   466 	TInt    aId,
   367    	TBool & aEnable
   467    	TBool & aEnable
   368 	)
   468 	)
   369 	{
   469 	{
   370 	if (aId < 0 || aId > KHwGpioPinMax)
   470     TUint16 pinId = DevicePinId(aId);
       
   471 	if (pinId > KHwGpioPinMax)
   371 		{
   472 		{
   372 		return KErrArgument;
   473 		return KErrArgument;
   373 		}
   474 		}
   374 	// TO DO: set aEnable wakeup state for this pin
   475 	// TO DO: set aEnable wakeup state for this pin
   375 	return KErrNone;
   476 	return KErrNone;
   379 	(
   480 	(
   380 	TInt                  aId,
   481 	TInt                  aId,
   381    	TGpioDetectionTrigger aTrigger
   482    	TGpioDetectionTrigger aTrigger
   382 	)
   483 	)
   383 	{
   484 	{
   384 	if (aId < 0 || aId > KHwGpioPinMax)
   485     TUint16 pinId = DevicePinId(aId);
       
   486 	if (pinId > KHwGpioPinMax)
   385 		{
   487 		{
   386 		return KErrArgument;
   488 		return KErrArgument;
   387 		}
   489 		}
   388 	// TO DO: set wakeup trigger on this pin
   490 	// TO DO: set wakeup trigger on this pin
   389 	return KErrNone;
   491 	return KErrNone;
   393 	(
   495 	(
   394 	TInt aId,
   496 	TInt aId,
   395    	TInt aTime
   497    	TInt aTime
   396 	)
   498 	)
   397 	{
   499 	{
   398 	if (aId < 0 || aId > KHwGpioPinMax)
   500     TUint16 pinId = DevicePinId(aId);
       
   501 	if (pinId > KHwGpioPinMax)
   399 		{
   502 		{
   400 		return KErrArgument;
   503 		return KErrArgument;
   401 		}
   504 		}
   402 	// TO DO: set debounce time for this pin
   505 	// TO DO: set debounce time for this pin
   403 	// it may be necessary to emulate debouncing ourselves
   506 	// it may be necessary to emulate debouncing ourselves
   408 	(
   511 	(
   409 	TInt   aId,
   512 	TInt   aId,
   410    	TInt & aTime
   513    	TInt & aTime
   411 	)
   514 	)
   412 	{
   515 	{
   413 	if (aId < 0 || aId > KHwGpioPinMax)
   516     TUint16 pinId = DevicePinId(aId);
       
   517 	if (pinId > KHwGpioPinMax)
   414 		{
   518 		{
   415 		return KErrArgument;
   519 		return KErrArgument;
   416 		}
   520 		}
   417 	// TO DO: get debounce time for this pin
   521 	// TO DO: get debounce time for this pin
   418 	return KErrNone;
   522 	return KErrNone;
   422 	(
   526 	(
   423 	TInt         aId,
   527 	TInt         aId,
   424    	TGpioState & aState
   528    	TGpioState & aState
   425 	)
   529 	)
   426 	{
   530 	{
   427 	if (aId < 0 || aId > KHwGpioPinMax)
   531     TUint16 pinId = DevicePinId(aId);
       
   532 	if (pinId > KHwGpioPinMax)
   428 		{
   533 		{
   429 		return KErrArgument;
   534 		return KErrArgument;
   430 		}
   535 		}
   431 	// TO DO: read the input state of this pin
   536 	// TO DO: read the input state of this pin
   432 	// if debouncing is handled by the driver here
   537 	// if debouncing is handled by the driver here
   440 	(
   545 	(
   441 	TInt       aId,
   546 	TInt       aId,
   442    	TGpioState aState
   547    	TGpioState aState
   443 	)
   548 	)
   444 	{
   549 	{
   445 	if (aId < 0 || aId > KHwGpioPinMax)
   550     TUint16 pinId = DevicePinId(aId);
       
   551 	if (pinId > KHwGpioPinMax)
   446 		{
   552 		{
   447 		return KErrArgument;
   553 		return KErrArgument;
   448 		}
   554 		}
   449 	// TO DO: set the output state of this pin
   555 	// TO DO: set the output state of this pin
   450 	return KErrNone;
   556 	return KErrNone;
   454 	(
   560 	(
   455 	TInt         aId,
   561 	TInt         aId,
   456    	TGpioState & aState
   562    	TGpioState & aState
   457 	)
   563 	)
   458 	{
   564 	{
   459 	if (aId < 0 || aId > KHwGpioPinMax)
   565     TUint16 pinId = DevicePinId(aId);
       
   566 	if (pinId > KHwGpioPinMax)
   460 		{
   567 		{
   461 		return KErrArgument;
   568 		return KErrArgument;
   462 		}
   569 		}
   463 	// TO DO: get the output state of this pin
   570 	// TO DO: get the output state of this pin
   464 	return KErrNone;
   571 	return KErrNone;
   468 	(
   575 	(
   469 	TInt                  aId,
   576 	TInt                  aId,
   470    	TGpioCallback		* aCb
   577    	TGpioCallback		* aCb
   471 	)
   578 	)
   472 	{
   579 	{
   473 	if (aId < 0 || aId > KHwGpioPinMax)
   580     TUint16 pinId = DevicePinId(aId);
       
   581 	if (pinId > KHwGpioPinMax)
   474 		{
   582 		{
   475 		return KErrArgument;
   583 		return KErrArgument;
   476 		}
   584 		}
   477 	// TO DO: get the input state of this pin
   585 	// TO DO: get the input state of this pin
   478 	return KErrNone;
   586 	return KErrNone;
   483 	TInt                  aId,
   591 	TInt                  aId,
   484 	TGpioState			  aState,
   592 	TGpioState			  aState,
   485    	TGpioCallback		* aCb
   593    	TGpioCallback		* aCb
   486 	)
   594 	)
   487 	{
   595 	{
   488 	if (aId < 0 || aId > KHwGpioPinMax)
   596     TUint16 pinId = DevicePinId(aId);
       
   597 	if (pinId > KHwGpioPinMax)
   489 		{
   598 		{
   490 		return KErrArgument;
   599 		return KErrArgument;
   491 		}
   600 		}
   492 	// TO DO: set the ouput state of this pin
   601 	// TO DO: set the ouput state of this pin
   493 	return KErrNone;
   602 	return KErrNone;
   499 	TInt	  aCmd,
   608 	TInt	  aCmd,
   500 	TAny	* aArg1,
   609 	TAny	* aArg1,
   501 	TAny	* aArg2
   610 	TAny	* aArg2
   502 	)
   611 	)
   503 	{
   612 	{
   504 	if (aId < 0 || aId > KHwGpioPinMax)
   613     TUint16 pinId = DevicePinId(aId);
       
   614 	if (pinId > KHwGpioPinMax)
   505 		{
   615 		{
   506 		return KErrArgument;
   616 		return KErrArgument;
   507 		}
   617 		}
   508 	// TO DO: call the appropriate static extension if supported
   618 	// TO DO: call the appropriate static extension if supported
   509 	return KErrNotSupported;
   619 	return KErrNotSupported;