From 9952a20fdaf2913d880d2a0e96064617ac9d9ebe Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 20 Jun 2011 20:46:52 -0300 Subject: [PATCH] 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. --- tools/lib/atben.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/lib/atben.c b/tools/lib/atben.c index ce7bd34..5a0cc11 100644 --- a/tools/lib/atben.c +++ b/tools/lib/atben.c @@ -388,12 +388,17 @@ int atben_interrupt_wait(void *handle, int timeout_ms) { struct timeout to; int timedout; + uint8_t irq; timeout_start(&to, timeout_ms); while (1) { timedout = timeout_reached(&to); - if (atben_interrupt(handle)) - return atben_reg_read(handle, REG_IRQ_STATUS); + if (atben_interrupt(handle)) { + irq = atben_reg_read(handle, REG_IRQ_STATUS); + if (irq) + return irq; + fprintf(stderr, "ignoring stray interrupt\n"); + } if (timedout) return 0; usleep(1000);