watchdog.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2001
  4. * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
  5. */
  6. /*
  7. * Watchdog functions and macros.
  8. */
  9. #ifndef _WATCHDOG_H_
  10. #define _WATCHDOG_H_
  11. #if !defined(__ASSEMBLY__)
  12. /*
  13. * Reset the watchdog timer, always returns 0
  14. *
  15. * This function is here since it is shared between board_f() and board_r(),
  16. * and the legacy arch/<arch>/board.c code.
  17. */
  18. int init_func_watchdog_reset(void);
  19. #endif
  20. #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
  21. #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
  22. #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
  23. #else
  24. #define INIT_FUNC_WATCHDOG_INIT
  25. #define INIT_FUNC_WATCHDOG_RESET
  26. #endif
  27. #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
  28. # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
  29. #endif
  30. /*
  31. * Hardware watchdog
  32. */
  33. #ifdef CONFIG_HW_WATCHDOG
  34. #if defined(__ASSEMBLY__)
  35. #define WATCHDOG_RESET bl hw_watchdog_reset
  36. #else
  37. extern void hw_watchdog_reset(void);
  38. #define WATCHDOG_RESET hw_watchdog_reset
  39. #endif /* __ASSEMBLY__ */
  40. #else
  41. /*
  42. * Maybe a software watchdog?
  43. */
  44. #if defined(CONFIG_WATCHDOG)
  45. #if defined(__ASSEMBLY__)
  46. #define WATCHDOG_RESET bl watchdog_reset
  47. #else
  48. extern void watchdog_reset(void);
  49. #define WATCHDOG_RESET watchdog_reset
  50. #endif
  51. #else
  52. /*
  53. * No hardware or software watchdog.
  54. */
  55. #if defined(__ASSEMBLY__)
  56. #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
  57. #else
  58. #define WATCHDOG_RESET() {}
  59. #endif /* __ASSEMBLY__ */
  60. #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
  61. #endif /* CONFIG_HW_WATCHDOG */
  62. /*
  63. * Prototypes from $(CPU)/cpu.c.
  64. */
  65. #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
  66. void hw_watchdog_init(void);
  67. #endif
  68. #if defined(CONFIG_MPC85xx) && !defined(__ASSEMBLY__)
  69. void init_85xx_watchdog(void);
  70. #endif
  71. #endif /* _WATCHDOG_H_ */