1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 13:32:28 +02:00

tools/atrf-xmit/atrf-xmit.c: cleaned up timeouts and interrupt polling

- atrf-xmit.c (xfer_one): wait 10 ms for the packet to be sent (1 ms
  was clearly too short)
- atrf-xmit.c (xfer_one): use wait_for_interrupt instead of
  atrf_interrupt_wait, so that the retry logic can do its work
This commit is contained in:
Werner Almesberger 2011-06-23 13:18:57 -03:00
parent d8363d853c
commit 7c12bf02c1

View File

@ -72,22 +72,22 @@ static int xfer_one(struct atrf_dsc *tx, struct atrf_dsc *rx)
uint8_t buf[PSDU_SIZE+1]; /* +1 for LQI */ uint8_t buf[PSDU_SIZE+1]; /* +1 for LQI */
int n, i; int n, i;
if (atrf_interrupt_wait(tx, 1)) { if (wait_for_interrupt(tx, IRQ_TRX_END, IRQ_TRX_END, 1)) {
fprintf(stderr, "unexpected sender interrupt\n"); fprintf(stderr, "unexpected sender interrupt\n");
exit(1); exit(1);
} }
if (atrf_interrupt_wait(rx, 1)) { if (wait_for_interrupt(rx, IRQ_TRX_END, IRQ_TRX_END, 1)) {
fprintf(stderr, "unexpected receiver interrupt\n"); fprintf(stderr, "unexpected receiver interrupt\n");
exit(1); exit(1);
} }
atrf_slp_tr(tx, 1, 1); atrf_slp_tr(tx, 1, 1);
irq = wait_for_interrupt(rx, IRQ_TRX_END, IRQ_TRX_END | IRQ_RX_START, irq = wait_for_interrupt(rx, IRQ_TRX_END, IRQ_TRX_END | IRQ_RX_START,
0); 10);
if (!(irq & IRQ_TRX_END)) if (!(irq & IRQ_TRX_END))
return 0; return 0;
irq = atrf_interrupt_wait(tx, 1); irq = wait_for_interrupt(tx, IRQ_TRX_END, IRQ_TRX_END, 1);
if (!(irq & IRQ_TRX_END)) { if (!(irq & IRQ_TRX_END)) {
fprintf(stderr, "sender claims packet was not sent ?\n"); fprintf(stderr, "sender claims packet was not sent ?\n");
exit(1); exit(1);