console: USB: KBD: Fix incorrect autoboot timeout
Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in configuration file and when tstc() function for checking key pressed takes longer time than 10 ms (e.g., 50 ms) to finish. Signed-off-by: Jim Lin <jilin@nvidia.com>
This commit is contained in:
parent
3fd1e85aaa
commit
b2f3e0ea3e
|
@ -225,6 +225,7 @@ static inline
|
||||||
int abortboot(int bootdelay)
|
int abortboot(int bootdelay)
|
||||||
{
|
{
|
||||||
int abort = 0;
|
int abort = 0;
|
||||||
|
unsigned long ts;
|
||||||
|
|
||||||
#ifdef CONFIG_MENUPROMPT
|
#ifdef CONFIG_MENUPROMPT
|
||||||
printf(CONFIG_MENUPROMPT);
|
printf(CONFIG_MENUPROMPT);
|
||||||
|
@ -248,11 +249,10 @@ int abortboot(int bootdelay)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((bootdelay > 0) && (!abort)) {
|
while ((bootdelay > 0) && (!abort)) {
|
||||||
int i;
|
|
||||||
|
|
||||||
--bootdelay;
|
--bootdelay;
|
||||||
/* delay 100 * 10ms */
|
/* delay 1000 ms */
|
||||||
for (i=0; !abort && i<100; ++i) {
|
ts = get_timer(0);
|
||||||
|
do {
|
||||||
if (tstc()) { /* we got a key press */
|
if (tstc()) { /* we got a key press */
|
||||||
abort = 1; /* don't auto boot */
|
abort = 1; /* don't auto boot */
|
||||||
bootdelay = 0; /* no more delay */
|
bootdelay = 0; /* no more delay */
|
||||||
|
@ -264,7 +264,7 @@ int abortboot(int bootdelay)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
udelay(10000);
|
udelay(10000);
|
||||||
}
|
} while (!abort && get_timer(ts) < 1000);
|
||||||
|
|
||||||
printf("\b\b\b%2d ", bootdelay);
|
printf("\b\b\b%2d ", bootdelay);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue