1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 22:20:37 +02:00

libatrf: new function to reliably flush interrupts

- misctxrx.h (flush_interrupts), misctxrx.c: reliably flush interrupts
  on all drivers (with the exception of atnet talking to an atusb)
This commit is contained in:
Werner Almesberger 2011-06-20 17:21:40 -03:00
parent 110ecf67a1
commit 620709a20a
2 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "atrf.h" #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 wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for,
uint8_t ignore, int sleep_us, int timeout); uint8_t ignore, int sleep_us, int timeout);

View File

@ -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 wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for,
uint8_t ignore, int sleep_us, int timeout) uint8_t ignore, int sleep_us, int timeout)
{ {