Date:2011-07-13 19:22:49 (8 years 3 months ago)
Author:Werner Almesberger
Commit:eeeb5599f87a4088e3201beb90015c650dcd0767
Message:atusb/fw/mac.c: reserved code 0 and added notification of TX completion

- mac.c (queued_tx_ack, rx_done, handle_irq): on TX completion, send a
a zero byte on EP 1
- mac.c (handle_irq): don't receive zero-sized frames (they're
malformed anyway), so that size zero can be used to signal TX
completion
Files: atusb/fw/mac.c (4 diffs)

Change Details

atusb/fw/mac.c
2828static uint8_t tx_buf[MAX_PSDU];
2929static uint8_t tx_size = 0;
3030static int txing = 0;
31static int queued_tx_ack = 0;
3132
3233
3334static uint8_t reg_read(uint8_t reg)
...... 
5556static void rx_done(void *user)
5657{
5758    led(0);
59    if (queued_tx_ack) {
60        usb_send(&eps[1], "", 1, rx_done, NULL);
61        queued_tx_ack = 0;
62    }
5863}
5964
6065
...... 
6469    uint8_t size, i;
6570
6671    if (txing) {
72        if (eps[1].state == EP_IDLE)
73            usb_send(&eps[1], "", 1, rx_done, NULL);
74        else {
75            if (queued_tx_ack)
76                panic();
77            queued_tx_ack = 1;
78        }
6779        txing = 0;
6880        return 0;
6981    }
...... 
7991    spi_begin();
8092    spi_send(AT86RF230_BUF_READ);
8193    size = spi_recv();
82    if (size & 0x80) {
94    if (!size || (size & 0x80)) {
8395        spi_end();
8496        return 1;
8597    }

Archive Download the corresponding diff file



interactive