From d8ba7b5ac558214e0baa3ea39ee79c4a1b9bc451 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Sun, 4 Apr 2010 12:22:42 +0100 Subject: [PATCH] watchdog/eeprom: Added declaration blocks for older cores For the mega128 generation Signed-off-by: Michel Pollet --- simavr/sim/avr_eeprom.h | 21 +++++++++++++++++++++ simavr/sim/avr_watchdog.h | 15 +++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/simavr/sim/avr_eeprom.h b/simavr/sim/avr_eeprom.h index 7700e4c..6176b0c 100644 --- a/simavr/sim/avr_eeprom.h +++ b/simavr/sim/avr_eeprom.h @@ -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. diff --git a/simavr/sim/avr_watchdog.h b/simavr/sim/avr_watchdog.h index 48a1da7..e31d3bb 100644 --- a/simavr/sim/avr_watchdog.h +++ b/simavr/sim/avr_watchdog.h @@ -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___ */ -- 2.39.5