use remote-utils facilities for baud_rate
authorK. Richard Pixley <rich@cygnus>
Tue, 14 Sep 1993 19:34:15 +0000 (19:34 +0000)
committerK. Richard Pixley <rich@cygnus>
Tue, 14 Sep 1993 19:34:15 +0000 (19:34 +0000)
gdb/ChangeLog
gdb/remote-es.c
gdb/remote-mon.c
gdb/remote-nindy.c
gdb/remote.c

index ecb459d..a72d2e9 100644 (file)
@@ -1,3 +1,12 @@
+Tue Sep 14 12:21:49 1993  K. Richard Pixley  (rich@sendai.cygnus.com)
+
+       * remote.c, remote-nindy.c, remote-mon.c, remote-es.c: include
+         remote-utils.h.
+
+       * remote.c (remote_open), remote-nindy.c (nindy_open,
+         nindy_files_info), remote-mon.c (general_open), remote-es.c
+         (es1800_open): use remote-utils facilities for baud rate.
+
 Tue Sep 14 09:12:17 1993  Jim Kingdon  (kingdon@cirdan.cygnus.com)
 
        * paread.c, coffread.c, elfread.c: Include <time.h> before libbfd.h.
index f61c1eb..e910816 100644 (file)
@@ -106,6 +106,7 @@ STP
 #include "wait.h"
 #include "terminal.h"
 #include "command.h"
+#include "remote-utils.h"
 
 #ifdef USG
 #include <sys/types.h>
@@ -364,7 +365,7 @@ es1800_open (name, from_tty)
   char buf[PBUFSIZ];
   char *p;
   int i, fcflag;
-  char *baudrate;
+  char baudrate[1024];
 
   m68020 = 0;
 
@@ -372,7 +373,7 @@ es1800_open (name, from_tty)
     {
       error_no_arg ("serial port device name");
     }
-  baudrate = baud_rate ? baud_rate : "19200";  /* default baudrate = 19200 */
+  sprintf(baudrate, "%d", sr_get_baud_rate());
 
   target_preopen (from_tty);
   es1800_close (0);
index d9367a8..989729c 100644 (file)
@@ -49,6 +49,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "command.h"
 #include "serial.h"
 #include "monitor.h"
+#include "remote-utils.h"
 
 #ifdef HAVE_TERMIO
 #  define TERMINAL struct termios
@@ -337,16 +338,10 @@ general_open(args, name, from_tty)
     perror_with_name(dev_name);
 
   /* The baud rate was specified when GDB was started.  */
-  if (baud_rate)
+  if (SERIAL_SETBAUDRATE (monitor_desc, sr_get_baud_rate()))
     {
-      int rate;
-
-      if (sscanf (baud_rate, "%d", &rate) == 1)
-       if (SERIAL_SETBAUDRATE (monitor_desc, rate))
-         {
-           SERIAL_CLOSE (monitor_desc);
-           perror_with_name (name);
-         }
+      SERIAL_CLOSE (monitor_desc);
+      perror_with_name (name);
     }
 
   SERIAL_RAW(monitor_desc);
index 3329e49..c8ac0ec 100644 (file)
@@ -117,6 +117,7 @@ NINDY ROM monitor at the other end of the line.
 #include "nindy-share/stop.h"
 
 #include "dcache.h"
+#include "remote-utils.h"
 
 static DCACHE *nindy_dcache;
 
@@ -179,6 +180,7 @@ nindy_open (name, from_tty)
     char *name;                /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
     int from_tty;
 {
+  char baudrate[1024];
 
   if (!name)
     error_no_arg ("serial port device name");
@@ -193,7 +195,8 @@ nindy_open (name, from_tty)
   /* Allow user to interrupt the following -- we could hang if there's
      no NINDY at the other end of the remote tty.  */
   immediate_quit++;
-  ninConnect(name, baud_rate ? baud_rate : "9600",
+  sprintf(baudrate, "%d", sr_get_baud_rate());
+  ninConnect(name, baudrate,
             nindy_initial_brk, !from_tty, nindy_old_protocol);
   immediate_quit--;
 
@@ -222,8 +225,8 @@ nindy_detach (name, from_tty)
 static void
 nindy_files_info ()
 {
-  printf("\tAttached to %s at %s bps%s%s.\n", savename,
-        baud_rate? baud_rate: "9600",
+  printf("\tAttached to %s at %d bps%s%s.\n", savename,
+        sr_get_baud_rate(),
         nindy_old_protocol? " in old protocol": "",
          nindy_initial_brk? " with initial break": "");
 }
index 7775b62..efdc7d9 100644 (file)
@@ -133,6 +133,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "gdb-stabs.h"
 
 #include "dcache.h"
+#include "remote-utils.h"
 
 #if !defined(DONT_USE_REMOTE)
 #ifdef USG
@@ -297,20 +298,11 @@ device is attached to the remote system (e.g. /dev/ttya).");
   if (!remote_desc)
     perror_with_name (name);
 
-#if 0
-  /* FIXME: This should be using remote-utils.c.  */
-  if (baud_rate)
+  if (SERIAL_SETBAUDRATE (remote_desc, sr_get_baud_rate()))
     {
-      int rate;
-
-      if (sscanf (baud_rate, "%d", &rate) == 1)
-       if (SERIAL_SETBAUDRATE (remote_desc, rate))
-         {
-           SERIAL_CLOSE (remote_desc);
-           perror_with_name (name);
-         }
+      SERIAL_CLOSE (remote_desc);
+      perror_with_name (name);
     }
-#endif
 
   SERIAL_RAW (remote_desc);