From 578d0c0409fadd4c49c3a3a2db7b110183529300 Mon Sep 17 00:00:00 2001 From: Stephan Veigl Date: Thu, 23 Jun 2011 16:20:56 +0200 Subject: [PATCH] simavr: change hard-coded value to define: AVR_IOPORT_OUTPUT Signed-off-by: Stephan Veigl --- simavr/sim/avr_ioport.c | 2 +- simavr/sim/avr_ioport.h | 2 ++ simavr/sim/avr_timer.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c index fd43454..abbd10a 100644 --- a/simavr/sim/avr_ioport.c +++ b/simavr/sim/avr_ioport.c @@ -86,7 +86,7 @@ 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; + int output = value & AVR_IOPORT_OUTPUT; value &= 0xff; uint8_t mask = 1 << irq->irq; // set the real PIN bit. ddr doesn't matter here as it's masked when read. diff --git a/simavr/sim/avr_ioport.h b/simavr/sim/avr_ioport.h index 06497e2..f0a080f 100644 --- a/simavr/sim/avr_ioport.h +++ b/simavr/sim/avr_ioport.h @@ -33,6 +33,8 @@ enum { IOPORT_IRQ_COUNT }; +#define AVR_IOPORT_OUTPUT 0x100 + // add port name (uppercase) to get the real IRQ #define AVR_IOCTL_IOPORT_GETIRQ(_name) AVR_IOCTL_DEF('i','o','g',(_name)) diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 667667e..c775aad 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -62,7 +62,7 @@ static avr_cycle_count_t avr_timer_comp(avr_timer_t *p, avr_cycle_count_t when, case avr_timer_com_toggle: // Toggle OCnA on compare match if (p->comp[comp].com_pin.reg) // we got a physical pin avr_raise_irq(irq, - 0x100 + (avr_regbit_get(avr, p->comp[comp].com_pin) ? 0 : 1)); + AVR_IOPORT_OUTPUT | (avr_regbit_get(avr, p->comp[comp].com_pin) ? 0 : 1)); else // no pin, toggle the IRQ anyway avr_raise_irq(irq, p->io.irq[TIMER_IRQ_OUT_COMP + comp].value ? 0 : 1); -- 2.39.5