summaryrefslogtreecommitdiff
path: root/avr/command_tbl.c
blob: 6fcbee71472026acf229e08a8be6a7c34597112f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#include "common.h"

#include "command.h"
#include "cmd_mem.h"


extern command_ret_t do_help(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_echo(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_env_print(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_env_set(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_env_save(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_loadf(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_go(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_restart(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_dump_mem(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_eep_cp(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_busreq_pulse(cmd_tbl_t *, int, int, char * const []);
extern command_ret_t do_date(cmd_tbl_t *, int, int, char * const []);


cmd_tbl_t cmd_tbl[] = {

CMD_TBL_ITEM(
	date,	2,	1,	do_date,
	"get/set/reset date & time",
	"[MMDDhhmm[[CC]YY][.ss]]\ndate reset\n"
	"  - without arguments: print date & time\n"
	"  - with numeric argument: set the system date & time\n"
	"  - with 'reset' argument: reset the RTC"
),

#ifdef DEBUG
CMD_TBL_ITEM(
	!mdr,	3,	1,	do_dump_mem,
	"RAM dump",
	"address [count]"
),
CMD_TBL_ITEM(
	!mde,	3,	1,	do_dump_mem,
	"EEPROM dump",
	"address [count]"
),
CMD_TBL_ITEM(
	!cpe,	4,	0,	do_eep_cp,
	"EEPROM copy",
	"source target count"
),
#endif
CMD_TBL_ITEM(
	mstep,	2,	1,	do_busreq_pulse,
	"execute one M cycle",
	"[count]\n"
	"     - repeat count times"
),
CMD_TBL_ITEM(
	echo,	CONFIG_SYS_MAXARGS,	1,	do_echo,
	"echo args to console",
	"[args..]\n"
	"     - echo args to console; \\c suppresses newline"
),
CMD_TBL_ITEM_COMPLETE(
	run,	CONFIG_SYS_MAXARGS,	1,	do_run,
	"run commands in an environment variable",
	"var [...]\n"
	"    - run the commands in the environment variable(s) 'var'",
	var_complete
),
CMD_TBL_ITEM_COMPLETE(
	printenv, CONFIG_SYS_MAXARGS,	1,	do_env_print,
	"print environment variables",
	"\n"
	"    - print values of all environment variables\n"
	"printenv name ...\n"
	"    - print value of environment variable 'name'",
	var_complete
),
CMD_TBL_ITEM_COMPLETE(
	setenv, CONFIG_SYS_MAXARGS,	0,	do_env_set,
	"set environment variables",
	"name value ...\n"
	"    - set environment variable 'name' to 'value ...'\n"
	"setenv name\n"
	"    - delete environment variable 'name'",
	var_complete
),
CMD_TBL_ITEM(
	saveenv,	1,	0,	do_env_save,
	"save environment variables to persistent storage",
	""
),

CMD_TBL_ITEM(
	loadf,	1,	0,	do_loadf,
	"load srec_cat prepared image from controller flash",
	""
),
CMD_TBL_ITEM(
	go,	2,	0,	do_go,
	"start application at address 'addr'",
	"addr\n"
	"    - start application at address 'addr'"
//	"\n"
//	"      passing 'arg' as arguments"
),
CMD_TBL_ITEM(
	reset,	1,	0,	do_reset,
	"Keep CPU in RESET state",
	""
),
CMD_TBL_ITEM(
	restart, 1, 0,	do_restart,
	"Perform RESET of the CPU",
	""
),

CMD_TBL_ITEM(
	md,	3,	1,	do_mem_md,
	"memory display",
	"address [# of objects]"
),
CMD_TBL_ITEM(
	mm,	2,	1,	do_mem_mm,
	"memory modify (auto-incrementing address)",
	"address"
),
CMD_TBL_ITEM(
	nm,	2,	1,	do_mem_nm,
	"memory modify (constant address)",
	"address"
),
CMD_TBL_ITEM(
	mw,	4,	1,	do_mem_mw,
	"memory write (fill)",
	"address value [count]"
),
CMD_TBL_ITEM(
	cp,	4,	1,	do_mem_cp,
	"memory copy",
	"source target count"
),
CMD_TBL_ITEM(
	cmp,	4,	1,	do_mem_cmp,
	"memory compare",
	"addr1 addr2 count"
),
CMD_TBL_ITEM(
	base,	2,	1,	do_mem_base,
	"print or set address offset",
	"\n"
	"    - print address offset for memory commands\n"
	"base offset\n"
	"    - set address offset for memory commands to 'offset'"
),
CMD_TBL_ITEM(
	loop,	3,	1,	do_mem_loop,
	"infinite loop on address range",
	"address number_of_bytes"
),
#ifdef CONFIG_LOOPW
CMD_TBL_ITEM(
	loopw,	4,	1,	do_mem_loopw,
	"infinite write loop on address range",
	"address number_of_bytes data_to_write"
),
#endif /* CONFIG_LOOPW */

#ifdef CONFIG_CMD_MEMTEST
CMD_TBL_ITEM(
	mtest,	5,	1,	do_mem_mtest,
	"simple RAM read/write test",
	"[start [end [pattern [iterations]]]]"
),
#endif	/* CONFIG_CMD_MEMTEST */

#ifdef CONFIG_MX_CYCLIC
CMD_TBL_ITEM(
	mdc,	4,	1,	do_mem_mdc,
	"memory display cyclic",
	"address count delay(ms)"
),
CMD_TBL_ITEM(
	mwc,	4,	1,	do_mem_mwc,
	"memory write cyclic",
	"address value delay(ms)"
),
#endif /* CONFIG_MX_CYCLIC */


CMD_TBL_ITEM(
	help,	CONFIG_SYS_MAXARGS,	1,	do_help,
	"print command description/usage",
	"\n"
	"       - print brief description of all commands\n"
	"help command ...\n"
	"       - print detailed usage of 'command'"
),

/* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
	{FSTR("?"),   CONFIG_SYS_MAXARGS, 1, do_help,
	 FSTR("alias for 'help'"),
#ifdef  CONFIG_SYS_LONGHELP
	FSTR(""),
#endif /* CONFIG_SYS_LONGHELP */
#ifdef CONFIG_AUTO_COMPLETE
	0,
#endif
},
/* Mark end of table */
{ 0 },
};