]> Git Repo - J-u-boot.git/commitdiff
xyz-modem: Change getc timeout loop waiting
author[email protected] <[email protected]>
Mon, 21 Nov 2016 08:18:51 +0000 (10:18 +0200)
committerTom Rini <[email protected]>
Tue, 29 Nov 2016 00:49:48 +0000 (19:49 -0500)
This fixes the loop delay when using a hw watchdog.

In case a watchdog is used that accesses CPU registers,
the defined delay of 20us in a tight loop will cause a
huge delay in the actual timeout seen. This is caused
by the fact that udelay will inheritantly call WATCHDOG_RESET.
Together with the omap wdt implementation, the seen timeout increases up to
around 30s. This makes the loop very slow and causes long
delays when using the modem.

Instead, implement the 2 sec loop by using the timer interface to know
when to break out of the timeout loop. Watchdog kicking is taken care of
by getc().

Signed-off-by: Tomas Melin <[email protected]>
common/xyzModem.c

index 5656aac48fb1b688a10247adf572444392779194..e0d87dbfec95af68bf72be382cc931aeb60c9ea5 100644 (file)
@@ -71,12 +71,12 @@ typedef int cyg_int32;
 static int
 CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
 {
-#define DELAY 20
-  unsigned long counter = 0;
-  while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT * 1000 / DELAY))
+
+  ulong now = get_timer(0);
+  while (!tstc ())
     {
-      udelay (DELAY);
-      counter++;
+      if (get_timer(now) > xyzModem_CHAR_TIMEOUT)
+        break;
     }
   if (tstc ())
     {
This page took 0.038584 seconds and 4 git commands to generate.