/** * @brief shell_func * @param[in] void * @param[in,out] void * @return void */ void shell_func (void) { cursor_blink(); while(1) { PRINT("\r\nBOS# "); UART0_AsyncReceive(64, g_rx_buffer, &rx_complete); BOS_WaitEvent(EVT_UART_RECEIVE); BOS_ClearEvent(EVT_UART_RECEIVE); if(check_cmd((char *)g_rx_buffer, "help")) { cmd_help(); } else if(check_cmd((char *)g_rx_buffer, "info")) { cmd_info(); } else if(check_cmd((char *)g_rx_buffer, "ps")) { cmd_ps(); } else if(check_cmd((char *)g_rx_buffer, "mbx")) { cmd_mbx(); } else { PRINT("\r\nCommand not found, type help for more details\r\n"); } } }
/* Parse the command and return the command ID */ int getCommand( const char *cmd ) { /* Hello: Print out the welcome message. */ if ( strncmp( cmd, "Hello", 5 ) == 0 ) sPuts( "Hi, Welcome to FreeRTOS!" ); /* ps: Show all the task that are on the OS. */ else if ( strncmp( cmd, "ps", 2 ) == 0 ) cmd_ps(); /* host <command>: The command passed to the host. */ else if ( strncmp( cmd, "host", 4 ) == 0 ) cmd_host( cmd ); /* cat <path/filename>: Display the content of the file. */ else if ( strncmp( cmd, "cat", 3 ) == 0 ) cmd_cat( &cmd[4] ); /* Command not found, show the message. */ else sPuts( "Command Not found!" ); }
void parse_input(char *cmd) { if(strcmp("ps", cmd) == 0) { cmd_ps(); } else if (strcmp("lsdev", cmd) == 0) { cmd_lsdev(); } else if (strncmp("ls ", cmd, 3) == 0) { cmd_ls(cmd + 3); } else if (strcmp("exit", cmd) == 0) { cmd_exit(); } else if (strcmp("testmt", cmd) == 0) { cmd_testmt(); } else if (strncmp("cat ", cmd, 4) == 0) { cmd_cat(cmd + 4); } else if (strncmp("stat ", cmd, 5) == 0) { cmd_stat(cmd + 5); } else if (strncmp("elf ", cmd, 4) == 0) { cmd_elf(cmd + 4); } }
int cmd_i(int argc, char** argv) { return cmd_ps(argc, argv); }