Tweak to match output of autoconf 2.9 with same cygnus local patch as
[deliverable/binutils-gdb.git] / gdb / remote-est.c
CommitLineData
93584146 1/* Remote debugging interface for EST-300 ICE, for GDB
5de0c648 2 Copyright 1995 Free Software Foundation, Inc.
93584146
SC
3 Contributed by Cygnus Support.
4
5 Written by Steve Chamberlain for Cygnus Support.
a25a9f49 6 Re-written by Stu Grossman of Cygnus Support
93584146 7
5de0c648 8This file is part of GDB.
93584146 9
5de0c648
SG
10This program is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2 of the License, or
13(at your option) any later version.
93584146 14
5de0c648
SG
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
93584146 19
5de0c648
SG
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
6c9638b4 22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
93584146 23
93584146 24#include "defs.h"
93584146
SC
25#include "gdbcore.h"
26#include "target.h"
a25a9f49 27#include "monitor.h"
93584146 28#include "serial.h"
93584146 29
a25a9f49 30static void est_open PARAMS ((char *args, int from_tty));
93584146 31
93584146 32static void
a25a9f49
SG
33est_supply_register (regname, regnamelen, val, vallen)
34 char *regname;
35 int regnamelen;
36 char *val;
37 int vallen;
93584146
SC
38{
39 int regno;
40
a25a9f49 41 if (regnamelen != 2)
93584146 42 return;
93584146 43
a25a9f49 44 switch (regname[0])
93584146 45 {
a25a9f49
SG
46 case 'S':
47 if (regname[1] != 'R')
48 return;
49 regno = PS_REGNUM;
93584146 50 break;
a25a9f49
SG
51 case 'P':
52 if (regname[1] != 'C')
53 return;
54 regno = PC_REGNUM;
93584146 55 break;
a25a9f49
SG
56 case 'D':
57 if (regname[1] < '0' || regname[1] > '7')
58 return;
59 regno = regname[1] - '0' + D0_REGNUM;
93584146 60 break;
a25a9f49
SG
61 case 'A':
62 if (regname[1] < '0' || regname[1] > '7')
63 return;
64 regno = regname[1] - '0' + A0_REGNUM;
65 break;
66 default:
67 return;
93584146 68 }
a25a9f49
SG
69
70 monitor_supply_register (regno, val);
93584146
SC
71}
72
a25a9f49
SG
73/*
74 * This array of registers needs to match the indexes used by GDB. The
75 * whole reason this exists is because the various ROM monitors use
76 * different names than GDB does, and don't support all the
77 * registers either. So, typing "info reg sp" becomes a "r30".
78 */
79
80static char *est_regnames[NUM_REGS] =
93584146 81{
a25a9f49
SG
82 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
83 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
84 "SR", "PC",
85};
93584146 86
a25a9f49
SG
87/*
88 * Define the monitor command strings. Since these are passed directly
89 * through to a printf style function, we need can include formatting
90 * strings. We also need a CR or LF on the end.
91 */
92
93static struct target_ops est_ops;
94
a25a9f49
SG
95static char *est_inits[] = {"he\r", /* Resets the prompt, and clears repeated cmds */
96 NULL};
97
98static struct monitor_ops est_cmds =
99{
100 MO_CLR_BREAK_USES_ADDR | MO_FILL_USES_ADDR | MO_NEED_REGDUMP_AFTER_CONT,
101 est_inits, /* Init strings */
102 "go\r", /* continue command */
103 "sidr\r", /* single step */
a706069f 104 "\003", /* ^C interrupts the program */
a25a9f49
SG
105 "sb %x\r", /* set a breakpoint */
106 "rb %x\r", /* clear a breakpoint */
107 "rb\r", /* clear all breakpoints */
108 "bfb %x %x %x\r", /* fill (start end val) */
109 {
110 "smb %x %x\r", /* setmem.cmdb (addr, value) */
111 "smw %x %x\r", /* setmem.cmdw (addr, value) */
112 "sml %x %x\r", /* setmem.cmdl (addr, value) */
113 NULL, /* setmem.cmdll (addr, value) */
114 NULL, /* setreg.resp_delim */
115 NULL, /* setreg.term */
116 NULL, /* setreg.term_cmd */
117 },
118 {
119 "dmb %x %x\r", /* getmem.cmdb (addr, len) */
120 "dmw %x %x\r", /* getmem.cmdw (addr, len) */
121 "dml %x %x\r", /* getmem.cmdl (addr, len) */
122 NULL, /* getmem.cmdll (addr, len) */
123 ": ", /* getmem.resp_delim */
124 NULL, /* getmem.term */
125 NULL, /* getmem.term_cmd */
126 },
127 {
128 "sr %s %x\r", /* setreg.cmd (name, value) */
129 NULL, /* setreg.resp_delim */
130 NULL, /* setreg.term */
131 NULL /* setreg.term_cmd */
132 },
133 {
134 "dr %s\r", /* getreg.cmd (name) */
135 " = ", /* getreg.resp_delim */
136 NULL, /* getreg.term */
137 NULL /* getreg.term_cmd */
138 },
139 "dr\r", /* dump_registers */
140 "\\(\\w+\\) = \\([0-9a-fA-F]+\\)", /* register_pattern */
141 est_supply_register, /* supply_register */
5de0c648 142 NULL, /* load_routine (defaults to SRECs) */
a25a9f49
SG
143 "dl\r", /* download command */
144 "+", /* load response */
145 ">BKM>", /* monitor command prompt */
511ffbf2 146 "\r", /* end-of-line terminator */
a25a9f49
SG
147 NULL, /* optional command terminator */
148 &est_ops, /* target operations */
a25a9f49
SG
149 SERIAL_1_STOPBITS, /* number of stop bits */
150 est_regnames, /* registers names */
151 MONITOR_OPS_MAGIC /* magic */
152 };
93584146 153
bec6c6db 154static void
a25a9f49 155est_open(args, from_tty)
93584146
SC
156 char *args;
157 int from_tty;
158{
a25a9f49 159 monitor_open (args, &est_cmds, from_tty);
93584146
SC
160}
161
a25a9f49
SG
162void
163_initialize_est ()
93584146 164{
a25a9f49 165 init_monitor_ops (&est_ops);
93584146 166
a25a9f49
SG
167 est_ops.to_shortname = "est";
168 est_ops.to_longname = "EST background debug monitor";
169 est_ops.to_doc = "Debug via the EST BDM.\n\
170Specify the serial device it is connected to (e.g. /dev/ttya).";
171 est_ops.to_open = est_open;
93584146 172
93584146
SC
173 add_target (&est_ops);
174}
This page took 0.087592 seconds and 4 git commands to generate.