From 6b94d793538d8511466cbc804e1193427f3b080c Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Sat, 10 Apr 2010 13:14:12 +0100 Subject: [PATCH] ioport: Aded a way to specify the output value via IRQ Adding 0x100 to the IRQ value simulates a pin output change and not just a pin input change. Signed-off-by: Michel Pollet --- simavr/sim/avr_ioport.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c index 32cf5f9..2aed5e3 100644 --- a/simavr/sim/avr_ioport.c +++ b/simavr/sim/avr_ioport.c @@ -69,11 +69,17 @@ void avr_ioport_irq_notify(struct avr_irq_t * irq, uint32_t value, void * param) avr_ioport_t * p = (avr_ioport_t *)param; avr_t * avr = p->io.avr; + int output = value & 0x100; + value &= 0xff; uint8_t mask = 1 << irq->irq; // set the real PIN bit. ddr doesn't matter here as it's masked when read. avr->data[p->r_pin] &= ~mask; if (value) avr->data[p->r_pin] |= mask; + + if (output) // if the IRQ was marked as Output, also do the IO write + avr_ioport_write(avr, p->r_port, (avr->data[p->r_port] & ~mask) | (value ? mask : 0), p); + if (p->r_pcint) { // if the pcint bit is on, try to raise it int raise = avr->data[p->r_pcint] & mask; -- 2.39.5