Commit d8ba7b5ac558214e0baa3ea39ee79c4a1b9bc451
authorMichel Pollet <buserror@gmail.com>
Sun, 4 Apr 2010 11:22:42 +0000 (12:22 +0100)
committerMichel Pollet <buserror@gmail.com>
Sun, 4 Apr 2010 11:22:42 +0000 (12:22 +0100)
For the mega128 generation

Signed-off-by: Michel Pollet <buserror@gmail.com>
2 files changed:
simavr/sim/avr_eeprom.h
simavr/sim/avr_watchdog.h

index 7700e4cc89f38ddff1a562a9d8c6d112a5d970bd..6176b0c913f983ccf1338413b2de559cbe500f2b 100644 (file)
@@ -78,6 +78,27 @@ typedef struct avr_eeprom_desc_t {
                },\
        }
 
+/*
+ * no EEPM registers in atmega128
+ */
+#define AVR_EEPROM_DECLARE_NOEEPM(_vector)             \
+       .eeprom = {\
+               .size = E2END+1,\
+               .r_eearh = EEARH,\
+               .r_eearl = EEARL,\
+               .r_eedr = EEDR,\
+               .r_eecr = EECR,\
+               .eepm = { },            \
+               .eempe = AVR_IO_REGBIT(EECR, EEMWE),\
+               .eepe = AVR_IO_REGBIT(EECR, EEWE),\
+               .eere = AVR_IO_REGBIT(EECR, EERE),\
+               .ready = {\
+                       .enable = AVR_IO_REGBIT(EECR, EERIE),\
+                       .vector = _vector,\
+               },\
+       }
+
+
 /*
  * macro definition without a high address bit register,
  * which is not implemented in some tiny AVRs.
index 48a1da70cf137409de8440806f3600085306db5b..e31d3bb7ee352d2bc9cc0b63ddf0b33578311b40 100644 (file)
@@ -65,4 +65,19 @@ void avr_watchdog_init(avr_t * avr, avr_watchdog_t * p);
                },\
        }
 
+/* no WDP3, WDIE, WDIF in atmega128 */
+#define AVR_WATCHDOG_DECLARE_128(_WDSR, _vec) \
+       .watchdog = {\
+               .wdrf = AVR_IO_REGBIT(MCUSR, WDRF),\
+               .wdce = AVR_IO_REGBIT(_WDSR, WDCE),\
+               .wde = AVR_IO_REGBIT(_WDSR, WDE),\
+               .wdp = { AVR_IO_REGBIT(_WDSR, WDP0),AVR_IO_REGBIT(_WDSR, WDP1),\
+                               AVR_IO_REGBIT(_WDSR, WDP2) },\
+               .watchdog = {\
+                       .enable = AVR_IO_REGBIT(_WDSR, 6),\
+                       .raised = AVR_IO_REGBIT(_WDSR, 7),\
+                       .vector = _vec,\
+               },\
+       }
+
 #endif /* __AVR_WATCHDOG_H___ */