[U-Boot] [PATCH 1/1] console: USB: KBD: Fix incorrect autoboot timeout
Wolfgang Denk
wd at denx.de
Wed Jan 23 09:38:31 CET 2013
Dear Jim Lin,
In message <1358923034-2727-1-git-send-email-jilin at nvidia.com> you wrote:
> 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.
...
> /* delay 100 * 10ms */
> - for (i=0; !abort && i<100; ++i) {
> + j = 100;
> + for (i = 0; !abort && i < j; ++i) {
> + ts = get_timer(0);
> if (tstc()) { /* we got a key press */
> abort = 1; /* don't auto boot */
> bootdelay = 0; /* no more delay */
> @@ -263,7 +266,11 @@ int abortboot(int bootdelay)
> # endif
> break;
> }
> - udelay(10000);
> + ts = get_timer(ts);
> + if (ts < 10)
> + mdelay(10 - ts);
> + else
> + j = 1000 / (int) ts;
> }
This is a pretty awkward implementation. If you feel the current
plain delay loop based approach is not exact enough, then please
implement a real timeout - you are calling the timer anyway, so just
use the timer values instead of a loop count.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Quantum particles: The dreams that stuff is made of.
More information about the U-Boot
mailing list