Date:2013-07-24 21:21:38 (6 years 3 months ago)
Author:Werner Almesberger
Commit:998ac7e5c66ae7e5893e43b958183a138be1db10
Message:atusb/fw/mac.c (next_buf): dedicated function for incrementing buffer indices

Files: atusb/fw/mac.c (4 diffs)

Change Details

atusb/fw/mac.c
2929
3030
3131static uint8_t rx_buf[RX_BUFS][MAX_PSDU+2]; /* PHDR+payload+LQ */
32static bool rx_in = 0, rx_out = 0;
3332static uint8_t tx_buf[MAX_PSDU];
3433static uint8_t tx_size = 0;
3534static bool txing = 0;
...... 
3736static uint8_t next_seq, this_seq, queued_seq;
3837
3938
39/* ----- Receive buffer management ----------------------------------------- */
40
41
42static uint8_t rx_in = 0, rx_out = 0;
43
44
45static inline void next_buf(uint8_t *index)
46{
47    *index = (*index+1) % RX_BUFS;
48}
49
50
4051/* ----- Register access --------------------------------------------------- */
4152
4253
...... 
95106static void rx_done(void *user)
96107{
97108    led(0);
98    rx_out = (rx_out+1) & (RX_BUFS-1);
109    next_buf(&rx_out);
99110    usb_next();
100111}
101112
...... 
122133    spi_end();
123134
124135    buf[0] = size;
125    rx_in = (rx_in+1) & (RX_BUFS-1);
136    next_buf(&rx_in);
126137
127138    if (eps[1].state == EP_IDLE)
128139        usb_next();

Archive Download the corresponding diff file



interactive