From c84e500001e7cb3d349291d50c51f2b5cf3668db Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Sat, 13 Jan 1996 00:21:55 +0000 Subject: [PATCH] * dsrec.c (load_srec): Remove unused variable. monitor.c (monitor_expect): Don't expect a ^C to echo. * serial.c (serial_open): Add parallel interface. * sh3-rom.c (parallel, parallel_in_use): New. (sh3_load): If parallel_in_use, download though the parallel port. (sh3_open): Open parallel port if specified. (sh3_close): New function. (_inititalize_sh3): Add sh3_close hook and documentation. * monitor.c (monitor_close): Export. * monitor.h (monitor_close): Add prototype. --- gdb/ChangeLog | 14 +++++++++ gdb/monitor.h | 6 ++-- gdb/serial.c | 4 ++- gdb/sh3-rom.c | 87 ++++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 95 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f2c2369567..35f1a445561 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +Fri Jan 12 15:56:12 1996 Steve Chamberlain + + * dsrec.c (load_srec): Remove unused variable. + monitor.c (monitor_expect): Don't expect a ^C to echo. + * serial.c (serial_open): Add parallel interface. + * sh3-rom.c (parallel, parallel_in_use): New. + (sh3_load): If parallel_in_use, download though the + parallel port. + (sh3_open): Open parallel port if specified. + (sh3_close): New function. + (_inititalize_sh3): Add sh3_close hook and documentation. + * monitor.c (monitor_close): Export. + * monitor.h (monitor_close): Add prototype. + Fri Jan 12 13:11:42 1996 Stan Shebs From Wilfried Moser : diff --git a/gdb/monitor.h b/gdb/monitor.h index d11e29f33ba..7fbf8cca86c 100644 --- a/gdb/monitor.h +++ b/gdb/monitor.h @@ -1,8 +1,5 @@ /* Remote debugging interface ROM monitors. - * Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus. - * - * Copyright 1990, 1991, 1992 Free Software Foundation, Inc. + * Copyright 1990, 1991, 1992, 1996 Free Software Foundation, Inc. * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus. * * This file is part of GDB. @@ -165,6 +162,7 @@ extern struct monitor_ops *current_monitor; #define REG_DELIM (current_monitor->regset.delim) extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty)); +extern void monitor_close PARAMS ((int quitting)); extern char *monitor_supply_register PARAMS ((int regno, char *valstr)); extern int monitor_expect PARAMS ((char *prompt, char *buf, int buflen)); extern int monitor_expect_prompt PARAMS ((char *buf, int buflen)); diff --git a/gdb/serial.c b/gdb/serial.c index ea886a6a3c9..72bfc507713 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -1,5 +1,5 @@ /* Generic serial interface routines - Copyright 1992, 1993 Free Software Foundation, Inc. + Copyright 1992, 1993, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -74,6 +74,8 @@ serial_open (name) ops = serial_interface_lookup ("pc"); else if (strchr (name, ':')) ops = serial_interface_lookup ("tcp"); + else if (strncmp (name, "lpt", 3) == 0) + ops = serial_interface_lookup ("parallel"); else ops = serial_interface_lookup ("hardwire"); diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index 0973bfd620a..315a8c5543e 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -1,5 +1,5 @@ /* Remote target glue for the Hitachi SH-3 ROM monitor. - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "serial.h" #include "srec.h" +static serial_t parallel; +static int parallel_in_use; + static void sh3_open PARAMS ((char *args, int from_tty)); static void @@ -109,16 +112,25 @@ sh3_load (desc, file, hashmark) char *file; int hashmark; { - monitor_printf ("il;s:x\r"); - monitor_expect ("\005", NULL, 0); /* Look for ENQ */ - SERIAL_WRITE (desc, "\006", 1); /* Send ACK */ - monitor_expect ("LO x\r", NULL, 0); /* Look for filename */ + if (parallel_in_use) + { + monitor_printf("pl;s\r"); + load_srec (parallel, file, 80, SREC_ALL, hashmark); + monitor_expect_prompt (NULL, 0); + } + else + { + monitor_printf ("il;s:x\r"); + monitor_expect ("\005", NULL, 0); /* Look for ENQ */ + SERIAL_WRITE (desc, "\006", 1); /* Send ACK */ + monitor_expect ("LO x\r", NULL, 0); /* Look for filename */ - load_srec (desc, file, 80, SREC_ALL, hashmark); + load_srec (desc, file, 80, SREC_ALL, hashmark); - monitor_expect ("\005", NULL, 0); /* Look for ENQ */ - SERIAL_WRITE (desc, "\006", 1); /* Send ACK */ - monitor_expect_prompt (NULL, 0); + monitor_expect ("\005", NULL, 0); /* Look for ENQ */ + SERIAL_WRITE (desc, "\006", 1); /* Send ACK */ + monitor_expect_prompt (NULL, 0); + } } /* This array of registers need to match the indexes used by GDB. @@ -203,7 +215,48 @@ sh3_open (args, from_tty) char *args; int from_tty; { - monitor_open (args, &sh3_cmds, from_tty); + char *serial_port_name = args; + char *parallel_port_name = 0; + if (args) + { + char *cursor = serial_port_name = strsave (args); + + while (*cursor && *cursor != ' ') + cursor++; + + if (*cursor) + *cursor++ = 0; + + while (*cursor == ' ') + cursor++; + + if (*cursor) + parallel_port_name = cursor; + } + + monitor_open (serial_port_name, &sh3_cmds, from_tty); + + if (parallel_port_name) + { + parallel = SERIAL_OPEN (parallel_port_name); + if (!parallel) + { + perror_with_name ("Unable to open parallel port."); + } + parallel_in_use = 1; + } +} + + +static void +sh3_close (quitting) + int quitting; +{ + monitor_close (quitting); + if (parallel_in_use) { + SERIAL_CLOSE (parallel); + parallel_in_use = 0; + } } void @@ -213,9 +266,21 @@ _initialize_sh3 () sh3_ops.to_shortname = "sh3"; sh3_ops.to_longname = "Hitachi SH-3 rom monitor"; - sh3_ops.to_doc = "Debug on a Hitachi eval board running the SH-3 rom monitor.\n\ + + sh3_ops.to_doc = +#ifdef _WINDOWS + /* On windows we can talk through the parallel port too. */ + "Debug on a Hitachi eval board running the SH-3 rom monitor.\n" + "Specify the serial device it is connected to (e.g. com2).\n" + "If you want to use the parallel port to download to it, specify that\n" + "as the second argument. (e.g. lpt1)"; +#else + "Debug on a Hitachi eval board running the SH-3 rom monitor.\n\ Specify the serial device it is connected to (e.g. /dev/ttya)."; +#endif + sh3_ops.to_open = sh3_open; + sh3_ops.to_close = sh3_close; add_target (&sh3_ops); } -- 2.30.2