]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/command_tbl.c
Programmable Z180 clock, clock command
[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_default(cmd_tbl_t *, int, int, char * const []);
12 extern command_ret_t do_env_set(cmd_tbl_t *, int, int, char * const []);
13 extern command_ret_t do_env_save(cmd_tbl_t *, int, int, char * const []);
14 extern command_ret_t do_loadf(cmd_tbl_t *, int, int, char * const []);
15 extern command_ret_t do_go(cmd_tbl_t *, int, int, char * const []);
16 extern command_ret_t do_restart(cmd_tbl_t *, int, int, char * const []);
17 extern command_ret_t do_dump_mem(cmd_tbl_t *, int, int, char * const []);
18 extern command_ret_t do_eep_cp(cmd_tbl_t *, int, int, char * const []);
19 extern command_ret_t do_busreq_pulse(cmd_tbl_t *, int, int, char * const []);
20 extern command_ret_t do_date(cmd_tbl_t *, int, int, char * const []);
21 extern command_ret_t do_clock(cmd_tbl_t *, int, int, char * const []);
22
23
24 cmd_tbl_t cmd_tbl[] = {
25
26 CMD_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
35 #ifdef DEBUG
36 CMD_TBL_ITEM(
37 !mdr, 3, 1, do_dump_mem,
38 "RAM dump",
39 "address [count]"
40 ),
41 CMD_TBL_ITEM(
42 !mde, 3, 1, do_dump_mem,
43 "EEPROM dump",
44 "address [count]"
45 ),
46 CMD_TBL_ITEM(
47 !cpe, 4, 0, do_eep_cp,
48 "EEPROM copy",
49 "source target count"
50 ),
51 #endif
52 CMD_TBL_ITEM(
53 mstep, 2, 1, do_busreq_pulse,
54 "execute one M cycle",
55 "[count]\n"
56 " - repeat count times"
57 ),
58 CMD_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 ),
64 CMD_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 ),
71 CMD_TBL_ITEM_COMPLETE(
72 printenv, CONFIG_SYS_MAXARGS, 1, do_env_print,
73 "print environment variables",
74 "\n"
75 " - print values of all environment variables\n"
76 "printenv name ...\n"
77 " - print value of environment variable 'name'",
78 var_complete
79 ),
80 CMD_TBL_ITEM_COMPLETE(
81 setenv, CONFIG_SYS_MAXARGS, 0, do_env_set,
82 "set environment variables",
83 "name value ...\n"
84 " - set environment variable 'name' to 'value ...'\n"
85 "setenv name\n"
86 " - delete environment variable 'name'",
87 var_complete
88 ),
89 CMD_TBL_ITEM(
90 saveenv, 1, 0, do_env_save,
91 "save environment variables to persistent storage",
92 ""
93 ),
94 CMD_TBL_ITEM(
95 defaultenv, 1, 0, do_env_default,
96 "set all environment variables to their default values",
97 ""
98 ),
99
100 CMD_TBL_ITEM(
101 loadf, 1, 0, do_loadf,
102 "load srec_cat prepared image from controller flash",
103 ""
104 ),
105 CMD_TBL_ITEM(
106 go, 2, 0, do_go,
107 "start application at address 'addr'",
108 "addr\n"
109 " - start application at address 'addr'"
110 // "\n"
111 // " passing 'arg' as arguments"
112 ),
113 CMD_TBL_ITEM(
114 reset, 1, 0, do_reset,
115 "Keep CPU in RESET state",
116 ""
117 ),
118 CMD_TBL_ITEM(
119 restart, 1, 0, do_restart,
120 "Perform RESET of the CPU",
121 ""
122 ),
123 CMD_TBL_ITEM(
124 clock, 2, 0, do_clock,
125 "Set or get CPU frequency",
126 ""
127 ),
128
129 CMD_TBL_ITEM(
130 md, 3, 1, do_mem_md,
131 "memory display",
132 "address [# of objects]"
133 ),
134 CMD_TBL_ITEM(
135 mm, 2, 1, do_mem_mm,
136 "memory modify (auto-incrementing address)",
137 "address"
138 ),
139 CMD_TBL_ITEM(
140 nm, 2, 1, do_mem_nm,
141 "memory modify (constant address)",
142 "address"
143 ),
144 CMD_TBL_ITEM(
145 mw, 4, 1, do_mem_mw,
146 "memory write (fill)",
147 "address value [count]"
148 ),
149 CMD_TBL_ITEM(
150 cp, 4, 1, do_mem_cp,
151 "memory copy",
152 "source target count"
153 ),
154 CMD_TBL_ITEM(
155 cmp, 4, 1, do_mem_cmp,
156 "memory compare",
157 "addr1 addr2 count"
158 ),
159 CMD_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 ),
167 CMD_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
173 CMD_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
181 CMD_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
189 CMD_TBL_ITEM(
190 mdc, 4, 1, do_mem_mdc,
191 "memory display cyclic",
192 "address count delay(ms)"
193 ),
194 CMD_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
202 CMD_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
211 /* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
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 };