Commit | Line | Data |
---|---|---|
e8b73ba7 RS |
1 | #include "defs.h" |
2 | #include "gdbcore.h" | |
3 | #include "target.h" | |
4 | #include "monitor.h" | |
5 | ||
27e889bf RS |
6 | extern int baud_rate; |
7 | ||
e8b73ba7 | 8 | void w89k_open(); |
27e889bf RS |
9 | void monitor_open(); |
10 | ||
11 | /* | |
12 | * this array of registers need to match the indexes used by GDB. The | |
13 | * whole reason this exists is cause the various ROM monitors use | |
14 | * different strings than GDB does, and doesn't support all the | |
15 | * registers either. So, typing "info reg sp" becomes a "r30". | |
16 | */ | |
17 | static char *w89k_regnames[] = { | |
18 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", | |
19 | "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", | |
20 | "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", | |
21 | "r30", "r31", "sar", "", "", "", "", | |
22 | "eiem", "iir", "iva", "ior", "ipsw","", "", "", "", "", | |
23 | "", "", "", "", "", "", "", "ccr", "", "", | |
24 | "tr0", "tr1", "", "", "", "", "", | |
25 | "", "", "", "", "", "", "", "", | |
26 | "", "", "", "", "", "", "", "", | |
27 | "", "", "", "", "", "", "", "", | |
28 | "", "", "", "", "", "", "", "", | |
29 | "", "", "", "", "", "", "", "", | |
30 | "", "", "", "", "", "", "", "", | |
31 | "", "", "", "", "", "", "", "", | |
32 | "", "", "", "", "", "", "", "" | |
33 | }; | |
e8b73ba7 RS |
34 | |
35 | /* | |
36 | * Define the monitor command strings. Since these are passed directly | |
37 | * through to a printf style function, we need can include formatting | |
38 | * strings. We also need a CR or LF on the end. | |
39 | */ | |
40 | ||
41 | struct target_ops w89k_ops = { | |
42 | "w89k", | |
43 | "WinBond's debug monitor for the W89k Eval board", | |
44 | "Debug on a WinBond W89K eval board.\n\ | |
45 | Specify the serial device it is connected to (e.g. /dev/ttya).", | |
46 | w89k_open, | |
47 | monitor_close, | |
48 | 0, | |
49 | monitor_detach, | |
50 | monitor_resume, | |
51 | monitor_wait, | |
52 | monitor_fetch_register, | |
53 | monitor_store_register, | |
54 | monitor_prepare_to_store, | |
55 | monitor_xfer_inferior_memory, | |
56 | monitor_files_info, | |
57 | monitor_insert_breakpoint, | |
58 | monitor_remove_breakpoint, /* Breakpoints */ | |
59 | 0, | |
60 | 0, | |
61 | 0, | |
62 | 0, | |
63 | 0, /* Terminal handling */ | |
64 | monitor_kill, | |
65 | monitor_load, /* load */ | |
66 | 0, /* lookup_symbol */ | |
67 | monitor_create_inferior, | |
68 | monitor_mourn_inferior, | |
69 | 0, /* can_run */ | |
70 | 0, /* notice_signals */ | |
71 | process_stratum, | |
72 | 0, /* next */ | |
73 | 1, | |
74 | 1, | |
75 | 1, | |
76 | 1, | |
77 | 1, /* all mem, mem, stack, regs, exec */ | |
78 | 0, | |
79 | 0, /* Section pointers */ | |
80 | OPS_MAGIC, /* Always the last thing */ | |
81 | }; | |
82 | ||
83 | struct monitor_ops w89k_cmds = { | |
27e889bf RS |
84 | 1, /* 1 for ASCII, 0 for binary */ |
85 | "\r", /* monitor init string */ | |
86 | "G = 100000\r", /* execute or usually GO command */ | |
87 | "G\r", /* continue command */ | |
88 | "T\r", /* single step */ | |
e8b73ba7 RS |
89 | "BP %x\r", /* set a breakpoint */ |
90 | "BC %x\r", /* clear a breakpoint */ | |
91 | "E %x %x\r", /* set memory to a value */ | |
92 | "D %x\r", /* display memory */ | |
27e889bf RS |
93 | "", /* prompt memory commands use */ |
94 | { /* set a register */ | |
95 | "r %s %x\r", /* set a register */ | |
96 | "", /* delimiter between registers */ | |
97 | "", /* the result */ | |
98 | }, | |
99 | { | |
100 | "r %s\r", /* get a register */ | |
101 | "", /* delimiter between registers */ | |
102 | "", /* the result */ | |
103 | }, | |
104 | "U\r", /* download command */ | |
e8b73ba7 RS |
105 | "ROM>", /* monitor command prompt */ |
106 | "", /* end-of-command delimitor */ | |
107 | "", /* optional command terminator */ | |
27e889bf RS |
108 | &w89k_ops, /* target operations */ |
109 | "xmodem-srec,xmodem-som", /* load types */ | |
110 | w89k_regnames /* registers names */ | |
e8b73ba7 RS |
111 | }; |
112 | ||
113 | void | |
114 | w89k_open(args, from_tty) | |
115 | char *args; | |
116 | int from_tty; | |
117 | { | |
27e889bf | 118 | target_preopen(from_tty); |
e8b73ba7 RS |
119 | push_target (&w89k_ops); |
120 | push_monitor (&w89k_cmds); | |
27e889bf | 121 | monitor_open (args, "w89k", from_tty); |
e8b73ba7 RS |
122 | } |
123 | ||
124 | void | |
125 | _initialize_w89k () | |
126 | { | |
127 | add_target (&w89k_ops); | |
27e889bf RS |
128 | |
129 | /* this is the default, since it's the only baud rate supported by the hardware */ | |
130 | baud_rate = 9600; | |
e8b73ba7 RS |
131 | } |
132 | ||
133 | ||
134 | ||
135 |