4 * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See devlib/README for information.
10 * \author Bernardo Innocenti <bernie@develer.com>
12 * \brief Watchdog interface
17 *#* Revision 1.3 2005/04/11 19:10:28 bernie
18 *#* Include top-level headers from cfg/ subdir.
20 *#* Revision 1.2 2004/11/16 21:02:07 bernie
21 *#* Make driver optional; mark AVR specific parts as such.
23 *#* Revision 1.1 2004/10/26 08:34:47 bernie
24 *#* New DevLib module.
30 #include <cfg/config.h>
31 #include <cfg/compiler.h> // INLINE
33 /* Configury sanity check */
34 #if !defined(CONFIG_WATCHDOG) || (CONFIG_WATCHDOG != 0 && CONFIG_WATCHDOG != 1)
35 #error CONFIG_WATCHDOG must be defined to either 0 or 1
43 #include <cfg/macros.h> // BV()
47 #endif /* CONFIG_WATCHDOG */
50 * Reset the watchdog timer.
52 INLINE void wdt_reset(void)
56 __asm__ __volatile__ ("wdr");
60 #endif /* CONFIG_WATCHDOG */
64 * Set watchdog timer timeout.
66 * \param timeout 0: 16.3ms, 7: 2.1s
68 INLINE void wdt_init(uint8_t timeout)
72 WDTCR |= BV(WDCE) | BV(WDE);
77 #endif /* CONFIG_WATCHDOG */
80 INLINE void wdt_start(void)
88 #endif /* CONFIG_WATCHDOG */
91 INLINE void wdt_stop(void)
95 WDTCR |= BV(WDCE) | BV(WDE);
100 #endif /* CONFIG_WATCHDOG */
103 #endif /* DRV_WDT_H */