From: Konstantin Begun Date: Wed, 10 May 2017 22:38:32 +0000 (+0100) Subject: timer: Added an IRQ for input capture trigger (ICP) X-Git-Tag: v1.6~42 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=e4002611fc614c1c323aac7575cf4eedc8d15aca;p=sx%2Fsimavr.git timer: Added an IRQ for input capture trigger (ICP) --- diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 81131a1..c54bd76 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -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] = "