Make ao_radio_idle keep trying to get the radio to idle.
authorKeith Packard <keithp@keithp.com>
Mon, 5 Apr 2010 02:48:50 +0000 (19:48 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 5 Apr 2010 02:48:50 +0000 (19:48 -0700)
Attempting to abort a radio operation could lead to a hang if the user
of the radio jumped in and started using it again before the task
attempting to abort woke up. This change just keeps smacking the radio
until the radio goes idle long enough to detect it.

src/ao_radio.c

index bb19c6a99f77934c00f8007d9dcb15375f479c78..0849349edb1d10a59208aebad7929c523da414f4 100644 (file)
@@ -317,8 +317,8 @@ ao_radio_idle(void)
 {
        if (RF_MARCSTATE != RF_MARCSTATE_IDLE)
        {
 {
        if (RF_MARCSTATE != RF_MARCSTATE_IDLE)
        {
-               RFST = RFST_SIDLE;
                do {
                do {
+                       RFST = RFST_SIDLE;
                        ao_yield();
                } while (RF_MARCSTATE != RF_MARCSTATE_IDLE);
        }
                        ao_yield();
                } while (RF_MARCSTATE != RF_MARCSTATE_IDLE);
        }