kerneltest/e32test/iic/iic_psl/i2c.cpp
changeset 247 d8d70de2bd36
parent 90 947f0dc9f7a8
--- a/kerneltest/e32test/iic/iic_psl/i2c.cpp	Tue Jul 06 15:50:07 2010 +0300
+++ b/kerneltest/e32test/iic/iic_psl/i2c.cpp	Wed Aug 18 11:08:29 2010 +0300
@@ -47,14 +47,15 @@
 	}
 #endif/*STANDALONE_CHANNEL*/
 
-#ifdef SLAVE_MODE
+//Macros MASTER_MODE and SLAVE_MODE are intentionally omitted from this file
+//This is for master and slave stubs to exercise the channel class,
+//and we need these stubs for code coverage tests.
 LOCAL_C TInt16 AssignSlaveChanId()
 	{
 	static TInt16 iBaseSlaveChanId = KI2cSlaveChannelIdBase;
 	I2C_PRINT(("I2C AssignSlaveChanId - on entry, iBaseSlaveChanId = 0x%x\n",iBaseSlaveChanId));
 	return iBaseSlaveChanId++; // Arbitrary, for illustration
 	}
-#endif/*SLAVE_MODE*/
 
 NONSHARABLE_CLASS(DSimulatedI2cDevice) : public DPhysicalDevice
 	{
@@ -230,8 +231,6 @@
 	return new DSimulatedI2cDevice;
 	}
 
-
-#ifdef MASTER_MODE
 #ifdef STANDALONE_CHANNEL
 EXPORT_C
 #endif
@@ -253,6 +252,8 @@
 	if(r == KErrNone)
 		SetDfcQ((TDfcQue*)iDynamicDfcQ);
 	DSimulatedIicBusChannelMasterI2c::SetRequestDelayed(this,EFalse);
+	//Call to base class DoCreate(not strictly necessary)
+	DIicBusChannelMaster::DoCreate();
 	return r;
 	}
 
@@ -423,7 +424,8 @@
 		default:
 			{
 			Kern::Printf("aFunction %d is not recognised \n",aFunction);
-			r=KErrNotSupported;
+			//For default case call the base class method for consistent handling
+            r=DIicBusChannelMaster::StaticExtension(aFunction,NULL,NULL);
 			}
 		}
 		
@@ -433,11 +435,6 @@
 	return r;
 	}
 
-//#ifdef MASTER_MODE
-#endif
-
-#ifdef SLAVE_MODE
-
 void DSimulatedIicBusChannelSlaveI2c::SlaveAsyncSimCallback(TAny* aPtr)
 	{
 	// To support simulating an asynchronous capture operation
@@ -1042,7 +1039,8 @@
 		default:
 			{
 			Kern::Printf("aFunction %d is not recognised \n",aFunction);
-			r=KErrNotSupported;
+			//For default case call the base class method for consistent handling
+            r=DIicBusChannelSlave::StaticExtension(aFunction,NULL,NULL);
 			}
 		}
 #ifdef IIC_INSTRUMENTATION_MACRO
@@ -1051,12 +1049,6 @@
 	return r;
 	}
 
-
-
-//#ifdef MASTER_MODE
-#endif
-
-#if defined(MASTER_MODE) && defined(SLAVE_MODE)
 #ifdef STANDALONE_CHANNEL
 EXPORT_C
 #endif
@@ -1107,15 +1099,13 @@
 		default:
 			{
 			Kern::Printf("aFunction %d is not recognised \n",aFunction);
-			r=KErrNotSupported;
+			//For default case call the base class method for consistent handling
+			r=DIicBusChannelMasterSlave::StaticExtension(aFunction,NULL,NULL);
 			}
 		}
 	return r;
 	}
 
 
-//#if defined(MASTER_MODE) && defined(SLAVE_MODE)
-#endif
 
 
-