IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2011-07-13 19:22:49 (9 years 6 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 | ||
---|---|---|
28 | 28 | static uint8_t tx_buf[MAX_PSDU]; |
29 | 29 | static uint8_t tx_size = 0; |
30 | 30 | static int txing = 0; |
31 | static int queued_tx_ack = 0; | |
31 | 32 | |
32 | 33 | |
33 | 34 | static uint8_t reg_read(uint8_t reg) |
... | ... | |
55 | 56 | static void rx_done(void *user) |
56 | 57 | { |
57 | 58 | led(0); |
59 | if (queued_tx_ack) { | |
60 | usb_send(&eps[1], "", 1, rx_done, NULL); | |
61 | queued_tx_ack = 0; | |
62 | } | |
58 | 63 | } |
59 | 64 | |
60 | 65 | |
... | ... | |
64 | 69 | uint8_t size, i; |
65 | 70 | |
66 | 71 | 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 | } | |
67 | 79 | txing = 0; |
68 | 80 | return 0; |
69 | 81 | } |
... | ... | |
79 | 91 | spi_begin(); |
80 | 92 | spi_send(AT86RF230_BUF_READ); |
81 | 93 | size = spi_recv(); |
82 | if (size & 0x80) { | |
94 | if (!size || (size & 0x80)) { | |
83 | 95 | spi_end(); |
84 | 96 | return 1; |
85 | 97 | } |