equal
deleted
inserted
replaced
45 #if defined(MASTER_MODE) |
45 #if defined(MASTER_MODE) |
46 const TInt KI2cThreadPriority = 5; // Arbitrary, can be 0-7, 7 highest |
46 const TInt KI2cThreadPriority = 5; // Arbitrary, can be 0-7, 7 highest |
47 #endif |
47 #endif |
48 |
48 |
49 const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary |
49 const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary |
|
50 |
|
51 const TInt KI2cSlaveAsyncDelaySim = 20; // Arbitrary delay, for timer to simulate asynchronous processing |
50 |
52 |
51 #ifdef MASTER_MODE |
53 #ifdef MASTER_MODE |
52 class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster |
54 class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster |
53 { |
55 { |
54 // platform specific implementation |
56 // platform specific implementation |
108 static void SlaveAsyncSimCallback(TAny* aPtr); |
110 static void SlaveAsyncSimCallback(TAny* aPtr); |
109 inline void ChanCaptureCb(TInt aResult) {ChanCaptureCallback(aResult);} |
111 inline void ChanCaptureCb(TInt aResult) {ChanCaptureCallback(aResult);} |
110 |
112 |
111 inline void SetChanNum(TInt8 aChanNum) {iChannelNumber = aChanNum;}; |
113 inline void SetChanNum(TInt8 aChanNum) {iChannelNumber = aChanNum;}; |
112 |
114 |
|
115 enum TAsyncEvent |
|
116 { |
|
117 ENoEvent = 0, |
|
118 EAsyncChanCapture, |
|
119 ERxWords, |
|
120 ETxWords, |
|
121 ERxTxWords |
|
122 }; |
|
123 inline void ChanNotifyClient(TInt aTrigger) {NotifyClient(aTrigger);} |
|
124 |
113 protected: |
125 protected: |
114 virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL |
126 virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL |
115 |
127 |
116 |
128 |
117 private: |
129 private: |
130 TInt8* iTxCheckBuf; |
142 TInt8* iTxCheckBuf; |
131 |
143 |
132 TInt iBlockedTrigger; |
144 TInt iBlockedTrigger; |
133 TBool iBlockNotification; |
145 TBool iBlockNotification; |
134 |
146 |
|
147 TAsyncEvent iAsyncEvent; |
|
148 TInt iRxTxTrigger; |
|
149 |
135 NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation |
150 NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation |
|
151 TSpinLock iEventSpinLock; // To serialise simulated bus events - Rx, Tx or Rx+Tx |
136 }; |
152 }; |
137 #endif/*SLAVE_MODE*/ |
153 #endif/*SLAVE_MODE*/ |
138 |
154 |
139 #if defined(MASTER_MODE) && defined(SLAVE_MODE) |
155 #if defined(MASTER_MODE) && defined(SLAVE_MODE) |
140 class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave |
156 class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave |