📄 commands.c
字号:
static char _[] = " @(#)commands.c 5.23 93/08/23 15:30:30, Srini, AMD ";/****************************************************************************** * Copyright 1992 Advanced Micro Devices, Inc. * * This software is the property of Advanced Micro Devices, Inc (AMD) which * specifically grants the user the right to modify, use and distribute this * software provided this notice is not removed or altered. All other rights * are reserved by AMD. * * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR * USE OF THIS SOFTWARE. * * So that all may benefit from your experience, please report any problems * or suggestions about this software to the 29K Technical Support Center at * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. * * Advanced Micro Devices, Inc. * 29K Support Products * Mail Stop 573 * 5900 E. Ben White Blvd. * Austin, TX 78741 * 800-292-9263 ***************************************************************************** * Engineer: Srini Subramanian. ***************************************************************************** ** This file contains the functions associated with ** commands used by the main program. In general, ** the commands in this file are fairly simple and ** were not given a source file of their own. ***************************************************************************** */#include <stdio.h>#include <ctype.h>#include "memspcs.h"#include "main.h"#include "monitor.h"#include "macros.h"#include "help.h"#include "miniint.h"#include "error.h"#ifdef MSDOS#include <stdlib.h>#include <string.h>#else#include <strings.h>#endifextern int get_addr_29k PARAMS((char *, struct addr_29k_t *));extern int addr_29k_ok PARAMS((struct addr_29k_t *));extern int get_word PARAMS((char *, INT32 *));/*** Global variables*/static char *processor_name[] = { /* 0 */ "Am29000", /* 1 */ "Am29005", /* 2 */ "Am29050", /* 3 */ "Am29035", /* 4 */ "Am29030", /* 5 */ "Am29200", /* 6 */ "Am29240", /* 7 */ "Cougar", /* 8 */ "TBA", /* 9 */ "TBA" };#define NO_PROCESSOR 9static char *coprocessor_name[] = { /* 0 */ "None", /* 1 */ "Am29027 (revision A)", };static char *io_control_name[] = { /* 0 */ "Console controlled by target.", /* 1 */ "Console controlled by host." };/*** This command is used to print out the configuration** of the system. This includes both host and target** configurations.**** This command also re-allocates the message buffers** and the breakpoint array. This permits this command** to be used to re-configure the host for a new target** without restarting the monitor. This is useful in cases** where the target is reset or changed.*/INT32config_cmd(token, token_count) char *token[]; int token_count; { int processor; int coprocessor; char revision; char prtbuf[256]; INT32 retval; /* Get target CONFIG */ if ((retval = Mini_config_req(&target_config, &versions_etc)) != SUCCESS) { return(retval); }; /* If returned SUCCESSfully do the rest */ /* Print out configuration information ** Note: a -1 is no coprocessor present, 0 is an ** Am29027 (revision A), etc ... To get ** the array index for the coprocessor_name, ** add one to the target_config.coprocessor. *//* ----------------------------------------------------------------- */ sprintf(&prtbuf[0], "\n"); sprintf(&prtbuf[strlen(prtbuf)], " MiniMON29K R 3.0 Debugger Front End.\n"); if (io_config.echo_mode == (INT32) TRUE) fprintf (io_config.echo_file, "%s", &prtbuf[0]); fprintf (stderr, "%s", &prtbuf[0]);/* ----------------------------------------------------------------- */ sprintf(&prtbuf[0], " Copyright 1993 Advanced Micro Devices, Inc.\n"); sprintf(&prtbuf[strlen(prtbuf)], " Version %s (%s)\n", host_config.version, host_config.date); if (io_config.echo_mode == (INT32) TRUE) fprintf (io_config.echo_file, "%s", &prtbuf[0]); fprintf (stderr, "%s", &prtbuf[0]);/* ----------------------------------------------------------------- */ sprintf(&prtbuf[0], "\n"); if (target_config.processor_id == (UINT32) -1) sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s \n", processor_name[NO_PROCESSOR]); else { if ((target_config.processor_id & 0x58) == 0x58) { revision = (char) ('A' + (target_config.processor_id & 0x07)); sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s (revision %c)\n", "Am29205", (char) revision); } else { processor = (int) (target_config.processor_id >> 4); revision = (char) ('A' + (target_config.processor_id & 0x0f)); sprintf(&prtbuf[strlen(prtbuf)], "\tProcessor type: %s (revision %c)\n", processor_name[processor], revision); } } if (io_config.echo_mode == (INT32) TRUE) fprintf (io_config.echo_file, "%s", &prtbuf[0]); fprintf (stderr, "%s", &prtbuf[0]);/* ----------------------------------------------------------------- */ coprocessor = (int) target_config.coprocessor + 1; sprintf(&prtbuf[0], "\tCoprocessor: %s\n", coprocessor_name[coprocessor]);/* ----------------------------------------------------------------- */ if ((target_config.ROM_start == (ADDR32) -1) && (target_config.ROM_size == (INT32) -1)) { sprintf(&prtbuf[strlen(prtbuf)], "\tROM range: Unavailable\n"); } else { sprintf(&prtbuf[strlen(prtbuf)], "\tROM range: 0x%lx to 0x%lx (%luK)\n", target_config.ROM_start, (target_config.ROM_start + (ADDR32) target_config.ROM_size - 1), (unsigned long) target_config.ROM_size/1024); } if (io_config.echo_mode == (INT32) TRUE) fprintf (io_config.echo_file, "%s", &prtbuf[0]); fprintf (stderr, "%s", &prtbuf[0]);/* ----------------------------------------------------------------- */ if ((target_config.I_mem_start == (ADDR32) -1) && (target_config.I_mem_size == (INT32) -1)) { sprintf(&prtbuf[0], "\tInstruction memory range: Unavailable\n"); } else { sprintf(&prtbuf[0], "\tInstruction memory range: 0x%lx to 0x%lx (%luK)\n", target_config.I_mem_start, (target_config.I_mem_start + (ADDR32) target_config.I_mem_size - 1), (unsigned long) target_config.I_mem_size/1024); }/* ----------------------------------------------------------------- */ if ((target_config.D_mem_start == (ADDR32) -1) && (target_config.D_mem_size == (INT32) -1)) { sprintf(&prtbuf[strlen(prtbuf)], "\tData memory range: Unavailable\n"); } else { sprintf(&prtbuf[strlen(prtbuf)], "\tData memory range: 0x%lx to 0x%lx (%luK)\n", target_config.D_mem_start, (target_config.D_mem_start + (ADDR32) target_config.D_mem_size - 1), (unsigned long) target_config.D_mem_size/1024); } if (io_config.echo_mode == (INT32) TRUE) fprintf (io_config.echo_file, "%s", &prtbuf[0]); fprintf (stderr, "%s", &prtbuf[0]);/* ----------------------------------------------------------------- */ sprintf(&prtbuf[0], "\n"); sprintf(&prtbuf[strlen(prtbuf)], "\t (Enter 'h' or '?' for help)\n"); sprintf(&prtbuf[strlen(prtbuf)], "\n"); if (io_config.echo_mode == (INT32) TRUE) fprintf (io_config.echo_file, "%s", &prtbuf[0]); fprintf (stderr, "%s", &prtbuf[0]);/* ----------------------------------------------------------------- */ return (SUCCESS); } /* end config_cmd() *//*** This command is used to print out help information.*/INT32help_cmd(token, token_count) char *token[]; int token_count; { int i; char **help_ptr; if (((strcmp(token[0], "h") != 0) && (strcmp(token[0], "?") != 0)) || (token_count > 2)) return (EMSYNTAX); if (token_count == 1) { help_ptr = help_main; } else /* Print command-specific help line */ if (token_count == 2) switch (*token[1]) { case 'a': help_ptr = help_a; break; case 'b': help_ptr = help_b; break; case 'c': if (strcmp(token[1], "caps") == 0) help_ptr = help_caps; else if (strcmp(token[1], "cp") == 0) help_ptr = help_cp; else if (strcmp(token[1], "con") == 0) help_ptr = help_con; else if (strcmp(token[1], "ch0") == 0) help_ptr = help_ch0; else help_ptr = help_c; break; case 'd': help_ptr = help_d; if (strcmp(token[1], "disc") == 0) help_ptr = help_disc; else if (strcmp(token[1], "dp") == 0) help_ptr = help_dp; break; case 'e': help_ptr = help_e; if (strcmp(token[1], "ex") == 0) help_ptr = help_ex; else if (strcmp(token[1], "esc") == 0) help_ptr = help_esc; else if (strcmp(token[1], "eon") == 0) help_ptr = help_eon; else if (strcmp(token[1], "eoff") == 0) help_ptr = help_eon; break; case 'f': help_ptr = help_f; break; case 'g': help_ptr = help_g; break; case 'h': help_ptr = help_h; break; case 'i': help_ptr = help_i; if (strcmp (token[1],"init") == 0) help_ptr = help_init; break; case 'k': help_ptr = help_k; break; case 'l': help_ptr = help_l; if (strcmp (token[1], "logon") == 0) help_ptr = help_logon; else if (strcmp (token[1], "logoff") == 0) help_ptr = help_logon; break; case 'm': help_ptr = help_m; break; case 'p': help_ptr = help_pid; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -