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