*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / rom68k-rom.c
CommitLineData
d108166f
SS
1/* Remote target glue for the ROM68K ROM monitor.
2 Copyright 1988, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
50e183a2
RS
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
6c9638b4 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
50e183a2 19
06b8f5e4
RS
20#include "defs.h"
21#include "gdbcore.h"
22#include "target.h"
23#include "monitor.h"
1265e2d8 24#include "serial.h"
06b8f5e4 25
5de0c648 26static void rom68k_open PARAMS ((char *args, int from_tty));
2081365f
SG
27
28static void
29rom68k_supply_register (regname, regnamelen, val, vallen)
30 char *regname;
31 int regnamelen;
32 char *val;
33 int vallen;
34{
35 int numregs;
36 int regno;
37
38 numregs = 1;
39 regno = -1;
40
41 if (regnamelen == 2)
5de0c648
SG
42 switch (regname[0])
43 {
44 case 'S':
45 if (regname[1] == 'R')
46 regno = PS_REGNUM;
47 break;
48 case 'P':
49 if (regname[1] == 'C')
50 regno = PC_REGNUM;
51 break;
52 case 'D':
53 if (regname[1] != 'R')
d108166f 54 break;
5de0c648
SG
55 regno = D0_REGNUM;
56 numregs = 8;
57 break;
58 case 'A':
59 if (regname[1] != 'R')
d108166f 60 break;
5de0c648
SG
61 regno = A0_REGNUM;
62 numregs = 7;
63 break;
64 }
2081365f 65 else if (regnamelen == 3)
5de0c648
SG
66 switch (regname[0])
67 {
68 case 'I':
69 if (regname[1] == 'S' && regname[2] == 'P')
70 regno = SP_REGNUM;
71 }
2081365f
SG
72
73 if (regno >= 0)
74 while (numregs-- > 0)
75 val = monitor_supply_register (regno++, val);
76}
06b8f5e4 77
d108166f
SS
78/* This array of registers need to match the indexes used by GDB.
79 This exists because the various ROM monitors use different strings
80 than does GDB, and don't necessarily support all the registers
81 either. So, typing "info reg sp" becomes a "r30". */
82
1265e2d8
SG
83static char *rom68k_regnames[NUM_REGS] = {
84 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
85 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
86 "SR", "PC" };
06b8f5e4 87
d108166f
SS
88/* Define the monitor command strings. Since these are passed directly
89 through to a printf style function, we may include formatting
90 strings. We also need a CR or LF on the end. */
06b8f5e4 91
32fa4b59 92static struct target_ops rom68k_ops;
06b8f5e4 93
a706069f
SG
94static char *rom68k_inits[] = {".\r\r", NULL}; /* Exits pm/pr & download cmds */
95
adc176bb
JM
96static struct monitor_ops rom68k_cmds ;
97static void init_rom68k_cmds(void)
1265e2d8 98{
adc176bb
JM
99 rom68k_cmds.flags = 0;
100 rom68k_cmds.init = rom68k_inits; /* monitor init string */
101 rom68k_cmds.cont = "go\r";
102 rom68k_cmds.step = "st\r";
103 rom68k_cmds.stop = NULL;
104 rom68k_cmds.set_break = "db %x\r";
105 rom68k_cmds.clr_break = "cb %x\r";
106 rom68k_cmds.clr_all_break = "cb *\r";
107 rom68k_cmds.fill = "fm %x %x %x\r";
108 rom68k_cmds.setmem.cmdb = "pm %x %x\r";
109 rom68k_cmds.setmem.cmdw = "pm;w %x %x\r";
110 rom68k_cmds.setmem.cmdl = "pm;l %x %x\r";
111 rom68k_cmds.setmem.cmdll = NULL;
112 rom68k_cmds.setmem.resp_delim = NULL;
113 rom68k_cmds.setmem.term = NULL;
114 rom68k_cmds.setmem.term_cmd = NULL;
115 rom68k_cmds.getmem.cmdb = "dm %x %x\r";
116 rom68k_cmds.getmem.cmdw = "dm;w %x %x\r";
117 rom68k_cmds.getmem.cmdl = "dm;l %x %x\r";
118 rom68k_cmds.getmem.cmdll = NULL;
119 rom68k_cmds.getmem.resp_delim = " ";
120 rom68k_cmds.getmem.term = NULL;
121 rom68k_cmds.getmem.term_cmd = NULL;
122 rom68k_cmds.setreg.cmd = "pr %s %x\r";
123 rom68k_cmds.setreg.resp_delim = NULL;
124 rom68k_cmds.setreg.term = NULL;
125 rom68k_cmds.setreg.term_cmd = NULL ;
126 rom68k_cmds.getreg.cmd = "pr %s\r" ;
127 rom68k_cmds.getreg.resp_delim = ": " ;
128 rom68k_cmds.getreg.term = "= " ;
129 rom68k_cmds.getreg.term_cmd = ";\r" ;
130 rom68k_cmds.dump_registers = "dr\r" ;
131 rom68k_cmds.register_pattern =
132 "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)" ;
133 rom68k_cmds.supply_register = rom68k_supply_register;
134 rom68k_cmds.load_routine = NULL;
135 rom68k_cmds.load = "dc\r";
136 rom68k_cmds.loadresp = "Waiting for S-records from host;.. ";
137 rom68k_cmds.prompt = "ROM68K :-> ";
138 rom68k_cmds.line_term = "\r";
139 rom68k_cmds.cmd_end = ";\r";
140 rom68k_cmds.target = &rom68k_ops;
141 rom68k_cmds.stopbits = SERIAL_1_STOPBITS;
142 rom68k_cmds.regnames = rom68k_regnames;
143 rom68k_cmds.magic = MONITOR_OPS_MAGIC ;
144} /* init_rom68k_cmds */
06b8f5e4 145
d108166f
SS
146static void
147rom68k_open (args, from_tty)
06b8f5e4
RS
148 char *args;
149 int from_tty;
150{
1265e2d8 151 monitor_open (args, &rom68k_cmds, from_tty);
06b8f5e4
RS
152}
153
154void
155_initialize_rom68k ()
156{
82973f18 157 init_rom68k_cmds() ;
32fa4b59
SG
158 init_monitor_ops (&rom68k_ops);
159
160 rom68k_ops.to_shortname = "rom68k";
161 rom68k_ops.to_longname = "Rom68k debug monitor for the IDP Eval board";
162 rom68k_ops.to_doc = "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\
163Specify the serial device it is connected to (e.g. /dev/ttya).";
164 rom68k_ops.to_open = rom68k_open;
165
06b8f5e4 166 add_target (&rom68k_ops);
06b8f5e4 167}
This page took 0.194178 seconds and 4 git commands to generate.