author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 11:08:29 +0300 | |
changeset 247 | d8d70de2bd36 |
parent 0 | a41df078684a |
child 253 | d37db4dcc88d |
permissions | -rw-r--r-- |
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 2 |
// All rights reserved. |
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32test/usb/t_usb_device/src/activerw.cpp |
|
15 |
// USB Test Program T_USB_DEVICE, functional part. |
|
16 |
// Device-side part, to work against T_USB_HOST running on the host. |
|
17 |
// |
|
18 |
// |
|
19 |
||
20 |
#include "general.h" // CActiveControl, CActiveRW |
|
21 |
#include "config.h" |
|
22 |
#include "activerw.h" |
|
23 |
#include "activetimer.h" |
|
24 |
#include "usblib.h" // Helpers |
|
25 |
||
26 |
_LIT(KFileName, "\\T_USBFILE.BIN"); |
|
27 |
||
28 |
extern RTest test; |
|
29 |
extern TBool gVerbose; |
|
30 |
extern TBool gSkip; |
|
31 |
extern TBool gStopOnFail; |
|
32 |
extern TBool gAltSettingOnNotify; |
|
33 |
extern TInt8 gSettingNumber [128]; |
|
34 |
extern TInt gSoakCount; |
|
35 |
extern CActiveRW* gRW[KMaxConcurrentTests]; // the USB read/write active object |
|
36 |
extern IFConfigPtr gInterfaceConfig [128] [KMaxInterfaceSettings]; |
|
37 |
extern TInt gActiveTestCount; |
|
38 |
||
39 |
static TInt gYieldRepeat = 0; |
|
40 |
static const TInt KYieldRepeat = 100; |
|
41 |
||
42 |
// |
|
43 |
// --- class CActiveRW --------------------------------------------------------- |
|
44 |
// |
|
45 |
||
46 |
CActiveRW::CActiveRW(CConsoleBase* aConsole, RDEVCLIENT* aPort, RFs aFs, TUint16 aIndex, TBool aLastSetting) |
|
47 |
: CActive(EPriorityNormal), |
|
48 |
#ifndef USB_SC |
|
49 |
iWriteBuf((TUint8 *)NULL,0,0), // temporary initialisation |
|
50 |
iReadBuf((TUint8 *)NULL,0,0), // temporary initialisation |
|
51 |
#endif |
|
52 |
iConsole(aConsole), |
|
53 |
iPort(aPort), |
|
54 |
iBufSz(0), |
|
55 |
iMaxPktSz(0), |
|
56 |
iCurrentXfer(ETxferNone), |
|
57 |
iXferMode(::ENone), |
|
58 |
iDoStop(EFalse), |
|
59 |
iPktNum(0), |
|
60 |
iFs(aFs), |
|
61 |
iRepeat(0), |
|
62 |
iComplete(EFalse), |
|
63 |
iResult(EFalse), |
|
64 |
iIndex (aIndex), |
|
65 |
iLastSetting (aLastSetting) |
|
66 |
{ |
|
67 |
gActiveTestCount++; |
|
68 |
TUSB_VERBOSE_PRINT("CActiveRW::CActiveRW()"); |
|
69 |
} |
|
70 |
||
71 |
||
72 |
CActiveRW* CActiveRW::NewL(CConsoleBase* aConsole, RDEVCLIENT* aPort, RFs aFs, TUint16 aIndex, TBool aLastSetting) |
|
73 |
{ |
|
74 |
||
75 |
CActiveRW* self = new (ELeave) CActiveRW(aConsole, aPort, aFs, aIndex, aLastSetting); |
|
76 |
CleanupStack::PushL(self); |
|
77 |
self->ConstructL(); |
|
78 |
CActiveScheduler::Add(self); |
|
79 |
CleanupStack::Pop(); // self |
|
80 |
return self; |
|
81 |
} |
|
82 |
||
83 |
||
84 |
void CActiveRW::ConstructL() |
|
85 |
{ |
|
86 |
TUSB_VERBOSE_PRINT("CActiveRW::ConstructL()"); |
|
87 |
||
88 |
// Create read timeout timer active object (but don't activate it yet) |
|
89 |
iTimeoutTimer = CActiveTimer::NewL(iConsole, iPort); |
|
90 |
if (!iTimeoutTimer) |
|
91 |
{ |
|
92 |
TUSB_PRINT("Failed to create timeout timer"); |
|
93 |
} |
|
94 |
} |
|
95 |
||
96 |
||
97 |
CActiveRW::~CActiveRW() |
|
98 |
{ |
|
99 |
TUSB_VERBOSE_PRINT("CActiveRW::~CActiveRW()"); |
|
100 |
Cancel(); // base class |
|
101 |
delete iTimeoutTimer; |
|
102 |
#ifdef USB_SC |
|
103 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
104 |
{ |
|
105 |
iSCReadBuf.Close(); |
|
106 |
} |
|
107 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
108 |
{ |
|
109 |
iSCWriteBuf.Close(); |
|
110 |
} |
|
111 |
#else |
|
112 |
User::Free((TAny *)iReadBuf.Ptr()); |
|
113 |
User::Free((TAny *)iWriteBuf.Ptr()); |
|
114 |
#endif |
|
115 |
iFile.Close(); |
|
116 |
gRW[iIndex] = NULL; |
|
117 |
gActiveTestCount--; |
|
118 |
} |
|
119 |
||
120 |
||
121 |
void CActiveRW::SetTestParams(TestParamPtr aTpPtr) |
|
122 |
{ |
|
123 |
iBufSz = aTpPtr->minSize; |
|
124 |
iPktNum = aTpPtr->packetNumber; |
|
125 |
||
126 |
iTestParams = *aTpPtr; |
|
127 |
||
128 |
gYieldRepeat = ((iTestParams.settingRepeat != 0) || (iIndex == 0))? 0 : KYieldRepeat; |
|
129 |
||
130 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
131 |
{ |
|
132 |
#ifndef USB_SC |
|
133 |
TAny * newBuffer = User::Alloc(aTpPtr->maxSize); |
|
134 |
if (newBuffer == NULL) |
|
135 |
{ |
|
136 |
TUSB_PRINT ("Failure to allocate heap memory"); |
|
137 |
test(EFalse); |
|
138 |
} |
|
139 |
iReadBuf.Set((TUint8 *)newBuffer,0,(TInt)aTpPtr->maxSize); |
|
140 |
#endif |
|
141 |
TBuf8<KUsbDescSize_Endpoint> descriptor; |
|
142 |
TUSB_VERBOSE_PRINT2 ("GetEndpointDescriptor Alt Setting %d Endpoint %d",iTestParams.alternateSetting, iTestParams.outPipe); |
|
143 |
TInt r = iPort->GetEndpointDescriptor(iTestParams.alternateSetting, (TENDPOINTNUMBER)iTestParams.outPipe, descriptor); |
|
144 |
if ((TUint)r != iReadSize) |
|
145 |
{ |
|
146 |
TUSB_PRINT("Failed to get endpoint descriptor"); |
|
147 |
test(EFalse); |
|
148 |
return; |
|
149 |
} |
|
150 |
||
151 |
iMaxPktSz = EpSize(descriptor[KEpDesc_PacketSizeOffset],descriptor[KEpDesc_PacketSizeOffset+1]); |
|
152 |
TUSB_VERBOSE_PRINT5 ("Out Endpoint 0x%x attributes 0x%x interface %d setting %d max packet size %d", |
|
153 |
descriptor[KEpDesc_AddressOffset],descriptor[KEpDesc_AttributesOffset],iTestParams.interfaceNumber,iTestParams.alternateSetting,iMaxPktSz); |
|
154 |
if (!gSkip && iMaxPktSz != (TUint)gInterfaceConfig[iTestParams.interfaceNumber][iTestParams.alternateSetting]->iInfoPtr->iEndpointData[iTestParams.outPipe-1].iSize) |
|
155 |
{ |
|
156 |
TUSB_PRINT4("Error - Interface %d Setting %d Endpoint %d Max Packet Size %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.outPipe,iMaxPktSz); |
|
157 |
test(EFalse); |
|
158 |
return; |
|
159 |
} |
|
160 |
} |
|
161 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
162 |
{ |
|
163 |
#ifndef USB_SC |
|
164 |
TAny * newBuffer = User::Alloc(aTpPtr->maxSize); |
|
165 |
if (newBuffer == NULL) |
|
166 |
{ |
|
167 |
TUSB_PRINT ("Failure to allocate heap memory"); |
|
168 |
test(EFalse); |
|
169 |
} |
|
170 |
iWriteBuf.Set((TUint8 *)newBuffer,0,(TInt)aTpPtr->maxSize); |
|
171 |
#endif |
|
172 |
TBuf8<KUsbDescSize_Endpoint> descriptor; |
|
173 |
TUSB_VERBOSE_PRINT2 ("GetEndpointDescriptor Alt Setting %d Endpoint %d",iTestParams.alternateSetting, iTestParams.inPipe); |
|
174 |
TInt r = iPort->GetEndpointDescriptor(iTestParams.alternateSetting, (TENDPOINTNUMBER)iTestParams.inPipe, descriptor); |
|
175 |
if (r != KErrNone) |
|
176 |
{ |
|
177 |
TUSB_PRINT("Failed to get endpoint descriptor"); |
|
178 |
test(EFalse); |
|
179 |
return; |
|
180 |
} |
|
181 |
||
182 |
TInt maxPktSz = EpSize(descriptor[KEpDesc_PacketSizeOffset],descriptor[KEpDesc_PacketSizeOffset+1]); |
|
183 |
TUSB_VERBOSE_PRINT5 ("In Endpoint 0x%x attributes 0x%x interface %d setting %d max packet size %d", |
|
184 |
descriptor[KEpDesc_AddressOffset],descriptor[KEpDesc_AttributesOffset],iTestParams.interfaceNumber,iTestParams.alternateSetting,maxPktSz); |
|
185 |
if (!gSkip && maxPktSz != gInterfaceConfig[iTestParams.interfaceNumber][iTestParams.alternateSetting]->iInfoPtr->iEndpointData[iTestParams.inPipe-1].iSize) |
|
186 |
{ |
|
187 |
TUSB_PRINT4("Error - Interface %d Setting %d Endpoint %d Max Packet Size %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.inPipe,maxPktSz); |
|
188 |
test(EFalse); |
|
189 |
return; |
|
190 |
} |
|
191 |
} |
|
192 |
||
193 |
} |
|
194 |
||
195 |
||
196 |
void CActiveRW::SetTransferMode(TXferMode aMode) |
|
197 |
{ |
|
198 |
iXferMode = aMode; |
|
199 |
if (aMode == EReceiveOnly || aMode == ETransmitOnly) |
|
200 |
{ |
|
201 |
// For streaming transfers we do this only once. |
|
202 |
iBufSz = iTestParams.maxSize; |
|
203 |
} |
|
204 |
} |
|
205 |
||
206 |
void CActiveRW::Suspend(TXferType aType) |
|
207 |
{ |
|
208 |
if (aType == ESuspend) |
|
209 |
TUSB_VERBOSE_PRINT1("Index %d Suspend",iIndex); |
|
210 |
if (aType == EAltSetting) |
|
211 |
TUSB_VERBOSE_PRINT3("Index %d Suspend for Alternate Setting - interface %d setting %d",iIndex,iTestParams.interfaceNumber,iTestParams.alternateSetting); |
|
212 |
iStatus = KRequestPending; |
|
213 |
iCurrentXfer = aType; |
|
214 |
if (!IsActive()) |
|
215 |
{ |
|
216 |
SetActive(); |
|
217 |
} |
|
218 |
} |
|
219 |
||
220 |
void CActiveRW::Resume() |
|
221 |
{ |
|
222 |
TUSB_VERBOSE_PRINT3("Index %d Resume interface %d setting %d",iIndex,iTestParams.interfaceNumber,iTestParams.alternateSetting); |
|
223 |
TRequestStatus* status = &iStatus; |
|
224 |
User::RequestComplete(status,KErrNone); |
|
225 |
if (!IsActive()) |
|
226 |
{ |
|
227 |
SetActive(); |
|
228 |
} |
|
229 |
} |
|
230 |
||
231 |
void CActiveRW::Yield() |
|
232 |
{ |
|
233 |
TUSB_VERBOSE_PRINT1("Index %d Scheduler Yield",iIndex); |
|
234 |
// removes the active object from the scheduler queue then adds it back in again |
|
235 |
Deque(); |
|
236 |
CActiveScheduler::Add(this); |
|
237 |
} |
|
238 |
||
239 |
void CActiveRW::ResumeAltSetting(TUint aAltSetting) |
|
240 |
{ |
|
241 |
if (iCurrentXfer == EAltSetting && iTestParams.alternateSetting == aAltSetting) |
|
242 |
{ |
|
243 |
Resume(); |
|
244 |
} |
|
245 |
} |
|
246 |
||
247 |
void CActiveRW::StartOrSuspend() |
|
248 |
{ |
|
249 |
TInt altSetting; |
|
250 |
||
251 |
iPort->GetAlternateSetting (altSetting); |
|
252 |
if (iTestParams.alternateSetting != altSetting) |
|
253 |
{ |
|
254 |
Suspend(EAltSetting); |
|
255 |
} |
|
256 |
else |
|
257 |
{ |
|
258 |
#ifdef USB_SC |
|
259 |
TInt r; |
|
260 |
if (iTestParams.alternateSetting != gSettingNumber[iTestParams.interfaceNumber]) |
|
261 |
{ |
|
262 |
gSettingNumber[iTestParams.interfaceNumber] = iTestParams.alternateSetting; |
|
263 |
r = iPort->StartNextOutAlternateSetting(ETrue); |
|
264 |
TUSB_VERBOSE_PRINT1("StartNextOutAlternateSetting retValue %d",r); |
|
265 |
test_Value(r, (r >= KErrNone) || (r == KErrNotReady) || (r == KErrGeneral)); |
|
266 |
} |
|
267 |
TUSB_VERBOSE_PRINT4 ("CActiveRW::StartOrSuspend() interface %d setting %d Out %d In %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.outPipe,iTestParams.inPipe); |
|
268 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
269 |
{ |
|
270 |
r = iPort->OpenEndpoint(iSCReadBuf,iTestParams.outPipe); |
|
271 |
test_KErrNone(r); |
|
272 |
} |
|
273 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
274 |
{ |
|
275 |
r = iPort->OpenEndpoint(iSCWriteBuf,iTestParams.inPipe); |
|
276 |
test_KErrNone(r); |
|
277 |
} |
|
278 |
#endif |
|
279 |
if (iXferMode == EReceiveOnly) |
|
280 |
{ |
|
281 |
// read data and process any available |
|
282 |
iReadSize = ReadData(); |
|
283 |
if (iReadSize != 0) |
|
284 |
{ |
|
285 |
ProcessReadXfer(); |
|
286 |
} |
|
287 |
} |
|
288 |
else |
|
289 |
{ |
|
290 |
SendData(); // or we send data |
|
291 |
if (iXferMode == ETransmitOnly) |
|
292 |
{ |
|
293 |
iPktNum++; |
|
294 |
iRepeat++; |
|
295 |
} |
|
296 |
} |
|
297 |
} |
|
298 |
} |
|
299 |
||
300 |
void CActiveRW::RunL() |
|
301 |
{ |
|
302 |
#ifdef USB_SC |
|
303 |
TInt r = 0; |
|
304 |
#else |
|
305 |
TInt altSetting; |
|
306 |
#endif |
|
307 |
||
308 |
TUSB_VERBOSE_PRINT("CActiveRW::RunL()"); |
|
309 |
||
310 |
if ((iStatus != KErrNone) && (iStatus != KErrEof)) |
|
311 |
{ |
|
312 |
TUSB_PRINT1("Error %d in RunL", iStatus.Int()); |
|
313 |
} |
|
314 |
if (iDoStop) |
|
315 |
{ |
|
316 |
TUSB_PRINT("Stopped"); |
|
317 |
iDoStop = EFalse; |
|
318 |
return; |
|
319 |
} |
|
320 |
switch (iCurrentXfer) |
|
321 |
{ |
|
322 |
case EWaitSetting: |
|
323 |
#ifdef USB_SC |
|
324 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
325 |
{ |
|
326 |
r = iSCReadBuf.Close(); |
|
327 |
test_KErrNone(r); |
|
328 |
} |
|
329 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
330 |
{ |
|
331 |
r = iSCWriteBuf.Close(); |
|
332 |
test_KErrNone(r); |
|
333 |
} |
|
334 |
#endif |
|
335 |
if (iTestParams.settingRepeat && ((iRepeat < iTestParams.repeat) || !iLastSetting)) |
|
336 |
{ |
|
337 |
gRW[iTestParams.afterIndex]->Resume(); |
|
338 |
} |
|
339 |
Suspend(ESuspend); |
|
340 |
break; |
|
341 |
||
342 |
case ESuspend: |
|
343 |
#ifdef USB_SC |
|
344 |
TUSB_VERBOSE_PRINT3("Index %d Resumed interface %d setting test=%d",iIndex,iTestParams.interfaceNumber,iTestParams.alternateSetting); |
|
345 |
if (iTestParams.alternateSetting != gSettingNumber[iTestParams.interfaceNumber]) |
|
346 |
{ |
|
347 |
r = iPort->StartNextOutAlternateSetting(ETrue); |
|
348 |
TUSB_VERBOSE_PRINT1("StartNextOutAlternateSetting retValue %d",r); |
|
349 |
test_Value(r, (r >= KErrNone) || (r == KErrNotReady) || (r == KErrGeneral)); |
|
350 |
if (r != KErrNotReady) |
|
351 |
{ |
|
352 |
gSettingNumber[iTestParams.interfaceNumber] = r; |
|
353 |
} |
|
354 |
if (iTestParams.alternateSetting != gSettingNumber[iTestParams.interfaceNumber]) |
|
355 |
{ |
|
356 |
Suspend(EAltSetting); |
|
357 |
break; |
|
358 |
} |
|
359 |
} |
|
360 |
#else |
|
361 |
iPort->GetAlternateSetting (altSetting); |
|
362 |
TUSB_VERBOSE_PRINT4("Index %d Resumed interface %d setting test=%d actual=%d",iIndex,iTestParams.interfaceNumber,iTestParams.alternateSetting,altSetting); |
|
363 |
if (gAltSettingOnNotify) |
|
364 |
{ |
|
365 |
if (iTestParams.alternateSetting != altSetting) |
|
366 |
{ |
|
367 |
Suspend(EAltSetting); |
|
368 |
break; |
|
369 |
} |
|
370 |
} |
|
371 |
#endif |
|
372 |
||
373 |
// If alternate setting is ok drops through to EAltSetting to start next read or write |
|
374 |
iCurrentXfer = EAltSetting; |
|
375 |
||
376 |
case EAltSetting: |
|
377 |
#ifdef USB_SC |
|
378 |
if (iTestParams.alternateSetting != gSettingNumber[iTestParams.interfaceNumber]) |
|
379 |
{ |
|
380 |
r = iPort->StartNextOutAlternateSetting(ETrue); |
|
381 |
TUSB_VERBOSE_PRINT1("StartNextOutAlternateSetting retValue %d",r); |
|
382 |
test_Value(r, (r >= KErrNone) || (r == KErrNotReady) || (r == KErrGeneral)); |
|
383 |
if (r != KErrNotReady) |
|
384 |
{ |
|
385 |
gSettingNumber[iTestParams.interfaceNumber] = r; |
|
386 |
} |
|
387 |
if (iTestParams.alternateSetting != gSettingNumber[iTestParams.interfaceNumber]) |
|
388 |
{ |
|
389 |
Suspend(EAltSetting); |
|
390 |
break; |
|
391 |
} |
|
392 |
} |
|
393 |
TUSB_VERBOSE_PRINT4 ("CActiveRW::Runl() EAltSetting interface %d setting %d Out %d In %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.outPipe,iTestParams.inPipe); |
|
394 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
395 |
{ |
|
396 |
r = iPort->OpenEndpoint(iSCReadBuf,iTestParams.outPipe); |
|
397 |
test_KErrNone(r); |
|
398 |
} |
|
399 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
400 |
{ |
|
401 |
r = iPort->OpenEndpoint(iSCWriteBuf,iTestParams.inPipe); |
|
402 |
test_KErrNone(r); |
|
403 |
} |
|
404 |
#endif |
|
405 |
if (iXferMode == EReceiveOnly) |
|
406 |
{ |
|
407 |
// read data and process any available |
|
408 |
iReadSize = ReadData(); |
|
409 |
if (iReadSize != 0) |
|
410 |
{ |
|
411 |
ProcessReadXfer(); |
|
412 |
} |
|
413 |
} |
|
414 |
else |
|
415 |
{ |
|
416 |
SendData(); // or we send data |
|
417 |
if (iXferMode == ETransmitOnly) |
|
418 |
{ |
|
419 |
iPktNum++; |
|
420 |
iRepeat++; |
|
421 |
} |
|
422 |
} |
|
423 |
break; |
|
424 |
||
425 |
case EWriteXfer: |
|
426 |
ProcessWriteXfer(); |
|
427 |
break; |
|
428 |
||
429 |
case EReadXfer: |
|
430 |
#ifdef USB_SC |
|
431 |
iReadSize = ReadData(); |
|
432 |
if (iReadSize != 0) |
|
433 |
{ |
|
434 |
ProcessReadXfer(); |
|
435 |
} |
|
436 |
#else |
|
437 |
iReadSize = iReadBuf.Length(); |
|
438 |
ProcessReadXfer(); |
|
439 |
#endif |
|
440 |
break; |
|
441 |
||
442 |
default: |
|
443 |
TUSB_PRINT("Oops. (Shouldn't end up here...)"); |
|
444 |
break; |
|
445 |
} |
|
446 |
return; |
|
447 |
} |
|
448 |
||
449 |
void CActiveRW::ProcessWriteXfer() |
|
450 |
{ |
|
451 |
if (iXferMode == ETransmitOnly) |
|
452 |
{ |
|
453 |
if (iTestParams.settingRepeat && iRepeat) |
|
454 |
{ |
|
455 |
if (((iRepeat % iTestParams.settingRepeat) == 0) || (iRepeat >= iTestParams.repeat)) |
|
456 |
{ |
|
457 |
if ((iRepeat < iTestParams.repeat) || !iLastSetting) |
|
458 |
{ |
|
459 |
#ifdef USB_SC |
|
460 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
461 |
{ |
|
462 |
test_KErrNone(iSCWriteBuf.Close()); |
|
463 |
} |
|
464 |
#endif |
|
465 |
gRW[iTestParams.afterIndex]->Resume(); |
|
466 |
} |
|
467 |
if (iRepeat < iTestParams.repeat) |
|
468 |
{ |
|
469 |
Suspend(ESuspend); |
|
470 |
return; |
|
471 |
} |
|
472 |
} |
|
473 |
} |
|
474 |
||
475 |
if ((iTestParams.repeat == 0) || (iRepeat < iTestParams.repeat)) |
|
476 |
{ |
|
477 |
// Yield the scheduler to ensure other activeObjects can run |
|
478 |
if (iRepeat && gYieldRepeat) |
|
479 |
{ |
|
480 |
if ((iRepeat % gYieldRepeat) == 0) |
|
481 |
{ |
|
482 |
Yield(); |
|
483 |
} |
|
484 |
} |
|
485 |
SendData(); // next we send data |
|
486 |
iPktNum++; |
|
487 |
iRepeat++; |
|
488 |
} |
|
489 |
else |
|
490 |
{ |
|
491 |
TestComplete(ETrue); |
|
492 |
} |
|
493 |
} |
|
494 |
else |
|
495 |
{ |
|
496 |
// read data and process any available |
|
497 |
iReadSize = ReadData(); |
|
498 |
if (iReadSize != 0) |
|
499 |
{ |
|
500 |
ProcessReadXfer(); |
|
501 |
} |
|
502 |
} |
|
503 |
||
504 |
return; |
|
505 |
} |
|
506 |
||
507 |
void CActiveRW::ProcessReadXfer() |
|
508 |
{ |
|
509 |
if ((iReadOffset + iReadSize) > iBufSz) |
|
510 |
{ |
|
511 |
TUSB_PRINT2("*** rcv'd too much data: 0x%x (expected: 0x%x)", iReadOffset + iReadSize, iBufSz); |
|
512 |
test(EFalse); |
|
513 |
} |
|
514 |
||
515 |
if (iXferMode == EReceiveOnly) |
|
516 |
{ |
|
517 |
if (iReadOffset == 0) |
|
518 |
{ |
|
519 |
#ifdef USB_SC |
|
520 |
const TUint32 num = *reinterpret_cast<const TUint32*>(iSCReadData); |
|
521 |
#else |
|
522 |
const TUint32 num = *reinterpret_cast<const TUint32*>(iReadBuf.Ptr()); |
|
523 |
#endif |
|
524 |
if (num != iPktNum) |
|
525 |
{ |
|
526 |
TUSB_PRINT3("*** Repeat %d rcv'd wrong pkt number: 0x%x (expected: 0x%x)", iRepeat, num, iPktNum); |
|
527 |
iPktNum = num; |
|
528 |
test(EFalse); |
|
529 |
} |
|
530 |
} |
|
531 |
if (iDiskAccessEnabled) |
|
532 |
{ |
|
533 |
// Write out to disk previous completed Read |
|
534 |
#ifdef USB_SC |
|
535 |
TPtr8 readBuf((TUint8 *)iSCReadData,iReadSize,iReadSize); |
|
536 |
WriteBufferToDisk(readBuf, iReadSize); |
|
537 |
#else |
|
538 |
TUSB_VERBOSE_PRINT2("Max Buffer Size = %d (iReadBuf.Size(): %d)", iTestParams.maxSize, iReadBuf.Size()); |
|
539 |
WriteBufferToDisk(iReadBuf, iTestParams.maxSize); |
|
540 |
#endif |
|
541 |
} |
|
542 |
iReadOffset += iReadSize; |
|
543 |
if (iReadOffset >= iBufSz) |
|
544 |
{ |
|
545 |
iReadOffset = 0; |
|
546 |
} |
|
547 |
else |
|
548 |
{ |
|
549 |
#ifdef USB_SC |
|
550 |
iReadSize = ReadData(); |
|
551 |
if (iReadSize) |
|
552 |
{ |
|
553 |
ProcessReadXfer(); |
|
554 |
} |
|
555 |
#endif |
|
556 |
return; |
|
557 |
} |
|
558 |
iPktNum++; |
|
559 |
iRepeat++; |
|
560 |
iReadSize = 0; |
|
561 |
if (iTestParams.settingRepeat) |
|
562 |
{ |
|
563 |
if (((iRepeat % iTestParams.settingRepeat) == 0) || (iRepeat >= iTestParams.repeat)) |
|
564 |
{ |
|
565 |
#ifdef USB_SC |
|
566 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
567 |
{ |
|
568 |
test_KErrNone(iSCReadBuf.Close()); |
|
569 |
} |
|
570 |
#endif |
|
571 |
if ((iRepeat < iTestParams.repeat) || !iLastSetting) |
|
572 |
{ |
|
573 |
gRW[iTestParams.afterIndex]->Resume(); |
|
574 |
} |
|
575 |
if (iRepeat < iTestParams.repeat) |
|
576 |
{ |
|
577 |
Suspend(ESuspend); |
|
578 |
return; |
|
579 |
} |
|
580 |
} |
|
581 |
} |
|
582 |
if ((iTestParams.repeat == 0) || (iRepeat < iTestParams.repeat)) |
|
583 |
{ |
|
584 |
// Yield the scheduler to ensure other activeObjects can run |
|
585 |
if (iRepeat && gYieldRepeat) |
|
586 |
{ |
|
587 |
if ((iRepeat % gYieldRepeat) == 0) |
|
588 |
{ |
|
589 |
Yield(); |
|
590 |
} |
|
591 |
} |
|
592 |
#ifdef USB_SC |
|
593 |
TRequestStatus* status = &iStatus; |
|
594 |
User::RequestComplete(status,KErrNone); |
|
595 |
if (!IsActive()) |
|
596 |
{ |
|
597 |
SetActive(); |
|
598 |
} |
|
599 |
#else |
|
600 |
iReadSize = ReadData(); |
|
601 |
#endif |
|
602 |
} |
|
603 |
else |
|
604 |
{ |
|
605 |
TestComplete(ETrue); |
|
606 |
} |
|
607 |
} |
|
608 |
else |
|
609 |
{ |
|
610 |
if (iXferMode == ELoopComp) |
|
611 |
{ |
|
612 |
test(CompareBuffers()); |
|
613 |
} |
|
614 |
else if (iBufSz > 3) |
|
615 |
{ |
|
616 |
if (iReadOffset == 0) |
|
617 |
{ |
|
618 |
#ifdef USB_SC |
|
619 |
const TUint32 num = *reinterpret_cast<const TUint32*>(iSCReadData); |
|
620 |
#else |
|
621 |
const TUint32 num = *reinterpret_cast<const TUint32*>(iReadBuf.Ptr()); |
|
622 |
#endif |
|
623 |
if (num != iPktNum) |
|
624 |
{ |
|
625 |
TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
|
626 |
} |
|
627 |
} |
|
628 |
} |
|
629 |
iReadOffset += iReadSize; |
|
630 |
if (iReadOffset >= iBufSz) |
|
631 |
{ |
|
632 |
iReadOffset = 0; |
|
633 |
} |
|
634 |
else |
|
635 |
{ |
|
636 |
iReadSize = ReadData(); |
|
637 |
if (iReadSize) |
|
638 |
{ |
|
639 |
ProcessReadXfer(); |
|
640 |
} |
|
641 |
return; |
|
642 |
} |
|
643 |
if ((TUint)iBufSz == iTestParams.maxSize) |
|
644 |
{ |
|
645 |
iBufSz = iTestParams.minSize; |
|
646 |
} |
|
647 |
else |
|
648 |
{ |
|
649 |
iBufSz++; |
|
650 |
} |
|
651 |
iPktNum++; |
|
652 |
iRepeat++; |
|
653 |
iReadSize = 0; |
|
654 |
if (iTestParams.settingRepeat) |
|
655 |
{ |
|
656 |
if (((iRepeat % iTestParams.settingRepeat) == 0) || (iRepeat >= iTestParams.repeat)) |
|
657 |
{ |
|
658 |
if (iRepeat < iTestParams.repeat) |
|
659 |
{ |
|
660 |
SendWaitSetting(); |
|
661 |
return; |
|
662 |
} |
|
663 |
else |
|
664 |
{ |
|
665 |
#ifdef USB_SC |
|
666 |
if ((TENDPOINTNUMBER)iTestParams.outPipe <= KMaxEndpointsPerClient) |
|
667 |
{ |
|
668 |
test_KErrNone(iSCReadBuf.Close()); |
|
669 |
} |
|
670 |
if ((TENDPOINTNUMBER)iTestParams.inPipe <= KMaxEndpointsPerClient) |
|
671 |
{ |
|
672 |
test_KErrNone(iSCWriteBuf.Close()); |
|
673 |
} |
|
674 |
#endif |
|
675 |
if (!iLastSetting) |
|
676 |
{ |
|
677 |
gRW[iTestParams.afterIndex]->Resume(); |
|
678 |
} |
|
679 |
} |
|
680 |
} |
|
681 |
} |
|
682 |
||
683 |
if ((iTestParams.repeat == 0) || (iRepeat < iTestParams.repeat)) |
|
684 |
{ |
|
685 |
// Yield the scheduler to ensure other activeObjects can run |
|
686 |
if (iRepeat && gYieldRepeat) |
|
687 |
{ |
|
688 |
if ((iRepeat % gYieldRepeat) == 0) |
|
689 |
{ |
|
690 |
Yield(); |
|
691 |
} |
|
692 |
} |
|
693 |
SendData(); |
|
694 |
} |
|
695 |
else |
|
696 |
{ |
|
697 |
TestComplete(ETrue); |
|
698 |
} |
|
699 |
} |
|
700 |
||
701 |
return; |
|
702 |
} |
|
703 |
||
704 |
void CActiveRW::SendWaitSetting() |
|
705 |
{ |
|
706 |
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 662)); |
|
707 |
#ifdef USB_SC |
|
708 |
TAny* inBuffer; |
|
709 |
TUint inBufLength; |
|
710 |
test_KErrNone(iSCWriteBuf.GetInBufferRange(inBuffer, inBufLength)); |
|
711 |
test_KErrNone(iSCWriteBuf.WriteBuffer(inBuffer,KWaitSettingSize,FALSE,iStatus)); |
|
712 |
#else |
|
713 |
iWriteBuf.SetLength(KWaitSettingSize); |
|
714 |
iPort->Write(iStatus, (TENDPOINTNUMBER)iTestParams.inPipe, iWriteBuf, KWaitSettingSize); |
|
715 |
#endif |
|
716 |
iCurrentXfer = EWaitSetting; |
|
717 |
if (!IsActive()) |
|
718 |
{ |
|
719 |
SetActive(); |
|
720 |
} |
|
721 |
} |
|
722 |
||
723 |
||
724 |
void CActiveRW::SendData() |
|
725 |
{ |
|
726 |
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 663)); |
|
727 |
#ifdef USB_SC |
|
728 |
TUint8* inBuffer; |
|
729 |
TUint inBufLength; |
|
730 |
test_KErrNone(iSCWriteBuf.GetInBufferRange((TAny*&)inBuffer, inBufLength)); |
|
731 |
if (iDiskAccessEnabled) |
|
732 |
{ |
|
733 |
TPtr8 writeBuf((TUint8 *)inBuffer,iBufSz,iBufSz); |
|
734 |
ReadBufferFromDisk(writeBuf, iBufSz); |
|
735 |
} |
|
736 |
if (iBufSz > 3) |
|
737 |
*reinterpret_cast<TUint32*>(inBuffer) = iPktNum; |
|
738 |
||
739 |
if (iXferMode == ELoopComp) |
|
740 |
{ |
|
741 |
for (TUint i = 4; i < iBufSz; i++) |
|
742 |
{ |
|
743 |
*(inBuffer+i) = static_cast<TUint8>((iPktNum+i) & 0x000000ff); |
|
744 |
} |
|
745 |
} |
|
746 |
TUSB_VERBOSE_PRINT3("SendData interface %d setting %d endpoint %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.inPipe); |
|
747 |
iCurrentXfer = EWriteXfer; |
|
748 |
TInt r = iSCWriteBuf.WriteBuffer(inBuffer, iBufSz, FALSE, iStatus); |
|
749 |
test_KErrNone(r); |
|
750 |
#else |
|
751 |
if (iDiskAccessEnabled) |
|
752 |
{ |
|
753 |
ReadBufferFromDisk(iWriteBuf, iBufSz); |
|
754 |
} |
|
755 |
iWriteBuf.SetLength(iBufSz); |
|
756 |
if (iBufSz > 3) |
|
757 |
*reinterpret_cast<TUint32*>(const_cast<TUint8*>(iWriteBuf.Ptr())) = iPktNum; |
|
758 |
if (iXferMode == ELoopComp) |
|
759 |
{ |
|
760 |
for (TUint i = 4; i < iBufSz; i++) |
|
761 |
{ |
|
762 |
iWriteBuf[i] = static_cast<TUint8>((iPktNum+i) & 0x000000ff); |
|
763 |
} |
|
764 |
} |
|
765 |
||
766 |
TUSB_VERBOSE_PRINT3("SendData interface %d setting %d endpoint %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.inPipe); |
|
767 |
iCurrentXfer = EWriteXfer; |
|
768 |
iPort->Write(iStatus, (TENDPOINTNUMBER)iTestParams.inPipe, iWriteBuf, iBufSz); |
|
769 |
#endif |
|
770 |
if (!IsActive()) |
|
771 |
{ |
|
772 |
SetActive(); |
|
773 |
} |
|
774 |
} |
|
775 |
||
776 |
TInt CActiveRW::WriteToDisk(TChar aDriveLetter) |
|
777 |
{ |
|
778 |
iDiskAccessEnabled = ETrue; |
|
779 |
TInt r = KErrNone; |
|
780 |
||
781 |
iFileName.Format(_L("%c:"), aDriveLetter.operator TUint()); |
|
782 |
iFileName.Append(KFileName); |
|
783 |
TUSB_PRINT1("\nFilename = %S", &iFileName); |
|
784 |
||
785 |
// open the record file |
|
786 |
r = iFile.Replace(iFs, iFileName, EFileWrite); |
|
787 |
iFileOffset = 0; |
|
788 |
if (r != KErrNone) |
|
789 |
{ |
|
790 |
TUSB_PRINT1("RFile::Replace() returned %d", r); |
|
791 |
iDiskAccessEnabled = EFalse; |
|
792 |
return r; |
|
793 |
} |
|
794 |
||
795 |
return r; |
|
796 |
} |
|
797 |
||
798 |
||
799 |
TInt CActiveRW::ReadFromDisk(TChar aDriveLetter, TInt aMaxFileSize) |
|
800 |
{ |
|
801 |
iDiskAccessEnabled = ETrue; |
|
802 |
TInt r = KErrNone; |
|
803 |
||
804 |
iFileName.Format(_L("%c:"), aDriveLetter.operator TUint()); |
|
805 |
iFileName.Append(KFileName); |
|
806 |
TUSB_PRINT1("\nFilename = %S", &iFileName); |
|
807 |
TUSB_PRINT1("File size: %d", aMaxFileSize); |
|
808 |
||
809 |
// First create the file & fill it |
|
810 |
r = iFile.Replace(iFs, iFileName, EFileWrite); |
|
811 |
if (r != KErrNone) |
|
812 |
{ |
|
813 |
TUSB_PRINT1("RFile::Replace() returned %d", r); |
|
814 |
iDiskAccessEnabled = EFalse; |
|
815 |
return r; |
|
816 |
} |
|
817 |
const TInt KBufferSize = 4 * 1024; |
|
818 |
TBuf8<KBufferSize> buffer; |
|
819 |
buffer.SetLength(KBufferSize); |
|
820 |
for (TInt n = 0; n < KBufferSize; n++) |
|
821 |
{ |
|
822 |
buffer[n] = static_cast<TUint8>(n & 0x000000ff); |
|
823 |
} |
|
824 |
TUSB_PRINT("Writing data to file (this may take some minutes...)"); |
|
825 |
for (TInt n = 0; n < aMaxFileSize; n += KBufferSize) |
|
826 |
{ |
|
827 |
r = iFile.Write(buffer, KBufferSize); |
|
828 |
if (r != KErrNone) |
|
829 |
{ |
|
830 |
TUSB_PRINT1("RFile::Write() returned %d (disk full?)", r); |
|
831 |
iFile.Close(); |
|
832 |
iDiskAccessEnabled = EFalse; |
|
833 |
return r; |
|
834 |
} |
|
835 |
} |
|
836 |
TUSB_PRINT("Done."); |
|
837 |
iFile.Close(); |
|
838 |
// Now open the file for reading |
|
839 |
r = iFile.Open(iFs, iFileName, EFileRead); |
|
840 |
if (r != KErrNone) |
|
841 |
{ |
|
842 |
TUSB_PRINT1("RFile::Open() returned %d", r); |
|
843 |
iDiskAccessEnabled = EFalse; |
|
844 |
return r; |
|
845 |
} |
|
846 |
iFileOffset = 0; |
|
847 |
||
848 |
return r; |
|
849 |
} |
|
850 |
||
851 |
||
852 |
void CActiveRW::WriteBufferToDisk(TDes8& aBuffer, TInt aLen) |
|
853 |
{ |
|
854 |
TUSB_VERBOSE_PRINT1("CActiveRW::WriteBufferToDisk(), len = %d", aLen); |
|
855 |
TInt r = iFile.Write(aBuffer, aLen); |
|
856 |
if (r != KErrNone) |
|
857 |
{ |
|
858 |
TUSB_PRINT2("Error writing to %S (%d)", &iFileName, r); |
|
859 |
iDiskAccessEnabled = EFalse; |
|
860 |
return; |
|
861 |
} |
|
862 |
iFileOffset += aLen; |
|
863 |
} |
|
864 |
||
865 |
||
866 |
void CActiveRW::ReadBufferFromDisk(TDes8& aBuffer, TInt aLen) |
|
867 |
{ |
|
868 |
const TInt r = iFile.Read(aBuffer, aLen); |
|
869 |
if (r != KErrNone) |
|
870 |
{ |
|
871 |
TUSB_PRINT2("Error reading from %S (%d)", &iFileName, r); |
|
872 |
iDiskAccessEnabled = EFalse; |
|
873 |
return; |
|
874 |
} |
|
875 |
TInt readLen = aBuffer.Length(); |
|
876 |
TUSB_VERBOSE_PRINT1("CActiveRW::ReadBufferFromDisk(), len = %d\n", readLen); |
|
877 |
if (readLen < aLen) |
|
878 |
{ |
|
879 |
TUSB_PRINT3("Only %d bytes of %d read from file %S)", |
|
880 |
readLen, aLen, &iFileName); |
|
881 |
iDiskAccessEnabled = EFalse; |
|
882 |
return; |
|
883 |
} |
|
884 |
iFileOffset += aLen; |
|
885 |
} |
|
886 |
||
887 |
||
888 |
TUint CActiveRW::ReadData() |
|
889 |
{ |
|
890 |
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 664)); |
|
891 |
iCurrentXfer = EReadXfer; |
|
892 |
#ifdef USB_SC |
|
893 |
TUint readSize = 0; // note that this returns zero when asynchronous read is pending |
|
894 |
TInt r = 0; |
|
895 |
do |
|
896 |
{ |
|
897 |
r = iSCReadBuf.GetBuffer (iSCReadData,readSize,iReadZlp,iStatus); |
|
898 |
test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
|
899 |
TUSB_VERBOSE_PRINT4("Get Buffer Return code %d Status %d DataPtr 0x%x Size %d", r, iStatus.Int(),iSCReadData,readSize); |
|
900 |
} |
|
901 |
while ((r == KErrCompletion && readSize == 0) || (r == KErrEof)); |
|
902 |
if (r == KErrCompletion) |
|
903 |
{ |
|
904 |
return readSize; |
|
905 |
} |
|
906 |
else |
|
907 |
{ |
|
908 |
if (!IsActive()) |
|
909 |
{ |
|
910 |
SetActive(); |
|
911 |
} |
|
912 |
return 0; |
|
913 |
} |
|
914 |
#else |
|
915 |
iReadBuf.SetLength (0); |
|
916 |
if (iBufSz <= iMaxPktSz) |
|
917 |
{ |
|
918 |
// Testing the packet version of Read() |
|
919 |
TUSB_VERBOSE_PRINT3("ReadData (single packet) interface %d setting %d endpoint %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.outPipe); |
|
920 |
iPort->ReadPacket(iStatus, (TENDPOINTNUMBER)iTestParams.outPipe, iReadBuf, iBufSz); |
|
921 |
} |
|
922 |
else if ((TUint)iBufSz == iTestParams.maxSize) |
|
923 |
{ |
|
924 |
// Testing the two-parameter version |
|
925 |
TUSB_VERBOSE_PRINT3("ReadData (w/o length) interface %d setting %d endpoint %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.outPipe); |
|
926 |
iPort->Read(iStatus, (TENDPOINTNUMBER)iTestParams.outPipe, iReadBuf); |
|
927 |
} |
|
928 |
else |
|
929 |
{ |
|
930 |
// otherwise, we use the universal default version |
|
931 |
// Testing the three-parameter version |
|
932 |
TUSB_VERBOSE_PRINT3("ReadData (normal) interface %d setting %d endpoint %d",iTestParams.interfaceNumber,iTestParams.alternateSetting,iTestParams.outPipe); |
|
933 |
iPort->Read(iStatus, (TENDPOINTNUMBER)iTestParams.outPipe, iReadBuf, iBufSz); |
|
934 |
} |
|
935 |
if (!IsActive()) |
|
936 |
{ |
|
937 |
SetActive(); |
|
938 |
} |
|
939 |
return 0; |
|
940 |
#endif |
|
941 |
} |
|
942 |
||
943 |
||
944 |
void CActiveRW::Stop() |
|
945 |
{ |
|
946 |
if (!IsActive()) |
|
947 |
{ |
|
948 |
TUSB_PRINT("CActiveRW::Stop(): Not active"); |
|
949 |
return; |
|
950 |
} |
|
951 |
TUSB_PRINT("Cancelling outstanding transfer requests\n"); |
|
952 |
iBufSz = 0; |
|
953 |
iPktNum = 0; |
|
954 |
iDoStop = ETrue; |
|
955 |
iCurrentXfer = ETxferNone; |
|
956 |
Cancel(); |
|
957 |
} |
|
958 |
||
959 |
||
960 |
void CActiveRW::DoCancel() |
|
961 |
{ |
|
962 |
TUSB_VERBOSE_PRINT("CActiveRW::DoCancel()"); |
|
963 |
// Canceling the transfer requests can be done explicitly |
|
964 |
// for every transfer... |
|
965 |
iPort->WriteCancel((TENDPOINTNUMBER)iTestParams.inPipe); |
|
966 |
iPort->ReadCancel((TENDPOINTNUMBER)iTestParams.outPipe); |
|
967 |
// or like this: |
|
968 |
// iPort->EndpointTransferCancel(~0); |
|
969 |
} |
|
970 |
||
971 |
||
972 |
TBool CActiveRW::CompareBuffers() |
|
973 |
{ |
|
974 |
TUSB_VERBOSE_PRINT2("CActiveRW::CompareBuffers() ReadOffset %d ReadSize %d",iReadOffset,iReadSize); |
|
975 |
#ifdef USB_SC |
|
976 |
TUint8 *readPtr = reinterpret_cast<TUint8*>(iSCReadData); |
|
977 |
TUint8* writePtr; |
|
978 |
TUint inBufLength; |
|
979 |
test_KErrNone(iSCWriteBuf.GetInBufferRange((TAny*&)writePtr, inBufLength)); |
|
980 |
writePtr += iReadOffset; |
|
981 |
#endif |
|
982 |
for (TUint i = 0; i < iReadSize; i++) |
|
983 |
{ |
|
984 |
#ifdef USB_SC |
|
985 |
if (*readPtr != *writePtr) |
|
986 |
{ |
|
987 |
TUSB_PRINT3 ("*** Error while comparing tx & rx buffers packet 0x%x length %d index %d",iPktNum, iReadSize,i + iReadOffset); |
|
988 |
TUSB_PRINT2 ("*** Read byte 0x%x Write byte 0x%x",*readPtr,*writePtr); |
|
989 |
return EFalse; |
|
990 |
} |
|
991 |
readPtr++; |
|
992 |
writePtr++; |
|
993 |
#else |
|
994 |
if (iReadBuf[i] != iWriteBuf[i + iReadOffset]) |
|
995 |
{ |
|
996 |
TUSB_PRINT3 ("*** Error while comparing tx & rx buffers packet 0x%x length %d index %d",iPktNum, iReadSize,i + iReadOffset); |
|
997 |
TUSB_PRINT5 ("WriteBuf Start 0x%x 0x%x 0x%x 0x%x 0x%x", |
|
998 |
iWriteBuf[i], iWriteBuf[i+1], iWriteBuf[i+2], iWriteBuf[i+3], iWriteBuf[i+4]); |
|
999 |
TUSB_PRINT5 ("ReadBuf Start 0x%x 0x%x 0x%x 0x%x 0x%x", |
|
1000 |
iReadBuf[i], iReadBuf[i+1], iReadBuf[i+2], iReadBuf[i+3], iReadBuf[i+4]); |
|
1001 |
if (iReadSize >= 10) |
|
1002 |
{ |
|
1003 |
TUSB_PRINT5 ("WriteBuf End 0x%x 0x%x 0x%x 0x%x 0x%x", |
|
1004 |
iWriteBuf[iReadSize-5], iWriteBuf[iReadSize-4], iWriteBuf[iReadSize-3], iWriteBuf[iReadSize-2], iWriteBuf[iReadSize-1]); |
|
1005 |
TUSB_PRINT5 ("ReadBuf End 0x%x 0x%x 0x%x 0x%x 0x%x", |
|
1006 |
iReadBuf[iReadSize-5], iReadBuf[iReadSize-4], iReadBuf[iReadSize-3], iReadBuf[iReadSize-2], iReadBuf[iReadSize-1]); |
|
1007 |
} |
|
1008 |
return EFalse; |
|
1009 |
} |
|
1010 |
#endif |
|
1011 |
} |
|
1012 |
return ETrue; |
|
1013 |
} |
|
1014 |
||
1015 |
void CActiveRW::TestComplete(TBool aResult) |
|
1016 |
{ |
|
1017 |
TUSB_VERBOSE_PRINT("CActiveRW::TestComplete()"); |
|
1018 |
||
1019 |
iResult = aResult; |
|
1020 |
||
1021 |
if (iComplete || !iResult || iTestParams.repeat == 0) |
|
1022 |
{ |
|
1023 |
test(iResult); |
|
1024 |
test.End(); |
|
1025 |
gRW[iIndex] = NULL; |
|
1026 |
delete this; |
|
1027 |
} |
|
1028 |
else |
|
1029 |
{ |
|
1030 |
iComplete = ETrue; |
|
1031 |
} |
|
1032 |
} |
|
1033 |
||
1034 |
// -eof- |