diff -r a179b74831c9 -r c1f20ce4abcf kerneltest/e32test/iic/iic_psl/i2c.h --- a/kerneltest/e32test/iic/iic_psl/i2c.h Thu Aug 19 11:14:22 2010 +0300 +++ b/kerneltest/e32test/iic/iic_psl/i2c.h Tue Aug 31 16:34:26 2010 +0300 @@ -42,13 +42,15 @@ #endif/*STANDALONE_CHANNEL*/ -#if defined(MASTER_MODE) const TInt KI2cThreadPriority = 5; // Arbitrary, can be 0-7, 7 highest -#endif const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary -#ifdef MASTER_MODE +const TInt KI2cSlaveAsyncDelaySim = 20; // Arbitrary delay, for timer to simulate asynchronous processing + +//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. class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster { // platform specific implementation @@ -85,9 +87,7 @@ #ifndef STANDALONE_CHANNEL TInt8 DSimulatedIicBusChannelMasterI2c::iCurrentChanNum = KI2cChannelNumBase; // Initialise static member of DSimulatedIicBusChannelMasterI2c #endif -#endif/*MASTER_MODE*/ -#ifdef SLAVE_MODE class DSimulatedIicBusChannelSlaveI2c : public DIicBusChannelSlave { public: @@ -110,6 +110,16 @@ inline void SetChanNum(TInt8 aChanNum) {iChannelNumber = aChanNum;}; + enum TAsyncEvent + { + ENoEvent = 0, + EAsyncChanCapture, + ERxWords, + ETxWords, + ERxTxWords + }; + inline void ChanNotifyClient(TInt aTrigger) {NotifyClient(aTrigger);} + protected: virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL @@ -132,11 +142,13 @@ TInt iBlockedTrigger; TBool iBlockNotification; + TAsyncEvent iAsyncEvent; + TInt iRxTxTrigger; + NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation + TSpinLock iEventSpinLock; // To serialise simulated bus events - Rx, Tx or Rx+Tx }; -#endif/*SLAVE_MODE*/ -#if defined(MASTER_MODE) && defined(SLAVE_MODE) class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave { public: @@ -147,6 +159,5 @@ TInt StaticExtension(TUint aFunction, TAny* aParam1, TAny* aParam2); }; -#endif/*(MASTER_MODE) && (SLAVE_MODE)*/ #endif /*I2C_H_*/