3 * @author Shinichiro Nakamura
4 * @brief ナチュラルタイニーシェルタスクの実装(task_ntshell)
6 * システムをコンソールから制御することのできるインターフェースタスク。
12 #include <target_syssvc.h>
13 #include <syssvc/serial.h>
14 #include <logtrace/trace_config.h>
16 #include "kernel_cfg.h"
18 #include "task_ntshell.h"
20 #include "task_display.h"
21 #include "task_audio.h"
30 int func_read(char *buf, int cnt);
31 int func_write(const char *buf, int cnt);
32 int func_ntopt(int argc, char **argv, void *extobj);
33 int func_ntshell(const char *text);
38 void (*func)(int argc, char **argv);
41 const command_table_t table[] = {
42 {"taskinfo", "Task information.", cmd_taskinfo},
43 {"audio", "Audio task parameter.", cmd_audio},
44 {"lcd", "Control the LCD.", cmd_lcd},
45 {"led", "Set state of the debug purpose LED.", cmd_led},
46 {"mount", "Mount a SD card.", cmd_mount},
47 {"ls", "List contents on a SD card.", cmd_ls},
48 {"cd", "Change the current directory.", cmd_cd},
49 {"trace", "Trace the kernel conditions.", cmd_trace},
50 {"exit", "Exit the kernel.", cmd_exit},
55 const command_table_t *p = &table[0];
57 while (p->command != NULL) {
58 ntlibc_strcpy(buf, p->command);
59 ntlibc_strcat(buf, "\t:");
60 ntlibc_strcat(buf, p->description);
61 syslog(LOG_NOTICE, buf);
67 int func_read(char *buf, int cnt)
69 return serial_rea_dat(SIO_PORTID, (char_t *)buf, cnt);
72 int func_write(const char *buf, int cnt)
74 return serial_wri_dat(SIO_PORTID, (const char_t *)buf, cnt);
77 int func_ntopt(int argc, char **argv, void *extobj)
84 const command_table_t *p = &table[0];
85 while (p->command != NULL) {
86 if (ntlibc_strcmp((const char *)argv[0], p->command) == 0) {
97 "Found unknown command. (help: display help.)");
105 int func_ntshell(const char *text)
107 return ntopt_parse((const char *)text, NULL, func_ntopt);
112 * \param exinf コンフィギュレータから渡す引数。今回は利用しない
115 void task_ntshell(intptr_t exinf)
117 serial_opn_por(SIO_PORTID);
119 ntshell_execute(&ntshell, func_read, func_write, func_ntshell);