Add copyright message.
[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
5    Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
22
23 #include "defs.h"
24 #include "gdbcore.h"
25 #include "target.h"
26 #include "monitor.h"
27
28 extern int baud_rate;
29
30 void w89k_open();
31 void monitor_open();
32
33 /*
34  * this array of registers need to match the indexes used by GDB. The
35  * whole reason this exists is cause the various ROM monitors use
36  * different strings than GDB does, and doesn't support all the
37  * registers either. So, typing "info reg sp" becomes a "r30".
38  */
39 static char *w89k_regnames[] = {
40   "r0",   "r1",    "r2",   "r3",   "r4",  "r5",  "r6",  "r7",  "r8",  "r9",
41   "r10",  "r11",   "r12",  "r13",  "r14", "r15", "r16", "r17", "r18", "r19",
42   "r20",  "r21",   "r22",  "r23",  "r24", "r25", "r26", "r27", "r28", "r29",
43   "r30",  "r31",   "sar",  "pc",   "",    "",    "",
44   "eiem", "iir",   "iva",  "ior",  "ipsw","",    "",    "",    "",    "",
45   "",     "",      "",     "",     "",    "",    "",    "ccr", "",    "",
46   "tr0",  "tr1",   "",     "",     "",    "",    "",
47   "",     "",      "",     "",     "",    "",    "",    "",
48   "",     "",      "",     "",     "",    "",    "",    "",
49   "",     "",      "",     "",     "",    "",    "",    "",
50   "",     "",      "",     "",     "",    "",    "",    "",
51   "",     "",      "",     "",     "",    "",    "",    "",
52   "",     "",      "",     "",     "",    "",    "",    "",
53   "",     "",      "",     "",     "",    "",    "",    "",
54   "",     "",      "",     "",     "",    "",    "",    ""
55 };
56
57 /*
58  * Define the monitor command strings. Since these are passed directly
59  * through to a printf style function, we need can include formatting
60  * strings. We also need a CR or LF on the end.
61  */
62
63 struct target_ops w89k_ops = {
64   "w89k",
65   "WinBond's debug monitor for the W89k Eval board",
66   "Debug on a WinBond W89K eval board.\n\
67 Specify the serial device it is connected to (e.g. /dev/ttya).",
68   w89k_open,
69   monitor_close, 
70   monitor_attach,
71   monitor_detach,
72   monitor_resume,
73   monitor_wait,
74   monitor_fetch_register,
75   monitor_store_register,
76   monitor_prepare_to_store,
77   monitor_xfer_inferior_memory,
78   monitor_files_info,
79   monitor_insert_breakpoint,
80   monitor_remove_breakpoint,    /* Breakpoints */
81   0,
82   0,
83   0,
84   0,
85   0,                            /* Terminal handling */
86   monitor_kill,
87   monitor_load,                 /* load */
88   0,                            /* lookup_symbol */
89   monitor_create_inferior,
90   monitor_mourn_inferior,
91   0,                            /* can_run */
92   0,                            /* notice_signals */
93   0,                            /* to_stop */
94   process_stratum,
95   0,                            /* next */
96   1,
97   1,
98   1,
99   1,
100   1,                            /* all mem, mem, stack, regs, exec */
101   0,
102   0,                            /* Section pointers */
103   OPS_MAGIC,                    /* Always the last thing */
104 };
105
106 struct monitor_ops w89k_cmds = {
107   1,                                    /* 1 for ASCII, 0 for binary */
108   "\n",                                 /* monitor init string */
109   "g = %x\n",                           /* execute or usually GO command */
110   "g\n",                                /* continue command */
111   "t\n",                                /* single step */
112   "bp %x\n",                            /* set a breakpoint */
113   "bc %x\n",                            /* clear a breakpoint */
114   0,                                    /* 0 for number, 1 for address */
115   {
116     "e %x %x\n",                        /* set memory */
117     "",                                 /* delimiter */
118     "",                                 /* the result */
119   },
120   {
121     "db %x %x\n",                       /* get memory */
122     "",                                 /* delimiter */
123     "",                                 /* the result */
124   },
125   {
126     "r %s %x\n",                        /* set a register */
127     "",                                 /* delimiter between registers */
128     "",                                 /* the result */
129   },
130   {
131     "r %s\n",                           /* get a register */
132     "",                                 /* delimiter between registers */
133     "",                                 /* the result */
134   },
135   "u\n",                                /* download command */
136   "ROM>",                               /* monitor command prompt */
137   "",                                   /* end-of-command delimitor */
138   "",                                   /* optional command terminator */
139   &w89k_ops,                            /* target operations */
140   "srec,xmodem-ascii,xmodem-srec,default",/* load types */
141   w89k_regnames                         /* registers names */
142 };
143
144 void
145 w89k_open(args, from_tty)
146      char *args;
147      int from_tty;
148 {
149   target_preopen(from_tty);
150   push_target  (&w89k_ops);
151   push_monitor (&w89k_cmds);
152   monitor_open (args, "w89k", from_tty);
153 }
154
155 void
156 _initialize_w89k ()
157 {
158   add_target (&w89k_ops);
159
160   /* this is the default, since it's the only baud rate supported by the hardware */
161   baud_rate = 9600;
162 }
163
164
165
166