equal
deleted
inserted
replaced
35 |
35 |
36 TCommConfig TheConfigBuf; |
36 TCommConfig TheConfigBuf; |
37 TCommConfigV01& TheConfig = TheConfigBuf(); |
37 TCommConfigV01& TheConfig = TheConfigBuf(); |
38 |
38 |
39 const TInt KReceiveBufferLength = 65536/*16384*/; // TODO: speed enhancement! |
39 const TInt KReceiveBufferLength = 65536/*16384*/; // TODO: speed enhancement! |
40 //const TInt KMaxBufferSize = 8192; // TODO: speed enhancement! |
|
41 const TUint KChunkSize = 65536; |
40 const TUint KChunkSize = 65536; |
42 |
41 |
43 //////////////////////////////////////////////////////////////////////////////// |
42 //////////////////////////////////////////////////////////////////////////////// |
44 |
43 |
45 //_LIT(KUsbCsyName, "ECACM"); |
|
46 _LIT(KUsbPortName, "ACM::0"); |
44 _LIT(KUsbPortName, "ACM::0"); |
47 _LIT(KUsbLddName, "EUSBC"); |
45 _LIT(KUsbLddName, "EUSBC"); |
48 |
46 |
49 //////////////////////////////////////////////////////////////////////////////// |
47 //////////////////////////////////////////////////////////////////////////////// |
50 |
48 |
135 { |
133 { |
136 TRequestStatus consoleStatus; |
134 TRequestStatus consoleStatus; |
137 TRequestStatus status; |
135 TRequestStatus status; |
138 RComm port; |
136 RComm port; |
139 |
137 |
140 // static TBuf8<1024> OUT_Buf; // TODO: speed enhancement! |
|
141 static TBuf8<KChunkSize> OUT_Buf; |
138 static TBuf8<KChunkSize> OUT_Buf; |
142 |
139 |
143 _printf(_L("\n")); |
140 _printf(_L("\n")); |
144 _printf(_L("+-----------------------------------------+\n")); |
141 _printf(_L("+-----------------------------------------+\n")); |
145 _printf(_L("|+---------------------------------------+|\n")); |
142 _printf(_L("|+---------------------------------------+|\n")); |
160 // prime the console for the abandon-ship |
157 // prime the console for the abandon-ship |
161 |
158 |
162 console->Read(consoleStatus); |
159 console->Read(consoleStatus); |
163 |
160 |
164 TInt uReadCount = 0 ; |
161 TInt uReadCount = 0 ; |
165 //TInt uThermoBar = 0 ; // TODO: speed enhancement! (remove ThermoBar fnality) |
|
166 |
162 |
167 _printf(_L("\tWatch : ")); |
163 _printf(_L("\tWatch : ")); |
168 |
164 |
169 TInt uAvgCount = 0 ; |
165 TInt uAvgCount = 0 ; |
170 TInt uNumReads = 0 ; |
166 TInt uNumReads = 0 ; |
214 { |
210 { |
215 uAvgCount = ( ( 9 * uAvgCount ) + OUT_Buf.Length() ) / 10 ; |
211 uAvgCount = ( ( 9 * uAvgCount ) + OUT_Buf.Length() ) / 10 ; |
216 } |
212 } |
217 |
213 |
218 uReadCount += OUT_Buf.Length() ; |
214 uReadCount += OUT_Buf.Length() ; |
219 |
|
220 /* if( uReadCount >= 1024 ) |
|
221 { |
|
222 // uThermoBar runs from 0..63 |
|
223 |
|
224 uThermoBar = ( uThermoBar + 1 ) & 0x3F ; |
|
225 |
|
226 if( uThermoBar < 32 ) |
|
227 { |
|
228 _printf(_L("*")); |
|
229 } |
|
230 else |
|
231 { |
|
232 _printf(_L("\b \b")); |
|
233 } |
|
234 |
|
235 uReadCount -= 1024 ; |
|
236 } |
|
237 */ |
|
238 } |
215 } |
239 else |
216 else |
240 { |
217 { |
241 // user must have wanted to stop, shut down the reader |
218 // user must have wanted to stop, shut down the reader |
242 |
219 |
268 { |
245 { |
269 TRequestStatus consoleStatus; |
246 TRequestStatus consoleStatus; |
270 TRequestStatus status; |
247 TRequestStatus status; |
271 RComm port; |
248 RComm port; |
272 |
249 |
273 //#define uInBufSize 4096 // TODO: speed enhancement! reduce number of IPC calls |
|
274 #define uInBufSize 65536 |
250 #define uInBufSize 65536 |
275 |
251 |
276 static TBuf8<uInBufSize> IN_Buf; |
252 static TBuf8<uInBufSize> IN_Buf; |
277 static TBuf8<uInBufSize> ZLP_Buf; |
253 static TBuf8<uInBufSize> ZLP_Buf; |
278 |
254 |
335 TInt bDoneBlock = EFalse ; |
311 TInt bDoneBlock = EFalse ; |
336 |
312 |
337 TInt bNeedZLP = bUseZLP && ((IN_Buf.Length()%64)==0); |
313 TInt bNeedZLP = bUseZLP && ((IN_Buf.Length()%64)==0); |
338 |
314 |
339 TInt uWriteCount = 0 ; |
315 TInt uWriteCount = 0 ; |
340 // TInt uThermoBar = 0 ; // TODO: speed enhancement! |
|
341 |
316 |
342 _printf(_L("\tWatch : ")); |
317 _printf(_L("\tWatch : ")); |
343 |
318 |
344 while (1) |
319 while (1) |
345 { |
320 { |
376 LEAVE(status.Int()); |
351 LEAVE(status.Int()); |
377 } |
352 } |
378 |
353 |
379 // reassure watcher that there is something happening... |
354 // reassure watcher that there is something happening... |
380 |
355 |
381 /* while( uWriteCount >= 1024 ) |
|
382 { |
|
383 // uThermoBar runs from 0..63 |
|
384 |
|
385 uThermoBar = ( uThermoBar + 1 ) & 0x3F ; |
|
386 |
|
387 if( uThermoBar < 32 ) |
|
388 { |
|
389 _printf(_L("*")); |
|
390 } |
|
391 else |
|
392 { |
|
393 _printf(_L("\b \b")); |
|
394 } |
|
395 |
|
396 uWriteCount -= 1024 ; |
|
397 } |
|
398 */ |
|
399 } |
356 } |
400 else |
357 else |
401 { |
358 { |
402 _printf(_L("\n\n\tCancelling Write()")); |
359 _printf(_L("\n\n\tCancelling Write()")); |
403 |
360 |
496 LEAVEIFERROR(status.Int()); |
453 LEAVEIFERROR(status.Int()); |
497 |
454 |
498 _printf(_L("Restarted USB.\n")); |
455 _printf(_L("Restarted USB.\n")); |
499 } |
456 } |
500 |
457 |
501 //////////////////////////////////////////////////////////////////////////////// |
458 |
502 |
|
503 /*void ThermoBar() |
|
504 { |
|
505 TUint uCol = 0 ; |
|
506 |
|
507 TTime now; |
|
508 |
|
509 TDateTime WasDT; |
|
510 TDateTime NowDT; |
|
511 |
|
512 now.HomeTime(); |
|
513 WasDT = now.DateTime(); |
|
514 |
|
515 for( TUint line = 0 ; line < 30 ; ) |
|
516 { |
|
517 for( TUint dotO = 0 ; dotO < 1000 ; dotO++ ) |
|
518 { |
|
519 for( TUint dotI = 0 ; dotI < 1000 ; dotI++ ) |
|
520 { |
|
521 ; |
|
522 } |
|
523 } |
|
524 |
|
525 _printf(_L("*")); |
|
526 |
|
527 now.HomeTime(); |
|
528 NowDT = now.DateTime(); |
|
529 |
|
530 if( ( ++uCol >= 79 ) || ( WasDT.Second() != NowDT.Second() ) ) |
|
531 { |
|
532 _printf(_L("\n")); |
|
533 |
|
534 uCol = 0 ; |
|
535 |
|
536 line++ ; |
|
537 |
|
538 WasDT = now.DateTime() ; |
|
539 } |
|
540 } |
|
541 } |
|
542 */ |
|
543 //////////////////////////////////////////////////////////////////////////////// |
|
544 |
459 |
545 void ToggleTermL() |
460 void ToggleTermL() |
546 { |
461 { |
547 bUseTerm = ( bUseTerm == EFalse ) ; |
462 bUseTerm = ( bUseTerm == EFalse ) ; |
548 |
463 |
657 _printf(_L("\n")); |
572 _printf(_L("\n")); |
658 _printf(_L("1. Bulk OUT test \n")); |
573 _printf(_L("1. Bulk OUT test \n")); |
659 _printf(_L("2. Bulk IN test \n")); |
574 _printf(_L("2. Bulk IN test \n")); |
660 _printf(_L("3. Set handshaking \n")); |
575 _printf(_L("3. Set handshaking \n")); |
661 _printf(_L("4. Restart USB \n")); |
576 _printf(_L("4. Restart USB \n")); |
662 // _printf(_L("5. Run ThermoBar \n")); |
|
663 _printf(_L("6. Swap Read Method \n")); |
577 _printf(_L("6. Swap Read Method \n")); |
664 _printf(_L("7. Swap ZLP Method \n")); |
578 _printf(_L("7. Swap ZLP Method \n")); |
665 _printf(_L("8. Swap Term Method \n")); |
579 _printf(_L("8. Swap Term Method \n")); |
666 _printf(_L("\n")); |
580 _printf(_L("\n")); |
667 _printf(_L("Select (q to quit): ")); |
581 _printf(_L("Select (q to quit): ")); |
673 { |
587 { |
674 case '1': Bulk_OUT_TestL(); break; |
588 case '1': Bulk_OUT_TestL(); break; |
675 case '2': Bulk_IN_TestL(); break; |
589 case '2': Bulk_IN_TestL(); break; |
676 case '3': SetHandshakingL(); break; |
590 case '3': SetHandshakingL(); break; |
677 case '4': RestartUsbL(); break; |
591 case '4': RestartUsbL(); break; |
678 // case '5': ThermoBar(); break; |
|
679 case '6': bReadCall = ( bReadCall == EFalse ) ; break; |
592 case '6': bReadCall = ( bReadCall == EFalse ) ; break; |
680 case '7': bUseZLP = ( bUseZLP == EFalse ) ; break; |
593 case '7': bUseZLP = ( bUseZLP == EFalse ) ; break; |
681 case '8': ToggleTermL() ; break; |
594 case '8': ToggleTermL() ; break; |
682 |
595 |
683 case 'q': |
596 case 'q': |