summaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2008-12-10 16:24:16 +0100
committerWolfgang Denk <wd@denx.de>2009-01-24 01:24:15 +0100
commitc3284b030b1cd492b4f46c576aea01bef258599d (patch)
treebbacd1476ff20d14e498de09cd2e6e429eaf5a1e /common/main.c
parent94f9279f7bbdc01bbc7cf85aedf9b545943b94c3 (diff)
common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED
Support bootdelay=0 in abortboot for the CONFIG_AUTOBOOT_KEYED case similar to the CONFIG_ZERO_BOOTDELAY_CHECK support for the !CONFIG_AUTOBOOT_KEYED case. Do this by reversing the loop so we do at least one iteration before checking for timeout. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/common/main.c b/common/main.c
index a999a5d64d6..4c4f7806500 100644
--- a/common/main.c
+++ b/common/main.c
@@ -158,7 +158,19 @@ static __inline__ int abortboot(int bootdelay)
/* In order to keep up with incoming data, check timeout only
* when catch up.
*/
- while (!abort && get_ticks() <= etime) {
+ do {
+ if (tstc()) {
+ if (presskey_len < presskey_max) {
+ presskey [presskey_len ++] = getc();
+ }
+ else {
+ for (i = 0; i < presskey_max - 1; i ++)
+ presskey [i] = presskey [i + 1];
+
+ presskey [i] = getc();
+ }
+ }
+
for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
if (delaykey[i].len > 0 &&
presskey_len >= delaykey[i].len &&
@@ -178,19 +190,8 @@ static __inline__ int abortboot(int bootdelay)
abort = 1;
}
}
+ } while (!abort && get_ticks() <= etime);
- if (tstc()) {
- if (presskey_len < presskey_max) {
- presskey [presskey_len ++] = getc();
- }
- else {
- for (i = 0; i < presskey_max - 1; i ++)
- presskey [i] = presskey [i + 1];
-
- presskey [i] = getc();
- }
- }
- }
# if DEBUG_BOOTKEYS
if (!abort)
puts("key timeout\n");