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) |
|
46 const TInt KI2cThreadPriority = 5; // Arbitrary, can be 0-7, 7 highest |
45 const TInt KI2cThreadPriority = 5; // Arbitrary, can be 0-7, 7 highest |
47 #endif |
|
48 |
46 |
49 const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary |
47 const TInt16 KI2cSlaveChannelIdBase = 0x1D00; // Arbitrary |
50 |
48 |
51 #ifdef MASTER_MODE |
49 const TInt KI2cSlaveAsyncDelaySim = 20; // Arbitrary delay, for timer to simulate asynchronous processing |
|
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. |
52 class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster |
54 class DSimulatedIicBusChannelMasterI2c : public DIicBusChannelMaster |
53 { |
55 { |
54 // platform specific implementation |
56 // platform specific implementation |
55 public: |
57 public: |
56 #ifdef STANDALONE_CHANNEL |
58 #ifdef STANDALONE_CHANNEL |
83 TBool iReqDelayed; |
85 TBool iReqDelayed; |
84 }; |
86 }; |
85 #ifndef STANDALONE_CHANNEL |
87 #ifndef STANDALONE_CHANNEL |
86 TInt8 DSimulatedIicBusChannelMasterI2c::iCurrentChanNum = KI2cChannelNumBase; // Initialise static member of DSimulatedIicBusChannelMasterI2c |
88 TInt8 DSimulatedIicBusChannelMasterI2c::iCurrentChanNum = KI2cChannelNumBase; // Initialise static member of DSimulatedIicBusChannelMasterI2c |
87 #endif |
89 #endif |
88 #endif/*MASTER_MODE*/ |
|
89 |
90 |
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);} |
112 |
122 |
113 protected: |
123 protected: |
114 virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL |
124 virtual void SendBusErrorAndReturn() {return;} // Not implemented in simulated PSL |
115 |
125 |
116 |
126 |
130 TInt8* iTxCheckBuf; |
140 TInt8* iTxCheckBuf; |
131 |
141 |
132 TInt iBlockedTrigger; |
142 TInt iBlockedTrigger; |
133 TBool iBlockNotification; |
143 TBool iBlockNotification; |
134 |
144 |
|
145 TAsyncEvent iAsyncEvent; |
|
146 TInt iRxTxTrigger; |
|
147 |
135 NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation |
148 NTimer iSlaveTimer; // Used to simulate an asynchronous capture operation |
|
149 TSpinLock iEventSpinLock; // To serialise simulated bus events - Rx, Tx or Rx+Tx |
136 }; |
150 }; |
137 #endif/*SLAVE_MODE*/ |
|
138 |
151 |
139 #if defined(MASTER_MODE) && defined(SLAVE_MODE) |
|
140 class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave |
152 class DSimulatedIicBusChannelMasterSlaveI2c : public DIicBusChannelMasterSlave |
141 { |
153 { |
142 public: |
154 public: |
143 #ifdef STANDALONE_CHANNEL |
155 #ifdef STANDALONE_CHANNEL |
144 IMPORT_C |
156 IMPORT_C |
145 #endif |
157 #endif |
146 DSimulatedIicBusChannelMasterSlaveI2c(TBusType /*aBusType*/, TChannelDuplex aChanDuplex, DSimulatedIicBusChannelMasterI2c* aMasterChan, DSimulatedIicBusChannelSlaveI2c* aSlaveChan); |
158 DSimulatedIicBusChannelMasterSlaveI2c(TBusType /*aBusType*/, TChannelDuplex aChanDuplex, DSimulatedIicBusChannelMasterI2c* aMasterChan, DSimulatedIicBusChannelSlaveI2c* aSlaveChan); |
147 |
159 |
148 TInt StaticExtension(TUint aFunction, TAny* aParam1, TAny* aParam2); |
160 TInt StaticExtension(TUint aFunction, TAny* aParam1, TAny* aParam2); |
149 }; |
161 }; |
150 #endif/*(MASTER_MODE) && (SLAVE_MODE)*/ |
|
151 |
162 |
152 #endif /*I2C_H_*/ |
163 #endif /*I2C_H_*/ |