aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-ocd.c
blob: 1b1213ede0f4c17dd99174f021b2146ceeac58c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/* Remote serial interface for Macraigor Systems implementation of
	On-Chip Debugging using serial target box or serial wiggler

   Copyright 1994, 1997 Free Software Foundation, Inc.

   This file is part of GDB.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#include "defs.h"
#include "serial.h"

static int ser_ocd_open PARAMS ((serial_t scb, const char *name));
static void ser_ocd_raw PARAMS ((serial_t scb));
static int ser_ocd_readchar PARAMS ((serial_t scb, int timeout));
static int ser_ocd_setbaudrate PARAMS ((serial_t scb, int rate));
static int ser_ocd_write PARAMS ((serial_t scb, const char *str, int len));
static void ser_ocd_close PARAMS ((serial_t scb));
static serial_ttystate ser_ocd_get_tty_state PARAMS ((serial_t scb));
static int ser_ocd_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));

static int
ocd_open (scb, name)
     serial_t scb;
     const char *name;
{
  return 0;
}

static int
ocd_noop (scb)
     serial_t scb;
{
  return 0;
}

static void
ocd_raw (scb)
     serial_t scb;
{
  /* Always in raw mode */
}

/* We need a buffer to store responses from the Wigglers.dll */
char * from_wigglers_buffer;
char * bptr;			/* curr spot in buffer */

static void
ocd_readremote ()
{
}

static int
ocd_readchar (scb, timeout)
     serial_t scb;
     int timeout;
{

}

struct ocd_ttystate {
  int dummy;
};

/* ocd_{get set}_tty_state() are both dummys to fill out the function
   vector.  Someday, they may do something real... */

static serial_ttystate
ocd_get_tty_state (scb)
     serial_t scb;
{
  struct ocd_ttystate *state;

  state = (struct ocd_ttystate *) xmalloc (sizeof *state);

  return (serial_ttystate) state;
}

static int
ocd_set_tty_state (scb, ttystate)
     serial_t scb;
     serial_ttystate ttystate;
{
  return 0;
}

static int
ocd_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
     serial_t scb;
     serial_ttystate new_ttystate;
     serial_ttystate old_ttystate;
{
  return 0;
}

static void
ocd_print_tty_state (scb, ttystate)
     serial_t scb;
     serial_ttystate ttystate;
{
  /* Nothing to print.  */
  return;
}

static int
ocd_setbaudrate (scb, rate)
     serial_t scb;
     int rate;
{
  return 0;
}

static int
ocd_write (scb, str, len)
     serial_t scb;
     const char *str;
     int len;
{
  char c;

  ocd_readremote();

#ifdef __CYGWIN32__ 
  /* send packet to Wigglers.dll and store response so we can give it to
	remote-wiggler.c when get_packet is run */
  do_command (str, from_wigglers_buffer);
#endif

  return 0;
}

static void
ocd_close (scb)
     serial_t scb;
{
  ocd_close (0);
}

static struct serial_ops ocd_ops =
{
  "ocd",
  0,
  ocd_open,
  ocd_close,
  ocd_readchar,
  ocd_write,
  ocd_noop,		/* flush output */
  ocd_noop,		/* flush input */
  ocd_noop,		/* send break -- currently used only for nindy */
  ocd_raw,
  ocd_get_tty_state,
  ocd_set_tty_state,
  ocd_print_tty_state,
  ocd_noflush_set_tty_state,
  ocd_setbaudrate,
};

void
_initialize_ser_ocd_bdm ()
{
  serial_add_interface (&ocd_ops);
}