Date:2011-06-23 14:41:40 (8 years 2 months ago)
Author:Werner Almesberger
Commit:27fc0a0e2c83942d6b88a093d6b2d1f90386dfec
Message:atusb/fw/: aggregate interrupts while waiting

- board_app.c (INT0_vect): always read IRQ_STATUS, even if an
interrupt is already enqueued
- board_app.c (INT0_vect): if an interrupt is enqueued, accumulate
the interrupts signaled since
- board_app.c (irqs_more): when a pending transfer completes, send
interrupts accumulated since (if any)
Files: atusb/fw/board_app.c (1 diff)

Change Details

atusb/fw/board_app.c
144144}
145145
146146
147ISR(INT0_vect)
147static uint8_t irqs = 0;
148
149
150static void irqs_more(void *user)
148151{
149    static uint8_t irq;
152    static uint8_t buf;
150153
151    if (eps[1].state != EP_IDLE)
154    if (!irqs)
152155        return;
156    buf = irqs;
157    usb_send(&eps[1], &buf, 1, irqs_more, NULL);
158    irqs = 0;
159}
160
161
162ISR(INT0_vect)
163{
153164    spi_begin();
154165    spi_send(AT86RF230_REG_READ | REG_IRQ_STATUS);
155    irq = spi_recv();
166    irqs |= spi_recv();
156167    spi_end();
157    usb_send(&eps[1], &irq, 1, NULL, NULL);
168    if (eps[1].state == EP_IDLE)
169        irqs_more(NULL);
158170}
159171
160172

Archive Download the corresponding diff file



interactive