16 // |
16 // |
17 // |
17 // |
18 |
18 |
19 #include "controltransferrequests.h" |
19 #include "controltransferrequests.h" |
20 #include "testdebug.h" |
20 #include "testdebug.h" |
|
21 #include "OstTraceDefinitions.h" |
|
22 #ifdef OST_TRACE_COMPILER_IN_USE |
|
23 #include "controltransferrequestsTraces.h" |
|
24 #endif |
21 |
25 |
22 namespace NUnitTesting_USBDI |
26 namespace NUnitTesting_USBDI |
23 { |
27 { |
24 |
28 |
25 |
29 |
26 CEp0Transfer::CEp0Transfer(RUsbInterface& aInterface0) |
30 CEp0Transfer::CEp0Transfer(RUsbInterface& aInterface0) |
27 : CActive(EPriorityStandard), |
31 : CActive(EPriorityStandard), |
28 iUsbInterface0(aInterface0), |
32 iUsbInterface0(aInterface0), |
29 iDataRequest(EFalse) |
33 iDataRequest(EFalse) |
30 { |
34 { |
|
35 OstTraceFunctionEntryExt( CEP0TRANSFER_CEP0TRANSFER_ENTRY, this ); |
31 CActiveScheduler::Add(this); |
36 CActiveScheduler::Add(this); |
|
37 OstTraceFunctionExit1( CEP0TRANSFER_CEP0TRANSFER_EXIT, this ); |
32 } |
38 } |
33 |
39 |
34 |
40 |
35 CEp0Transfer::~CEp0Transfer() |
41 CEp0Transfer::~CEp0Transfer() |
36 { |
42 { |
37 LOG_FUNC |
43 OstTraceFunctionEntry1( CEP0TRANSFER_CEP0TRANSFER_ENTRY_DUP01, this ); |
38 Cancel(); |
44 Cancel(); |
|
45 OstTraceFunctionExit1( CEP0TRANSFER_CEP0TRANSFER_EXIT_DUP01, this ); |
39 } |
46 } |
40 |
47 |
41 |
48 |
42 void CEp0Transfer::DoCancel() |
49 void CEp0Transfer::DoCancel() |
43 { |
50 { |
|
51 OstTraceFunctionEntry1( CEP0TRANSFER_DOCANCEL_ENTRY, this ); |
44 // Pretend cancel |
52 // Pretend cancel |
45 TRequestStatus* s = &iStatus; |
53 TRequestStatus* s = &iStatus; |
46 User::RequestComplete(s,KErrCancel); |
54 User::RequestComplete(s,KErrCancel); |
|
55 OstTraceFunctionExit1( CEP0TRANSFER_DOCANCEL_EXIT, this ); |
47 } |
56 } |
48 |
57 |
49 void CEp0Transfer::CancelSendRequest() |
58 void CEp0Transfer::CancelSendRequest() |
50 { |
59 { |
|
60 OstTraceFunctionEntry1( CEP0TRANSFER_CANCELSENDREQUEST_ENTRY, this ); |
51 // Pretend cancel |
61 // Pretend cancel |
52 iUsbInterface0.CancelEP0Transfer(); |
62 iUsbInterface0.CancelEP0Transfer(); |
|
63 OstTraceFunctionExit1( CEP0TRANSFER_CANCELSENDREQUEST_EXIT, this ); |
53 } |
64 } |
54 |
65 |
55 |
66 |
56 void CEp0Transfer::SendRequest(TEmptyRequest& aSetupPacket,MCommandObserver* aObserver) |
67 void CEp0Transfer::SendRequest(TEmptyRequest& aSetupPacket,MCommandObserver* aObserver) |
57 { |
68 { |
58 LOG_FUNC |
69 OstTraceFunctionEntryExt( CEP0TRANSFER_SENDREQUEST_ENTRY, this ); |
59 iObserver = aObserver; |
70 iObserver = aObserver; |
60 |
71 |
61 RDebug::Printf("bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
72 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST, "bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
62 RDebug::Printf("bRequest : 0x%02x",aSetupPacket.iRequest); |
73 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP01, "bRequest : 0x%02x",aSetupPacket.iRequest); |
63 RDebug::Printf("wValue : 0x%04x",aSetupPacket.iValue); |
74 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP02, "wValue : 0x%04x",aSetupPacket.iValue); |
64 RDebug::Printf("wIndex : 0x%04x",aSetupPacket.iIndex); |
75 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP03, "wIndex : 0x%04x",aSetupPacket.iIndex); |
65 RDebug::Printf("total sent : 8"); |
76 OstTrace0(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP04, "total sent : 8"); |
66 |
77 |
67 iUsbInterface0.Ep0Transfer(aSetupPacket,KNullDesC8,iTemp,iStatus); |
78 iUsbInterface0.Ep0Transfer(aSetupPacket,KNullDesC8,iTemp,iStatus); |
68 iRequestTime.HomeTime(); |
79 iRequestTime.HomeTime(); |
69 SetActive(); |
80 SetActive(); |
|
81 OstTraceFunctionExit1( CEP0TRANSFER_SENDREQUEST_EXIT, this ); |
70 } |
82 } |
71 |
83 |
72 |
84 |
73 void CEp0Transfer::SendRequest(TDataSendRequest& aSetupPacket,MCommandObserver* aObserver) |
85 void CEp0Transfer::SendRequest(TDataSendRequest& aSetupPacket,MCommandObserver* aObserver) |
74 { |
86 { |
75 LOG_FUNC |
87 OstTraceFunctionEntryExt( CEP0TRANSFER_SENDREQUEST_ENTRY_DUP01, this ); |
76 iObserver = aObserver; |
88 iObserver = aObserver; |
77 |
89 |
78 RDebug::Printf("bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
90 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP10, "bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
79 RDebug::Printf("bRequest : 0x%02x",aSetupPacket.iRequest); |
91 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP11, "bRequest : 0x%02x",aSetupPacket.iRequest); |
80 RDebug::Printf("wValue : 0x%04x",aSetupPacket.iValue); |
92 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP12, "wValue : 0x%04x",aSetupPacket.iValue); |
81 RDebug::Printf("wIndex : 0x%04x",aSetupPacket.iIndex); |
93 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP13, "wIndex : 0x%04x",aSetupPacket.iIndex); |
82 RDebug::Printf("data length : %d",aSetupPacket.iSendData.Length()); |
94 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP14, "data length : %d",aSetupPacket.iSendData.Length()); |
83 RDebug::Printf("total sent : %d",8+aSetupPacket.iSendData.Length()); |
95 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP15, "total sent : %d",8+aSetupPacket.iSendData.Length()); |
84 |
96 |
85 iUsbInterface0.Ep0Transfer(aSetupPacket,aSetupPacket.iSendData,iTemp,iStatus); |
97 iUsbInterface0.Ep0Transfer(aSetupPacket,aSetupPacket.iSendData,iTemp,iStatus); |
86 iRequestTime.HomeTime(); |
98 iRequestTime.HomeTime(); |
87 SetActive(); |
99 SetActive(); |
|
100 OstTraceFunctionExit1( CEP0TRANSFER_SENDREQUEST_EXIT_DUP01, this ); |
88 } |
101 } |
89 |
102 |
90 void CEp0Transfer::SendRequest(TWriteSynchronousCachedReadDataRequest& aSetupPacket,MCommandObserver* aObserver) |
103 void CEp0Transfer::SendRequest(TWriteSynchronousCachedReadDataRequest& aSetupPacket,MCommandObserver* aObserver) |
91 { |
104 { |
92 LOG_FUNC |
105 OstTraceFunctionEntryExt( CEP0TRANSFER_SENDREQUEST_ENTRY_DUP02, this ); |
93 iObserver = aObserver; |
106 iObserver = aObserver; |
94 |
107 |
95 RDebug::Printf("bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
108 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP20, "bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
96 RDebug::Printf("bRequest : 0x%02x",aSetupPacket.iRequest); |
109 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP21, "bRequest : 0x%02x",aSetupPacket.iRequest); |
97 RDebug::Printf("wValue : 0x%04x",aSetupPacket.iValue); |
110 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP22, "wValue : 0x%04x",aSetupPacket.iValue); |
98 RDebug::Printf("wIndex : 0x%04x",aSetupPacket.iIndex); |
111 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP23, "wIndex : 0x%04x",aSetupPacket.iIndex); |
99 RDebug::Printf("total sent : 8"); |
112 OstTrace0(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP24, "total sent : 8"); |
100 |
113 |
101 iUsbInterface0.Ep0Transfer(aSetupPacket,KNullDesC8,iTemp,iStatus); |
114 iUsbInterface0.Ep0Transfer(aSetupPacket,KNullDesC8,iTemp,iStatus); |
102 iRequestTime.HomeTime(); |
115 iRequestTime.HomeTime(); |
103 SetActive(); |
116 SetActive(); |
|
117 OstTraceFunctionExit1( CEP0TRANSFER_SENDREQUEST_EXIT_DUP02, this ); |
104 } |
118 } |
105 |
119 |
106 |
120 |
107 void CEp0Transfer::SendRequest(TEndpointReadRequest& aSetupPacket,MCommandObserver* aObserver) |
121 void CEp0Transfer::SendRequest(TEndpointReadRequest& aSetupPacket,MCommandObserver* aObserver) |
108 { |
122 { |
109 LOG_FUNC |
123 OstTraceFunctionEntryExt( CEP0TRANSFER_SENDREQUEST_ENTRY_DUP03, this ); |
110 iObserver = aObserver; |
124 iObserver = aObserver; |
111 |
125 |
112 RDebug::Printf("bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
126 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP30, "bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
113 RDebug::Printf("bRequest : 0x%02x",aSetupPacket.iRequest); |
127 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP31, "bRequest : 0x%02x",aSetupPacket.iRequest); |
114 RDebug::Printf("wValue : 0x%04x",aSetupPacket.iValue); |
128 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP32, "wValue : 0x%04x",aSetupPacket.iValue); |
115 RDebug::Printf("wIndex : 0x%04x",aSetupPacket.iIndex); |
129 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP33, "wIndex : 0x%04x",aSetupPacket.iIndex); |
116 RDebug::Printf("data length : %d",aSetupPacket.iReadSpecificationData.Length()); |
130 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP34, "data length : %d",aSetupPacket.iReadSpecificationData.Length()); |
117 RDebug::Printf("total sent : %d",8+aSetupPacket.iReadSpecificationData.Length()); |
131 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP35, "total sent : %d",8+aSetupPacket.iReadSpecificationData.Length()); |
118 TLex8 lex(aSetupPacket.iReadSpecificationData); |
132 TLex8 lex(aSetupPacket.iReadSpecificationData); |
119 TUint numBytes = 0; |
133 TUint numBytes = 0; |
120 lex.Val(numBytes, EDecimal); |
134 lex.Val(numBytes, EDecimal); |
121 RDebug::Printf("Read length required (in bytes) : %d",numBytes); |
135 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP06, "Read length required (in bytes) : %d",numBytes); |
122 |
136 |
123 iUsbInterface0.Ep0Transfer(aSetupPacket,aSetupPacket.iReadSpecificationData,iTemp,iStatus); |
137 iUsbInterface0.Ep0Transfer(aSetupPacket,aSetupPacket.iReadSpecificationData,iTemp,iStatus); |
124 iRequestTime.HomeTime(); |
138 iRequestTime.HomeTime(); |
125 SetActive(); |
139 SetActive(); |
|
140 OstTraceFunctionExit1( CEP0TRANSFER_SENDREQUEST_EXIT_DUP03, this ); |
126 } |
141 } |
127 |
142 |
128 void CEp0Transfer::SendRequest(TClassDataSendRequest& aSetupPacket,MCommandObserver* aObserver) |
143 void CEp0Transfer::SendRequest(TClassDataSendRequest& aSetupPacket,MCommandObserver* aObserver) |
129 { |
144 { |
130 LOG_FUNC |
145 OstTraceFunctionEntryExt( CEP0TRANSFER_SENDREQUEST_ENTRY_DUP04, this ); |
131 iObserver = aObserver; |
146 iObserver = aObserver; |
132 |
147 |
133 RDebug::Printf("bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
148 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP40, "bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
134 RDebug::Printf("bRequest : 0x%02x",aSetupPacket.iRequest); |
149 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP41, "bRequest : 0x%02x",aSetupPacket.iRequest); |
135 RDebug::Printf("wValue : 0x%04x",aSetupPacket.iValue); |
150 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP42, "wValue : 0x%04x",aSetupPacket.iValue); |
136 RDebug::Printf("wIndex : 0x%04x",aSetupPacket.iIndex); |
151 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP43, "wIndex : 0x%04x",aSetupPacket.iIndex); |
137 RDebug::Printf("data length : %d",aSetupPacket.iSendData.Length()); |
152 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP44, "data length : %d",aSetupPacket.iSendData.Length()); |
138 RDebug::Printf("total sent : %d",8+aSetupPacket.iSendData.Length()); |
153 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP45, "total sent : %d",8+aSetupPacket.iSendData.Length()); |
139 |
154 |
140 iUsbInterface0.Ep0Transfer(aSetupPacket,aSetupPacket.iSendData,iTemp,iStatus); |
155 iUsbInterface0.Ep0Transfer(aSetupPacket,aSetupPacket.iSendData,iTemp,iStatus); |
141 iRequestTime.HomeTime(); |
156 iRequestTime.HomeTime(); |
142 SetActive(); |
157 SetActive(); |
|
158 OstTraceFunctionExit1( CEP0TRANSFER_SENDREQUEST_EXIT_DUP04, this ); |
143 } |
159 } |
144 |
160 |
145 void CEp0Transfer::SendRequest(TDataRecvRequest& aSetupPacket,MCommandObserver* aObserver) |
161 void CEp0Transfer::SendRequest(TDataRecvRequest& aSetupPacket,MCommandObserver* aObserver) |
146 { |
162 { |
147 LOG_FUNC |
163 OstTraceFunctionEntryExt( CEP0TRANSFER_SENDREQUEST_ENTRY_DUP05, this ); |
148 iObserver = aObserver; |
164 iObserver = aObserver; |
149 |
165 |
150 RDebug::Printf("bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
166 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP50, "bmRequestType: 0x%02x",aSetupPacket.iRequestType); |
151 RDebug::Printf("bRequest : 0x%02x",aSetupPacket.iRequest); |
167 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP51, "bRequest : 0x%02x",aSetupPacket.iRequest); |
152 RDebug::Printf("wValue : 0x%04x",aSetupPacket.iValue); |
168 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP52, "wValue : 0x%04x",aSetupPacket.iValue); |
153 RDebug::Printf("wIndex : 0x%04x",aSetupPacket.iIndex); |
169 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP53, "wIndex : 0x%04x",aSetupPacket.iIndex); |
154 RDebug::Printf("data length : %d",aSetupPacket.iRecvData.Length()); |
170 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_SENDREQUEST_DUP54, "data length : %d",aSetupPacket.iRecvData.Length()); |
155 |
171 |
156 iUsbInterface0.Ep0Transfer(aSetupPacket,KNullDesC8,aSetupPacket.iRecvData,iStatus); |
172 iUsbInterface0.Ep0Transfer(aSetupPacket,KNullDesC8,aSetupPacket.iRecvData,iStatus); |
157 iRequestTime.HomeTime(); |
173 iRequestTime.HomeTime(); |
158 SetActive(); |
174 SetActive(); |
|
175 OstTraceFunctionExit1( CEP0TRANSFER_SENDREQUEST_EXIT_DUP05, this ); |
159 } |
176 } |
160 |
177 |
161 |
178 |
162 void CEp0Transfer::RunL() |
179 void CEp0Transfer::RunL() |
163 { |
180 { |
|
181 OstTraceFunctionEntry1( CEP0TRANSFER_RUNL_ENTRY, this ); |
164 iCompletionTime.HomeTime(); |
182 iCompletionTime.HomeTime(); |
165 LOG_FUNC |
|
166 TInt completionCode(iStatus.Int()); |
183 TInt completionCode(iStatus.Int()); |
167 |
184 |
168 RDebug::Printf("Client command sent, Completion code: %d",completionCode); |
185 OstTrace1(TRACE_NORMAL, CEP0TRANSFER_RUNL, "Client command sent, Completion code: %d",completionCode); |
169 iObserver->Ep0TransferCompleteL(completionCode); |
186 iObserver->Ep0TransferCompleteL(completionCode); |
|
187 OstTraceFunctionExit1( CEP0TRANSFER_RUNL_EXIT, this ); |
170 } |
188 } |
171 |
189 |
172 |
190 |
173 TInt CEp0Transfer::RunError(TInt aError) |
191 TInt CEp0Transfer::RunError(TInt aError) |
174 { |
192 { |
175 LOG_FUNC |
193 OstTraceFunctionEntryExt( CEP0TRANSFER_RUNERROR_ENTRY, this ); |
|
194 OstTraceFunctionExitExt( CEP0TRANSFER_RUNERROR_EXIT, this, KErrNone ); |
176 return KErrNone; |
195 return KErrNone; |
177 } |
196 } |
178 |
197 |
179 void CEp0Transfer::LastRequestStartTime( TTime& aDuration) |
198 void CEp0Transfer::LastRequestStartTime( TTime& aDuration) |
180 { |
199 { |
|
200 OstTraceFunctionEntryExt( CEP0TRANSFER_LASTREQUESTSTARTTIME_ENTRY, this ); |
181 aDuration= iRequestTime.Int64(); |
201 aDuration= iRequestTime.Int64(); |
|
202 OstTraceFunctionExit1( CEP0TRANSFER_LASTREQUESTSTARTTIME_EXIT, this ); |
182 } |
203 } |
183 |
204 |
184 void CEp0Transfer::LastRequestCompletionTime( TTime& aDuration) |
205 void CEp0Transfer::LastRequestCompletionTime( TTime& aDuration) |
185 { |
206 { |
|
207 OstTraceFunctionEntryExt( CEP0TRANSFER_LASTREQUESTCOMPLETIONTIME_ENTRY, this ); |
186 aDuration= iCompletionTime.Int64(); |
208 aDuration= iCompletionTime.Int64(); |
187 } |
209 OstTraceFunctionExit1( CEP0TRANSFER_LASTREQUESTCOMPLETIONTIME_EXIT, this ); |
188 |
210 } |
189 } |
211 |
190 |
212 } |
191 |
213 |
|
214 |