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.2 2004/11/16 21:02:07 bernie
18 *#* Make driver optional; mark AVR specific parts as such.
20 *#* Revision 1.1 2004/10/26 08:34:47 bernie
21 *#* New DevLib module.
28 #include <compiler.h> // INLINE
30 /* Configury sanity check */
31 #if !defined(CONFIG_WATCHDOG) || (CONFIG_WATCHDOG != 0 && CONFIG_WATCHDOG != 1)
32 #error CONFIG_WATCHDOG must be defined to either 0 or 1
40 #include <macros.h> // BV()
44 #endif /* CONFIG_WATCHDOG */
47 * Reset the watchdog timer.
49 INLINE void wdt_reset(void)
53 __asm__ __volatile__ ("wdr");
57 #endif /* CONFIG_WATCHDOG */
61 * Set watchdog timer timeout.
63 * \param timeout 0: 16.3ms, 7: 2.1s
65 INLINE void wdt_init(uint8_t timeout)
69 WDTCR |= BV(WDCE) | BV(WDE);
74 #endif /* CONFIG_WATCHDOG */
77 INLINE void wdt_start(void)
85 #endif /* CONFIG_WATCHDOG */
88 INLINE void wdt_stop(void)
92 WDTCR |= BV(WDCE) | BV(WDE);
97 #endif /* CONFIG_WATCHDOG */
100 #endif /* DRV_WDT_H */