]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/command_tbl.c
Add commands: loadf, go, reset restart
[z180-stamp.git] / avr / command_tbl.c
1
2 #include "common.h"
3
4 #include "command.h"
5 #include "cmd_mem.h"
6
7
8 extern int do_help(cmd_tbl_t *, int, int, char * const []);
9 extern int do_echo(cmd_tbl_t *, int, int, char * const []);
10 extern int do_env_print(cmd_tbl_t *, int, int, char * const []);
11 extern int do_env_set(cmd_tbl_t *, int, int, char * const []);
12 extern int do_loadf(cmd_tbl_t *, int, int, char * const []);
13 extern int do_go(cmd_tbl_t *, int, int, char * const []);
14 extern int do_restart(cmd_tbl_t *, int, int, char * const []);
15
16
17 cmd_tbl_t cmd_tbl[] = {
18
19 CMD_TBL_ITEM(
20 echo, CONFIG_SYS_MAXARGS, 1, do_echo,
21 "echo args to console",
22 "[args..]\n"
23 " - echo args to console; \\c suppresses newline"
24 ),
25 CMD_TBL_ITEM_COMPLETE(
26 run, CONFIG_SYS_MAXARGS, 1, do_run,
27 "run commands in an environment variable",
28 "var [...]\n"
29 " - run the commands in the environment variable(s) 'var'",
30 var_complete
31 ),
32 CMD_TBL_ITEM_COMPLETE(
33 printenv, CONFIG_SYS_MAXARGS, 1, do_env_print,
34 "print environment variables",
35 "\n"
36 " - print values of all environment variables\n"
37 "printenv name ...\n"
38 " - print value of environment variable 'name'",
39 var_complete
40 ),
41 CMD_TBL_ITEM_COMPLETE(
42 setenv, CONFIG_SYS_MAXARGS, 0, do_env_set,
43 "set environment variables",
44 "name value ...\n"
45 " - set environment variable 'name' to 'value ...'\n"
46 "setenv name\n"
47 " - delete environment variable 'name'",
48 var_complete
49 ),
50
51 CMD_TBL_ITEM(
52 loadf, 1, 0, do_loadf,
53 "load srec_cat prepared image from controller flash",
54 ""
55 ),
56 CMD_TBL_ITEM(
57 go, 2, 0, do_go,
58 "start application at address 'addr'",
59 "addr\n"
60 " - start application at address 'addr'"
61 // "\n"
62 // " passing 'arg' as arguments"
63 ),
64 CMD_TBL_ITEM(
65 reset, 1, 0, do_reset,
66 "Keep CPU in RESET state",
67 ""
68 ),
69 CMD_TBL_ITEM(
70 restart, 1, 0, do_restart,
71 "Perform RESET of the CPU",
72 ""
73 ),
74
75 CMD_TBL_ITEM(
76 md, 3, 1, do_mem_md,
77 "memory display",
78 "address [# of objects]"
79 ),
80 CMD_TBL_ITEM(
81 mm, 2, 1, do_mem_mm,
82 "memory modify (auto-incrementing address)",
83 "address"
84 ),
85 CMD_TBL_ITEM(
86 nm, 2, 1, do_mem_nm,
87 "memory modify (constant address)",
88 "address"
89 ),
90 CMD_TBL_ITEM(
91 mw, 4, 1, do_mem_mw,
92 "memory write (fill)",
93 "address value [count]"
94 ),
95 CMD_TBL_ITEM(
96 cp, 4, 1, do_mem_cp,
97 "memory copy",
98 "source target count"
99 ),
100 CMD_TBL_ITEM(
101 cmp, 4, 1, do_mem_cmp,
102 "memory compare",
103 "addr1 addr2 count"
104 ),
105 CMD_TBL_ITEM(
106 base, 2, 1, do_mem_base,
107 "print or set address offset",
108 "\n"
109 " - print address offset for memory commands\n"
110 "base offset\n"
111 " - set address offset for memory commands to 'offset'"
112 ),
113 CMD_TBL_ITEM(
114 loop, 3, 1, do_mem_loop,
115 "infinite loop on address range",
116 "address number_of_bytes"
117 ),
118 #ifdef CONFIG_LOOPW
119 CMD_TBL_ITEM(
120 loopw, 4, 1, do_mem_loopw,
121 "infinite write loop on address range",
122 "address number_of_bytes data_to_write"
123 ),
124 #endif /* CONFIG_LOOPW */
125
126 #ifdef CONFIG_CMD_MEMTEST
127 CMD_TBL_ITEM(
128 mtest, 5, 1, do_mem_mtest,
129 "simple RAM read/write test",
130 "[start [end [pattern [iterations]]]]"
131 ),
132 #endif /* CONFIG_CMD_MEMTEST */
133
134 #ifdef CONFIG_MX_CYCLIC
135 CMD_TBL_ITEM(
136 mdc, 4, 1, do_mem_mdc,
137 "memory display cyclic",
138 "address count delay(ms)"
139 ),
140 CMD_TBL_ITEM(
141 mwc, 4, 1, do_mem_mwc,
142 "memory write cyclic",
143 "address value delay(ms)"
144 ),
145 #endif /* CONFIG_MX_CYCLIC */
146
147
148 CMD_TBL_ITEM(
149 help, CONFIG_SYS_MAXARGS, 1, do_help,
150 "print command description/usage",
151 "\n"
152 " - print brief description of all commands\n"
153 "help command ...\n"
154 " - print detailed usage of 'command'"
155 ),
156
157 /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
158 {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help,
159 FSTR("alias for 'help'"),
160 #ifdef CONFIG_SYS_LONGHELP
161 FSTR(""),
162 #endif /* CONFIG_SYS_LONGHELP */
163 #ifdef CONFIG_AUTO_COMPLETE
164 0,
165 #endif
166 },
167 /* Mark end of table */
168 { 0 },
169 };