/* Remote serial interface for Macraigor Systems implementation of
- On-Chip Debugging using serial target box or serial wiggler
+ On-Chip Debugging using serial target box or serial wiggler
- Copyright 1994, 1997 Free Software Foundation, Inc.
+ Copyright 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of GDB.
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. */
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "serial.h"
#include <windows.h>
#endif
-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));
-
#ifdef _WIN32
/* On Windows, this function pointer is initialized to a function in
the wiggler DLL. */
-static int (*dll_do_command) PARAMS ((const char *, char *));
+static int (*dll_do_command) (const char *, char *);
#endif
static int
-ocd_open (scb, name)
- serial_t scb;
- const char *name;
+ocd_open (serial_t scb, const char *name)
{
#ifdef _WIN32
/* Find the wiggler DLL which talks to the board. */
if (handle == NULL)
error ("Can't load Wigglers.dll");
- dll_do_command = ((int (*) PARAMS ((const char *, char *)))
+ dll_do_command = ((int (*) (const char *, char *))
GetProcAddress (handle, "do_command"));
if (dll_do_command == NULL)
error ("Can't find do_command function in Wigglers.dll");
}
-#endif
-
+#else
+ /* No wiggler DLLs on Unix yet, fail. */
+ error ("Wiggler library not available for this type of host.");
+#endif /* _WIN32 */
return 0;
}
static int
-ocd_noop (scb)
- serial_t scb;
+ocd_noop (serial_t scb)
{
return 0;
}
static void
-ocd_raw (scb)
- serial_t scb;
+ocd_raw (serial_t scb)
{
/* Always in raw mode */
}
/* We need a buffer to store responses from the Wigglers.dll */
#define WIGGLER_BUFF_SIZE 512
unsigned char from_wiggler_buffer[WIGGLER_BUFF_SIZE];
-unsigned char * wiggler_buffer_ptr; /* curr spot in buffer */
-
-static void
-ocd_readremote ()
-{
-}
+unsigned char *wiggler_buffer_ptr; /* curr spot in buffer */
static int
-ocd_readchar (scb, timeout)
- serial_t scb;
- int timeout;
+ocd_readchar (serial_t scb, int timeout)
{
- return (int) *wiggler_buffer_ptr++; /* return curr char and increment ptr */
+ /* Catch attempts at reading past the end of the buffer */
+ if (wiggler_buffer_ptr >
+ (from_wiggler_buffer + (sizeof (char *) * WIGGLER_BUFF_SIZE)))
+ error ("ocd_readchar asked to read past the end of the buffer!");
+
+ return (int) *wiggler_buffer_ptr++; /* return curr char and increment ptr */
}
-struct ocd_ttystate {
+struct ocd_ttystate
+{
int dummy;
};
vector. Someday, they may do something real... */
static serial_ttystate
-ocd_get_tty_state (scb)
- serial_t scb;
+ocd_get_tty_state (serial_t scb)
{
struct ocd_ttystate *state;
}
static int
-ocd_set_tty_state (scb, ttystate)
- serial_t scb;
- serial_ttystate ttystate;
+ocd_set_tty_state (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;
+ocd_noflush_set_tty_state (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;
+ocd_print_tty_state (serial_t scb,
+ serial_ttystate ttystate,
+ struct ui_file *stream)
{
/* Nothing to print. */
return;
}
static int
-ocd_setbaudrate (scb, rate)
- serial_t scb;
- int rate;
+ocd_setbaudrate (serial_t scb, int rate)
{
return 0;
}
static int
-ocd_write (scb, str, len)
- serial_t scb;
- const char *str;
- int len;
+ocd_write (serial_t scb, const char *str, int len)
{
- char c;
-
-#ifdef _WIN32
+#ifdef _WIN32
/* send packet to Wigglers.dll and store response so we can give it to
- remote-wiggler.c when get_packet is run */
+ remote-wiggler.c when get_packet is run */
dll_do_command (str, from_wiggler_buffer);
wiggler_buffer_ptr = from_wiggler_buffer;
#endif
}
static void
-ocd_close (scb)
- serial_t scb;
+ocd_close (serial_t scb)
{
}
ocd_close,
ocd_readchar,
ocd_write,
- ocd_noop, /* flush output */
- ocd_noop, /* flush input */
- ocd_noop, /* send break -- currently used only for nindy */
+ 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,
+ ocd_noop, /* wait for output to drain */
};
void
-_initialize_ser_ocd_bdm ()
+_initialize_ser_ocd_bdm (void)
{
serial_add_interface (&ocd_ops);
}