4 * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See README.devlib for information.
10 * \author Bernardo Innocenti <bernie@develer.com>
12 * \brief Watchdog interface
17 *#* Revision 1.5 2005/11/04 16:20:02 bernie
18 *#* Fix reference to README.devlib in header.
20 *#* Revision 1.4 2005/04/12 01:37:17 bernie
21 *#* Prevent warning when watchdog is disabled.
23 *#* Revision 1.3 2005/04/11 19:10:28 bernie
24 *#* Include top-level headers from cfg/ subdir.
26 *#* Revision 1.2 2004/11/16 21:02:07 bernie
27 *#* Make driver optional; mark AVR specific parts as such.
29 *#* Revision 1.1 2004/10/26 08:34:47 bernie
30 *#* New DevLib module.
36 #include <cfg/config.h>
37 #include <cfg/compiler.h> // INLINE
39 /* Configury sanity check */
40 #if !defined(CONFIG_WATCHDOG) || (CONFIG_WATCHDOG != 0 && CONFIG_WATCHDOG != 1)
41 #error CONFIG_WATCHDOG must be defined to either 0 or 1
49 #include <cfg/macros.h> // BV()
53 #endif /* CONFIG_WATCHDOG */
56 * Reset the watchdog timer.
58 INLINE void wdt_reset(void)
62 __asm__ __volatile__ ("wdr");
66 #endif /* CONFIG_WATCHDOG */
70 * Set watchdog timer timeout.
72 * \param timeout 0: 16.3ms, 7: 2.1s
74 INLINE void wdt_init(uint8_t timeout)
78 WDTCR |= BV(WDCE) | BV(WDE);
85 #endif /* CONFIG_WATCHDOG */
88 INLINE void wdt_start(void)
96 #endif /* CONFIG_WATCHDOG */
99 INLINE void wdt_stop(void)
103 WDTCR |= BV(WDCE) | BV(WDE);
108 #endif /* CONFIG_WATCHDOG */
111 #endif /* DRV_WDT_H */