| * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| * SPDX-License-Identifier: GPL-2.0+ |
| static int do_sleep(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| ulong start = get_timer(0); |
| delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ; |
| while (get_timer(start) < delay) { |
| "delay execution for some time", |
| " - delay execution for N seconds (N is _decimal_ !!!)" |
| static int do_timer(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| if (!strcmp(argv[1], "start")) |
| if (!strcmp(argv[1], "get")) { |
| ulong msecs = get_timer(start) * 1000 / CONFIG_SYS_HZ; |
| printf("%ld.%03d\n", msecs / 1000, (int)(msecs % 1000)); |
| "access the system timer", |
| "start - Reset the timer reference.\n" |
| "timer get - Print the time since 'start'." |