watchdog.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * (C) Copyright 2001
  3. * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * Watchdog functions and macros.
  25. */
  26. #ifndef _WATCHDOG_H_
  27. #define _WATCHDOG_H_
  28. #if !defined(__ASSEMBLY__)
  29. /*
  30. * Reset the watchdog timer, always returns 0
  31. *
  32. * This function is here since it is shared between board_f() and board_r(),
  33. * and the legacy arch/<arch>/board.c code.
  34. */
  35. int init_func_watchdog_reset(void);
  36. #endif
  37. #ifdef CONFIG_WATCHDOG
  38. #define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
  39. #define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
  40. #else
  41. #define INIT_FUNC_WATCHDOG_INIT
  42. #define INIT_FUNC_WATCHDOG_RESET
  43. #endif
  44. #if defined(CONFIG_HW_WATCHDOG) && defined(CONFIG_WATCHDOG)
  45. # error "Configuration error: CONFIG_HW_WATCHDOG and CONFIG_WATCHDOG can't be used together."
  46. #endif
  47. /*
  48. * Hardware watchdog
  49. */
  50. #ifdef CONFIG_HW_WATCHDOG
  51. #if defined(__ASSEMBLY__)
  52. #define WATCHDOG_RESET bl hw_watchdog_reset
  53. #else
  54. extern void hw_watchdog_reset(void);
  55. #define WATCHDOG_RESET hw_watchdog_reset
  56. #endif /* __ASSEMBLY__ */
  57. #else
  58. /*
  59. * Maybe a software watchdog?
  60. */
  61. #if defined(CONFIG_WATCHDOG)
  62. #if defined(__ASSEMBLY__)
  63. #define WATCHDOG_RESET bl watchdog_reset
  64. #else
  65. extern void watchdog_reset(void);
  66. #define WATCHDOG_RESET watchdog_reset
  67. #endif
  68. #else
  69. /*
  70. * No hardware or software watchdog.
  71. */
  72. #if defined(__ASSEMBLY__)
  73. #define WATCHDOG_RESET /*XXX DO_NOT_DEL_THIS_COMMENT*/
  74. #else
  75. #define WATCHDOG_RESET() {}
  76. #endif /* __ASSEMBLY__ */
  77. #endif /* CONFIG_WATCHDOG && !__ASSEMBLY__ */
  78. #endif /* CONFIG_HW_WATCHDOG */
  79. /*
  80. * Prototypes from $(CPU)/cpu.c.
  81. */
  82. /* MPC 8xx */
  83. #if (defined(CONFIG_8xx) || defined(CONFIG_MPC860)) && !defined(__ASSEMBLY__)
  84. void reset_8xx_watchdog(volatile immap_t *immr);
  85. #endif
  86. /* MPC 5xx */
  87. #if defined(CONFIG_5xx) && !defined(__ASSEMBLY__)
  88. void reset_5xx_watchdog(volatile immap_t *immr);
  89. #endif
  90. /* MPC 5xxx */
  91. #if defined(CONFIG_MPC5xxx) && !defined(__ASSEMBLY__)
  92. void reset_5xxx_watchdog(void);
  93. #endif
  94. /* AMCC 4xx */
  95. #if defined(CONFIG_4xx) && !defined(__ASSEMBLY__)
  96. void reset_4xx_watchdog(void);
  97. #endif
  98. #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__)
  99. void hw_watchdog_init(void);
  100. #endif
  101. #endif /* _WATCHDOG_H_ */