/* * running the graphic mode */ void run_graphic_mode(void) { do { xboot_set_mode(MODE_SHELL); } while(xboot_get_mode() == MODE_GRAPHIC); }
/* * default application for this mode */ static void default_application(void) { do { /* * enter to shell mode */ xboot_set_mode(MODE_SHELL); } while(xboot_get_mode() == MODE_APPLICATION); }
/* * running the shell mode */ void run_shell_mode(void) { char * p; char cwd[256]; char prompt[256]; /* * clear the screen */ console_cls(get_console_stdout()); do { getcwd(cwd, sizeof(cwd)); sprintf(prompt, "%s: %s$ ", getenv("prompt"), cwd); p = readline(prompt); exec_cmdline(p); free(p); } while(xboot_get_mode() == MODE_SHELL); }
/* * the entry of main function. */ int xboot_main(int argc, char * argv[]) { /* do all init calls */ do_initcalls(); /* do system xtime */ do_system_xtime(); /* mount root filesystem */ do_system_rootfs(); /* load system configure */ do_system_cfg(); /* load system fonts */ do_system_fonts(); /* check battery capacity */ do_system_battery(); /* wait a moment */ do_system_wait(); /* run loop */ while(1) { /* * normal mode */ if(xboot_get_mode() == MODE_NORMAL) { run_normal_mode(); } /* * shell mode */ else if(xboot_get_mode() == MODE_SHELL) { run_shell_mode(); } /* * memu mode */ else if(xboot_get_mode() == MODE_MENU) { run_menu_mode(); } /* * graphic mode */ else if(xboot_get_mode() == MODE_GRAPHIC) { run_graphic_mode(); } /* * application mode */ else if(xboot_get_mode() == MODE_APPLICATION) { run_application_mode(); } } /* do all exit calls */ do_exitcalls(); /* xboot return */ return 0; }