Hi,
What is the intended semantics of `irq->value` from inside an irq callback?
The important bit is that I make an irq myself, then connect it to an AVR pin, and then I attach callbacks to both pins:
avr_irq_t *external_trigger = avr_alloc_irq(&(avr->irq_pool), 0, 1, &trigger_name);
avr_irq_t *internal_trigger = avr_io_getirq(avr, AVR_IOCTL_IOPORT_GETIRQ('C'), 1);
avr_irq_register_notify(external_trigger, ext_cb, internal_trigger);
avr_irq_register_notify(internal_trigger, int_cb, external_trigger);
avr_connect_irq(internal_trigger, external_trigger);
In ext_cb and int_cb, I am printing both the value as supplied to the callback (which is, of course, the new value of the irq), as well as the value of external_trigger and internal_trigger:
ext_cb: arg = 00 external->value = 01 internal->value = 01
int_cb: arg = 00 external->value = 00 internal->value = 01
ext_cb: arg = 01 external->value = 00 internal->value = 00
int_cb: arg = 01 external->value = 01 internal->value = 00
So what I can observe is that when the AVR pin's value changes, this triggers the external, connected irq before updating its value; then, after the cb runs and after the external irq's value is updated, it then runs the internal pin's cb before updating the internal pin's irq's value. Is this correct? Is this the intended behavior, or is this unspecified?
Thanks,
Gergo