1 /* Remote serial interface for Macraigor Systems implementation of
2 On-Chip Debugging using serial target box or serial wiggler
4 Copyright 1994, 1997 Free Software Foundation, Inc.
6 This file is part of GDB.
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.
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.
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. */
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));
53 /* Always in raw mode */
56 /* We need a buffer to store responses from the Wigglers.dll */
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 */
67 ocd_readchar (scb, timeout)
71 return (int) *wiggler_buffer_ptr++; /* return curr char and increment ptr */
78 /* ocd_{get set}_tty_state() are both dummys to fill out the function
79 vector. Someday, they may do something real... */
81 static serial_ttystate
82 ocd_get_tty_state (scb)
85 struct ocd_ttystate *state;
87 state = (struct ocd_ttystate *) xmalloc (sizeof *state);
89 return (serial_ttystate) state;
93 ocd_set_tty_state (scb, ttystate)
95 serial_ttystate ttystate;
101 ocd_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
103 serial_ttystate new_ttystate;
104 serial_ttystate old_ttystate;
110 ocd_print_tty_state (scb, ttystate)
112 serial_ttystate ttystate;
114 /* Nothing to print. */
119 ocd_setbaudrate (scb, rate)
127 ocd_write (scb, str, len)
135 /* send packet to Wigglers.dll and store response so we can give it to
136 remote-wiggler.c when get_packet is run */
137 do_command (str, from_wiggler_buffer);
138 wiggler_buffer_ptr = from_wiggler_buffer;
150 static struct serial_ops ocd_ops =
158 ocd_noop, /* flush output */
159 ocd_noop, /* flush input */
160 ocd_noop, /* send break -- currently used only for nindy */
165 ocd_noflush_set_tty_state,
170 _initialize_ser_ocd_bdm ()
172 serial_add_interface (&ocd_ops);