1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-05 06:58:06 +02:00

atrf-xmit/atrf-xmit.c: updated to no longer use atrf_interrupt

- atrf-xmit.c (xfer_one): use atrf_interrupt_wait instead of
  atrf_interrupt to pull the interrupt line
- atrf-xmit.c (xfer_one): removed delay-based wait to interrupt
- atrf-xmit.c (xfer_one): use atrf_interrupt_wait instead of reading
  REG_IRQ_STATUS directly
This commit is contained in:
Werner Almesberger 2011-06-20 20:41:30 -03:00
parent b4a6e8ef46
commit b7276d282a

View File

@ -72,35 +72,22 @@ 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)) {
if (atrf_interrupt_wait(tx, 1)) {
fprintf(stderr, "unexpected sender interrupt\n");
exit(1);
}
if (atrf_interrupt(rx)) {
if (atrf_interrupt_wait(rx, 1)) {
fprintf(stderr, "unexpected receiver interrupt\n");
exit(1);
}
atrf_slp_tr(tx, 1, 1);
#if 1
irq = wait_for_interrupt(rx, IRQ_TRX_END, IRQ_TRX_END | IRQ_RX_START,
0);
#else
/*
* Just waiting for the maximum time is much faster than polling the
* interrupt, at least for now.
*/
usleep(5000);
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);
irq = atrf_interrupt_wait(tx, 1);
if (!(irq & IRQ_TRX_END)) {
fprintf(stderr, "sender claims packet was not sent ?\n");
exit(1);