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