]>
Commit | Line | Data |
---|---|---|
35edb766 | 1 | /* |
04f84937 | 2 | * (C) Copyright 2014-2016, 2018 Leo C. <erbl259-lmu@yahoo.de> |
35edb766 | 3 | * |
b51d2360 | 4 | * SPDX-License-Identifier: GPL-2.0 |
35edb766 | 5 | */ |
d684c216 L |
6 | |
7 | #include "common.h" | |
d684c216 | 8 | #include "command.h" |
72f58822 | 9 | #include "cmd_mem.h" |
7eecbdac | 10 | #include "cmd_boot.h" |
226d3221 | 11 | #include "cmd_cpu.h" |
7eecbdac L |
12 | #include "cmd_misc.h" |
13 | #include "cmd_date.h" | |
14 | #include "cmd_run.h" | |
15 | #include "cmd_loadcpm3.h" | |
16 | #include "cmd_loadihex.h" | |
17 | #include "cmd_gpio.h" | |
18 | #include "cmd_sd.h" | |
19 | #include "cmd_fat.h" | |
20 | #include "cmd_attach.h" | |
21 | #include "env.h" | |
22 | #include "debug.h" | |
d684c216 | 23 | |
d684c216 L |
24 | |
25 | cmd_tbl_t cmd_tbl[] = { | |
26 | ||
51dd0948 L |
27 | CMD_TBL_ITEM_TOP( |
28 | xx, CONFIG_SYS_MAXARGS, 0, do_cpu, | |
29 | "experimental commands", | |
30 | "<subcommand> args ...\n" | |
31 | "xx help\n", | |
32 | cmd_tbl_cpu | |
33 | ), | |
34 | ||
35 | ||
61b0cfe9 L |
36 | CMD_TBL_ITEM( |
37 | date, 2, 1, do_date, | |
a036b05f | 38 | "get/set date & time", |
85046f8c | 39 | "[MMDDhhmm[[CC]YY][.ss]]\n" |
61b0cfe9 L |
40 | " - without arguments: print date & time\n" |
41 | " - with numeric argument: set the system date & time\n" | |
61b0cfe9 L |
42 | ), |
43 | ||
323398b1 | 44 | #ifdef DEBUG |
4565be9a | 45 | |
323398b1 | 46 | CMD_TBL_ITEM( |
7a1ed620 | 47 | !mdr, 3, CTBL_DBG|CTBL_RPT, do_dump_mem, |
f338df2a L |
48 | "RAM dump", |
49 | "address [count]" | |
50 | ), | |
51 | CMD_TBL_ITEM( | |
7a1ed620 | 52 | !mde, 3, CTBL_DBG|CTBL_RPT, do_dump_mem, |
323398b1 L |
53 | "EEPROM dump", |
54 | "address [count]" | |
55 | ), | |
c748023e | 56 | CMD_TBL_ITEM( |
7a1ed620 | 57 | !mdf, 3, CTBL_DBG|CTBL_RPT, do_dump_mem, |
c748023e L |
58 | "FLASH dump", |
59 | "address [count]" | |
60 | ), | |
323398b1 | 61 | CMD_TBL_ITEM( |
7a1ed620 | 62 | !cpe, 4, CTBL_DBG, do_eep_cp, |
323398b1 L |
63 | "EEPROM copy", |
64 | "source target count" | |
65 | ), | |
ad9bc17c | 66 | CMD_TBL_ITEM( |
7a1ed620 | 67 | !mm, 2, CTBL_DBG|CTBL_RPT, do_mem_mm_avr, |
ad9bc17c L |
68 | "avr memory modify (auto-incrementing address)", |
69 | "address" | |
70 | ), | |
71 | CMD_TBL_ITEM( | |
7a1ed620 | 72 | !nm, 2, CTBL_DBG|CTBL_RPT, do_mem_nm_avr, |
ad9bc17c L |
73 | "avr memory modify (constant address)", |
74 | "address" | |
75 | ), | |
fb9b17a9 | 76 | CMD_TBL_ITEM( |
7a1ed620 | 77 | !prfree, 1, CTBL_DBG|CTBL_RPT, do_pr_free_avr, |
fb9b17a9 | 78 | "print avr heap free list", |
b9aef06e L |
79 | "" |
80 | ), | |
81 | CMD_TBL_ITEM( | |
7a1ed620 | 82 | !prheap, 1, CTBL_DBG, do_pr_heap_avr, |
b9aef06e L |
83 | "dump avr heap", |
84 | "" | |
fb9b17a9 | 85 | ), |
323398b1 | 86 | #endif |
1e5609bf L |
87 | CMD_TBL_ITEM( |
88 | msize, 1, 1, do_mem_size, | |
89 | "Detect memory size", | |
90 | "" | |
91 | ), | |
f338df2a L |
92 | CMD_TBL_ITEM( |
93 | mstep, 2, 1, do_busreq_pulse, | |
94 | "execute one M cycle", | |
95 | "[count]\n" | |
96 | " - repeat count times" | |
97 | ), | |
d684c216 L |
98 | CMD_TBL_ITEM( |
99 | echo, CONFIG_SYS_MAXARGS, 1, do_echo, | |
bbd45c46 L |
100 | "display a line of text", |
101 | "[-n] [argument ...]\n" | |
32154e5a L |
102 | "- echo the argument(s) to console.\n" |
103 | " -n do not output the trailing newline" | |
d684c216 | 104 | ), |
8a7decea L |
105 | CMD_TBL_ITEM( |
106 | sleep , 2, 1, do_sleep, | |
107 | "delay execution for some time", | |
108 | "N[m][s]\n" | |
109 | " - delay execution for decimal N (milli) seconds" | |
110 | ), | |
d684c216 L |
111 | CMD_TBL_ITEM_COMPLETE( |
112 | run, CONFIG_SYS_MAXARGS, 1, do_run, | |
113 | "run commands in an environment variable", | |
114 | "var [...]\n" | |
115 | " - run the commands in the environment variable(s) 'var'", | |
116 | var_complete | |
117 | ), | |
85d34e10 L |
118 | CMD_TBL_ITEM( |
119 | boot, 1, 1, do_bootd, | |
120 | "boot default, i.e., run 'bootcmd'", | |
121 | "" | |
122 | ), | |
04b3ea0e L |
123 | CMD_TBL_ITEM_COMPLETE( |
124 | source, CONFIG_SYS_MAXARGS, 1, do_source, | |
125 | "run commands from a file", | |
126 | "filename\n" | |
127 | " - run the commands in the script file 'filename'", | |
128 | var_complete | |
129 | ), | |
dab74a42 L |
130 | |
131 | CMD_TBL_ITEM_TOP( | |
132 | env, CONFIG_SYS_MAXARGS, 0, do_env, | |
133 | "environment handling commands", | |
134 | "", | |
135 | cmd_tbl_env | |
7e24905c | 136 | ), |
72f58822 | 137 | |
534e1dfc | 138 | CMD_TBL_ITEM( |
323398b1 | 139 | loadf, 1, 0, do_loadf, |
534e1dfc L |
140 | "load srec_cat prepared image from controller flash", |
141 | "" | |
142 | ), | |
a2907f2e L |
143 | CMD_TBL_ITEM( |
144 | bootcf, CONFIG_SYS_MAXARGS, 0, do_bootcf, | |
145 | "boot from cf card", | |
146 | "[options]\n" | |
147 | " Load a number of sectors from the first CP/M partition and jump to\n" | |
148 | " the load address.\n" | |
149 | " -a ADDRESS\n" | |
150 | " Load and start address (default 100 hex)\n" | |
151 | " -s NUM\n" | |
152 | " First sector of partition to load (0..255, default 0)\n" | |
153 | " -c NUM\n" | |
154 | " Number of sectors to load (1..127, default 7)\n" | |
155 | " -i NUM\n" | |
156 | " Partition type to look for (default 52 hex)\n" | |
157 | " -n\n" | |
158 | " Load only, do not execute\n" | |
159 | " -t NUM\n" | |
160 | " Timeout for IDE commands (1..65535, default 10000)\n" | |
161 | " -v verbose\n" | |
162 | " TODO: be verbose" | |
163 | ), | |
c0abd68b L |
164 | CMD_TBL_ITEM( |
165 | loadcpm3, 3, 0, do_loadcpm3, | |
166 | "load CPM3.SYS file", | |
98aac4d0 | 167 | "[filename [common-base [banked-base]]] \n" |
fa84c3ba L |
168 | " - Load CP/M 3 system file from FAT filesystem. This command makes\n" |
169 | " CPMLDR superfluous. Uses the following environment variables if set:\n" | |
b51d2360 L |
170 | " '"ENV_CPM3_SYSFILE"' File to load. Default is '"CONFIG_CPM3_SYSFILE"'.\n" |
171 | " '"ENV_CPM3_BANKED_BASE"' Default is '"CONFIG_CPM3_BANKED_BASE_STR"'.\n" | |
172 | " Sets the following environment variables after loading:\n" | |
173 | " '"ENV_CPM3_COMMON_BASE"'\n" | |
174 | " '"ENV_STARTADDRESS"'" | |
c0abd68b | 175 | ), |
179bc609 L |
176 | CMD_TBL_ITEM( |
177 | loadi, 2, 0, do_loadihex, | |
bf587043 L |
178 | "load intel hex file over serial line", |
179 | "[[-]offset]\n" | |
180 | " - load Intel-Hex-Record file over serial line with offset 'offset'" | |
179bc609 | 181 | ), |
393b1897 L |
182 | |
183 | #if defined(CONFIG_CMD_LOADB) | |
184 | CMD_TBL_ITEM( | |
185 | loadb, 1, 0, do_load_serial_bin, | |
186 | "load binary file over serial line (kermit mode)", | |
187 | " - load binary file over serial line" | |
188 | ), | |
189 | ||
190 | CMD_TBL_ITEM( | |
191 | loadx, 1, 0, do_load_serial_bin, | |
192 | "load binary file over serial line (xmodem mode)", | |
193 | " - load binary file over serial line" | |
194 | ), | |
195 | ||
196 | CMD_TBL_ITEM( | |
197 | loady, 1, 0, do_load_serial_bin, | |
198 | "load binary file over serial line (ymodem mode)", | |
199 | " - load binary file over serial line" | |
200 | ), | |
201 | #endif /* CONFIG_CMD_LOADB */ | |
202 | ||
534e1dfc | 203 | CMD_TBL_ITEM( |
9403f939 | 204 | go, CONFIG_SYS_MAXARGS, 0, do_go, |
534e1dfc | 205 | "start application at address 'addr'", |
9403f939 | 206 | "[-h] addr\n" |
534e1dfc | 207 | " - start application at address 'addr'" |
534e1dfc L |
208 | ), |
209 | CMD_TBL_ITEM( | |
323398b1 | 210 | reset, 1, 0, do_reset, |
534e1dfc L |
211 | "Keep CPU in RESET state", |
212 | "" | |
213 | ), | |
214 | CMD_TBL_ITEM( | |
89adce76 | 215 | restart, 1, 1, do_restart, |
534e1dfc L |
216 | "Perform RESET of the CPU", |
217 | "" | |
218 | ), | |
89adce76 | 219 | CMD_TBL_ITEM( |
2fe44122 | 220 | connect, 1, 0, do_console, |
89adce76 | 221 | "Connect to CPU console i/o", |
98aac4d0 L |
222 | "\n" |
223 | " - type the escape character followed by Q to close the connection, \n" | |
224 | " or followed by ? to see other options. The default escape character \n" | |
225 | " is Ctrl-^ (0x1E). It can be changed by setting env var '"ENV_ESC_CHAR"'." | |
226 | ||
89adce76 | 227 | ), |
41d36f28 | 228 | |
41d36f28 | 229 | CMD_TBL_ITEM( |
05994bd9 | 230 | pin, CONFIG_SYS_MAXARGS, 1, do_gpio, |
cd5ee544 L |
231 | "Set or query pin state", |
232 | "[-s] [<pins>]\n" | |
41d36f28 L |
233 | " - print cofiguration and state or frequency of pins\n" |
234 | " print all pins, if argument is omitted\n" | |
cd5ee544 | 235 | "pin <pins> h[igh]|l[ow]\n" |
41d36f28 | 236 | " - config pins as output and set to level high or low\n" |
cd5ee544 | 237 | "pin <pins> ts|i[n]|p[ullup]\n" |
41d36f28 | 238 | " - config pins as input/tristate or input with pullup\n" |
cd5ee544 | 239 | "pin <pins> value[K|M][Hz]\n" |
41d36f28 L |
240 | " - output a clock on pins\n" |
241 | " value is system clock divider or frequency, if 'Hz' is appended\n" | |
242 | " divider is rounded down to next possible value (depends on pin)\n" | |
243 | "\n" | |
cd5ee544 | 244 | "<pins> is a comma separated list of numbers or ranges, i.e. \"0,9,3-6\"\n" |
6035a17b | 245 | ), |
534e1dfc | 246 | |
72f58822 | 247 | CMD_TBL_ITEM( |
7a1ed620 | 248 | md, 3, CTBL_RPT, do_mem_md, |
72f58822 L |
249 | "memory display", |
250 | "address [# of objects]" | |
251 | ), | |
252 | CMD_TBL_ITEM( | |
7a1ed620 | 253 | mm, 2, CTBL_RPT, do_mem_mm, |
72f58822 L |
254 | "memory modify (auto-incrementing address)", |
255 | "address" | |
256 | ), | |
257 | CMD_TBL_ITEM( | |
7a1ed620 | 258 | nm, 2, CTBL_RPT, do_mem_nm, |
72f58822 L |
259 | "memory modify (constant address)", |
260 | "address" | |
261 | ), | |
262 | CMD_TBL_ITEM( | |
7a1ed620 | 263 | mw, CONFIG_SYS_MAXARGS, CTBL_RPT, do_mem_mw, |
72f58822 | 264 | "memory write (fill)", |
32154e5a L |
265 | "[-bwl] address value [count]\n" |
266 | " -b write value as byte (8 bit, default)\n" | |
267 | " -w write value as word (16 bit)\n" | |
fcd2239e | 268 | " -l write value as long (32 bit)" |
72f58822 L |
269 | ), |
270 | CMD_TBL_ITEM( | |
04f84937 | 271 | mcp, 4, CTBL_RPT, do_mem_cp, |
72f58822 L |
272 | "memory copy", |
273 | "source target count" | |
274 | ), | |
275 | CMD_TBL_ITEM( | |
04f84937 | 276 | mcmp, 4, CTBL_RPT, do_mem_cmp, |
72f58822 L |
277 | "memory compare", |
278 | "addr1 addr2 count" | |
279 | ), | |
280 | CMD_TBL_ITEM( | |
c79c80b4 | 281 | base, 2, 0, do_mem_base, |
72f58822 L |
282 | "print or set address offset", |
283 | "\n" | |
284 | " - print address offset for memory commands\n" | |
285 | "base offset\n" | |
286 | " - set address offset for memory commands to 'offset'" | |
287 | ), | |
288 | CMD_TBL_ITEM( | |
7a1ed620 | 289 | mloop, 3, CTBL_RPT, do_mem_loop, |
72f58822 L |
290 | "infinite loop on address range", |
291 | "address number_of_bytes" | |
292 | ), | |
72f58822 | 293 | CMD_TBL_ITEM( |
7a1ed620 | 294 | mloopw, 4, CTBL_RPT, do_mem_loopw, |
72f58822 L |
295 | "infinite write loop on address range", |
296 | "address number_of_bytes data_to_write" | |
297 | ), | |
72f58822 L |
298 | |
299 | #ifdef CONFIG_CMD_MEMTEST | |
300 | CMD_TBL_ITEM( | |
7a1ed620 | 301 | mtest, 4, CTBL_RPT, do_mem_mtest, |
72f58822 | 302 | "simple RAM read/write test", |
5480dc65 | 303 | "[start [end [iterations]]]" |
72f58822 L |
304 | ), |
305 | #endif /* CONFIG_CMD_MEMTEST */ | |
306 | ||
307 | #ifdef CONFIG_MX_CYCLIC | |
308 | CMD_TBL_ITEM( | |
7a1ed620 | 309 | mdc, 4, CTBL_RPT, do_mem_mdc, |
72f58822 L |
310 | "memory display cyclic", |
311 | "address count delay(ms)" | |
312 | ), | |
313 | CMD_TBL_ITEM( | |
7a1ed620 | 314 | mwc, CONFIG_SYS_MAXARGS, CTBL_RPT, do_mem_mdc, |
72f58822 | 315 | "memory write cyclic", |
fcd2239e L |
316 | "[-bwl] address value delay(ms)\n" |
317 | " -b write value as byte (8 bit, default)\n" | |
318 | " -w write value as word (16 bit)\n" | |
319 | " -l write value as long (32 bit)" | |
72f58822 L |
320 | ), |
321 | #endif /* CONFIG_MX_CYCLIC */ | |
322 | ||
8da60ec5 | 323 | CMD_TBL_ITEM_TOP( |
04f84937 | 324 | sd, CONFIG_SYS_MAXARGS, 0, do_sd, |
7f552300 L |
325 | "SD/MMC card handling commands", |
326 | "<subcommand> args ...\n" | |
327 | "sd help\n" | |
8da60ec5 L |
328 | " - print help on subcommands", |
329 | cmd_tbl_sd | |
7f552300 | 330 | ), |
8da60ec5 | 331 | CMD_TBL_ITEM_TOP( |
dab74a42 | 332 | fat, CONFIG_SYS_MAXARGS, 0, do_fat, |
8a2b0da0 L |
333 | "fat filesystem commands", |
334 | "<subcommand> args ...\n" | |
335 | "fat help\n" | |
8da60ec5 L |
336 | " - print help on subcommands", |
337 | cmd_tbl_fat | |
2f53dd65 | 338 | ), |
8a2b0da0 | 339 | |
cb4fb1ed | 340 | CMD_TBL_ITEM( |
7a1ed620 | 341 | attach, CONFIG_SYS_MAXARGS, CTBL_RPT, do_attach, |
cb4fb1ed | 342 | "attach filesystem image file to CP/M drive", |
96798b2c | 343 | "[-rw] [-o options] dsk<n> diskfile\n" |
5e8ac5e0 | 344 | " Attach diskfile to dsk<n>, where n in 0.."CONFIG_CPM_MAX_DRNR_STR"\n" |
96798b2c L |
345 | " -r File is read only (write protected)\n" |
346 | " -w File is read/write (default)\n" | |
347 | " -o options\n" | |
348 | " Options is a comma-separated list of\n" | |
349 | " ro, rw, debug, nodebug\n" | |
350 | "\n" | |
351 | "attach [-rw] -o reattach[,other options] dsk<n>\n" | |
352 | " Change options for dsk<n>.\n" | |
353 | " Options as above.\n" | |
354 | "\n" | |
355 | "attach -d -a|dsk<n>\n" | |
356 | "detach -a|dsk<n>\n" | |
357 | " Detach diskfile from dsk<n>.\n" | |
358 | " -a Detach all.\n" | |
359 | "\n" | |
cb4fb1ed | 360 | "attach\n" |
8da60ec5 | 361 | " Without arguments, list current assignments" |
cb4fb1ed L |
362 | ), |
363 | CMD_TBL_ITEM( | |
7a1ed620 | 364 | detach, 2, 0, do_attach, |
cb4fb1ed L |
365 | "detach file from CP/M drive", |
366 | "dsk<n>]\n" | |
a2907f2e | 367 | " - alias for 'attach -d dsk<n>'" |
cb4fb1ed | 368 | ), |
2f53dd65 | 369 | |
d684c216 | 370 | CMD_TBL_ITEM( |
7a1ed620 | 371 | help, CONFIG_SYS_MAXARGS, 0, do_help, |
d684c216 | 372 | "print command description/usage", |
c646b5a9 L |
373 | "[-a]\n" |
374 | " print brief description of all commands\n" | |
375 | " -a print description of subcommands too\n" | |
376 | "help -fk keyword ...\n" | |
377 | " print brief description of commands matching keyword\n" | |
378 | " -f search keyword in command name\n" | |
379 | " -k search keyword in command name and description\n" | |
380 | "help [-a] command ...\n" | |
381 | " print detailed usage of 'command'" | |
d684c216 L |
382 | ), |
383 | ||
72f58822 | 384 | /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */ |
d684c216 L |
385 | {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help, |
386 | FSTR("alias for 'help'"), | |
387 | #ifdef CONFIG_SYS_LONGHELP | |
388 | FSTR(""), | |
389 | #endif /* CONFIG_SYS_LONGHELP */ | |
8da60ec5 | 390 | NULL, |
d684c216 | 391 | #ifdef CONFIG_AUTO_COMPLETE |
8da60ec5 | 392 | NULL, |
d684c216 L |
393 | #endif |
394 | }, | |
395 | /* Mark end of table */ | |
5caa8c2b | 396 | CMD_TBL_END(cmd_tbl) |
d684c216 | 397 | }; |