From: Michel Pollet <buserror@gmail.com> Date: Sun, 4 Apr 2010 11:22:42 +0000 (+0100) Subject: watchdog/eeprom: Added declaration blocks for older cores X-Git-Tag: v1.0a2~16 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=d8ba7b5ac558214e0baa3ea39ee79c4a1b9bc451;p=sx%2Fsimavr.git watchdog/eeprom: Added declaration blocks for older cores For the mega128 generation Signed-off-by: Michel Pollet <buserror@gmail.com> --- 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___ */