xref: /openbmc/u-boot/include/bootretry.h (revision e8f80a5a)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
20098e179SSimon Glass /*
30098e179SSimon Glass  * (C) Copyright 2000
40098e179SSimon Glass  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
50098e179SSimon Glass  */
60098e179SSimon Glass 
7b26440f1SSimon Glass #ifndef __BOOTRETRY_H
8b26440f1SSimon Glass #define __BOOTRETRY_H
90098e179SSimon Glass 
100098e179SSimon Glass #ifdef CONFIG_BOOT_RETRY_TIME
110098e179SSimon Glass /**
120098e179SSimon Glass  * bootretry_tstc_timeout() - ensure we get a keypress before timeout
130098e179SSimon Glass  *
140098e179SSimon Glass  * Check for a keypress repeatedly, resetting the watchdog each time. If a
150098e179SSimon Glass  * keypress is not received within the command timeout, return an error.
160098e179SSimon Glass  *
170098e179SSimon Glass  * @return 0 if a key is received in time, -ETIMEDOUT if not
180098e179SSimon Glass  */
190098e179SSimon Glass int bootretry_tstc_timeout(void);
20b26440f1SSimon Glass 
21b26440f1SSimon Glass /**
22b26440f1SSimon Glass  * bootretry_init_cmd_timeout() - set up command timeout
23b26440f1SSimon Glass  *
24b26440f1SSimon Glass  * Get the required command timeout from the environment.
25b26440f1SSimon Glass  */
26b26440f1SSimon Glass void bootretry_init_cmd_timeout(void);
27b26440f1SSimon Glass 
28b26440f1SSimon Glass /**
29b26440f1SSimon Glass  * bootretry_reset_cmd_timeout() - reset command timeout
30b26440f1SSimon Glass  *
31b26440f1SSimon Glass  * Reset the command timeout so that the user has a fresh start. This is
32b26440f1SSimon Glass  * typically used when input is received from the user.
33b26440f1SSimon Glass  */
34b26440f1SSimon Glass void bootretry_reset_cmd_timeout(void);
35b26440f1SSimon Glass 
36b26440f1SSimon Glass /** bootretry_dont_retry() - Indicate that we should not retry the boot */
37b26440f1SSimon Glass void bootretry_dont_retry(void);
380098e179SSimon Glass #else
bootretry_tstc_timeout(void)390098e179SSimon Glass static inline int bootretry_tstc_timeout(void)
400098e179SSimon Glass {
410098e179SSimon Glass 	return 0;
420098e179SSimon Glass }
430098e179SSimon Glass 
bootretry_init_cmd_timeout(void)44b26440f1SSimon Glass static inline void bootretry_init_cmd_timeout(void)
45b26440f1SSimon Glass {
46b26440f1SSimon Glass }
47b26440f1SSimon Glass 
bootretry_reset_cmd_timeout(void)48b26440f1SSimon Glass static inline void bootretry_reset_cmd_timeout(void)
49b26440f1SSimon Glass {
50b26440f1SSimon Glass }
51b26440f1SSimon Glass 
bootretry_dont_retry(void)52b26440f1SSimon Glass static inline void bootretry_dont_retry(void)
53b26440f1SSimon Glass {
54b26440f1SSimon Glass }
55b26440f1SSimon Glass 
56b26440f1SSimon Glass #endif
570098e179SSimon Glass 
580098e179SSimon Glass #endif
59