bootretry.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #ifndef __BOOTRETRY_H
  7. #define __BOOTRETRY_H
  8. #ifdef CONFIG_BOOT_RETRY_TIME
  9. /**
  10. * bootretry_tstc_timeout() - ensure we get a keypress before timeout
  11. *
  12. * Check for a keypress repeatedly, resetting the watchdog each time. If a
  13. * keypress is not received within the command timeout, return an error.
  14. *
  15. * @return 0 if a key is received in time, -ETIMEDOUT if not
  16. */
  17. int bootretry_tstc_timeout(void);
  18. /**
  19. * bootretry_init_cmd_timeout() - set up command timeout
  20. *
  21. * Get the required command timeout from the environment.
  22. */
  23. void bootretry_init_cmd_timeout(void);
  24. /**
  25. * bootretry_reset_cmd_timeout() - reset command timeout
  26. *
  27. * Reset the command timeout so that the user has a fresh start. This is
  28. * typically used when input is received from the user.
  29. */
  30. void bootretry_reset_cmd_timeout(void);
  31. /** bootretry_dont_retry() - Indicate that we should not retry the boot */
  32. void bootretry_dont_retry(void);
  33. #else
  34. static inline int bootretry_tstc_timeout(void)
  35. {
  36. return 0;
  37. }
  38. static inline void bootretry_init_cmd_timeout(void)
  39. {
  40. }
  41. static inline void bootretry_reset_cmd_timeout(void)
  42. {
  43. }
  44. static inline void bootretry_dont_retry(void)
  45. {
  46. }
  47. #endif
  48. #endif