1 |
578 |
markom |
static char _[] = " @(#)commands.c 5.23 93/08/23 15:30:30, Srini, AMD ";
|
2 |
|
|
/******************************************************************************
|
3 |
|
|
* Copyright 1992 Advanced Micro Devices, Inc.
|
4 |
|
|
*
|
5 |
|
|
* This software is the property of Advanced Micro Devices, Inc (AMD) which
|
6 |
|
|
* specifically grants the user the right to modify, use and distribute this
|
7 |
|
|
* software provided this notice is not removed or altered. All other rights
|
8 |
|
|
* are reserved by AMD.
|
9 |
|
|
*
|
10 |
|
|
* AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
|
11 |
|
|
* SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
|
12 |
|
|
* DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
|
13 |
|
|
* USE OF THIS SOFTWARE.
|
14 |
|
|
*
|
15 |
|
|
* So that all may benefit from your experience, please report any problems
|
16 |
|
|
* or suggestions about this software to the 29K Technical Support Center at
|
17 |
|
|
* 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
|
18 |
|
|
* 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
|
19 |
|
|
*
|
20 |
|
|
* Advanced Micro Devices, Inc.
|
21 |
|
|
* 29K Support Products
|
22 |
|
|
* Mail Stop 573
|
23 |
|
|
* 5900 E. Ben White Blvd.
|
24 |
|
|
* Austin, TX 78741
|
25 |
|
|
* 800-292-9263
|
26 |
|
|
*****************************************************************************
|
27 |
|
|
* Engineer: Srini Subramanian.
|
28 |
|
|
*****************************************************************************
|
29 |
|
|
** This file contains the functions associated with
|
30 |
|
|
** commands used by the main program. In general,
|
31 |
|
|
** the commands in this file are fairly simple and
|
32 |
|
|
** were not given a source file of their own.
|
33 |
|
|
*****************************************************************************
|
34 |
|
|
*/
|
35 |
|
|
|
36 |
|
|
#include <stdio.h>
|
37 |
|
|
#include <ctype.h>
|
38 |
|
|
#include "memspcs.h"
|
39 |
|
|
#include "main.h"
|
40 |
|
|
#include "monitor.h"
|
41 |
|
|
#include "macros.h"
|
42 |
|
|
#include "help.h"
|
43 |
|
|
#include "miniint.h"
|
44 |
|
|
#include "error.h"
|
45 |
|
|
|
46 |
|
|
#ifdef MSDOS
|
47 |
|
|
#include <stdlib.h>
|
48 |
|
|
#include <string.h>
|
49 |
|
|
#else
|
50 |
|
|
#include <strings.h>
|
51 |
|
|
#endif
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
extern int get_addr_29k PARAMS((char *, struct addr_29k_t *));
|
55 |
|
|
extern int addr_29k_ok PARAMS((struct addr_29k_t *));
|
56 |
|
|
|
57 |
|
|
extern int get_word PARAMS((char *, INT32 *));
|
58 |
|
|
|
59 |
|
|
/*
|
60 |
|
|
** Global variables
|
61 |
|
|
*/
|
62 |
|
|
|
63 |
|
|
static char *processor_name[] = {
|
64 |
|
|
/* 0 */ "Am29000",
|
65 |
|
|
/* 1 */ "Am29005",
|
66 |
|
|
/* 2 */ "Am29050",
|
67 |
|
|
/* 3 */ "Am29035",
|
68 |
|
|
/* 4 */ "Am29030",
|
69 |
|
|
/* 5 */ "Am29200",
|
70 |
|
|
/* 6 */ "Am29240",
|
71 |
|
|
/* 7 */ "Cougar",
|
72 |
|
|
/* 8 */ "TBA",
|
73 |
|
|
/* 9 */ "TBA"
|
74 |
|
|
};
|
75 |
|
|
#define NO_PROCESSOR 9
|
76 |
|
|
|
77 |
|
|
static char *coprocessor_name[] = {
|
78 |
|
|
/* 0 */ "None",
|
79 |
|
|
/* 1 */ "Am29027 (revision A)",
|
80 |
|
|
};
|
81 |
|
|
|
82 |
|
|
static char *io_control_name[] = {
|
83 |
|
|
/* 0 */ "Console controlled by target.",
|
84 |
|
|
/* 1 */ "Console controlled by host."
|
85 |
|
|
};
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
/*
|
90 |
|
|
** This command is used to print out the configuration
|
91 |
|
|
** of the system. This includes both host and target
|
92 |
|
|
** configurations.
|
93 |
|
|
**
|
94 |
|
|
** This command also re-allocates the message buffers
|
95 |
|
|
** and the breakpoint array. This permits this command
|
96 |
|
|
** to be used to re-configure the host for a new target
|
97 |
|
|
** without restarting the monitor. This is useful in cases
|
98 |
|
|
** where the target is reset or changed.
|
99 |
|
|
*/
|
100 |
|
|
|
101 |
|
|
INT32
|
102 |
|
|
config_cmd(token, token_count)
|
103 |
|
|
char *token[];
|
104 |
|
|
int token_count;
|
105 |
|
|
{
|
106 |
|
|
int processor;
|
107 |
|
|
int coprocessor;
|
108 |
|
|
char revision;
|
109 |
|
|
char prtbuf[256];
|
110 |
|
|
|
111 |
|
|
INT32 retval;
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
/* Get target CONFIG */
|
115 |
|
|
if ((retval = Mini_config_req(&target_config, &versions_etc)) != SUCCESS) {
|
116 |
|
|
return(retval);
|
117 |
|
|
};
|
118 |
|
|
/* If returned SUCCESSfully do the rest */
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
/* Print out configuration information
|
123 |
|
|
** Note: a -1 is no coprocessor present, 0 is an
|
124 |
|
|
** Am29027 (revision A), etc ... To get
|
125 |
|
|
** the array index for the coprocessor_name,
|
126 |
|
|
** add one to the target_config.coprocessor.
|
127 |
|
|
*/
|
128 |
|
|
|
129 |
|
|
/* ----------------------------------------------------------------- */
|
130 |
|
|
sprintf(&prtbuf[0], "\n");
|
131 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], " MiniMON29K R 3.0 Debugger Front End.\n");
|
132 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
133 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
134 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
135 |
|
|
|
136 |
|
|
/* ----------------------------------------------------------------- */
|
137 |
|
|
sprintf(&prtbuf[0], " Copyright 1993 Advanced Micro Devices, Inc.\n");
|
138 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], " Version %s (%s)\n",
|
139 |
|
|
host_config.version,
|
140 |
|
|
host_config.date);
|
141 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
142 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
143 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
144 |
|
|
|
145 |
|
|
/* ----------------------------------------------------------------- */
|
146 |
|
|
sprintf(&prtbuf[0], "\n");
|
147 |
|
|
if (target_config.processor_id == (UINT32) -1)
|
148 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s \n", processor_name[NO_PROCESSOR]);
|
149 |
|
|
|
150 |
|
|
else {
|
151 |
|
|
|
152 |
|
|
if ((target_config.processor_id & 0x58) == 0x58) {
|
153 |
|
|
revision = (char) ('A' + (target_config.processor_id & 0x07));
|
154 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s (revision %c)\n", "Am29205", (char) revision);
|
155 |
|
|
|
156 |
|
|
} else {
|
157 |
|
|
|
158 |
|
|
processor = (int) (target_config.processor_id >> 4);
|
159 |
|
|
revision = (char) ('A' + (target_config.processor_id & 0x0f));
|
160 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s (revision %c)\n", processor_name[processor], revision);
|
161 |
|
|
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
167 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
168 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
169 |
|
|
/* ----------------------------------------------------------------- */
|
170 |
|
|
coprocessor = (int) target_config.coprocessor + 1;
|
171 |
|
|
sprintf(&prtbuf[0], "\tCoprocessor: %s\n",
|
172 |
|
|
coprocessor_name[coprocessor]);
|
173 |
|
|
/* ----------------------------------------------------------------- */
|
174 |
|
|
if ((target_config.ROM_start == (ADDR32) -1) &&
|
175 |
|
|
(target_config.ROM_size == (INT32) -1)) {
|
176 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tROM range: Unavailable\n");
|
177 |
|
|
} else {
|
178 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tROM range: 0x%lx to 0x%lx (%luK)\n",
|
179 |
|
|
target_config.ROM_start,
|
180 |
|
|
(target_config.ROM_start + (ADDR32) target_config.ROM_size - 1),
|
181 |
|
|
(unsigned long) target_config.ROM_size/1024);
|
182 |
|
|
}
|
183 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
184 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
185 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
186 |
|
|
/* ----------------------------------------------------------------- */
|
187 |
|
|
if ((target_config.I_mem_start == (ADDR32) -1) &&
|
188 |
|
|
(target_config.I_mem_size == (INT32) -1)) {
|
189 |
|
|
sprintf(&prtbuf[0], "\tInstruction memory range: Unavailable\n");
|
190 |
|
|
} else {
|
191 |
|
|
sprintf(&prtbuf[0], "\tInstruction memory range: 0x%lx to 0x%lx (%luK)\n",
|
192 |
|
|
target_config.I_mem_start,
|
193 |
|
|
(target_config.I_mem_start + (ADDR32) target_config.I_mem_size - 1),
|
194 |
|
|
(unsigned long) target_config.I_mem_size/1024);
|
195 |
|
|
}
|
196 |
|
|
/* ----------------------------------------------------------------- */
|
197 |
|
|
if ((target_config.D_mem_start == (ADDR32) -1) &&
|
198 |
|
|
(target_config.D_mem_size == (INT32) -1)) {
|
199 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tData memory range: Unavailable\n");
|
200 |
|
|
} else {
|
201 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\tData memory range: 0x%lx to 0x%lx (%luK)\n",
|
202 |
|
|
target_config.D_mem_start,
|
203 |
|
|
(target_config.D_mem_start + (ADDR32) target_config.D_mem_size - 1),
|
204 |
|
|
(unsigned long) target_config.D_mem_size/1024);
|
205 |
|
|
}
|
206 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
207 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
208 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
209 |
|
|
/* ----------------------------------------------------------------- */
|
210 |
|
|
sprintf(&prtbuf[0], "\n");
|
211 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t (Enter 'h' or '?' for help)\n");
|
212 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\n");
|
213 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
214 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
215 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
216 |
|
|
/* ----------------------------------------------------------------- */
|
217 |
|
|
|
218 |
|
|
return (SUCCESS);
|
219 |
|
|
|
220 |
|
|
} /* end config_cmd() */
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
/*
|
226 |
|
|
** This command is used to print out help information.
|
227 |
|
|
*/
|
228 |
|
|
|
229 |
|
|
INT32
|
230 |
|
|
help_cmd(token, token_count)
|
231 |
|
|
char *token[];
|
232 |
|
|
int token_count;
|
233 |
|
|
{
|
234 |
|
|
int i;
|
235 |
|
|
char **help_ptr;
|
236 |
|
|
|
237 |
|
|
if (((strcmp(token[0], "h") != 0) &&
|
238 |
|
|
(strcmp(token[0], "?") != 0)) ||
|
239 |
|
|
(token_count > 2))
|
240 |
|
|
return (EMSYNTAX);
|
241 |
|
|
|
242 |
|
|
if (token_count == 1) {
|
243 |
|
|
help_ptr = help_main;
|
244 |
|
|
}
|
245 |
|
|
else
|
246 |
|
|
/* Print command-specific help line */
|
247 |
|
|
if (token_count == 2)
|
248 |
|
|
switch (*token[1]) {
|
249 |
|
|
case 'a': help_ptr = help_a;
|
250 |
|
|
break;
|
251 |
|
|
case 'b': help_ptr = help_b;
|
252 |
|
|
break;
|
253 |
|
|
case 'c':
|
254 |
|
|
if (strcmp(token[1], "caps") == 0)
|
255 |
|
|
help_ptr = help_caps;
|
256 |
|
|
else if (strcmp(token[1], "cp") == 0)
|
257 |
|
|
help_ptr = help_cp;
|
258 |
|
|
else if (strcmp(token[1], "con") == 0)
|
259 |
|
|
help_ptr = help_con;
|
260 |
|
|
else if (strcmp(token[1], "ch0") == 0)
|
261 |
|
|
help_ptr = help_ch0;
|
262 |
|
|
else
|
263 |
|
|
help_ptr = help_c;
|
264 |
|
|
break;
|
265 |
|
|
case 'd': help_ptr = help_d;
|
266 |
|
|
if (strcmp(token[1], "disc") == 0)
|
267 |
|
|
help_ptr = help_disc;
|
268 |
|
|
else if (strcmp(token[1], "dp") == 0)
|
269 |
|
|
help_ptr = help_dp;
|
270 |
|
|
break;
|
271 |
|
|
case 'e': help_ptr = help_e;
|
272 |
|
|
if (strcmp(token[1], "ex") == 0)
|
273 |
|
|
help_ptr = help_ex;
|
274 |
|
|
else if (strcmp(token[1], "esc") == 0)
|
275 |
|
|
help_ptr = help_esc;
|
276 |
|
|
else if (strcmp(token[1], "eon") == 0)
|
277 |
|
|
help_ptr = help_eon;
|
278 |
|
|
else if (strcmp(token[1], "eoff") == 0)
|
279 |
|
|
help_ptr = help_eon;
|
280 |
|
|
break;
|
281 |
|
|
case 'f': help_ptr = help_f;
|
282 |
|
|
break;
|
283 |
|
|
case 'g': help_ptr = help_g;
|
284 |
|
|
break;
|
285 |
|
|
case 'h': help_ptr = help_h;
|
286 |
|
|
break;
|
287 |
|
|
case 'i': help_ptr = help_i;
|
288 |
|
|
if (strcmp (token[1],"init") == 0)
|
289 |
|
|
help_ptr = help_init;
|
290 |
|
|
break;
|
291 |
|
|
case 'k': help_ptr = help_k;
|
292 |
|
|
break;
|
293 |
|
|
case 'l': help_ptr = help_l;
|
294 |
|
|
if (strcmp (token[1], "logon") == 0)
|
295 |
|
|
help_ptr = help_logon;
|
296 |
|
|
else if (strcmp (token[1], "logoff") == 0)
|
297 |
|
|
help_ptr = help_logon;
|
298 |
|
|
break;
|
299 |
|
|
case 'm': help_ptr = help_m;
|
300 |
|
|
break;
|
301 |
|
|
case 'p': help_ptr = help_pid;
|
302 |
|
|
break;
|
303 |
|
|
case 'q': help_ptr = help_q;
|
304 |
|
|
if (strcmp(token[1], "qon") == 0)
|
305 |
|
|
help_ptr = help_qoff;
|
306 |
|
|
else if (strcmp(token[1], "qoff") == 0)
|
307 |
|
|
help_ptr = help_qoff;
|
308 |
|
|
break;
|
309 |
|
|
case 'r': help_ptr = help_r;
|
310 |
|
|
break;
|
311 |
|
|
case 's': help_ptr = help_s;
|
312 |
|
|
if (strcmp(token[1], "sid") == 0)
|
313 |
|
|
help_ptr = help_sid;
|
314 |
|
|
break;
|
315 |
|
|
case 't': help_ptr = help_t;
|
316 |
|
|
if (strcmp(token[1], "tip") == 0)
|
317 |
|
|
help_ptr = help_tip;
|
318 |
|
|
break;
|
319 |
|
|
case 'x': help_ptr = help_x;
|
320 |
|
|
break;
|
321 |
|
|
case 'y': help_ptr = help_y;
|
322 |
|
|
break;
|
323 |
|
|
case 'z': help_ptr = help_zc;
|
324 |
|
|
if (strcmp(token[1], "ze") == 0)
|
325 |
|
|
help_ptr = help_ze;
|
326 |
|
|
else if (strcmp(token[1], "zl") == 0)
|
327 |
|
|
help_ptr = help_zl;
|
328 |
|
|
break;
|
329 |
|
|
default: help_ptr = help_main;
|
330 |
|
|
break;
|
331 |
|
|
} /* end switch */
|
332 |
|
|
else
|
333 |
|
|
/* Too many parameters */
|
334 |
|
|
return (EMSYNTAX);
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
i=0;
|
338 |
|
|
while (*help_ptr[i] != '\0') {
|
339 |
|
|
fprintf(stderr, "\n%s", help_ptr[i]);
|
340 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
341 |
|
|
fprintf (io_config.echo_file, "\n%s", help_ptr[i]);
|
342 |
|
|
i=i+1;
|
343 |
|
|
} /* end while */
|
344 |
|
|
fprintf(stderr, "\n");
|
345 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
346 |
|
|
fprintf(io_config.echo_file, "\n");
|
347 |
|
|
|
348 |
|
|
return (SUCCESS);
|
349 |
|
|
} /* end help_cmd() */
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
/*
|
354 |
|
|
** This command toggles control of the keyboard between
|
355 |
|
|
** TERM_USER and TERM_29K.
|
356 |
|
|
**
|
357 |
|
|
** IMPORTANT NOTE
|
358 |
|
|
** This command is no longer used. It was an attempt to
|
359 |
|
|
** toggle control between the host and the target when the
|
360 |
|
|
** target is displaying output and accepting input.
|
361 |
|
|
** The UDI methodology allows this control to be handled by the
|
362 |
|
|
** UDIWait procedures. Hence, this io_toggle_cmd is not used.
|
363 |
|
|
** It is left here only as an historical anomoly
|
364 |
|
|
**
|
365 |
|
|
** The i command is now used for ix, ia, il the 2903x cashe
|
366 |
|
|
** which is contained in the monitor.c code.
|
367 |
|
|
** END OF IMPORTANT NOTE
|
368 |
|
|
*/
|
369 |
|
|
|
370 |
|
|
INT32
|
371 |
|
|
io_toggle_cmd(token, token_count)
|
372 |
|
|
char *token[];
|
373 |
|
|
int token_count;
|
374 |
|
|
{
|
375 |
|
|
|
376 |
|
|
if ((strcmp(token[0], "io_toggle") != 0) ||
|
377 |
|
|
(token_count != 1))
|
378 |
|
|
return (EMSYNTAX);
|
379 |
|
|
|
380 |
|
|
if (io_config.io_control == TERM_29K)
|
381 |
|
|
io_config.io_control = TERM_USER;
|
382 |
|
|
else
|
383 |
|
|
if (io_config.io_control == TERM_USER)
|
384 |
|
|
io_config.io_control = TERM_29K;
|
385 |
|
|
else
|
386 |
|
|
return(EMFAIL);
|
387 |
|
|
|
388 |
|
|
fprintf(stderr, "%s\n", io_control_name[io_config.io_control]);
|
389 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
390 |
|
|
fprintf(io_config.echo_file, "%s\n", io_control_name[io_config.io_control]);
|
391 |
|
|
|
392 |
|
|
return(0);
|
393 |
|
|
|
394 |
|
|
} /* end io_toggle_cmd() */
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
/*
|
400 |
|
|
** This command send a BREAK message to the target. This
|
401 |
|
|
** should halt execution of user code. A HALT message should
|
402 |
|
|
** be returned by the target. This function deos not, however,
|
403 |
|
|
** wait for the HALT message.
|
404 |
|
|
*/
|
405 |
|
|
|
406 |
|
|
INT32
|
407 |
|
|
kill_cmd(token, token_count)
|
408 |
|
|
char *token[];
|
409 |
|
|
int token_count;
|
410 |
|
|
{
|
411 |
|
|
int result;
|
412 |
|
|
INT32 retval;
|
413 |
|
|
|
414 |
|
|
result = -1;
|
415 |
|
|
if ((strcmp(token[0], "k") != 0) ||
|
416 |
|
|
(token_count != 1))
|
417 |
|
|
return (EMSYNTAX);
|
418 |
|
|
|
419 |
|
|
if ((retval = Mini_break()) != SUCCESS) {
|
420 |
|
|
return(FAILURE);
|
421 |
|
|
};
|
422 |
|
|
return(SUCCESS);
|
423 |
|
|
|
424 |
|
|
} /* end kill_cmd() */
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
/*
|
429 |
|
|
** This command send a RESET message to the target. This
|
430 |
|
|
** should restart the target code. A HALT message should
|
431 |
|
|
** be returned by the target. This function deos not, however,
|
432 |
|
|
** wait for the HALT message.
|
433 |
|
|
*/
|
434 |
|
|
|
435 |
|
|
INT32
|
436 |
|
|
reset_cmd(token, token_count)
|
437 |
|
|
char *token[];
|
438 |
|
|
int token_count;
|
439 |
|
|
{
|
440 |
|
|
int result;
|
441 |
|
|
INT32 retval;
|
442 |
|
|
|
443 |
|
|
result = -1;
|
444 |
|
|
if ((strcmp(token[0], "r") != 0) ||
|
445 |
|
|
(token_count != 1))
|
446 |
|
|
return (EMSYNTAX);
|
447 |
|
|
|
448 |
|
|
if ((retval = Mini_reset_processor()) != SUCCESS) {
|
449 |
|
|
return(FAILURE);
|
450 |
|
|
} else
|
451 |
|
|
return(SUCCESS);
|
452 |
|
|
|
453 |
|
|
} /* end reset_cmd() */
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
/*
|
462 |
|
|
** This command is used to display the versions of the various
|
463 |
|
|
** MINIMON 29K modules. First the version of the host code and
|
464 |
|
|
** its date is printed from the global data structure "host_config".
|
465 |
|
|
** Next the montip version field and date is printed from
|
466 |
|
|
** the VERSION_SPACE UDIRead call. This is an ascii zero terminated
|
467 |
|
|
** field of ** less than 11 characters.
|
468 |
|
|
** Next the "version" field in the "target_config" data structure is
|
469 |
|
|
** printed. This "version field is encoded as follows:
|
470 |
|
|
**
|
471 |
|
|
** Bits 0 - 7: Target debug core version
|
472 |
|
|
** Bits 8 - 15: Configuration version
|
473 |
|
|
** Bits 16 - 23: Message system version
|
474 |
|
|
** Bits 24 - 31: Communication driver version
|
475 |
|
|
**
|
476 |
|
|
** Each eight bit field is further broken up into two four bit
|
477 |
|
|
** fields. The first four bits is the "release" number, the
|
478 |
|
|
** second is the "version" number. This is typically printed
|
479 |
|
|
** as <version>.<release>. i.e. version=2, release=6 is
|
480 |
|
|
** printed as "2.6".
|
481 |
|
|
**
|
482 |
|
|
*/
|
483 |
|
|
|
484 |
|
|
/*
|
485 |
|
|
** The os version number is coded into the eighth word of the
|
486 |
|
|
**configuration message. It is in the lower 8 bits.
|
487 |
|
|
** Bits 0 - 7: OS version
|
488 |
|
|
**
|
489 |
|
|
*/
|
490 |
|
|
|
491 |
|
|
INT32
|
492 |
|
|
version_cmd(token, token_count)
|
493 |
|
|
char *token[];
|
494 |
|
|
int token_count;
|
495 |
|
|
{
|
496 |
|
|
int comm_version;
|
497 |
|
|
int message_version;
|
498 |
|
|
int config_version;
|
499 |
|
|
int debug_core_version;
|
500 |
|
|
char tip_version[12];
|
501 |
|
|
char tip_date[12];
|
502 |
|
|
int os_version; /* eighth word of config message */
|
503 |
|
|
INT32 junk;
|
504 |
|
|
char prtbuf[256];
|
505 |
|
|
INT32 retval;
|
506 |
|
|
|
507 |
|
|
if ((strcmp(token[0], "ver") != 0) ||
|
508 |
|
|
(token_count != 1))
|
509 |
|
|
return (EMSYNTAX);
|
510 |
|
|
|
511 |
|
|
/* byte count is 40 because 4 bytes for target version
|
512 |
|
|
4 bytes for os version
|
513 |
|
|
12 bytes for tip version
|
514 |
|
|
12 bytes for tip date
|
515 |
|
|
4 for msgbuf size
|
516 |
|
|
4 for max bkpts */
|
517 |
|
|
if ((retval = Mini_read_req ((INT32) VERSION_SPACE,
|
518 |
|
|
(ADDR32) 0,
|
519 |
|
|
(INT32) 1,
|
520 |
|
|
(INT16) 40,
|
521 |
|
|
(INT32 *) &junk,
|
522 |
|
|
(BYTE *) &(versions_etc.version),
|
523 |
|
|
TRUE)) != SUCCESS)
|
524 |
|
|
return (FAILURE);
|
525 |
|
|
|
526 |
|
|
comm_version = (int) ((versions_etc.version >> 24) & 0x00ff);
|
527 |
|
|
message_version = (int) ((versions_etc.version >> 16) & 0x00ff);
|
528 |
|
|
config_version = (int) ((versions_etc.version >> 8) & 0x00ff);
|
529 |
|
|
debug_core_version = (int) ((versions_etc.version) & 0x00ff);
|
530 |
|
|
strcpy(tip_version,versions_etc.tip_version);
|
531 |
|
|
strcpy(tip_date,versions_etc.tip_date);
|
532 |
|
|
os_version = (int) ((versions_etc.os_version ) & 0x00ff);
|
533 |
|
|
|
534 |
|
|
|
535 |
|
|
sprintf(&prtbuf[0], "\n");
|
536 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\n");
|
537 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], " MiniMON29K R3.0\n");
|
538 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
539 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
540 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
541 |
|
|
sprintf(&prtbuf[0], " Copyright 1993 Advanced Micro Devices, Inc.\n");
|
542 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\n");
|
543 |
|
|
|
544 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
545 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
546 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
547 |
|
|
sprintf(&prtbuf[0], "\t Host code:\n");
|
548 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Version %s\n",
|
549 |
|
|
host_config.version);
|
550 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Date: %s\n",
|
551 |
|
|
host_config.date);
|
552 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\n");
|
553 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
554 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
555 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
556 |
|
|
|
557 |
|
|
sprintf(&prtbuf[0], "\t Tip code:\n");
|
558 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Version %s\n",
|
559 |
|
|
tip_version);
|
560 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Date: %s\n",
|
561 |
|
|
tip_date);
|
562 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\n");
|
563 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
564 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
565 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
566 |
|
|
|
567 |
|
|
sprintf(&prtbuf[0], "\t Target code:\n");
|
568 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Debug core version: %d.%d\n",
|
569 |
|
|
((debug_core_version >> 4) & 0x0f),
|
570 |
|
|
(debug_core_version & 0x0f));
|
571 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Configuration version: %d.%d\n",
|
572 |
|
|
((config_version >> 4) & 0x0f),
|
573 |
|
|
(config_version & 0x0f));
|
574 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Message system version: %d.%d\n",
|
575 |
|
|
((message_version >> 4) & 0x0f),
|
576 |
|
|
(message_version & 0x0f));
|
577 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t Communication driver version: %d.%d\n",
|
578 |
|
|
((comm_version >> 4) & 0x0f),
|
579 |
|
|
(comm_version & 0x0f));
|
580 |
|
|
|
581 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\t\t OS system version: %d.%d\n",
|
582 |
|
|
((os_version >> 4) & 0x0f),
|
583 |
|
|
(os_version & 0x0f));
|
584 |
|
|
|
585 |
|
|
|
586 |
|
|
sprintf(&prtbuf[strlen(prtbuf)], "\n");
|
587 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
588 |
|
|
fprintf (io_config.echo_file, "%s", &prtbuf[0]);
|
589 |
|
|
fprintf (stderr, "%s", &prtbuf[0]);
|
590 |
|
|
|
591 |
|
|
fprintf(stderr, "Maximum message buffer size on target: 0x%lx\n",versions_etc.max_msg_size);
|
592 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
593 |
|
|
fprintf(io_config.echo_file, "Maximum message buffer size on target: 0x%lx\n",versions_etc.max_msg_size);
|
594 |
|
|
fprintf(stderr, "Maximum number of breakpoints on target: %ld\n", versions_etc.max_bkpts);
|
595 |
|
|
if (io_config.echo_mode == (INT32) TRUE)
|
596 |
|
|
fprintf(io_config.echo_file, "Maximum message buffer size on target: 0x%lx\n",versions_etc.max_msg_size);
|
597 |
|
|
return (SUCCESS);
|
598 |
|
|
|
599 |
|
|
} /* end version_cmd() */
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
|