diff --git a/tools/atrf-xmit/atrf-xmit.c b/tools/atrf-xmit/atrf-xmit.c index af57e42..f286ffc 100644 --- a/tools/atrf-xmit/atrf-xmit.c +++ b/tools/atrf-xmit/atrf-xmit.c @@ -72,6 +72,10 @@ static int xfer_one(struct atrf_dsc *tx, struct atrf_dsc *rx) uint8_t buf[PSDU_SIZE+1]; /* +1 for LQI */ int n, i; + if (atrf_interrupt(tx)) { + fprintf(stderr, "unexpected sender interrupt\n"); + exit(1); + } if (atrf_interrupt(rx)) { fprintf(stderr, "unexpected receiver interrupt\n"); exit(1); @@ -87,10 +91,21 @@ static int xfer_one(struct atrf_dsc *tx, struct atrf_dsc *rx) * interrupt, at least for now. */ usleep(5000); - irq = atrf_reg_read(tx, REG_IRQ_STATUS); + irq = atrf_reg_read(rx, REG_IRQ_STATUS); #endif if (!(irq & IRQ_TRX_END)) return 0; + + if (!atrf_interrupt(tx)) { + fprintf(stderr, "missing sender interrupt\n"); + exit(1); + } + irq = atrf_reg_read(tx, REG_IRQ_STATUS); + if (!(irq & IRQ_TRX_END)) { + fprintf(stderr, "sender claims packet was not sent ?\n"); + exit(1); + } + if (atrf_reg_read(rx, REG_PHY_RSSI) & RX_CRC_VALID) return 1; n = atrf_buf_read(rx, buf, sizeof(buf));