]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/command_tbl.c
Enable pullups on all gpio pins. cleanup
[z180-stamp.git] / avr / command_tbl.c
1
2 #include "common.h"
3
4 #include "command.h"
5 #include "cmd_mem.h"
6
7
8 extern command_ret_t do_help(cmd_tbl_t *, int, int, char * const []);
9 extern command_ret_t do_echo(cmd_tbl_t *, int, int, char * const []);
10 extern command_ret_t do_sleep(cmd_tbl_t *, int, int, char * const []);
11 extern command_ret_t do_env_print(cmd_tbl_t *, int, int, char * const []);
12 extern command_ret_t do_env_default(cmd_tbl_t *, int, int, char * const []);
13 extern command_ret_t do_env_set(cmd_tbl_t *, int, int, char * const []);
14 extern command_ret_t do_env_save(cmd_tbl_t *, int, int, char * const []);
15 extern command_ret_t do_loadf(cmd_tbl_t *, int, int, char * const []);
16 extern command_ret_t do_go(cmd_tbl_t *, int, int, char * const []);
17 extern command_ret_t do_restart(cmd_tbl_t *, int, int, char * const []);
18 extern command_ret_t do_console(cmd_tbl_t *, int, int, char * const []);
19 extern command_ret_t do_dump_mem(cmd_tbl_t *, int, int, char * const []);
20 extern command_ret_t do_eep_cp(cmd_tbl_t *, int, int, char * const []);
21 extern command_ret_t do_busreq_pulse(cmd_tbl_t *, int, int, char * const []);
22 extern command_ret_t do_date(cmd_tbl_t *, int, int, char * const []);
23 extern command_ret_t do_gpio(cmd_tbl_t *, int, int, char * const []);
24 extern command_ret_t do_sd(cmd_tbl_t *, int, int, char * const []);
25
26 #ifdef CONFIG_SYS_LONGHELP
27 const FLASH char sd_help_text[] =
28 "bla \t- do bla\n"
29 ;
30 #endif /* CONFIG_SYS_LONGHELP */
31
32
33 cmd_tbl_t cmd_tbl[] = {
34
35 CMD_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
44 #ifdef DEBUG
45 CMD_TBL_ITEM(
46 !mdr, 3, 1, do_dump_mem,
47 "RAM dump",
48 "address [count]"
49 ),
50 CMD_TBL_ITEM(
51 !mde, 3, 1, do_dump_mem,
52 "EEPROM dump",
53 "address [count]"
54 ),
55 CMD_TBL_ITEM(
56 !cpe, 4, 0, do_eep_cp,
57 "EEPROM copy",
58 "source target count"
59 ),
60 #endif
61 CMD_TBL_ITEM(
62 mstep, 2, 1, do_busreq_pulse,
63 "execute one M cycle",
64 "[count]\n"
65 " - repeat count times"
66 ),
67 CMD_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 ),
73 CMD_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 ),
79 CMD_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 ),
86 CMD_TBL_ITEM_COMPLETE(
87 printenv, CONFIG_SYS_MAXARGS, 1, do_env_print,
88 "print environment variables",
89 "\n"
90 " - print values of all environment variables\n"
91 "printenv name ...\n"
92 " - print value of environment variable 'name'",
93 var_complete
94 ),
95 CMD_TBL_ITEM_COMPLETE(
96 setenv, CONFIG_SYS_MAXARGS, 0, do_env_set,
97 "set environment variables",
98 "name value ...\n"
99 " - set environment variable 'name' to 'value ...'\n"
100 "setenv name\n"
101 " - delete environment variable 'name'",
102 var_complete
103 ),
104 CMD_TBL_ITEM(
105 saveenv, 1, 0, do_env_save,
106 "save environment variables to persistent storage",
107 ""
108 ),
109 CMD_TBL_ITEM(
110 defaultenv, 1, 0, do_env_default,
111 "set all environment variables to their default values",
112 ""
113 ),
114
115 CMD_TBL_ITEM(
116 loadf, 1, 0, do_loadf,
117 "load srec_cat prepared image from controller flash",
118 ""
119 ),
120 CMD_TBL_ITEM(
121 go, 2, 0, do_go,
122 "start application at address 'addr'",
123 "addr\n"
124 " - start application at address 'addr'"
125 // "\n"
126 // " passing 'arg' as arguments"
127 ),
128 CMD_TBL_ITEM(
129 reset, 1, 0, do_reset,
130 "Keep CPU in RESET state",
131 ""
132 ),
133 CMD_TBL_ITEM(
134 restart, 1, 1, do_restart,
135 "Perform RESET of the CPU",
136 ""
137 ),
138 CMD_TBL_ITEM(
139 connect, 1, 1, do_console,
140 "Connect to CPU console i/o",
141 ""
142 ),
143
144 CMD_TBL_ITEM(
145 pin, CONFIG_SYS_MAXARGS, 1, do_gpio,
146 "Set or query pin state",
147 "[-s] [<pins>]\n"
148 " - print cofiguration and state or frequency of pins\n"
149 " print all pins, if argument is omitted\n"
150 "pin <pins> h[igh]|l[ow]\n"
151 " - config pins as output and set to level high or low\n"
152 "pin <pins> ts|i[n]|p[ullup]\n"
153 " - config pins as input/tristate or input with pullup\n"
154 "pin <pins> value[K|M][Hz]\n"
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"
159 "<pins> is a comma separated list of numbers or ranges, i.e. \"0,9,3-6\"\n"
160 ),
161
162 CMD_TBL_ITEM(
163 md, 3, 1, do_mem_md,
164 "memory display",
165 "address [# of objects]"
166 ),
167 CMD_TBL_ITEM(
168 mm, 2, 1, do_mem_mm,
169 "memory modify (auto-incrementing address)",
170 "address"
171 ),
172 CMD_TBL_ITEM(
173 nm, 2, 1, do_mem_nm,
174 "memory modify (constant address)",
175 "address"
176 ),
177 CMD_TBL_ITEM(
178 mw, 4, 1, do_mem_mw,
179 "memory write (fill)",
180 "address value [count]"
181 ),
182 CMD_TBL_ITEM(
183 cp, 4, 1, do_mem_cp,
184 "memory copy",
185 "source target count"
186 ),
187 CMD_TBL_ITEM(
188 cmp, 4, 1, do_mem_cmp,
189 "memory compare",
190 "addr1 addr2 count"
191 ),
192 CMD_TBL_ITEM(
193 base, 2, 0, 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 ),
200 CMD_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
206 CMD_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
214 CMD_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
222 CMD_TBL_ITEM(
223 mdc, 4, 1, do_mem_mdc,
224 "memory display cyclic",
225 "address count delay(ms)"
226 ),
227 CMD_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 CMD_TBL_ITEM(
235 sd, CONFIG_SYS_MAXARGS, 1, do_sd,
236 "SD/MMC card handling commands",
237 "<subcommand> args ...\n"
238 "sd help\n"
239 " - print help on subcommands"
240 ),
241
242 CMD_TBL_ITEM(
243 help, CONFIG_SYS_MAXARGS, 1, do_help,
244 "print command description/usage",
245 "\n"
246 " - print brief description of all commands\n"
247 "help command ...\n"
248 " - print detailed usage of 'command'"
249 ),
250
251 /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
252 {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help,
253 FSTR("alias for 'help'"),
254 #ifdef CONFIG_SYS_LONGHELP
255 FSTR(""),
256 #endif /* CONFIG_SYS_LONGHELP */
257 #ifdef CONFIG_AUTO_COMPLETE
258 0,
259 #endif
260 },
261 /* Mark end of table */
262 { 0 },
263 };