use remote-utils facilities for baud_rate

This commit is contained in:
K. Richard Pixley
1993-09-14 19:34:15 +00:00
parent fc77365385
commit a94abe5bb7
5 changed files with 26 additions and 26 deletions

View 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) 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. * paread.c, coffread.c, elfread.c: Include <time.h> before libbfd.h.

View File

@ -106,6 +106,7 @@ STP
#include "wait.h" #include "wait.h"
#include "terminal.h" #include "terminal.h"
#include "command.h" #include "command.h"
#include "remote-utils.h"
#ifdef USG #ifdef USG
#include <sys/types.h> #include <sys/types.h>
@ -364,7 +365,7 @@ es1800_open (name, from_tty)
char buf[PBUFSIZ]; char buf[PBUFSIZ];
char *p; char *p;
int i, fcflag; int i, fcflag;
char *baudrate; char baudrate[1024];
m68020 = 0; m68020 = 0;
@ -372,7 +373,7 @@ es1800_open (name, from_tty)
{ {
error_no_arg ("serial port device name"); 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); target_preopen (from_tty);
es1800_close (0); es1800_close (0);

View File

@ -49,6 +49,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "command.h" #include "command.h"
#include "serial.h" #include "serial.h"
#include "monitor.h" #include "monitor.h"
#include "remote-utils.h"
#ifdef HAVE_TERMIO #ifdef HAVE_TERMIO
# define TERMINAL struct termios # define TERMINAL struct termios
@ -337,16 +338,10 @@ general_open(args, name, from_tty)
perror_with_name(dev_name); perror_with_name(dev_name);
/* The baud rate was specified when GDB was started. */ /* The baud rate was specified when GDB was started. */
if (baud_rate) if (SERIAL_SETBAUDRATE (monitor_desc, sr_get_baud_rate()))
{ {
int rate; SERIAL_CLOSE (monitor_desc);
perror_with_name (name);
if (sscanf (baud_rate, "%d", &rate) == 1)
if (SERIAL_SETBAUDRATE (monitor_desc, rate))
{
SERIAL_CLOSE (monitor_desc);
perror_with_name (name);
}
} }
SERIAL_RAW(monitor_desc); SERIAL_RAW(monitor_desc);

View File

@ -117,6 +117,7 @@ NINDY ROM monitor at the other end of the line.
#include "nindy-share/stop.h" #include "nindy-share/stop.h"
#include "dcache.h" #include "dcache.h"
#include "remote-utils.h"
static DCACHE *nindy_dcache; static DCACHE *nindy_dcache;
@ -179,6 +180,7 @@ nindy_open (name, from_tty)
char *name; /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */ char *name; /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
int from_tty; int from_tty;
{ {
char baudrate[1024];
if (!name) if (!name)
error_no_arg ("serial port device 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 /* Allow user to interrupt the following -- we could hang if there's
no NINDY at the other end of the remote tty. */ no NINDY at the other end of the remote tty. */
immediate_quit++; 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); nindy_initial_brk, !from_tty, nindy_old_protocol);
immediate_quit--; immediate_quit--;
@ -222,8 +225,8 @@ nindy_detach (name, from_tty)
static void static void
nindy_files_info () nindy_files_info ()
{ {
printf("\tAttached to %s at %s bps%s%s.\n", savename, printf("\tAttached to %s at %d bps%s%s.\n", savename,
baud_rate? baud_rate: "9600", sr_get_baud_rate(),
nindy_old_protocol? " in old protocol": "", nindy_old_protocol? " in old protocol": "",
nindy_initial_brk? " with initial break": ""); nindy_initial_brk? " with initial break": "");
} }

View File

@ -133,6 +133,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdb-stabs.h" #include "gdb-stabs.h"
#include "dcache.h" #include "dcache.h"
#include "remote-utils.h"
#if !defined(DONT_USE_REMOTE) #if !defined(DONT_USE_REMOTE)
#ifdef USG #ifdef USG
@ -297,20 +298,11 @@ device is attached to the remote system (e.g. /dev/ttya).");
if (!remote_desc) if (!remote_desc)
perror_with_name (name); perror_with_name (name);
#if 0 if (SERIAL_SETBAUDRATE (remote_desc, sr_get_baud_rate()))
/* FIXME: This should be using remote-utils.c. */
if (baud_rate)
{ {
int rate; SERIAL_CLOSE (remote_desc);
perror_with_name (name);
if (sscanf (baud_rate, "%d", &rate) == 1)
if (SERIAL_SETBAUDRATE (remote_desc, rate))
{
SERIAL_CLOSE (remote_desc);
perror_with_name (name);
}
} }
#endif
SERIAL_RAW (remote_desc); SERIAL_RAW (remote_desc);