From: Ian Muldoon Date: Sun, 1 May 2016 06:16:42 +0000 (-0700) Subject: Provide IRQs on PORT register when updated via PIN X-Git-Tag: v1.4~14^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=a95d9563ea716912654457e86fa5c9b915c584d0;p=sx%2Fsimavr.git Provide IRQs on PORT register when updated via PIN Fixes issue #164 --- 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