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"
253 md
, 3, CTBL_RPT
, do_mem_md
,
255 "address [# of objects]"
258 mm
, 2, CTBL_RPT
, do_mem_mm
,
259 "memory modify (auto-incrementing address)",
263 nm
, 2, CTBL_RPT
, do_mem_nm
,
264 "memory modify (constant address)",
268 mw
, CONFIG_SYS_MAXARGS
, CTBL_RPT
, do_mem_mw
,
269 "memory write (fill)",
270 "[-bwl] address value [count]\n"
271 " -b write value as byte (8 bit, default)\n"
272 " -w write value as word (16 bit)\n"
273 " -l write value as long (32 bit)"
276 mcp
, 4, CTBL_RPT
, do_mem_cp
,
278 "source target count"
281 mcmp
, 4, CTBL_RPT
, do_mem_cmp
,
286 base
, 2, 0, do_mem_base
,
287 "print or set address offset",
289 " - print address offset for memory commands\n"
291 " - set address offset for memory commands to 'offset'"
294 mloop
, 3, CTBL_RPT
, do_mem_loop
,
295 "infinite loop on address range",
296 "address number_of_bytes"
299 mloopw
, 4, CTBL_RPT
, do_mem_loopw
,
300 "infinite write loop on address range",
301 "address number_of_bytes data_to_write"
304 #ifdef CONFIG_CMD_MEMTEST
306 mtest
, 4, CTBL_RPT
, do_mem_mtest
,
307 "simple RAM read/write test",
308 "[start [end [iterations]]]"
310 #endif /* CONFIG_CMD_MEMTEST */
312 #ifdef CONFIG_MX_CYCLIC
314 mdc
, 4, CTBL_RPT
, do_mem_mdc
,
315 "memory display cyclic",
316 "address count delay(ms)"
319 mwc
, CONFIG_SYS_MAXARGS
, CTBL_RPT
, do_mem_mdc
,
320 "memory write cyclic",
321 "[-bwl] address value delay(ms)\n"
322 " -b write value as byte (8 bit, default)\n"
323 " -w write value as word (16 bit)\n"
324 " -l write value as long (32 bit)"
326 #endif /* CONFIG_MX_CYCLIC */
329 sd
, CONFIG_SYS_MAXARGS
, 0, do_sd
,
330 "SD/MMC card handling commands",
331 "<subcommand> args ...\n"
333 " - print help on subcommands",
337 fat
, CONFIG_SYS_MAXARGS
, 0, do_fat
,
338 "fat filesystem commands",
339 "<subcommand> args ...\n"
341 " - print help on subcommands",
346 attach
, CONFIG_SYS_MAXARGS
, CTBL_RPT
, do_attach
,
347 "attach filesystem image file to CP/M drive",
348 "[-rw] [-o options] dsk<n> diskfile\n"
349 " Attach diskfile to dsk<n>, where n in 0.."CONFIG_CPM_MAX_DRNR_STR
"\n"
350 " -r File is read only (write protected)\n"
351 " -w File is read/write (default)\n"
353 " Options is a comma-separated list of\n"
354 " ro, rw, debug, nodebug\n"
356 "attach [-rw] -o reattach[,other options] dsk<n>\n"
357 " Change options for dsk<n>.\n"
358 " Options as above.\n"
360 "attach -d -a|dsk<n>\n"
362 " Detach diskfile from dsk<n>.\n"
366 " Without arguments, list current assignments"
369 detach
, 2, 0, do_attach
,
370 "detach file from CP/M drive",
372 " - alias for 'attach -d dsk<n>'"
376 help
, CONFIG_SYS_MAXARGS
, 0, do_help
,
377 "print command description/usage",
379 " print brief description of all commands\n"
380 " -a print description of subcommands too\n"
381 "help -fk keyword ...\n"
382 " print brief description of commands matching keyword\n"
383 " -f search keyword in command name\n"
384 " -k search keyword in command name and description\n"
385 "help [-a] command ...\n"
386 " print detailed usage of 'command'"
389 /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
390 {FSTR("?"), CONFIG_SYS_MAXARGS
, 1, do_help
,
391 FSTR("alias for 'help'"),
392 #ifdef CONFIG_SYS_LONGHELP
394 #endif /* CONFIG_SYS_LONGHELP */
396 #ifdef CONFIG_AUTO_COMPLETE
400 /* Mark end of table */