X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Fsrc%2Fmain.c;h=f62e5ee7b6ce612a1c786ebf4a049fe990e76c53;hb=c97d09577cb82ffc5deda208163ecbee12f76037;hp=35f5d29c88d770541440edbcf57623f4442fa1c3;hpb=0f370216f7d50a6c8ffebfb1ba49b196e869d0ec;p=carl9170fw.git diff --git a/carlfw/src/main.c b/carlfw/src/main.c index 35f5d29..f62e5ee 100644 --- a/carlfw/src/main.c +++ b/carlfw/src/main.c @@ -75,14 +75,20 @@ static void init(void) down_trigger(); } -static void __attribute__((noreturn)) main_loop(void) +static void handle_fw(void) { - clock_set(true, AHB_40MHZ_OSC); + 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) +{ /* 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 @@ -112,6 +118,8 @@ static void __attribute__((noreturn)) main_loop(void) void __attribute__((noreturn)) start(void) { + clock_set(true, AHB_40MHZ_OSC); + /* initialize firmware context and DMA memory */ memset(&fw, 0, sizeof(fw)); @@ -141,5 +149,10 @@ void __attribute__((noreturn)) start(void) " ~`!1@2#3$4%%5^6&7*8(9)0_-+={[}]|\\:;\"'<,>.?/"); #endif /* CONFIG_CARL9170FW_DEBUG */ + /* + * Tell the host, that the firmware has booted and is + * now ready to process requests. + */ + send_cmd_to_host(0, CARL9170_RSP_BOOT, 0x00, NULL); main_loop(); }