summaryrefslogtreecommitdiffstats
path: root/commands/sleep.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:02:13 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:02:13 +0200
commit4b07af6730d2811363f158f5175138116038f7b9 (patch)
tree206044270884f80204a2da69e02ca3b6f5803185 /commands/sleep.c
parentd08c60e9d77dc0f83946cd702d383451865e66dd (diff)
downloadbarebox-4b07af6730d2811363f158f5175138116038f7b9.tar.gz
svn_rev_643
structure cleanup
Diffstat (limited to 'commands/sleep.c')
-rw-r--r--commands/sleep.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/sleep.c b/commands/sleep.c
new file mode 100644
index 0000000..99afc5f
--- /dev/null
+++ b/commands/sleep.c
@@ -0,0 +1,30 @@
+#include <common.h>
+#include <command.h>
+#include <clock.h>
+
+int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ uint64_t start;
+ ulong delay;
+
+ if (argc != 2) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return 1;
+ }
+
+ delay = simple_strtoul(argv[1], NULL, 10);
+
+ start = get_time_ns();
+ while (!is_timeout(start, delay * SECOND)) {
+ if (ctrlc())
+ return 1;
+ }
+
+ return 0;
+}
+
+U_BOOT_CMD_START(sleep)
+ .maxargs = 2,
+ .cmd = do_sleep,
+ .usage = "delay execution for n seconds",
+U_BOOT_CMD_END