watchdog: Fix register naming
[simavr] / simavr / sim / avr_watchdog.h
index e31d3bb..eb816a4 100644 (file)
@@ -23,6 +23,9 @@
 #ifndef __AVR_WATCHDOG_H___
 #define __AVR_WATCHDOG_H___
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include "sim_avr.h"
 
@@ -66,9 +69,10 @@ void avr_watchdog_init(avr_t * avr, avr_watchdog_t * p);
        }
 
 /* no WDP3, WDIE, WDIF in atmega128 */
+/* MCUSR is called MCUCSR in atmega128 */
 #define AVR_WATCHDOG_DECLARE_128(_WDSR, _vec) \
        .watchdog = {\
-               .wdrf = AVR_IO_REGBIT(MCUSR, WDRF),\
+               .wdrf = AVR_IO_REGBIT(MCUCSR, WDRF),\
                .wdce = AVR_IO_REGBIT(_WDSR, WDCE),\
                .wde = AVR_IO_REGBIT(_WDSR, WDE),\
                .wdp = { AVR_IO_REGBIT(_WDSR, WDP0),AVR_IO_REGBIT(_WDSR, WDP1),\
@@ -80,4 +84,8 @@ void avr_watchdog_init(avr_t * avr, avr_watchdog_t * p);
                },\
        }
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __AVR_WATCHDOG_H___ */