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