Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
Simon Glass | b26440f | 2014-04-10 20:01:31 -0600 | [diff] [blame] | 7 | #ifndef __BOOTRETRY_H |
| 8 | #define __BOOTRETRY_H |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 9 | |
| 10 | #ifdef CONFIG_BOOT_RETRY_TIME |
| 11 | /** |
| 12 | * bootretry_tstc_timeout() - ensure we get a keypress before timeout |
| 13 | * |
| 14 | * Check for a keypress repeatedly, resetting the watchdog each time. If a |
| 15 | * keypress is not received within the command timeout, return an error. |
| 16 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 17 | * Return: 0 if a key is received in time, -ETIMEDOUT if not |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 18 | */ |
| 19 | int bootretry_tstc_timeout(void); |
Simon Glass | b26440f | 2014-04-10 20:01:31 -0600 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * bootretry_init_cmd_timeout() - set up command timeout |
| 23 | * |
| 24 | * Get the required command timeout from the environment. |
| 25 | */ |
| 26 | void bootretry_init_cmd_timeout(void); |
| 27 | |
| 28 | /** |
| 29 | * bootretry_reset_cmd_timeout() - reset command timeout |
| 30 | * |
| 31 | * Reset the command timeout so that the user has a fresh start. This is |
| 32 | * typically used when input is received from the user. |
| 33 | */ |
| 34 | void bootretry_reset_cmd_timeout(void); |
| 35 | |
| 36 | /** bootretry_dont_retry() - Indicate that we should not retry the boot */ |
| 37 | void bootretry_dont_retry(void); |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 38 | #else |
| 39 | static inline int bootretry_tstc_timeout(void) |
| 40 | { |
| 41 | return 0; |
| 42 | } |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 43 | |
Simon Glass | b26440f | 2014-04-10 20:01:31 -0600 | [diff] [blame] | 44 | static inline void bootretry_init_cmd_timeout(void) |
| 45 | { |
| 46 | } |
| 47 | |
| 48 | static inline void bootretry_reset_cmd_timeout(void) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | static inline void bootretry_dont_retry(void) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | #endif |
Simon Glass | 0098e17 | 2014-04-10 20:01:30 -0600 | [diff] [blame] | 57 | |
| 58 | #endif |