Commit 578d0c0409fadd4c49c3a3a2db7b110183529300
authorStephan Veigl <veigl@gmx.net>
Thu, 23 Jun 2011 14:20:56 +0000 (16:20 +0200)
committerMichel Pollet <buserror@gmail.com>
Wed, 14 Sep 2011 07:17:51 +0000 (08:17 +0100)
Signed-off-by: Stephan Veigl <veigl@gmx.net>
3 files changed:
simavr/sim/avr_ioport.c
simavr/sim/avr_ioport.h
simavr/sim/avr_timer.c

index fd43454774b3d4b3916ddb87a92e7b62d88ab0c9..abbd10a9dcda1d7980208b4355b5a849268cb2cc 100644 (file)
@@ -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.
index 06497e220593821c32ca6bf79f4d4b87e538b19d..f0a080ff585780e2207a6656086f33360d898dfa 100644 (file)
@@ -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))
 
index 667667ef839882074798faf29f1b1c84e7aedf4e..c775aadf74a37404e8e4e2dec26e950ab2ee57e9 100644 (file)
@@ -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);