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.4 2005/04/12 01:37:17 bernie
18 *#* Prevent warning when watchdog is disabled.
20 *#* Revision 1.3 2005/04/11 19:10:28 bernie
21 *#* Include top-level headers from cfg/ subdir.
23 *#* Revision 1.2 2004/11/16 21:02:07 bernie
24 *#* Make driver optional; mark AVR specific parts as such.
26 *#* Revision 1.1 2004/10/26 08:34:47 bernie
27 *#* New DevLib module.
33 #include <cfg/config.h>
34 #include <cfg/compiler.h> // INLINE
36 /* Configury sanity check */
37 #if !defined(CONFIG_WATCHDOG) || (CONFIG_WATCHDOG != 0 && CONFIG_WATCHDOG != 1)
38 #error CONFIG_WATCHDOG must be defined to either 0 or 1
46 #include <cfg/macros.h> // BV()
50 #endif /* CONFIG_WATCHDOG */
53 * Reset the watchdog timer.
55 INLINE void wdt_reset(void)
59 __asm__ __volatile__ ("wdr");
63 #endif /* CONFIG_WATCHDOG */
67 * Set watchdog timer timeout.
69 * \param timeout 0: 16.3ms, 7: 2.1s
71 INLINE void wdt_init(uint8_t timeout)
75 WDTCR |= BV(WDCE) | BV(WDE);
82 #endif /* CONFIG_WATCHDOG */
85 INLINE void wdt_start(void)
93 #endif /* CONFIG_WATCHDOG */
96 INLINE void wdt_stop(void)
100 WDTCR |= BV(WDCE) | BV(WDE);
105 #endif /* CONFIG_WATCHDOG */
108 #endif /* DRV_WDT_H */