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