mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-23 00:42:28 +02:00
tools/lib/atben.c (atben_interrupt_wait): complain about stray interrupts
If INT_RF is high but IRQ_STATUS is clear, something strange is happening. We complain but continue waiting.
This commit is contained in:
parent
b7276d282a
commit
9952a20fda
@ -388,12 +388,17 @@ int atben_interrupt_wait(void *handle, int timeout_ms)
|
|||||||
{
|
{
|
||||||
struct timeout to;
|
struct timeout to;
|
||||||
int timedout;
|
int timedout;
|
||||||
|
uint8_t irq;
|
||||||
|
|
||||||
timeout_start(&to, timeout_ms);
|
timeout_start(&to, timeout_ms);
|
||||||
while (1) {
|
while (1) {
|
||||||
timedout = timeout_reached(&to);
|
timedout = timeout_reached(&to);
|
||||||
if (atben_interrupt(handle))
|
if (atben_interrupt(handle)) {
|
||||||
return atben_reg_read(handle, REG_IRQ_STATUS);
|
irq = atben_reg_read(handle, REG_IRQ_STATUS);
|
||||||
|
if (irq)
|
||||||
|
return irq;
|
||||||
|
fprintf(stderr, "ignoring stray interrupt\n");
|
||||||
|
}
|
||||||
if (timedout)
|
if (timedout)
|
||||||
return 0;
|
return 0;
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user