/src/barebox/commands/msleep.c
Line | Count | Source |
1 | | // SPDX-License-Identifier: GPL-2.0-only |
2 | | // SPDX-FileCopyrightText: © 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix |
3 | | |
4 | | /* |
5 | | * msleep.c - delay execution for n milliseconds |
6 | | * |
7 | | * derived from commands/sleep.c |
8 | | */ |
9 | | |
10 | | #include <common.h> |
11 | | #include <command.h> |
12 | | #include <clock.h> |
13 | | |
14 | | static int do_msleep(int argc, char *argv[]) |
15 | 0 | { |
16 | 0 | ulong delay; |
17 | |
|
18 | 0 | if (argc != 2) |
19 | 0 | return COMMAND_ERROR_USAGE; |
20 | | |
21 | 0 | delay = simple_strtoul(argv[1], NULL, 10); |
22 | |
|
23 | 0 | mdelay(delay); |
24 | |
|
25 | 0 | return 0; |
26 | 0 | } |
27 | | |
28 | | BAREBOX_CMD_START(msleep) |
29 | | .cmd = do_msleep, |
30 | | BAREBOX_CMD_DESC("delay execution for n milli-seconds") |
31 | | BAREBOX_CMD_OPTS("MILLISECONDS") |
32 | | BAREBOX_CMD_GROUP(CMD_GRP_SCRIPT) |
33 | | BAREBOX_CMD_END |