1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
14 #ifndef CONFIG_BOOT_RETRY_MIN
15 #define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
18 static uint64_t endtime; /* must be set, default is instant timeout */
19 static int retry_time = -1; /* -1 so can call readline before main_loop */
21 /***************************************************************************
22 * initialize command line timeout
24 void bootretry_init_cmd_timeout(void)
26 char *s = env_get("bootretry");
29 retry_time = (int)simple_strtol(s, NULL, 10);
31 retry_time = CONFIG_BOOT_RETRY_TIME;
33 if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
34 retry_time = CONFIG_BOOT_RETRY_MIN;
37 /***************************************************************************
38 * reset command line timeout to retry_time seconds
40 void bootretry_reset_cmd_timeout(void)
42 endtime = endtick(retry_time);
45 int bootretry_tstc_timeout(void)
47 while (!tstc()) { /* while no incoming data */
48 if (retry_time >= 0 && get_ticks() > endtime)
56 void bootretry_dont_retry(void)