From: Stefan Roese Date: Thu, 20 Oct 2005 14:36:44 +0000 (+0200) Subject: Fix problem with sleep in NetConsole (use get_timer()) X-Git-Tag: LABEL_2006_03_12_0025~83^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c4c13df284cb06156c16ee6aef49b8d23be3fadd;p=u-boot Fix problem with sleep in NetConsole (use get_timer()) Patch by Stefan Roese, 20 Oct 2005 --- diff --git a/CHANGELOG b/CHANGELOG index 2dd56169ba..a063a01db9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ Changes for U-Boot 1.1.4: ====================================================================== +* Fix problem with sleep in NetConsole (use get_timer()) + Patch by Stefan Roese, 20 Oct 2005 + * Add NetConsole Support for AMCC eval boards Patch by Stefan Roese, 20 Oct 2005 diff --git a/common/cmd_misc.c b/common/cmd_misc.c index 674eafca3f..67ee9e8a83 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -31,6 +31,7 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { + ulong start = get_timer(0); ulong delay; if (argc != 2) { @@ -38,20 +39,18 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - delay = simple_strtoul(argv[1], NULL, 10); + delay = simple_strtoul(argv[1], NULL, 10) * CFG_HZ; - while (delay) { - int i; - for (i=0; i<1000; ++i) { - if (ctrlc ()) { - return (-1); - } - udelay (1000); + while (get_timer(start) < delay) { + if (ctrlc ()) { + return (-1); } - --delay; + udelay (100); } + return 0; } + /* Implemented in $(CPU)/interrupts.c */ #if (CONFIG_COMMANDS & CFG_CMD_IRQ) int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);