]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - cmd/sleep.c
1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
10 #include <linux/delay.h>
12 static int do_sleep(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
15 ulong start
= get_timer(0);
23 delay
= dectoul(argv
[1], NULL
) * CONFIG_SYS_HZ
;
25 frpart
= strchr(argv
[1], '.');
28 uint mult
= CONFIG_SYS_HZ
/ 10;
29 for (frpart
++; *frpart
!= '\0' && mult
> 0; frpart
++) {
30 if (*frpart
< '0' || *frpart
> '9') {
34 mdelay
+= (*frpart
- '0') * mult
;
41 while (get_timer(start
) < delay
) {
43 return CMD_RET_FAILURE
;
52 sleep
, 2, 1, do_sleep
,
53 "delay execution for some time",
55 " - delay execution for N seconds (N is _decimal_ and can be\n"