diff options
author | Stefan Roese <sr@denx.de> | 2005-10-20 16:36:44 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2005-10-20 16:36:44 +0200 |
commit | c4c13df284cb06156c16ee6aef49b8d23be3fadd (patch) | |
tree | ac8391d4fb84e03b2c3dab4f147ef538cae13dac /common/cmd_misc.c | |
parent | 1e25f957c845878bf3f71425f2f5d2baef897470 (diff) | |
download | u-boot-imx-c4c13df284cb06156c16ee6aef49b8d23be3fadd.zip u-boot-imx-c4c13df284cb06156c16ee6aef49b8d23be3fadd.tar.gz u-boot-imx-c4c13df284cb06156c16ee6aef49b8d23be3fadd.tar.bz2 |
Fix problem with sleep in NetConsole (use get_timer())
Patch by Stefan Roese, 20 Oct 2005
Diffstat (limited to 'common/cmd_misc.c')
-rw-r--r-- | common/cmd_misc.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/common/cmd_misc.c b/common/cmd_misc.c index 674eafc..67ee9e8 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[]); |