Date:2013-02-20 17:05:33 (5 years 4 months ago)
Author:Werner Almesberger
Commit:de8bcc19255656094f80fb81087c0b41741a3fa2
Message:atusb/fw/mac.c: always wait for stability before changing transceiver state

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

Change Details

atusb/fw/mac.c
106106}
107107
108108
109static void change_state(uint8_t new)
110{
111    while ((reg_read(REG_TRX_STATUS) & TRX_STATUS_MASK) ==
112        TRX_STATUS_TRANSITION);
113    reg_write(REG_TRX_STATE, new);
114}
115
116
109117int mac_rx(int on)
110118{
111119    if (on) {
112120        mac_irq = handle_irq;
113121        reg_read(REG_IRQ_STATUS);
114        reg_write(REG_TRX_STATE, TRX_CMD_RX_ON);
122        change_state(TRX_CMD_RX_ON);
115123    } else {
116124        mac_irq = NULL;
117        reg_write(REG_TRX_STATE, TRX_CMD_FORCE_TRX_OFF);
125        change_state(TRX_CMD_FORCE_TRX_OFF);
118126        txing = 0;
119127    }
120128    return 1;
...... 
153161     * Wait until we reach BUSY_TX, so that we command the transition to
154162     * RX_ON which will be executed upon TX completion.
155163     */
156    while ((reg_read(REG_TRX_STATUS) & TRX_STATUS_MASK) ==
157        TRX_STATUS_TRANSITION);
158    reg_write(REG_TRX_STATE, TRX_CMD_RX_ON);
164    change_state(TRX_CMD_RX_ON);
159165}
160166
161167

Archive Download the corresponding diff file



interactive