1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
46 _LIT(KTestCaseId,"PBASE-T_USBDI-0496"); |
50 _LIT(KTestCaseId,"PBASE-T_USBDI-0496"); |
47 const TFunctorTestCase<CUT_PBASE_T_USBDI_0496,TBool> CUT_PBASE_T_USBDI_0496::iFunctor(KTestCaseId); |
51 const TFunctorTestCase<CUT_PBASE_T_USBDI_0496,TBool> CUT_PBASE_T_USBDI_0496::iFunctor(KTestCaseId); |
48 |
52 |
49 CUT_PBASE_T_USBDI_0496* CUT_PBASE_T_USBDI_0496::NewL(TBool aHostRole) |
53 CUT_PBASE_T_USBDI_0496* CUT_PBASE_T_USBDI_0496::NewL(TBool aHostRole) |
50 { |
54 { |
|
55 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_NEWL_ENTRY, aHostRole ); |
51 CUT_PBASE_T_USBDI_0496* self = new (ELeave) CUT_PBASE_T_USBDI_0496(aHostRole); |
56 CUT_PBASE_T_USBDI_0496* self = new (ELeave) CUT_PBASE_T_USBDI_0496(aHostRole); |
52 CleanupStack::PushL(self); |
57 CleanupStack::PushL(self); |
53 self->ConstructL(); |
58 self->ConstructL(); |
54 CleanupStack::Pop(self); |
59 CleanupStack::Pop(self); |
|
60 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_NEWL_EXIT, ( TUint )( self ) ); |
55 return self; |
61 return self; |
56 } |
62 } |
57 |
63 |
58 |
64 |
59 CUT_PBASE_T_USBDI_0496::CUT_PBASE_T_USBDI_0496(TBool aHostRole) |
65 CUT_PBASE_T_USBDI_0496::CUT_PBASE_T_USBDI_0496(TBool aHostRole) |
60 : CBaseBulkTestCase(KTestCaseId,aHostRole), |
66 : CBaseBulkTestCase(KTestCaseId,aHostRole), |
61 iCaseStep(EInProgress) |
67 iCaseStep(EInProgress) |
62 { |
68 { |
|
69 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_ENTRY, this ); |
|
70 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_EXIT, this ); |
63 } |
71 } |
64 |
72 |
65 |
73 |
66 void CUT_PBASE_T_USBDI_0496::ConstructL() |
74 void CUT_PBASE_T_USBDI_0496::ConstructL() |
67 { |
75 { |
|
76 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_CONSTRUCTL_ENTRY, this ); |
68 BaseBulkConstructL(); |
77 BaseBulkConstructL(); |
69 |
78 |
70 iInBuffer = HBufC8::NewL(KTestBufferLength); |
79 iInBuffer = HBufC8::NewL(KTestBufferLength); |
71 |
80 |
72 //Create buffer to contain two lots of the payload pattern |
81 //Create buffer to contain two lots of the payload pattern |
78 for(TInt i=0;i<repeats;i++) |
87 for(TInt i=0;i<repeats;i++) |
79 { |
88 { |
80 iValidateBufferPtr.Append(KLiteralEnglish5()); |
89 iValidateBufferPtr.Append(KLiteralEnglish5()); |
81 } |
90 } |
82 |
91 |
83 RDebug::Printf("CUT_PBASE_T_USBDI_0496::ConstructL(): buffer created"); |
92 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_CONSTRUCTL, "CUT_PBASE_T_USBDI_0496::ConstructL(): buffer created"); |
|
93 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_CONSTRUCTL_EXIT, this ); |
84 } |
94 } |
85 |
95 |
86 |
96 |
87 CUT_PBASE_T_USBDI_0496::~CUT_PBASE_T_USBDI_0496() |
97 CUT_PBASE_T_USBDI_0496::~CUT_PBASE_T_USBDI_0496() |
88 { |
98 { |
89 LOG_FUNC |
99 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_ENTRY_DUP01, this ); |
|
100 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_EXIT_DUP01, this ); |
90 } |
101 } |
91 |
102 |
92 void CUT_PBASE_T_USBDI_0496::KillTransfers() |
103 void CUT_PBASE_T_USBDI_0496::KillTransfers() |
93 { |
104 { |
94 LOG_FUNC |
105 OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_KILLTRANSFERS_ENTRY, this ); |
95 |
106 |
96 iInTransfer[0]->Cancel(); |
107 iInTransfer[0]->Cancel(); |
97 iInTransfer[1]->Cancel(); |
108 iInTransfer[1]->Cancel(); |
|
109 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_KILLTRANSFERS_EXIT, this ); |
98 } |
110 } |
99 |
111 |
100 |
112 |
101 |
113 |
102 void CUT_PBASE_T_USBDI_0496::Ep0TransferCompleteL(TInt aCompletionCode) |
114 void CUT_PBASE_T_USBDI_0496::Ep0TransferCompleteL(TInt aCompletionCode) |
103 { |
115 { |
104 LOG_FUNC |
116 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_ENTRY, this ); |
105 |
117 |
106 RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d", aCompletionCode); |
118 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d", aCompletionCode); |
107 |
119 |
108 if(aCompletionCode != KErrNone) |
120 if(aCompletionCode != KErrNone) |
109 { |
121 { |
110 if(iCaseStep == EFailed) |
122 if(iCaseStep == EFailed) |
111 {// ignore error, nad catch the TestFailed method called further down. |
123 {// ignore error, nad catch the TestFailed method called further down. |
112 RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***"); |
124 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***"); |
113 } |
125 } |
114 else |
126 else |
115 { |
127 { |
116 KillTransfers(); |
128 KillTransfers(); |
117 TBuf<256> msg; |
129 TBuf<256> msg; |
118 _LIT(lit, "<Error %d> Transfer to control endpoint 0 was not successful"); |
130 _LIT(lit, "<Error %d> Transfer to control endpoint 0 was not successful"); |
119 msg.Format(lit,aCompletionCode); |
131 msg.Format(lit,aCompletionCode); |
120 RDebug::Print(msg); |
132 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP02, msg); |
121 iCaseStep = EFailed; |
133 iCaseStep = EFailed; |
122 TTestCaseFailed request(aCompletionCode,msg); |
134 TTestCaseFailed request(aCompletionCode,msg); |
123 iControlEp0->SendRequest(request,this); |
135 iControlEp0->SendRequest(request,this); |
|
136 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_EXIT, this ); |
124 return; |
137 return; |
125 } |
138 } |
126 } |
139 } |
127 |
140 |
128 switch(iCaseStep) |
141 switch(iCaseStep) |
137 TestFailed(KErrCompletion); |
150 TestFailed(KErrCompletion); |
138 break; |
151 break; |
139 |
152 |
140 case ERequestRepeatedWrite: |
153 case ERequestRepeatedWrite: |
141 { |
154 { |
142 RDebug::Printf("Try to perform ALL transfers"); |
155 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP03, "Try to perform ALL transfers"); |
143 |
156 |
144 iCaseStep = ETransfer; |
157 iCaseStep = ETransfer; |
145 iIsValid = ETrue; //innocent until proved guilty |
158 iIsValid = ETrue; //innocent until proved guilty |
146 RDebug::Printf("\n"); |
159 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP04, "\n"); |
147 iTransferComplete |= ValidatePreviousAndPerformNextTransfers(KBulkTransferInId[0]); //should not validate - just perform necessary transfers |
160 iTransferComplete |= ValidatePreviousAndPerformNextTransfers(KBulkTransferInId[0]); //should not validate - just perform necessary transfers |
148 iTransferComplete |= ValidatePreviousAndPerformNextTransfers(KBulkTransferInId[1]); //should not validate - just perform necessary transfers |
161 iTransferComplete |= ValidatePreviousAndPerformNextTransfers(KBulkTransferInId[1]); //should not validate - just perform necessary transfers |
149 RDebug::Printf("\n"); |
162 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP05, "\n"); |
150 if((iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
163 if((iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
151 { |
164 { |
152 iTransferComplete = 0; //reset |
165 iTransferComplete = 0; //reset |
153 _LIT(lit, "TEST FAILURE: No data to send!!"); |
166 _LIT(lit, "TEST FAILURE: No data to send!!"); |
154 TBuf<40> msg(lit); |
167 TBuf<40> msg(lit); |
155 RDebug::Print(msg); |
168 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP06, msg); |
156 iCaseStep = EFailed; |
169 iCaseStep = EFailed; |
157 TTestCaseFailed request(KErrAbort,msg); |
170 TTestCaseFailed request(KErrAbort,msg); |
158 return iControlEp0->SendRequest(request,this); |
171 return iControlEp0->SendRequest(request,this); |
159 } |
172 } |
160 } |
173 } |
161 break; |
174 break; |
162 |
175 |
163 default: |
176 default: |
164 RDebug::Printf("<Error> Unknown test step"); |
177 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP07, "<Error> Unknown test step"); |
165 TestFailed(KErrUnknown); |
178 TestFailed(KErrUnknown); |
166 break; |
179 break; |
167 } |
180 } |
|
181 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this ); |
168 } |
182 } |
169 |
183 |
170 void CUT_PBASE_T_USBDI_0496::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) |
184 void CUT_PBASE_T_USBDI_0496::TransferCompleteL(TInt aTransferId,TInt aCompletionCode) |
171 { |
185 { |
172 LOG_FUNC |
186 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_ENTRY, this ); |
173 Cancel(); |
187 Cancel(); |
174 |
188 |
175 TInt err(KErrNone); |
189 TInt err(KErrNone); |
176 TBuf<256> msg; |
190 TBuf<256> msg; |
177 RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); |
191 OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep); |
178 |
192 |
179 |
193 |
180 switch(iCaseStep) |
194 switch(iCaseStep) |
181 { |
195 { |
182 case ETransfer: |
196 case ETransfer: |
196 _LIT(lit, "<Error %d> Unexpected transfer ID, wanted %d or %d, got %d"); |
210 _LIT(lit, "<Error %d> Unexpected transfer ID, wanted %d or %d, got %d"); |
197 msg.Format(lit, err, KBulkTransferInId[0], KBulkTransferInId[1], aTransferId); |
211 msg.Format(lit, err, KBulkTransferInId[0], KBulkTransferInId[1], aTransferId); |
198 break; |
212 break; |
199 } |
213 } |
200 |
214 |
201 RDebug::Printf("\n"); |
215 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP01, "\n"); |
202 iTransferComplete |= ValidatePreviousAndPerformNextTransfers(aTransferId); |
216 iTransferComplete |= ValidatePreviousAndPerformNextTransfers(aTransferId); |
203 RDebug::Printf("\n"); |
217 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP02, "\n"); |
204 |
218 |
205 if(err==KErrNone && (iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
219 if(err==KErrNone && (iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask) |
206 { |
220 { |
207 /* |
221 /* |
208 Transfers all complete - check all were valid, and if so pass the test |
222 Transfers all complete - check all were valid, and if so pass the test |
209 */ |
223 */ |
210 RDebug::Printf("All Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); |
224 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP03, "All Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete); |
211 if(!iIsValid) |
225 if(!iIsValid) |
212 { |
226 { |
213 err = KErrCompletion; //indicates data validation failure |
227 err = KErrCompletion; //indicates data validation failure |
214 iIsValid = ETrue; //reset |
228 iIsValid = ETrue; //reset |
215 break; |
229 break; |
216 } |
230 } |
217 // Comparison is a match |
231 // Comparison is a match |
218 RDebug::Printf("Comparison for IN transfer is a match"); |
232 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP04, "Comparison for IN transfer is a match"); |
219 iCaseStep = EPassed; |
233 iCaseStep = EPassed; |
220 TTestCasePassed request; |
234 TTestCasePassed request; |
221 iControlEp0->SendRequest(request,this); |
235 iControlEp0->SendRequest(request,this); |
222 iTransferComplete = 0; //reset |
236 iTransferComplete = 0; //reset |
223 } |
237 } |
240 } |
254 } |
241 |
255 |
242 if(err!=KErrNone) |
256 if(err!=KErrNone) |
243 { |
257 { |
244 KillTransfers(); |
258 KillTransfers(); |
245 RDebug::Print(msg); |
259 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP05, msg); |
246 iCaseStep = EFailed; |
260 iCaseStep = EFailed; |
247 TTestCaseFailed request(err,msg); |
261 TTestCaseFailed request(err,msg); |
248 return iControlEp0->SendRequest(request,this); |
262 return iControlEp0->SendRequest(request,this); |
249 } |
263 } |
|
264 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_EXIT, this ); |
250 } |
265 } |
251 |
266 |
252 void CUT_PBASE_T_USBDI_0496::DeviceInsertedL(TUint aDeviceHandle) |
267 void CUT_PBASE_T_USBDI_0496::DeviceInsertedL(TUint aDeviceHandle) |
253 { |
268 { |
254 LOG_FUNC |
269 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_ENTRY, this ); |
255 |
270 |
256 Cancel(); |
271 Cancel(); |
257 RDebug::Printf("this - %08x", this); |
272 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL, "this - %08x", this); |
258 |
273 |
259 TBuf<256> msg; |
274 TBuf<256> msg; |
260 TInt err = KErrNone; |
275 TInt err = KErrNone; |
261 if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError) |
276 if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError) |
262 // Prepare for response from control transfer to client |
277 // Prepare for response from control transfer to client |
279 |
294 |
280 iInTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferInId[0]); |
295 iInTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferInId[0]); |
281 iInTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferInId[1]); |
296 iInTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferInId[1]); |
282 |
297 |
283 // Initialise the descriptors for transfer |
298 // Initialise the descriptors for transfer |
284 RDebug::Printf("Initialising the transfer descriptors - interface 1"); |
299 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_DUP01, "Initialising the transfer descriptors - interface 1"); |
285 err = iUsbInterface1.InitialiseTransferDescriptors(); |
300 err = iUsbInterface1.InitialiseTransferDescriptors(); |
286 if(err != KErrNone) |
301 if(err != KErrNone) |
287 { |
302 { |
288 _LIT(lit, "<Error %d> Unable to initialise transfer descriptors"); |
303 _LIT(lit, "<Error %d> Unable to initialise transfer descriptors"); |
289 msg.Format(lit,err); |
304 msg.Format(lit,err); |
290 } |
305 } |
291 } |
306 } |
292 } |
307 } |
293 if(err != KErrNone) |
308 if(err != KErrNone) |
294 { |
309 { |
295 RDebug::Print(msg); |
310 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_DUP02, msg); |
296 iCaseStep = EFailed; |
311 iCaseStep = EFailed; |
297 TTestCaseFailed request(err,msg); |
312 TTestCaseFailed request(err,msg); |
298 iControlEp0->SendRequest(request,this); |
313 iControlEp0->SendRequest(request,this); |
299 } |
314 } |
300 else |
315 else |
301 { |
316 { |
302 RDebug::Printf("Asking client for 'Read' on interface 1"); |
317 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_DUP03, "Asking client for 'Read' on interface 1"); |
303 iCaseStep = ERequestRepeatedWrite; |
318 iCaseStep = ERequestRepeatedWrite; |
304 TRepeatedWriteDataRequest request(1,1,KLiteralEnglish5(),KDeviceNumWriteBytes,KTotalBytesToTransfer);// EP2 means endpoint index 2 not the actual endpoint number, here the ep with 32 byte max packet size |
319 TRepeatedWriteDataRequest request(1,1,KLiteralEnglish5(),KDeviceNumWriteBytes,KTotalBytesToTransfer);// EP2 means endpoint index 2 not the actual endpoint number, here the ep with 32 byte max packet size |
305 iControlEp0->SendRequest(request,this); |
320 iControlEp0->SendRequest(request,this); |
306 } |
321 } |
|
322 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_EXIT, this ); |
307 } |
323 } |
308 |
324 |
309 TUint8 CUT_PBASE_T_USBDI_0496::Index(TUint8 aTransferId) |
325 TUint8 CUT_PBASE_T_USBDI_0496::Index(TUint8 aTransferId) |
310 { |
326 { |
|
327 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_INDEX_ENTRY, this ); |
311 switch(aTransferId) |
328 switch(aTransferId) |
312 { |
329 { |
313 case KBulkTransferInId0: |
330 case KBulkTransferInId0: |
314 return 0; |
331 return 0; |
315 case KBulkTransferInId1: |
332 case KBulkTransferInId1: |
316 return 1; |
333 return 1; |
317 default: |
334 default: |
318 _LIT(lit, "TRANSFER ID OUT OF RANGE"); |
335 _LIT(lit, "TRANSFER ID OUT OF RANGE"); |
319 User::Panic(lit, KErrArgument); |
336 User::Panic(lit, KErrArgument); |
|
337 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_INDEX_EXIT, this ); |
320 return 0; //should never get here |
338 return 0; //should never get here |
321 } |
339 } |
322 } |
340 } |
323 |
341 |
324 TInt CUT_PBASE_T_USBDI_0496::ValidatePreviousAndPerformNextTransfers(TInt aTransferId) |
342 TInt CUT_PBASE_T_USBDI_0496::ValidatePreviousAndPerformNextTransfers(TInt aTransferId) |
327 @return zero UNLESS no more trasnfers have been queued for the specified ID in which case return the transfer ID |
345 @return zero UNLESS no more trasnfers have been queued for the specified ID in which case return the transfer ID |
328 Note: This return value allows the caller to respond easily if no more transfers are required for the specified |
346 Note: This return value allows the caller to respond easily if no more transfers are required for the specified |
329 transfer ID. |
347 transfer ID. |
330 */ |
348 */ |
331 { |
349 { |
332 LOG_FUNC |
350 OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_ENTRY, this ); |
333 |
351 |
334 TUint8 index = Index(aTransferId); |
352 TUint8 index = Index(aTransferId); |
335 RDebug::Printf("\n"); |
353 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS, "\n"); |
336 RDebug::Printf("Transfer[%d]", index); |
354 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_DUP01, "Transfer[%d]", index); |
337 |
355 |
338 |
356 |
339 if(iNumBytesExpected[index] != 0) |
357 if(iNumBytesExpected[index] != 0) |
340 { |
358 { |
341 TPtrC8 data1(iInTransfer[index]->DataPolled()); |
359 TPtrC8 data1(iInTransfer[index]->DataPolled()); |
342 if(ValidateData(data1, iValidateBufferPtr.Mid(iValidationStringStartPointTransfer[index], iNumBytesExpected[index])) == EFalse) |
360 if(ValidateData(data1, iValidateBufferPtr.Mid(iValidationStringStartPointTransfer[index], iNumBytesExpected[index])) == EFalse) |
343 { |
361 { |
344 RDebug::Printf("=====VALIDATION FAILURE: Point of Validation String Entry %d, Newly Read Bytes %d=====",iValidationStringStartPointTransfer[index], iNumBytesExpected[index]); |
362 OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_DUP02, "=====VALIDATION FAILURE: Point of Validation String Entry %u, Newly Read Bytes %u=====",iValidationStringStartPointTransfer[index], iNumBytesExpected[index]); |
345 iIsValid = EFalse; |
363 iIsValid = EFalse; |
346 } |
364 } |
347 iNumBytesExpected[index] = 0; //reset |
365 iNumBytesExpected[index] = 0; //reset |
348 } |
366 } |
349 if(iNumBytesRequestedSoFar >= KTotalBytesToTransfer) |
367 if(iNumBytesRequestedSoFar >= KTotalBytesToTransfer) |
350 //if we are near the end the other transfer will mop up remaining bytes... |
368 //if we are near the end the other transfer will mop up remaining bytes... |
351 { |
369 { |
352 RDebug::Printf("****ALL DONE for Transfer[%d]****", index); |
370 OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_DUP03, "****ALL DONE for Transfer[%d]****", index); |
|
371 OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_EXIT, this, aTransferId ); |
353 return aTransferId; //tell caller that all transfers are complete for this transfer ID |
372 return aTransferId; //tell caller that all transfers are complete for this transfer ID |
354 } |
373 } |
355 |
374 |
356 iValidationStringStartPointTransfer[index] = iNumBytesRequestedSoFar%(KLiteralEnglish5().Length()); //PRIOR TO THIS TRANSFER |
375 iValidationStringStartPointTransfer[index] = iNumBytesRequestedSoFar%(KLiteralEnglish5().Length()); //PRIOR TO THIS TRANSFER |
357 TUint bytesLeftToRead = KTotalBytesToTransfer - iNumBytesRequestedSoFar; |
376 TUint bytesLeftToRead = KTotalBytesToTransfer - iNumBytesRequestedSoFar; |
358 iNumBytesExpected[index] = bytesLeftToRead < KHostNumReadBytes ? bytesLeftToRead : KHostNumReadBytes; |
377 iNumBytesExpected[index] = bytesLeftToRead < KHostNumReadBytes ? bytesLeftToRead : KHostNumReadBytes; |
359 iNumBytesRequestedSoFar += iNumBytesExpected[index]; |
378 iNumBytesRequestedSoFar += iNumBytesExpected[index]; |
360 iInTransfer[index]->TransferIn(KHostNumReadBytes); //rely on ZLP to complete the last 'TransferIn' |
379 iInTransfer[index]->TransferIn(KHostNumReadBytes); //rely on ZLP to complete the last 'TransferIn' |
361 iExpectedNextTransferNumber = 1 - iExpectedNextTransferNumber; |
380 iExpectedNextTransferNumber = 1 - iExpectedNextTransferNumber; |
362 |
381 |
|
382 OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_EXIT_DUP01, this ); |
363 return 0; //tell caller there are still transfers to complete for the requested transfer ID |
383 return 0; //tell caller there are still transfers to complete for the requested transfer ID |
364 } |
384 } |
365 |
385 |
366 } //end namespace |
386 } //end namespace |