From 945aa04d9d15c6d7bcbc891aee6e1f1f6171a9ae Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 13 Feb 2013 10:44:39 -0300 Subject: [PATCH] tools/atrf-txrx/atrf-txrx.c (rtt_master): start transition to RX_ON while sending This allows us to turn around faster. --- tools/atrf-txrx/atrf-txrx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/atrf-txrx/atrf-txrx.c b/tools/atrf-txrx/atrf-txrx.c index a0454eb..972a991 100644 --- a/tools/atrf-txrx/atrf-txrx.c +++ b/tools/atrf-txrx/atrf-txrx.c @@ -494,8 +494,6 @@ static void rtt_slave_hmac(struct atrf_dsc *dsc) n = atrf_rx(dsc, buf, sizeof(buf), 0, NULL); if (n < 0) exit(1); -// uncomment if master doesn't turn around fast enough -//usleep(10*1000); atrf_tx(dsc, buf, n-2); } atrf_rx_mode(dsc, 0); @@ -518,9 +516,17 @@ static void rtt_master(struct atrf_dsc *dsc, int packets, int size) atrf_buf_write(dsc, buf, size+2); gettimeofday(&t0, NULL); atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_TX_START); - wait_for_interrupt(dsc, IRQ_TRX_END, - IRQ_TRX_END | IRQ_PLL_LOCK, 10); + + /* prepare transition to RX_ON while still sending */ + while ((atrf_reg_read(dsc, REG_TRX_STATUS) & TRX_STATUS_MASK) + == TRX_STATUS_TRANSITION); atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_RX_ON); + + /* wait for transmission to end */ + wait_for_interrupt(dsc, IRQ_TRX_END, + IRQ_TRX_END | IRQ_RX_START | IRQ_PLL_LOCK | IRQ_AMI, 1); + + /* wait for reception */ irq = wait_for_interrupt(dsc, IRQ_TRX_END, IRQ_TRX_END | IRQ_RX_START | IRQ_PLL_LOCK | IRQ_AMI, 1000); if (irq) {