mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-22 20:03:09 +02:00
atusb/fw/mac.c: always wait for stability before changing transceiver state
This commit is contained in:
parent
945aa04d9d
commit
de8bcc1925
@ -106,15 +106,23 @@ static int handle_irq(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void change_state(uint8_t new)
|
||||||
|
{
|
||||||
|
while ((reg_read(REG_TRX_STATUS) & TRX_STATUS_MASK) ==
|
||||||
|
TRX_STATUS_TRANSITION);
|
||||||
|
reg_write(REG_TRX_STATE, new);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int mac_rx(int on)
|
int mac_rx(int on)
|
||||||
{
|
{
|
||||||
if (on) {
|
if (on) {
|
||||||
mac_irq = handle_irq;
|
mac_irq = handle_irq;
|
||||||
reg_read(REG_IRQ_STATUS);
|
reg_read(REG_IRQ_STATUS);
|
||||||
reg_write(REG_TRX_STATE, TRX_CMD_RX_ON);
|
change_state(TRX_CMD_RX_ON);
|
||||||
} else {
|
} else {
|
||||||
mac_irq = NULL;
|
mac_irq = NULL;
|
||||||
reg_write(REG_TRX_STATE, TRX_CMD_FORCE_TRX_OFF);
|
change_state(TRX_CMD_FORCE_TRX_OFF);
|
||||||
txing = 0;
|
txing = 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -153,9 +161,7 @@ static void do_tx(void *user)
|
|||||||
* Wait until we reach BUSY_TX, so that we command the transition to
|
* Wait until we reach BUSY_TX, so that we command the transition to
|
||||||
* RX_ON which will be executed upon TX completion.
|
* RX_ON which will be executed upon TX completion.
|
||||||
*/
|
*/
|
||||||
while ((reg_read(REG_TRX_STATUS) & TRX_STATUS_MASK) ==
|
change_state(TRX_CMD_RX_ON);
|
||||||
TRX_STATUS_TRANSITION);
|
|
||||||
reg_write(REG_TRX_STATE, TRX_CMD_RX_ON);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user