2 * (C) Copyright 2014-2016, 2018 Leo C. <erbl259-lmu@yahoo.de>
4 * SPDX-License-Identifier: GPL-2.0
15 #include "cmd_loadcpm3.h"
16 #include "cmd_loadihex.h"
20 #include "cmd_attach.h"
25 cmd_tbl_t cmd_tbl
[] = {
28 xx
, CONFIG_SYS_MAXARGS
, 0, do_cpu
,
29 "experimental commands",
30 "<subcommand> args ...\n"
37 time
, CONFIG_SYS_MAXARGS
, 0, do_time
,
38 "run command and print execution time",
43 "get/set date & time",
44 "[MMDDhhmm[[CC]YY][.ss]]\n"
45 " - without arguments: print date & time\n"
46 " - with numeric argument: set the system date & time\n"
52 !mdr
, 3, CTBL_DBG
|CTBL_RPT
, do_dump_mem
,
57 !mde
, 3, CTBL_DBG
|CTBL_RPT
, do_dump_mem
,
62 !mdf
, 3, CTBL_DBG
|CTBL_RPT
, do_dump_mem
,
67 !cpe
, 4, CTBL_DBG
, do_eep_cp
,
72 !mm
, 2, CTBL_DBG
|CTBL_RPT
, do_mem_mm_avr
,
73 "avr memory modify (auto-incrementing address)",
77 !nm
, 2, CTBL_DBG
|CTBL_RPT
, do_mem_nm_avr
,
78 "avr memory modify (constant address)",
82 !prfree
, 1, CTBL_DBG
|CTBL_RPT
, do_pr_free_avr
,
83 "print avr heap free list",
87 !prheap
, 1, CTBL_DBG
, do_pr_heap_avr
,
93 msize
, 1, 1, do_mem_size
,
98 mstep
, 2, 1, do_busreq_pulse
,
99 "execute one M cycle",
101 " - repeat count times"
104 echo
, CONFIG_SYS_MAXARGS
, 1, do_echo
,
105 "display a line of text",
106 "[-n] [argument ...]\n"
107 "- echo the argument(s) to console.\n"
108 " -n do not output the trailing newline"
111 sleep
, 2, 1, do_sleep
,
112 "delay execution for some time",
114 " - delay execution for hexadecimal N (milli) seconds"
116 CMD_TBL_ITEM_COMPLETE(
117 run
, CONFIG_SYS_MAXARGS
, 1, do_run
,
118 "run commands in an environment variable",
120 " - run the commands in the environment variable(s) 'var'",
124 boot
, 1, 1, do_bootd
,
125 "boot default, i.e., run 'bootcmd'",
128 CMD_TBL_ITEM_COMPLETE(
129 source
, CONFIG_SYS_MAXARGS
, 1, do_source
,
130 "run commands from a file",
132 " - run the commands in the script file 'filename'",
137 env
, CONFIG_SYS_MAXARGS
, 0, do_env
,
138 "environment handling commands",
144 loadf
, 1, 0, do_loadf
,
145 "load srec_cat prepared image from controller flash",
149 bootcf
, CONFIG_SYS_MAXARGS
, 0, do_bootcf
,
152 " Load a number of sectors from the first CP/M partition and jump to\n"
153 " the load address.\n"
155 " Load and start address (default 100 hex)\n"
157 " First sector of partition to load (0..255, default 0)\n"
159 " Number of sectors to load (1..127, default 7)\n"
161 " Partition type to look for (default 52 hex)\n"
163 " Load only, do not execute\n"
165 " Timeout for IDE commands (1..65535, default 10000)\n"
170 loadcpm3
, 3, 0, do_loadcpm3
,
171 "load CPM3.SYS file",
172 "[filename [common-base [banked-base]]] \n"
173 " - Load CP/M 3 system file from FAT filesystem. This command makes\n"
174 " CPMLDR superfluous. Uses the following environment variables if set:\n"
175 " '"ENV_CPM3_SYSFILE
"' File to load. Default is '"CONFIG_CPM3_SYSFILE
"'.\n"
176 " '"ENV_CPM3_BANKED_BASE
"' Default is '"CONFIG_CPM3_BANKED_BASE_STR
"'.\n"
177 " Sets the following environment variables after loading:\n"
178 " '"ENV_CPM3_COMMON_BASE
"'\n"
179 " '"ENV_STARTADDRESS
"'"
182 loadi
, 2, 0, do_loadihex
,
183 "load intel hex file over serial line",
185 " - load Intel-Hex-Record file over serial line with offset 'offset'"
188 #if defined(CONFIG_CMD_LOADB)
190 loadb
, 1, 0, do_load_serial_bin
,
191 "load binary file over serial line (kermit mode)",
192 " - load binary file over serial line"
196 loadx
, 1, 0, do_load_serial_bin
,
197 "load binary file over serial line (xmodem mode)",
198 " - load binary file over serial line"
202 loady
, 1, 0, do_load_serial_bin
,
203 "load binary file over serial line (ymodem mode)",
204 " - load binary file over serial line"
206 #endif /* CONFIG_CMD_LOADB */
209 go
, CONFIG_SYS_MAXARGS
, 0, do_go
,
210 "start application at address 'addr'",
212 " - start application at address 'addr'"
215 reset
, 1, 0, do_reset
,
216 "Keep CPU in RESET state",
220 restart
, 1, 1, do_restart
,
221 "Perform RESET of the CPU",
225 connect
, 1, 0, do_console
,
226 "Connect to CPU console i/o",
228 " - type the escape character followed by Q to close the connection, \n"
229 " or followed by ? to see other options. The default escape character \n"
230 " is Ctrl-^ (0x1E). It can be changed by setting env var '"ENV_ESC_CHAR
"'."
235 pin
, CONFIG_SYS_MAXARGS
, 1, do_gpio
,
236 "Set or query pin state",
238 " - print cofiguration and state or frequency of pins\n"
239 " print all pins, if argument is omitted\n"
240 "pin <pins> h[igh]|l[ow]\n"
241 " - config pins as output and set to level high or low\n"
242 "pin <pins> ts|i[n]|p[ullup]\n"
243 " - config pins as input/tristate or input with pullup\n"
244 "pin <pins> value[K|M][Hz]\n"
245 " - output a clock on pins\n"
246 " value is system clock divider or frequency, if 'Hz' is appended\n"
247 " divider is rounded down to next possible value (depends on pin)\n"
249 "<pins> is a comma separated list of numbers or ranges, i.e. \"0,9,3-6\"\n"
252 disasemble
, 3, CTBL_RPT
, do_disas
,
253 "Disassemble from memory",
254 "address [# of lines]"
257 md
, 3, CTBL_RPT
, do_mem_md
,
259 "address [# of objects]"
262 mm
, 2, CTBL_RPT
, do_mem_mm
,
263 "memory modify (auto-incrementing address)",
267 nm
, 2, CTBL_RPT
, do_mem_nm
,
268 "memory modify (constant address)",
272 mw
, CONFIG_SYS_MAXARGS
, CTBL_RPT
, do_mem_mw
,
273 "memory write (fill)",
274 "[-bwl] address value [count]\n"
275 " -b write value as byte (8 bit, default)\n"
276 " -w write value as word (16 bit)\n"
277 " -l write value as long (32 bit)"
280 mcp
, 4, CTBL_RPT
, do_mem_cp
,
282 "source target count"
285 mcmp
, 4, CTBL_RPT
, do_mem_cmp
,
290 base
, 2, 0, do_mem_base
,
291 "print or set address offset",
293 " - print address offset for memory commands\n"
295 " - set address offset for memory commands to 'offset'"
298 mloop
, 3, CTBL_RPT
, do_mem_loop
,
299 "infinite loop on address range",
300 "address number_of_bytes"
303 mloopw
, 4, CTBL_RPT
, do_mem_loopw
,
304 "infinite write loop on address range",
305 "address number_of_bytes data_to_write"
308 #ifdef CONFIG_CMD_MEMTEST
310 mtest
, 4, CTBL_RPT
, do_mem_mtest
,
311 "simple RAM read/write test",
312 "[start [end [iterations]]]"
314 #endif /* CONFIG_CMD_MEMTEST */
316 #ifdef CONFIG_MX_CYCLIC
318 mdc
, 4, CTBL_RPT
, do_mem_mdc
,
319 "memory display cyclic",
320 "address count delay(ms)"
323 mwc
, CONFIG_SYS_MAXARGS
, CTBL_RPT
, do_mem_mdc
,
324 "memory write cyclic",
325 "[-bwl] address value delay(ms)\n"
326 " -b write value as byte (8 bit, default)\n"
327 " -w write value as word (16 bit)\n"
328 " -l write value as long (32 bit)"
330 #endif /* CONFIG_MX_CYCLIC */
333 sd
, CONFIG_SYS_MAXARGS
, 0, do_sd
,
334 "SD/MMC card handling commands",
335 "<subcommand> args ...\n"
337 " - print help on subcommands",
341 fat
, CONFIG_SYS_MAXARGS
, 0, do_fat
,
342 "fat filesystem commands",
343 "<subcommand> args ...\n"
345 " - print help on subcommands",
350 attach
, CONFIG_SYS_MAXARGS
, CTBL_RPT
, do_attach
,
351 "attach filesystem image file to CP/M drive",
352 "[-rw] [-o options] dsk<n> diskfile\n"
353 " Attach diskfile to dsk<n>, where n in 0.."CONFIG_CPM_MAX_DRNR_STR
"\n"
354 " -r File is read only (write protected)\n"
355 " -w File is read/write (default)\n"
357 " Options is a comma-separated list of\n"
358 " ro, rw, debug, nodebug\n"
360 "attach [-rw] -o reattach[,other options] dsk<n>\n"
361 " Change options for dsk<n>.\n"
362 " Options as above.\n"
364 "attach -d -a|dsk<n>\n"
366 " Detach diskfile from dsk<n>.\n"
370 " Without arguments, list current assignments"
373 detach
, 2, 0, do_attach
,
374 "detach file from CP/M drive",
376 " - alias for 'attach -d dsk<n>'"
380 help
, CONFIG_SYS_MAXARGS
, 0, do_help
,
381 "print command description/usage",
383 " print brief description of all commands\n"
384 " -a print description of subcommands too\n"
385 "help -fk keyword ...\n"
386 " print brief description of commands matching keyword\n"
387 " -f search keyword in command name\n"
388 " -k search keyword in command name and description\n"
389 "help [-a] command ...\n"
390 " print detailed usage of 'command'"
393 /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
394 {FSTR("?"), CONFIG_SYS_MAXARGS
, 1, do_help
,
395 FSTR("alias for 'help'"),
396 #ifdef CONFIG_SYS_LONGHELP
398 #endif /* CONFIG_SYS_LONGHELP */
400 #ifdef CONFIG_AUTO_COMPLETE
404 /* Mark end of table */