Refactor to use new protocol module and sipo.
[bertos.git] / bertos / cpu / arm / drv / wdt_arm.h
index 02e49906540b6023d7b62a75688865307743a4a5..cf6b480acf34092e2e01a1b4e2ae972c39de52e0 100644 (file)
@@ -32,7 +32,6 @@
  *
  * \brief Watchdog interface for ARM architecture.
  *
- * \version $Id$
  *
  * \author Luca Ottaviano <lottaviano@develer.com>
  *
 #define DRV_WDT_ARM_H
 
 #include <cfg/compiler.h> // INLINE
+#include <cfg/macros.h> // BV
 
-#warning TODO: This module is not implemented for at91 CPUs
+#if CPU_ARM_AT91
+       #include <io/arm.h>
 
-INLINE void wdt_start(uint32_t _timeout) { (void) _timeout; /* implement me */ }
-INLINE void wdt_stop(void) { /*implement me */ }
-INLINE void wdt_reset(void) { /* implement me */ }
+       INLINE void wdt_start(uint32_t _timeout) { (void) _timeout; /* implement me */ }
+       INLINE void wdt_stop(void) { WDT_MR = BV(WDT_WDDIS); }
+       INLINE void wdt_reset(void)
+       {
+               WDT_CR = WDT_KEY | BV(WDT_WDRSTT);
+       }
+#else
+       #error "Missing watchdog support for yout CPU"
+#endif
 
-#endif //DRV_WDT_ARM_H
+#endif /* DRV_WDT_ARM_H */