1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 07:51:55 +02:00

atrf-xmit: tightened checking of interrupt behaviour

- atrf-xmit.c (xfer_one): also check that also the sender has no
  pending interrupts before we start sending
- atrf-xmit.c (xfer_one): interrupt poll loop (now disabled) checked
  the sender, not the receiver. oops.
- atrf-xmit.c (xfer_one): upon reception, check that the sender has
  finished (IRQ_TRX_END) as well
This commit is contained in:
Werner Almesberger 2011-06-09 21:08:14 -03:00
parent 256ac01ab2
commit 4d4e132f0a

View File

@ -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));