1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
15 #ifndef CONFIG_BOOT_RETRY_MIN
16 #define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
19 static uint64_t endtime; /* must be set, default is instant timeout */
20 static int retry_time = -1; /* -1 so can call readline before main_loop */
22 /***************************************************************************
23 * initialize command line timeout
25 void bootretry_init_cmd_timeout(void)
27 char *s = env_get("bootretry");
30 retry_time = (int)simple_strtol(s, NULL, 10);
32 retry_time = CONFIG_BOOT_RETRY_TIME;
34 if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
35 retry_time = CONFIG_BOOT_RETRY_MIN;
38 /***************************************************************************
39 * reset command line timeout to retry_time seconds
41 void bootretry_reset_cmd_timeout(void)
43 endtime = endtick(retry_time);
46 int bootretry_tstc_timeout(void)
48 while (!tstc()) { /* while no incoming data */
49 if (retry_time >= 0 && get_ticks() > endtime)
57 void bootretry_dont_retry(void)