diff --git a/tools/include/misctxrx.h b/tools/include/misctxrx.h index 95c6bff..7a9eff4 100644 --- a/tools/include/misctxrx.h +++ b/tools/include/misctxrx.h @@ -18,6 +18,7 @@ #include "atrf.h" +void flush_interrupts(struct atrf_dsc *dsc); uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for, uint8_t ignore, int sleep_us, int timeout); diff --git a/tools/lib/misctxrx.c b/tools/lib/misctxrx.c index 30184be..4f6460c 100644 --- a/tools/lib/misctxrx.c +++ b/tools/lib/misctxrx.c @@ -35,6 +35,17 @@ static void die(int sig) } +void flush_interrupts(struct atrf_dsc *dsc) +{ + /* + * If the driver doesn't support atrf_interrupt_wait, we use + * atrf_reg_read. + */ + if (atrf_interrupt_wait(dsc, 1) < 0) + atrf_reg_read(dsc, REG_IRQ_STATUS); +} + + uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for, uint8_t ignore, int sleep_us, int timeout) {