* monitor.h: Add MO_GETMEM_NEEDS_RANGE flag.
[external/binutils.git] / gdb / w89k-rom.c
1 /* Remote target glue for the WinBond ROM monitor running on the "Cougar"
2    W89k eval board.
3
4    Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
5
6 This file is part of GDB.
7
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.
12
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.
17
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.  */
21
22 #include "defs.h"
23 #include "gdbcore.h"
24 #include "target.h"
25 #include "monitor.h"
26 #include "serial.h"
27
28 static void w89k_open PARAMS ((char *args, int from_tty));
29
30 /*
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".
35  */
36 static char *w89k_regnames[NUM_REGS] =
37 {
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",
46 };
47
48 /*
49  * Define the monitor command strings. Since these are passed directly
50  * through to a printf style function, we need can include formatting
51  * strings. We also need a CR or LF on the end.
52  */
53
54 static struct target_ops w89k_ops;
55
56 static char *w89k_loadtypes[] = {"none", "srec", "default", NULL};
57 static char *w89k_loadprotos[] = {"none", "xmodem", NULL};
58
59 static char *w89k_inits[] = {"\r", NULL};
60
61 static struct monitor_ops w89k_cmds =
62 {
63   MO_GETMEM_NEEDS_RANGE,        /* flags */
64   w89k_inits,                   /* Init strings */
65   "g\r",                        /* continue command */
66   "t\r",                        /* single step */
67   NULL,                         /* Interrupt char */
68   "bp %x\r",                    /* set a breakpoint */
69   "bc %x\r",                    /* clear a breakpoint */
70   NULL,                         /* clear all breakpoints */
71   NULL,                         /* memory fill cmd */
72   {
73     "eb %x %x\r",               /* setmem.cmdb (addr, value) */
74     "eh %x %x\r",               /* setmem.cmdw (addr, value) */
75     "ew %x %x\r",               /* setmem.cmdl (addr, value) */
76     NULL,                       /* setmem.cmdll (addr, value) */
77     NULL,                       /* setreg.resp_delim */
78     NULL,                       /* setreg.term */
79     NULL,                       /* setreg.term_cmd */
80   },
81   {
82     "db %x %x\r",               /* getmem.cmdb (startaddr, endaddr) */
83     "dh %x %x\r",               /* getmem.cmdw (startaddr, endaddr) */
84     "dw %x %x\r",               /* getmem.cmdl (startaddr, endaddr) */
85     NULL,                       /* getmem.cmdll (startaddr, endaddr) */
86     "  ",                       /* getmem.resp_delim */
87     NULL,                       /* getmem.term */
88     NULL,                       /* getmem.term_cmd */
89   },
90   {
91     "r %s %x\r",                /* setreg.cmd (name, value) */
92     NULL,                       /* setreg.resp_delim */
93     NULL,                       /* setreg.term */
94     NULL,                       /* setreg.term_cmd */
95   },
96   {
97     "r %s\r",                   /* getreg.cmd (name) */
98     "\r",                       /* getreg.resp_delim */
99     NULL,                       /* getreg.term */
100     NULL,                       /* getreg.term_cmd */
101   },
102   NULL,                         /* dump_registers */
103   NULL,                         /* register_pattern */
104   NULL,                         /* supply_register */
105   "u\r",                        /* download command */
106   NULL,                         /* load response */
107   "ROM>",                       /* monitor command prompt */
108   NULL,                         /* end-of-command delimitor */
109   NULL,                         /* optional command terminator */
110   &w89k_ops,                    /* target operations */
111   w89k_loadtypes,               /* loadtypes */
112   w89k_loadprotos,              /* loadprotos */
113   "9600",                       /* supported baud rates */
114   SERIAL_1_STOPBITS,            /* number of stop bits */
115   w89k_regnames,                /* register names */
116   MONITOR_OPS_MAGIC             /* magic */
117   };
118
119 void
120 w89k_open(args, from_tty)
121      char *args;
122      int from_tty;
123 {
124   monitor_open (args, &w89k_cmds, from_tty);
125 }
126
127 void
128 _initialize_w89k ()
129 {
130   init_monitor_ops (&w89k_ops);
131
132   w89k_ops.to_shortname = "w89k";
133   w89k_ops.to_longname = "WinBond's debug monitor for the W89k Eval board";
134   w89k_ops.to_doc = "Debug on a WinBond W89K eval board.\n\
135 Specify the serial device it is connected to (e.g. /dev/ttya).";
136   w89k_ops.to_open = w89k_open;
137
138   add_target (&w89k_ops);
139 }