]>
git.ipfire.org Git - people/ms/u-boot.git/blob - cmd/misc.c
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
15 static int do_sleep(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
17 ulong start
= get_timer(0);
23 delay
= simple_strtoul(argv
[1], NULL
, 10) * CONFIG_SYS_HZ
;
25 while (get_timer(start
) < delay
) {
36 sleep
, 2, 1, do_sleep
,
37 "delay execution for some time",
39 " - delay execution for N seconds (N is _decimal_ !!!)"
42 #ifdef CONFIG_CMD_TIMER
43 static int do_timer(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
50 if (!strcmp(argv
[1], "start"))
53 if (!strcmp(argv
[1], "get")) {
54 ulong msecs
= get_timer(start
) * 1000 / CONFIG_SYS_HZ
;
55 printf("%ld.%03d\n", msecs
/ 1000, (int)(msecs
% 1000));
62 timer
, 2, 1, do_timer
,
63 "access the system timer",
64 "start - Reset the timer reference.\n"
65 "timer get - Print the time since 'start'."