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