Commit 2c77c0d6524ebc2e34ea7a4485120225d2b936e6
Committed by
Tom Rini
1 parent
aa6ab905b2
Exists in
v2017.01-smarct4x
and in
25 other branches
xyz-modem: Change getc timeout loop waiting
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 <tomas.melin@vaisala.com>
Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff
common/xyzModem.c
... | ... | @@ -71,12 +71,12 @@ |
71 | 71 | static int |
72 | 72 | CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c) |
73 | 73 | { |
74 | -#define DELAY 20 | |
75 | - unsigned long counter = 0; | |
76 | - while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT * 1000 / DELAY)) | |
74 | + | |
75 | + ulong now = get_timer(0); | |
76 | + while (!tstc ()) | |
77 | 77 | { |
78 | - udelay (DELAY); | |
79 | - counter++; | |
78 | + if (get_timer(now) > xyzModem_CHAR_TIMEOUT) | |
79 | + break; | |
80 | 80 | } |
81 | 81 | if (tstc ()) |
82 | 82 | { |
-
mentioned in commit 77e1aa
-
mentioned in commit 77e1aa
-
mentioned in commit 77e1aa
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c
-
mentioned in commit a4773c