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