]>
Commit | Line | Data |
---|---|---|
d684c216 L |
1 | |
2 | #include "common.h" | |
3 | ||
4 | #include "command.h" | |
72f58822 | 5 | #include "cmd_mem.h" |
d684c216 L |
6 | |
7 | ||
d0581f88 L |
8 | extern command_ret_t do_help(cmd_tbl_t *, int, int, char * const []); |
9 | extern command_ret_t do_echo(cmd_tbl_t *, int, int, char * const []); | |
10 | extern command_ret_t do_env_print(cmd_tbl_t *, int, int, char * const []); | |
7e24905c | 11 | extern command_ret_t do_env_default(cmd_tbl_t *, int, int, char * const []); |
d0581f88 L |
12 | extern command_ret_t do_env_set(cmd_tbl_t *, int, int, char * const []); |
13 | extern command_ret_t do_env_save(cmd_tbl_t *, int, int, char * const []); | |
14 | extern command_ret_t do_loadf(cmd_tbl_t *, int, int, char * const []); | |
15 | extern command_ret_t do_go(cmd_tbl_t *, int, int, char * const []); | |
16 | extern command_ret_t do_restart(cmd_tbl_t *, int, int, char * const []); | |
17 | extern command_ret_t do_dump_mem(cmd_tbl_t *, int, int, char * const []); | |
18 | extern command_ret_t do_eep_cp(cmd_tbl_t *, int, int, char * const []); | |
19 | extern command_ret_t do_busreq_pulse(cmd_tbl_t *, int, int, char * const []); | |
61b0cfe9 | 20 | extern command_ret_t do_date(cmd_tbl_t *, int, int, char * const []); |
41d36f28 L |
21 | //extern command_ret_t do_clock(cmd_tbl_t *, int, int, char * const []); |
22 | //extern command_ret_t do_clock2(cmd_tbl_t *, int, int, char * const []); | |
23 | extern command_ret_t do_pin(cmd_tbl_t *, int, int, char * const []); | |
d684c216 L |
24 | |
25 | ||
26 | cmd_tbl_t cmd_tbl[] = { | |
27 | ||
61b0cfe9 L |
28 | CMD_TBL_ITEM( |
29 | date, 2, 1, do_date, | |
30 | "get/set/reset date & time", | |
31 | "[MMDDhhmm[[CC]YY][.ss]]\ndate reset\n" | |
32 | " - without arguments: print date & time\n" | |
33 | " - with numeric argument: set the system date & time\n" | |
34 | " - with 'reset' argument: reset the RTC" | |
35 | ), | |
36 | ||
323398b1 L |
37 | #ifdef DEBUG |
38 | CMD_TBL_ITEM( | |
f338df2a L |
39 | !mdr, 3, 1, do_dump_mem, |
40 | "RAM dump", | |
41 | "address [count]" | |
42 | ), | |
43 | CMD_TBL_ITEM( | |
44 | !mde, 3, 1, do_dump_mem, | |
323398b1 L |
45 | "EEPROM dump", |
46 | "address [count]" | |
47 | ), | |
48 | CMD_TBL_ITEM( | |
f338df2a | 49 | !cpe, 4, 0, do_eep_cp, |
323398b1 L |
50 | "EEPROM copy", |
51 | "source target count" | |
52 | ), | |
53 | #endif | |
f338df2a L |
54 | CMD_TBL_ITEM( |
55 | mstep, 2, 1, do_busreq_pulse, | |
56 | "execute one M cycle", | |
57 | "[count]\n" | |
58 | " - repeat count times" | |
59 | ), | |
d684c216 L |
60 | CMD_TBL_ITEM( |
61 | echo, CONFIG_SYS_MAXARGS, 1, do_echo, | |
62 | "echo args to console", | |
63 | "[args..]\n" | |
64 | " - echo args to console; \\c suppresses newline" | |
65 | ), | |
66 | CMD_TBL_ITEM_COMPLETE( | |
67 | run, CONFIG_SYS_MAXARGS, 1, do_run, | |
68 | "run commands in an environment variable", | |
69 | "var [...]\n" | |
70 | " - run the commands in the environment variable(s) 'var'", | |
71 | var_complete | |
72 | ), | |
73 | CMD_TBL_ITEM_COMPLETE( | |
74 | printenv, CONFIG_SYS_MAXARGS, 1, do_env_print, | |
75 | "print environment variables", | |
72f58822 | 76 | "\n" |
534e1dfc | 77 | " - print values of all environment variables\n" |
d684c216 L |
78 | "printenv name ...\n" |
79 | " - print value of environment variable 'name'", | |
80 | var_complete | |
81 | ), | |
82 | CMD_TBL_ITEM_COMPLETE( | |
83 | setenv, CONFIG_SYS_MAXARGS, 0, do_env_set, | |
84 | "set environment variables", | |
72f58822 L |
85 | "name value ...\n" |
86 | " - set environment variable 'name' to 'value ...'\n" | |
87 | "setenv name\n" | |
88 | " - delete environment variable 'name'", | |
d684c216 L |
89 | var_complete |
90 | ), | |
323398b1 L |
91 | CMD_TBL_ITEM( |
92 | saveenv, 1, 0, do_env_save, | |
93 | "save environment variables to persistent storage", | |
94 | "" | |
95 | ), | |
7e24905c L |
96 | CMD_TBL_ITEM( |
97 | defaultenv, 1, 0, do_env_default, | |
98 | "set all environment variables to their default values", | |
99 | "" | |
100 | ), | |
72f58822 | 101 | |
534e1dfc | 102 | CMD_TBL_ITEM( |
323398b1 | 103 | loadf, 1, 0, do_loadf, |
534e1dfc L |
104 | "load srec_cat prepared image from controller flash", |
105 | "" | |
106 | ), | |
107 | CMD_TBL_ITEM( | |
323398b1 | 108 | go, 2, 0, do_go, |
534e1dfc L |
109 | "start application at address 'addr'", |
110 | "addr\n" | |
111 | " - start application at address 'addr'" | |
112 | // "\n" | |
113 | // " passing 'arg' as arguments" | |
114 | ), | |
115 | CMD_TBL_ITEM( | |
323398b1 | 116 | reset, 1, 0, do_reset, |
534e1dfc L |
117 | "Keep CPU in RESET state", |
118 | "" | |
119 | ), | |
120 | CMD_TBL_ITEM( | |
121 | restart, 1, 0, do_restart, | |
122 | "Perform RESET of the CPU", | |
123 | "" | |
124 | ), | |
41d36f28 L |
125 | |
126 | #if 0 | |
6035a17b L |
127 | CMD_TBL_ITEM( |
128 | clock, 2, 0, do_clock, | |
129 | "Set or get CPU frequency", | |
41d36f28 L |
130 | "\n" |
131 | " - print frequency or state of clock pin\n" | |
132 | "clock value[K|M]\n" | |
133 | " - set frequency of clock pin to value\n" | |
134 | "clock [high|low]\n" | |
135 | " - set clock pin level high or low" | |
136 | ), | |
137 | CMD_TBL_ITEM( | |
138 | clk2, 3, 0, do_clock2, | |
139 | "Set or get clk2 frequency", | |
140 | "\n" | |
141 | " - print frequency or state of clk2 pin\n" | |
142 | "clk2 [-d] value[K|M]\n" | |
143 | " - set frequency of clk2 pin to value\n" | |
144 | "clk2 [high|low]\n" | |
145 | " - set clk2 pin level high or low" | |
146 | ), | |
147 | #endif | |
148 | ||
149 | CMD_TBL_ITEM( | |
150 | pin, CONFIG_SYS_MAXARGS, 0, do_pin, | |
151 | "Set or get pin state", | |
152 | "[-s][pins]\n" | |
153 | " - print cofiguration and state or frequency of pins\n" | |
154 | " print all pins, if argument is omitted\n" | |
155 | "pin pins [h[igh]]|[l[ow]]\n" | |
156 | " - config pins as output and set to level high or low\n" | |
157 | "pin pins [ts]|[i[n]]|[p[ullup]]\n" | |
158 | " - config pins as input/tristate or input with pullup\n" | |
159 | "pin pins value[K|M][Hz]\n" | |
160 | " - output a clock on pins\n" | |
161 | " value is system clock divider or frequency, if 'Hz' is appended\n" | |
162 | " divider is rounded down to next possible value (depends on pin)\n" | |
163 | "\n" | |
164 | "pins is a comma separated list of numbers or ranges, i.e. \"0,9,3-6\"\n" | |
6035a17b | 165 | ), |
534e1dfc | 166 | |
72f58822 L |
167 | CMD_TBL_ITEM( |
168 | md, 3, 1, do_mem_md, | |
169 | "memory display", | |
170 | "address [# of objects]" | |
171 | ), | |
172 | CMD_TBL_ITEM( | |
173 | mm, 2, 1, do_mem_mm, | |
174 | "memory modify (auto-incrementing address)", | |
175 | "address" | |
176 | ), | |
177 | CMD_TBL_ITEM( | |
178 | nm, 2, 1, do_mem_nm, | |
179 | "memory modify (constant address)", | |
180 | "address" | |
181 | ), | |
182 | CMD_TBL_ITEM( | |
183 | mw, 4, 1, do_mem_mw, | |
184 | "memory write (fill)", | |
185 | "address value [count]" | |
186 | ), | |
187 | CMD_TBL_ITEM( | |
188 | cp, 4, 1, do_mem_cp, | |
189 | "memory copy", | |
190 | "source target count" | |
191 | ), | |
192 | CMD_TBL_ITEM( | |
193 | cmp, 4, 1, do_mem_cmp, | |
194 | "memory compare", | |
195 | "addr1 addr2 count" | |
196 | ), | |
197 | CMD_TBL_ITEM( | |
198 | base, 2, 1, do_mem_base, | |
199 | "print or set address offset", | |
200 | "\n" | |
201 | " - print address offset for memory commands\n" | |
202 | "base offset\n" | |
203 | " - set address offset for memory commands to 'offset'" | |
204 | ), | |
205 | CMD_TBL_ITEM( | |
206 | loop, 3, 1, do_mem_loop, | |
207 | "infinite loop on address range", | |
208 | "address number_of_bytes" | |
209 | ), | |
210 | #ifdef CONFIG_LOOPW | |
211 | CMD_TBL_ITEM( | |
212 | loopw, 4, 1, do_mem_loopw, | |
213 | "infinite write loop on address range", | |
214 | "address number_of_bytes data_to_write" | |
215 | ), | |
216 | #endif /* CONFIG_LOOPW */ | |
217 | ||
218 | #ifdef CONFIG_CMD_MEMTEST | |
219 | CMD_TBL_ITEM( | |
220 | mtest, 5, 1, do_mem_mtest, | |
221 | "simple RAM read/write test", | |
222 | "[start [end [pattern [iterations]]]]" | |
223 | ), | |
224 | #endif /* CONFIG_CMD_MEMTEST */ | |
225 | ||
226 | #ifdef CONFIG_MX_CYCLIC | |
227 | CMD_TBL_ITEM( | |
228 | mdc, 4, 1, do_mem_mdc, | |
229 | "memory display cyclic", | |
230 | "address count delay(ms)" | |
231 | ), | |
232 | CMD_TBL_ITEM( | |
233 | mwc, 4, 1, do_mem_mwc, | |
234 | "memory write cyclic", | |
235 | "address value delay(ms)" | |
236 | ), | |
237 | #endif /* CONFIG_MX_CYCLIC */ | |
238 | ||
239 | ||
d684c216 L |
240 | CMD_TBL_ITEM( |
241 | help, CONFIG_SYS_MAXARGS, 1, do_help, | |
242 | "print command description/usage", | |
243 | "\n" | |
244 | " - print brief description of all commands\n" | |
245 | "help command ...\n" | |
246 | " - print detailed usage of 'command'" | |
247 | ), | |
248 | ||
72f58822 | 249 | /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */ |
d684c216 L |
250 | {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help, |
251 | FSTR("alias for 'help'"), | |
252 | #ifdef CONFIG_SYS_LONGHELP | |
253 | FSTR(""), | |
254 | #endif /* CONFIG_SYS_LONGHELP */ | |
255 | #ifdef CONFIG_AUTO_COMPLETE | |
256 | 0, | |
257 | #endif | |
258 | }, | |
259 | /* Mark end of table */ | |
260 | { 0 }, | |
261 | }; |