common/xyzModem.c: Fix delay timeout calculation
PATCH v2 1/1 common/xyzModem.c: Fix delay timeout calculation
When waiting for input in CYGACC_COMM_IF_GETC_TIMEOUT we delay 2 seconds by incrementing and checking a counter variable every 20 uSeconds. The overhead in the loop calling tstc() thousands of times causes the timeout to be closer to 20 seconds. Delay longer per iteration to reduce overhead and bring the timeout back closer to the correct time.
--- common/xyzModem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
common/xyzModem.c +2 -2
@@ -73,9 +73,9 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c) {#define DELAY 20unsigned long counter =0 ; -while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT *1000 /DELAY )) +while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT /DELAY )) { -udelay (DELAY ); +mdelay (DELAY ); counter++; }if (tstc ())
Signature · 1 line
2.9.3
PATCH v2 1/1 common/xyzModem.c: Fix delay timeout calculation
Quoted 7 lines · Andrew F. Davis
When waiting for input in
CYGACC_COMM_IF_GETC_TIMEOUTwe delay 2 seconds by incrementing and checking a counter variable every 20 uSeconds. The overhead in the loop callingtstc()thousands of times causes the timeout to be closer to 20 seconds. Delay longer per iteration to reduce overhead and bring the timeout back closer to the correct time.Signed-off-by Andrew F. Davis <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160923/788fc323/attachment.sig>
PATCH v2 1/1 common/xyzModem.c: Fix delay timeout calculation
Quoted 8 lines · Tom Rini
Quoted 6 lines · Andrew F. Davis
When waiting for input in
CYGACC_COMM_IF_GETC_TIMEOUTwe delay 2 seconds by incrementing and checking a counter variable every 20 uSeconds. The overhead in the loop callingtstc()thousands of times causes the timeout to be closer to 20 seconds. Delay longer per iteration to reduce overhead and bring the timeout back closer to the correct time.
Quoted 4 lines
Quoted 1 line
Signed-off-by Andrew F. Davis <[email protected]>Reviewed-by Tom Rini <[email protected]>
I was just informed that this may be breaking UART boot on a couple of our platforms, so this shouldn't be taken until I can get this figured out.
Thanks,
Andrew