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