1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
13 #ifndef CONFIG_BOOT_RETRY_MIN
14 #define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
17 static uint64_t endtime; /* must be set, default is instant timeout */
18 static int retry_time = -1; /* -1 so can call readline before main_loop */
20 /***************************************************************************
21 * initialize command line timeout
23 void bootretry_init_cmd_timeout(void)
25 char *s = env_get("bootretry");
28 retry_time = (int)simple_strtol(s, NULL, 10);
30 retry_time = CONFIG_BOOT_RETRY_TIME;
32 if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
33 retry_time = CONFIG_BOOT_RETRY_MIN;
36 /***************************************************************************
37 * reset command line timeout to retry_time seconds
39 void bootretry_reset_cmd_timeout(void)
41 endtime = endtick(retry_time);
44 int bootretry_tstc_timeout(void)
46 while (!tstc()) { /* while no incoming data */
47 if (retry_time >= 0 && get_ticks() > endtime)
55 void bootretry_dont_retry(void)