1 /* Remote target glue for the WinBond ROM monitor running on the "Cougar"
4 Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
28 static void w89k_open PARAMS ((char *args, int from_tty));
31 * this array of registers need to match the indexes used by GDB. The
32 * whole reason this exists is cause the various ROM monitors use
33 * different strings than GDB does, and doesn't support all the
34 * registers either. So, typing "info reg sp" becomes a "r30".
36 static char *w89k_regnames[NUM_REGS] =
38 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
39 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
40 "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
41 "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
42 "SAR", "PC", NULL, NULL, NULL, "EIEM", "IIR", "IVA",
43 "IOR", "IPSW", NULL, NULL, NULL, NULL, NULL,
44 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
45 "CCR", NULL, NULL, "TR0", "TR1",
49 w89k_supply_register (regname, regnamelen, val, vallen)
72 regno = R0_REGNUM + 4;
75 regno = R0_REGNUM + 8;
80 if (regname[1] == 'C')
84 else if (regnamelen == 3)
89 if (regname[1] == '1' && regname[2] == '2')
90 regno = R0_REGNUM + 12;
91 else if (regname[1] == '1' && regname[2] == '6')
92 regno = R0_REGNUM + 16;
93 else if (regname[1] == '2' && regname[2] == '0')
94 regno = R0_REGNUM + 20;
95 else if (regname[1] == '2' && regname[2] == '4')
96 regno = R0_REGNUM + 24;
97 else if (regname[1] == '2' && regname[2] == '8')
98 regno = R0_REGNUM + 28;
101 if (regname[1] == 'C' && regname[2] == 'R')
105 if (regname[1] == 'C' && regname[2] == 'R')
109 if (regname[1] == 'A' && regname[2] == 'R')
113 if (regname[1] == 'I' && regname[2] == 'R')
115 else if (regname[1] == 'O' && regname[2] == 'R')
120 if (regname[1] == 'R')
121 if (regname[2] == '0')
123 else if (regname[2] == '4')
124 regno = TR0_REGNUM + 4;
127 else if (regnamelen == 4)
131 if (regname[1] == 'I')
132 if (regname[2] == 'E' && regname[3] == 'M')
136 if (regname[1] == 'P' && regname[2] == 'S' && regname[3] == 'W')
140 else if (regnamelen == 5)
144 if (regname[1] == 'A'
147 && regname[4] == 'B')
148 regno = PCOQ_TAIL_REGNUM;
153 while (numregs-- > 0)
154 val = monitor_supply_register (regno++, val);
158 * Define the monitor command strings. Since these are passed directly
159 * through to a printf style function, we need can include formatting
160 * strings. We also need a CR or LF on the end.
163 static struct target_ops w89k_ops;
165 static char *w89k_loadtypes[] = {"srec", NULL};
166 static char *w89k_loadprotos[] = {"xmodem", NULL};
168 static char *w89k_inits[] = {"\r", NULL};
170 static struct monitor_ops w89k_cmds =
172 MO_GETMEM_NEEDS_RANGE|MO_FILL_USES_ADDR, /* flags */
173 w89k_inits, /* Init strings */
174 "g\r", /* continue command */
175 "t\r", /* single step */
176 NULL, /* Interrupt char */
177 "bp %x\r", /* set a breakpoint */
178 "bc %x\r", /* clear a breakpoint */
179 "bc *\r", /* clear all breakpoints */
180 "f %x %x %x\r", /* memory fill cmd */
182 "eb %x %x\r", /* setmem.cmdb (addr, value) */
183 "eh %x %x\r", /* setmem.cmdw (addr, value) */
184 "ew %x %x\r", /* setmem.cmdl (addr, value) */
185 NULL, /* setmem.cmdll (addr, value) */
186 NULL, /* setreg.resp_delim */
187 NULL, /* setreg.term */
188 NULL, /* setreg.term_cmd */
191 "db %x %x\r", /* getmem.cmdb (startaddr, endaddr) */
192 "dh %x %x\r", /* getmem.cmdw (startaddr, endaddr) */
193 "dw %x %x\r", /* getmem.cmdl (startaddr, endaddr) */
194 NULL, /* getmem.cmdll (startaddr, endaddr) */
195 " ", /* getmem.resp_delim */
196 NULL, /* getmem.term */
197 NULL, /* getmem.term_cmd */
200 "r %s %x\r", /* setreg.cmd (name, value) */
201 NULL, /* setreg.resp_delim */
202 NULL, /* setreg.term */
203 NULL, /* setreg.term_cmd */
206 "r %s\r", /* getreg.cmd (name) */
207 "\r", /* getreg.resp_delim */
208 NULL, /* getreg.term */
209 NULL, /* getreg.term_cmd */
211 "r\r", /* dump_registers */
212 "\\(\\w+\\)\\( +[0-9a-fA-F]+\\b\\)+",
213 w89k_supply_register, /* supply_register */
214 "u\r", /* download command */
215 "u\n\r", /* load response */
216 "ROM>", /* monitor command prompt */
217 NULL, /* end-of-command delimitor */
218 NULL, /* optional command terminator */
219 &w89k_ops, /* target operations */
220 w89k_loadtypes, /* loadtypes */
221 w89k_loadprotos, /* loadprotos */
222 "9600", /* supported baud rates */
223 SERIAL_1_STOPBITS, /* number of stop bits */
224 w89k_regnames, /* register names */
225 MONITOR_OPS_MAGIC /* magic */
229 w89k_open(args, from_tty)
233 monitor_open (args, &w89k_cmds, from_tty);
239 init_monitor_ops (&w89k_ops);
241 w89k_ops.to_shortname = "w89k";
242 w89k_ops.to_longname = "WinBond's debug monitor for the W89k Eval board";
243 w89k_ops.to_doc = "Debug on a WinBond W89K eval board.\n\
244 Specify the serial device it is connected to (e.g. /dev/ttya).";
245 w89k_ops.to_open = w89k_open;
247 add_target (&w89k_ops);