carl9170 firmware: revamp reset code
[carl9170fw.git] / carlfw / src / main.c
index 35f5d29c88d770541440edbcf57623f4442fa1c3..a9a1306b4693b2fed2ced3c9e95e066b8ac5d484 100644 (file)
@@ -75,14 +75,22 @@ static void init(void)
        down_trigger();
 }
 
+static void handle_fw(void)
+{
+       if (fw.watchdog_enable == 1)
+               set(AR9170_TIMER_REG_WATCH_DOG, AR9170_WATCH_DOG_TIMER);
+
+       if (fw.reboot)
+               reboot();
+}
+
 static void __attribute__((noreturn)) main_loop(void)
 {
        clock_set(true, AHB_40MHZ_OSC);
 
        /* main loop */
        while (1) {
-               if (fw.watchdog_enable == 1)
-                       set(AR9170_TIMER_REG_WATCH_DOG, AR9170_WATCH_DOG_TIMER);
+               handle_fw();
 
                /*
                 * Due to frame order persevation, the wlan subroutines