From a95d9563ea716912654457e86fa5c9b915c584d0 Mon Sep 17 00:00:00 2001 From: Ian Muldoon Date: Sat, 30 Apr 2016 23:16:42 -0700 Subject: [PATCH] Provide IRQs on PORT register when updated via PIN Fixes issue #164 --- simavr/sim/avr_ioport.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c index edbdf50..e322b11 100644 --- a/simavr/sim/avr_ioport.c +++ b/simavr/sim/avr_ioport.c @@ -63,6 +63,15 @@ avr_ioport_update_irqs( uint8_t pin = (avr->data[p->r_pin] & ~ddr) | (avr->data[p->r_port] & ddr); pin = (pin & ~p->external.pull_mask) | p->external.pull_value; avr_raise_irq(p->io.irq + IOPORT_IRQ_PIN_ALL, pin); + + // if IRQs are registered on the PORT register (for example, VCD dumps) send + // those as well + avr_io_addr_t port_io = AVR_DATA_TO_IO(p->r_port); + if (avr->io[port_io].irq) { + avr_raise_irq(avr->io[port_io].irq + AVR_IOMEM_IRQ_ALL, avr->data[p->r_port]); + for (int i = 0; i < 8; i++) + avr_raise_irq(avr->io[port_io].irq + i, (avr->data[p->r_port] >> i) & 1); + } } static void -- 2.39.5