Untested, but behaves the same as x8 so it should work..
Signed-off-by: Michel Pollet <buserror@gmail.com>
printf("%s init\n", avr->mmcu);
avr_eeprom_init(avr, &mcu->eeprom);
+ avr_flash_init(avr, &mcu->selfprog);
avr_extint_init(avr, &mcu->extint);
avr_ioport_init(avr, &mcu->porta);
avr_ioport_init(avr, &mcu->portb);
#include "sim_avr.h"
#include "sim_core_declare.h"
#include "avr_eeprom.h"
+#include "avr_flash.h"
#include "avr_extint.h"
#include "avr_ioport.h"
#include "avr_uart.h"
struct mcu_t {
avr_t core;
avr_eeprom_t eeprom;
+ avr_flash_t selfprog;
avr_extint_t extint;
avr_ioport_t porta, portb, portc, portd;
avr_uart_t uart0,uart1;
.reset = mx4_reset,
},
AVR_EEPROM_DECLARE(EE_READY_vect),
+ AVR_SELFPROG_DECLARE(SPMCSR, SPMEN, SPM_READY_vect),
.extint = {
AVR_EXTINT_DECLARE(0, 'D', PD2),
AVR_EXTINT_DECLARE(1, 'D', PD3),
.reset = mx8_reset,
},
AVR_EEPROM_DECLARE(EE_READY_vect),
- AVR_SELFPROG_DECLARE(SPMCSR, SPM_READY_vect),
+ AVR_SELFPROG_DECLARE(SPMCSR, SELFPRGEN, SPM_READY_vect),
.extint = {
AVR_EXTINT_DECLARE(0, 'D', 2),
AVR_EXTINT_DECLARE(1, 'D', 3),
#define AVR_IOCTL_FLASH_SPM AVR_IOCTL_DEF('f','s','p','m')
-#define AVR_SELFPROG_DECLARE(_spmr, _vector) \
+#define AVR_SELFPROG_DECLARE(_spmr, _spen, _vector) \
.selfprog = {\
.r_spm = _spmr,\
.spm_pagesize = SPM_PAGESIZE,\
- .selfprgen = AVR_IO_REGBIT(_spmr, SELFPRGEN),\
+ .selfprgen = AVR_IO_REGBIT(_spmr, _spen),\
.pgers = AVR_IO_REGBIT(_spmr, PGERS),\
.pgwrt = AVR_IO_REGBIT(_spmr, PGWRT),\
.blbset = AVR_IO_REGBIT(_spmr, BLBSET),\