From c9ab070ffd150932f0687646f7a0ffa998cb0cca Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 29 Mar 2013 18:50:54 -0300 Subject: [PATCH] atusb/fw/mac.c (do_tx): add timeout for transition to TRX_STATUS_RX_[AACK_]ON --- atusb/fw/mac.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/atusb/fw/mac.c b/atusb/fw/mac.c index 63c2fdc..ded7f96 100644 --- a/atusb/fw/mac.c +++ b/atusb/fw/mac.c @@ -135,10 +135,19 @@ int mac_rx(int on) static void do_tx(void *user) { + uint16_t timeout = 0xffff; uint8_t status; uint8_t i; - do status = reg_read(REG_TRX_STATUS) & TRX_STATUS_MASK; + /* + * If we time out here, the host driver will time out waiting for the + * TRX_END acknowledgement. + */ + do { + if (!--timeout) + return; + status = reg_read(REG_TRX_STATUS) & TRX_STATUS_MASK; + } while (status != TRX_STATUS_RX_ON && status != TRX_STATUS_RX_AACK_ON); /*