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