diff options
Diffstat (limited to 'commands/sleep.c')
-rw-r--r-- | commands/sleep.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/sleep.c b/commands/sleep.c new file mode 100644 index 0000000000..99afc5f9ba --- /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 |