Date:2013-04-01 20:17:37 (6 years 8 months ago)
Author:Werner Almesberger
Commit:65722d417abd17acf6a5783b4f84154ce9e9fbd7
Message:atusb/fw/mac.c: queue frame reception if USB is busy

This way we we make sure we retrieve the frame and thus release dynamic
buffer protection (if enabled).
Files: atusb/fw/mac.c (6 diffs)

Change Details

atusb/fw/mac.c
3030static uint8_t tx_size = 0;
3131static bool txing = 0;
3232static bool queued_tx_ack = 0;
33static bool queued_rx = 0;
3334
3435
3536static uint8_t reg_read(uint8_t reg)
...... 
5455}
5556
5657
58static void receive_frame(void);
59
60
5761static void rx_done(void *user)
5862{
5963    led(0);
64    if (queued_rx) {
65        receive_frame();
66        queued_rx = 0;
67        return;
68    }
6069    if (queued_tx_ack) {
6170        usb_send(&eps[1], "", 1, rx_done, NULL);
6271        queued_tx_ack = 0;
...... 
8897}
8998
9099
100static void flush_queued_rx(void)
101{
102    if (queued_rx)
103        receive_frame();
104    queued_rx = 0;
105}
106
107
91108static bool handle_irq(void)
92109{
93110    uint8_t irq;
...... 
109126    }
110127
111128    /* unlikely */
112    if (eps[1].state != EP_IDLE)
129    if (eps[1].state != EP_IDLE) {
130        queued_rx = 1;
113131        return 1;
132    }
114133
115134    receive_frame();
116135
...... 
165184     */
166185    reg_write(REG_TRX_STATE, TRX_CMD_FORCE_PLL_ON);
167186
187    flush_queued_rx();
168188    handle_irq();
189    queued_rx = 0;
169190
170191    spi_begin();
171192    spi_send(AT86RF230_BUF_WRITE);
...... 
201222    mac_irq = NULL;
202223    txing = 0;
203224    queued_tx_ack = 0;
225    queued_rx = 0;
204226
205227    /* enable CRC and PHY_RSSI (with RX_CRC_VALID) in SPI status return */
206228    reg_write(REG_TRX_CTRL_1,

Archive Download the corresponding diff file



interactive