Commit | Line | Data |
---|---|---|
35ce4f08 GN |
1 | /* Remote serial interface for Macraigor Systems implementation of |
2 | On-Chip Debugging using serial target box or serial wiggler | |
3 | ||
4 | Copyright 1994, 1997 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | #include "defs.h" | |
23 | #include "serial.h" | |
24 | ||
25 | static int ser_ocd_open PARAMS ((serial_t scb, const char *name)); | |
26 | static void ser_ocd_raw PARAMS ((serial_t scb)); | |
27 | static int ser_ocd_readchar PARAMS ((serial_t scb, int timeout)); | |
28 | static int ser_ocd_setbaudrate PARAMS ((serial_t scb, int rate)); | |
29 | static int ser_ocd_write PARAMS ((serial_t scb, const char *str, int len)); | |
30 | static void ser_ocd_close PARAMS ((serial_t scb)); | |
31 | static serial_ttystate ser_ocd_get_tty_state PARAMS ((serial_t scb)); | |
32 | static int ser_ocd_set_tty_state PARAMS ((serial_t scb, serial_ttystate state)); | |
33 | ||
34 | static int | |
35 | ocd_open (scb, name) | |
36 | serial_t scb; | |
37 | const char *name; | |
38 | { | |
39 | return 0; | |
40 | } | |
41 | ||
42 | static int | |
43 | ocd_noop (scb) | |
44 | serial_t scb; | |
45 | { | |
46 | return 0; | |
47 | } | |
48 | ||
49 | static void | |
50 | ocd_raw (scb) | |
51 | serial_t scb; | |
52 | { | |
53 | /* Always in raw mode */ | |
54 | } | |
55 | ||
56 | /* We need a buffer to store responses from the Wigglers.dll */ | |
9cf7f520 GN |
57 | #define WIGGLER_BUFF_SIZE 512 |
58 | unsigned char from_wiggler_buffer[WIGGLER_BUFF_SIZE]; | |
59 | unsigned char * wiggler_buffer_ptr; /* curr spot in buffer */ | |
35ce4f08 GN |
60 | |
61 | static void | |
62 | ocd_readremote () | |
63 | { | |
64 | } | |
65 | ||
66 | static int | |
67 | ocd_readchar (scb, timeout) | |
68 | serial_t scb; | |
69 | int timeout; | |
70 | { | |
9cf7f520 | 71 | return (int) *wiggler_buffer_ptr++; /* return curr char and increment ptr */ |
35ce4f08 GN |
72 | } |
73 | ||
74 | struct ocd_ttystate { | |
75 | int dummy; | |
76 | }; | |
77 | ||
78 | /* ocd_{get set}_tty_state() are both dummys to fill out the function | |
79 | vector. Someday, they may do something real... */ | |
80 | ||
81 | static serial_ttystate | |
82 | ocd_get_tty_state (scb) | |
83 | serial_t scb; | |
84 | { | |
85 | struct ocd_ttystate *state; | |
86 | ||
87 | state = (struct ocd_ttystate *) xmalloc (sizeof *state); | |
88 | ||
89 | return (serial_ttystate) state; | |
90 | } | |
91 | ||
92 | static int | |
93 | ocd_set_tty_state (scb, ttystate) | |
94 | serial_t scb; | |
95 | serial_ttystate ttystate; | |
96 | { | |
97 | return 0; | |
98 | } | |
99 | ||
100 | static int | |
101 | ocd_noflush_set_tty_state (scb, new_ttystate, old_ttystate) | |
102 | serial_t scb; | |
103 | serial_ttystate new_ttystate; | |
104 | serial_ttystate old_ttystate; | |
105 | { | |
106 | return 0; | |
107 | } | |
108 | ||
109 | static void | |
110 | ocd_print_tty_state (scb, ttystate) | |
111 | serial_t scb; | |
112 | serial_ttystate ttystate; | |
113 | { | |
114 | /* Nothing to print. */ | |
115 | return; | |
116 | } | |
117 | ||
118 | static int | |
119 | ocd_setbaudrate (scb, rate) | |
120 | serial_t scb; | |
121 | int rate; | |
122 | { | |
123 | return 0; | |
124 | } | |
125 | ||
126 | static int | |
127 | ocd_write (scb, str, len) | |
128 | serial_t scb; | |
129 | const char *str; | |
130 | int len; | |
131 | { | |
132 | char c; | |
133 | ||
35ce4f08 GN |
134 | #ifdef __CYGWIN32__ |
135 | /* send packet to Wigglers.dll and store response so we can give it to | |
136 | remote-wiggler.c when get_packet is run */ | |
9cf7f520 GN |
137 | do_command (str, from_wiggler_buffer); |
138 | wiggler_buffer_ptr = from_wiggler_buffer; | |
35ce4f08 GN |
139 | #endif |
140 | ||
141 | return 0; | |
142 | } | |
143 | ||
144 | static void | |
145 | ocd_close (scb) | |
146 | serial_t scb; | |
147 | { | |
35ce4f08 GN |
148 | } |
149 | ||
150 | static struct serial_ops ocd_ops = | |
151 | { | |
152 | "ocd", | |
153 | 0, | |
154 | ocd_open, | |
155 | ocd_close, | |
156 | ocd_readchar, | |
157 | ocd_write, | |
158 | ocd_noop, /* flush output */ | |
159 | ocd_noop, /* flush input */ | |
160 | ocd_noop, /* send break -- currently used only for nindy */ | |
161 | ocd_raw, | |
162 | ocd_get_tty_state, | |
163 | ocd_set_tty_state, | |
164 | ocd_print_tty_state, | |
165 | ocd_noflush_set_tty_state, | |
166 | ocd_setbaudrate, | |
167 | }; | |
168 | ||
169 | void | |
170 | _initialize_ser_ocd_bdm () | |
171 | { | |
172 | serial_add_interface (&ocd_ops); | |
173 | } | |
9cf7f520 GN |
174 | |
175 | ||
176 | ||
177 | ||
178 | ||
179 |