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