equal
deleted
inserted
replaced
40 // If client assumes Master mode, should be informed not available |
40 // If client assumes Master mode, should be informed not available |
41 #endif/*MASTER_MODE*/ |
41 #endif/*MASTER_MODE*/ |
42 #endif/*STANDALONE_CHANNEL*/ |
42 #endif/*STANDALONE_CHANNEL*/ |
43 |
43 |
44 |
44 |
|
45 #if defined(MASTER_MODE) |
45 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 |
46 |
48 |
47 const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary |
49 const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary |
48 |
50 |
49 const TInt KI2cSlaveAsyncDelaySim = 20; // Arbitrary delay, for timer to simulate asynchronous processing |
51 #ifdef MASTER_MODE |
50 |
|
51 //Macros MASTER_MODE and SLAVE_MODE are intentionally omitted from this file |
|
52 //This is for master and slave stubs to exercise the channel class, |
|
53 //and we need these stubs for code coverage tests. |
|
54 class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster |
52 class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster |
55 { |
53 { |
56 // platform specific implementation |
54 // platform specific implementation |
57 public: |
55 public: |
58 #ifdef STANDALONE_CHANNEL |
56 #ifdef STANDALONE_CHANNEL |
85 TBool iReqDelayed; |
83 TBool iReqDelayed; |
86 }; |
84 }; |
87 #ifndef STANDALONE_CHANNEL |
85 #ifndef STANDALONE_CHANNEL |
88 TInt8 DSimulatedIicBusChannelMasterI2c::iCurrentChanNum = KI2cChannelNumBase; // Initialise static member of DSimulatedIicBusChannelMasterI2c |
86 TInt8 DSimulatedIicBusChannelMasterI2c::iCurrentChanNum = KI2cChannelNumBase; // Initialise static member of DSimulatedIicBusChannelMasterI2c |
89 #endif |
87 #endif |
|
88 #endif/*MASTER_MODE*/ |
90 |
89 |
|
90 #ifdef SLAVE_MODE |
91 class DSimulatedIicBusChannelSlaveI2c : public DIicBusChannelSlave |
91 class DSimulatedIicBusChannelSlaveI2c : public DIicBusChannelSlave |
92 { |
92 { |
93 public: |
93 public: |
94 // platform specific implementation |
94 // platform specific implementation |
95 #ifdef STANDALONE_CHANNEL |
95 #ifdef STANDALONE_CHANNEL |
107 |
107 |
108 static void SlaveAsyncSimCallback(TAny* aPtr); |
108 static void SlaveAsyncSimCallback(TAny* aPtr); |
109 inline void ChanCaptureCb(TInt aResult) {ChanCaptureCallback(aResult);} |
109 inline void ChanCaptureCb(TInt aResult) {ChanCaptureCallback(aResult);} |
110 |
110 |
111 inline void SetChanNum(TInt8 aChanNum) {iChannelNumber = aChanNum;}; |
111 inline void SetChanNum(TInt8 aChanNum) {iChannelNumber = aChanNum;}; |
112 |
|
113 enum TAsyncEvent |
|
114 { |
|
115 ENoEvent = 0, |
|
116 EAsyncChanCapture, |
|
117 ERxWords, |
|
118 ETxWords, |
|
119 ERxTxWords |
|
120 }; |
|
121 inline void ChanNotifyClient(TInt aTrigger) {NotifyClient(aTrigger);} |
|
122 |
112 |
123 protected: |
113 protected: |
124 virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL |
114 virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL |
125 |
115 |
126 |
116 |
140 TInt8* iTxCheckBuf; |
130 TInt8* iTxCheckBuf; |
141 |
131 |
142 TInt iBlockedTrigger; |
132 TInt iBlockedTrigger; |
143 TBool iBlockNotification; |
133 TBool iBlockNotification; |
144 |
134 |
145 TAsyncEvent iAsyncEvent; |
135 NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation |
146 TInt iRxTxTrigger; |
136 }; |
|
137 #endif/*SLAVE_MODE*/ |
147 |
138 |
148 NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation |
139 #if defined(MASTER_MODE) && defined(SLAVE_MODE) |
149 TSpinLock iEventSpinLock; // To serialise simulated bus events - Rx, Tx or Rx+Tx |
|
150 }; |
|
151 |
|
152 class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave |
140 class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave |
153 { |
141 { |
154 public: |
142 public: |
155 #ifdef STANDALONE_CHANNEL |
143 #ifdef STANDALONE_CHANNEL |
156 IMPORT_C |
144 IMPORT_C |
157 #endif |
145 #endif |
158 DSimulatedIicBusChannelMasterSlaveI2c(TBusType /*aBusType*/, TChannelDuplex aChanDuplex, DSimulatedIicBusChannelMasterI2c* aMasterChan, DSimulatedIicBusChannelSlaveI2c* aSlaveChan); |
146 DSimulatedIicBusChannelMasterSlaveI2c(TBusType /*aBusType*/, TChannelDuplex aChanDuplex, DSimulatedIicBusChannelMasterI2c* aMasterChan, DSimulatedIicBusChannelSlaveI2c* aSlaveChan); |
159 |
147 |
160 TInt StaticExtension(TUint aFunction, TAny* aParam1, TAny* aParam2); |
148 TInt StaticExtension(TUint aFunction, TAny* aParam1, TAny* aParam2); |
161 }; |
149 }; |
|
150 #endif/*(MASTER_MODE) && (SLAVE_MODE)*/ |
162 |
151 |
163 #endif /*I2C_H_*/ |
152 #endif /*I2C_H_*/ |