/************************************************************************ * NAME: fapp_boot * * DESCRIPTION: ************************************************************************/ static void fapp_boot(fnet_shell_desc_t desc) { /* Bootloader. */ #if FAPP_CFG_BOOTLOADER /* The bootloader wait some time for a key over a serial connection.*/ /* The wait time is given by the boot_delay parameter.*/ fnet_time_t delay; const struct boot_mode *mode; mode = fapp_boot_mode_by_index (fapp_params_boot_config.mode); if(mode->handler) { delay = fapp_params_boot_config.delay; fnet_shell_printf(desc, FAPP_BOOT_STR, mode->name, delay); while(delay > 0u) { delay--; if( fnet_shell_getchar(desc) != FNET_ERR) { break; } fnet_timer_delay(FNET_TIMER_TICK_IN_SEC); /* 1 sec. delay. */ fnet_shell_printf(desc, "\b\b\b\b %3d", delay); } fnet_shell_println(desc, ""); if(delay == 0u) { /* Auto-start*/ mode->handler(desc); } } else #endif { /* Default startup script. */ #if FAPP_CFG_STARTUP_SCRIPT_ENABLED fnet_shell_println(desc, "Startup script: %s", FAPP_CFG_STARTUP_SCRIPT); fnet_shell_script(desc, FAPP_CFG_STARTUP_SCRIPT ); #endif } FNET_COMP_UNUSED_ARG(desc); }
static void fapp_get_cmd_boot(fnet_shell_desc_t desc) { const struct boot_mode *mode = fapp_boot_mode_by_index(fapp_params_boot_config.mode); fnet_shell_println(desc, FAPP_GET_SOPT_FORMAT, mode->name); }