Commit e4002611fc614c1c323aac7575cf4eedc8d15aca
authorKonstantin Begun <kostic2000@gmail.com>
Wed, 10 May 2017 22:38:32 +0000 (23:38 +0100)
committerMichel Pollet <github.com@pollet.net>
Thu, 11 May 2017 06:59:48 +0000 (07:59 +0100)
2 files changed:
simavr/sim/avr_timer.c
simavr/sim/avr_timer.h

index 81131a1a83698fc93d62e64d81c8bc11d9a66d15..c54bd76685ca718d68586fa3558880c54ab25968 100644 (file)
@@ -828,13 +828,16 @@ avr_timer_reset(
                        avr_connect_irq(&port->irq[TIMER_IRQ_OUT_COMP + compi], req.irq[0]);
                }
        }
+
+       avr_irq_register_notify(port->irq + TIMER_IRQ_IN_ICP, avr_timer_irq_icp, p);
+
        avr_ioport_getirq_t req = {
                .bit = p->icp
        };
        if (avr_ioctl(port->avr, AVR_IOCTL_IOPORT_GETIRQ_REGBIT, &req) > 0) {
                // cool, got an IRQ for the input capture pin
                //printf("%s-%c ICP Connecting PIN IRQ %d\n", __func__, p->name, req.irq[0]->irq);
-               avr_irq_register_notify(req.irq[0], avr_timer_irq_icp, p);
+               avr_connect_irq(req.irq[0], port->irq + TIMER_IRQ_IN_ICP);
        }
        p->ext_clock_flags &= ~(AVR_TIMER_EXTCLK_FLAG_STARTED | AVR_TIMER_EXTCLK_FLAG_TN |
                                                        AVR_TIMER_EXTCLK_FLAG_AS2 | AVR_TIMER_EXTCLK_FLAG_REVDIR);
@@ -844,6 +847,7 @@ avr_timer_reset(
 static const char * irq_names[TIMER_IRQ_COUNT] = {
        [TIMER_IRQ_OUT_PWM0] = "8>pwm0",
        [TIMER_IRQ_OUT_PWM1] = "8>pwm1",
+       [TIMER_IRQ_IN_ICP] = "<icp",
        [TIMER_IRQ_OUT_COMP + 0] = ">compa",
        [TIMER_IRQ_OUT_COMP + 1] = ">compb",
        [TIMER_IRQ_OUT_COMP + 2] = ">compc",
index 16c4636ea48fb3902ff4743d7aa07300bab4fb73..e0c18e0c659543100b46ba5cc796358696b4d648 100644 (file)
@@ -39,6 +39,7 @@ enum {
 enum {
        TIMER_IRQ_OUT_PWM0 = 0,
        TIMER_IRQ_OUT_PWM1,
+       TIMER_IRQ_IN_ICP,       // input capture
        TIMER_IRQ_OUT_COMP,     // comparator pins output IRQ
 
        TIMER_IRQ_COUNT = TIMER_IRQ_OUT_COMP + AVR_TIMER_COMP_COUNT