This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Eliminate SERIAL_*() macros
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [patch] Eliminate SERIAL_*() macros
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Sun, 15 Jul 2001 16:30:47 -0400
Hello,
The attached eliminates all the upper case SERIAL_*() macros that wrap
all the lower case serial functions.
Andrew
2001-07-14 Andrew Cagney <ac131313@redhat.com>
* serial.h (SERIAL_ASYNC): Delete.
(DEPRECATED_SERIAL_FD): Delete.
(SERIAL_DEBUG): Delete.
(SERIAL_DEBUG_P): Delete.
(SERIAL_DRAIN_OUTPUT): Delete.
(SERIAL_FLUSH_OUTPUT): Delete.
(SERIAL_FLUSH_INPUT): Delete.
(SERIAL_SEND_BREAK): Delete.
(SERIAL_RAW): Delete.
(SERIAL_GET_TTY_STATE): Delete.
(SERIAL_SET_TTY_STATE): Delete.
(SERIAL_PRINT_TTY_STATE): Delete.
(SERIAL_NOFLUSH_SET_TTY_STATE): Delete.
(SERIAL_SETBAUDRATE): Delete.
(SERIAL_SETSTOPBITS): Delete.
(SERIAL_CAN_ASYNC_P): Delete.
(SERIAL_IS_ASYNC_P): Delete.
(SERIAL_UN_FDOPEN): Delete.
(SERIAL_READCHAR): Delete.
(SERIAL_CLOSE): Delete.
(SERIAL_FDOPEN): Delete.
(SERIAL_OPEN): Delete.
* ser-unix.c: Update.
* sparclet-rom.c: Update.
* remote-bug.c: Update.
* dsrec.c: Update.
* xmodem.c: Update.
* nindy-share/ttyflush.c: Update.
* nindy-share/Onindy.c: Update.
* utils.c: Update.
* serial.c: Update.
* remote-nindy.c: Update.
* inflow.c: Update.
* sparcl-tdep.c: Update.
* sh3-rom.c: Update.
* remote.c: Update.
* remote-utils.c: Update.
* remote-st.c: Update.
* remote-sds.c: Update.
* remote-rdp.c: Update.
* remote-os9k.c: Update.
* remote-nrom.c: Update.
* remote-mips.c: Update.
* remote-es.c: Update.
* remote-e7000.c: Update.
* remote-array.c: Update.
* ocd.c: Update.
* nindy-share/nindy.c: Update.
* monitor.c: Update.
Index: dsrec.c
===================================================================
RCS file: /cvs/src/src/gdb/dsrec.c,v
retrieving revision 1.10
diff -p -r1.10 dsrec.c
*** dsrec.c 2001/07/11 17:52:32 1.10
--- dsrec.c 2001/07/15 20:19:40
*************** load_srec (struct serial *desc, const ch
*** 84,90 ****
srec[reclen] = '\0';
puts_debug ("sent -->", srec, "<--");
}
! SERIAL_WRITE (desc, srec, reclen);
for (s = abfd->sections; s; s = s->next)
if (s->flags & SEC_LOAD)
--- 84,90 ----
srec[reclen] = '\0';
puts_debug ("sent -->", srec, "<--");
}
! serial_write (desc, srec, reclen);
for (s = abfd->sections; s; s = s->next)
if (s->flags & SEC_LOAD)
*************** load_srec (struct serial *desc, const ch
*** 121,127 ****
acknowledgement is sent back. */
do
{
! SERIAL_WRITE (desc, srec, reclen);
if (ui_load_progress_hook)
if (ui_load_progress_hook (section_name, (unsigned long) i))
error ("Canceled the download");
--- 121,127 ----
acknowledgement is sent back. */
do
{
! serial_write (desc, srec, reclen);
if (ui_load_progress_hook)
if (ui_load_progress_hook (section_name, (unsigned long) i))
error ("Canceled the download");
*************** load_srec (struct serial *desc, const ch
*** 157,170 ****
puts_debug ("sent -->", srec, "<--");
}
! SERIAL_WRITE (desc, srec, reclen);
/* Some monitors need these to wake up properly. (Which ones? -sts) */
! SERIAL_WRITE (desc, "\r\r", 2);
if (remote_debug)
puts_debug ("sent -->", "\r\r", "<---");
! SERIAL_FLUSH_INPUT (desc);
report_transfer_performance (data_count, start_time, end_time);
}
--- 157,170 ----
puts_debug ("sent -->", srec, "<--");
}
! serial_write (desc, srec, reclen);
/* Some monitors need these to wake up properly. (Which ones? -sts) */
! serial_write (desc, "\r\r", 2);
if (remote_debug)
puts_debug ("sent -->", "\r\r", "<---");
! serial_flush_input (desc);
report_transfer_performance (data_count, start_time, end_time);
}
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.10
diff -p -r1.10 inflow.c
*** inflow.c 2001/07/11 17:52:32 1.10
--- inflow.c 2001/07/15 20:19:42
*************** gdb_has_a_terminal (void)
*** 129,147 ****
case no:
return 0;
case have_not_checked:
! /* Get all the current tty settings (including whether we have a tty at
! all!). Can't do this in _initialize_inflow because SERIAL_FDOPEN
! won't work until the serial_ops_list is initialized. */
#ifdef F_GETFL
tflags_ours = fcntl (0, F_GETFL, 0);
#endif
gdb_has_a_terminal_flag = no;
! stdin_serial = SERIAL_FDOPEN (0);
if (stdin_serial != NULL)
{
! our_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
if (our_ttystate != NULL)
{
--- 129,148 ----
case no:
return 0;
case have_not_checked:
! /* Get all the current tty settings (including whether we have a
! tty at all!). Can't do this in _initialize_inflow because
! serial_fdopen() won't work until the serial_ops_list is
! initialized. */
#ifdef F_GETFL
tflags_ours = fcntl (0, F_GETFL, 0);
#endif
gdb_has_a_terminal_flag = no;
! stdin_serial = serial_fdopen (0);
if (stdin_serial != NULL)
{
! our_ttystate = serial_get_tty_state (stdin_serial);
if (our_ttystate != NULL)
{
*************** terminal_init_inferior_with_pgrp (int pg
*** 182,192 ****
{
if (gdb_has_a_terminal ())
{
! /* We could just as well copy our_ttystate (if we felt like adding
! a new function SERIAL_COPY_TTY_STATE). */
if (inferior_ttystate)
xfree (inferior_ttystate);
! inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
#ifdef PROCESS_GROUP_TYPE
inferior_process_group = pgrp;
--- 183,193 ----
{
if (gdb_has_a_terminal ())
{
! /* We could just as well copy our_ttystate (if we felt like
! adding a new function serial_copy_tty_state()). */
if (inferior_ttystate)
xfree (inferior_ttystate);
! inferior_ttystate = serial_get_tty_state (stdin_serial);
#ifdef PROCESS_GROUP_TYPE
inferior_process_group = pgrp;
*************** terminal_inferior (void)
*** 236,242 ****
/* Because we were careful to not change in or out of raw mode in
terminal_ours, we will not change in our out of raw mode with
this call, so we don't flush any input. */
! result = SERIAL_SET_TTY_STATE (stdin_serial, inferior_ttystate);
OOPSY ("setting tty state");
if (!job_control)
--- 237,243 ----
/* Because we were careful to not change in or out of raw mode in
terminal_ours, we will not change in our out of raw mode with
this call, so we don't flush any input. */
! result = serial_set_tty_state (stdin_serial, inferior_ttystate);
OOPSY ("setting tty state");
if (!job_control)
*************** terminal_ours_1 (int output_only)
*** 334,340 ****
if (inferior_ttystate)
xfree (inferior_ttystate);
! inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
#ifdef HAVE_TERMIOS
inferior_process_group = tcgetpgrp (0);
#endif
--- 335,341 ----
if (inferior_ttystate)
xfree (inferior_ttystate);
! inferior_ttystate = serial_get_tty_state (stdin_serial);
#ifdef HAVE_TERMIOS
inferior_process_group = tcgetpgrp (0);
#endif
*************** terminal_ours_1 (int output_only)
*** 359,365 ****
though, since readline will deal with raw mode when/if it needs to.
*/
! SERIAL_NOFLUSH_SET_TTY_STATE (stdin_serial, our_ttystate,
inferior_ttystate);
if (job_control)
--- 360,366 ----
though, since readline will deal with raw mode when/if it needs to.
*/
! serial_noflush_set_tty_state (stdin_serial, our_ttystate,
inferior_ttystate);
if (job_control)
*************** child_terminal_info (char *args, int fro
*** 489,495 ****
(int) inferior_process_group);
#endif
! SERIAL_PRINT_TTY_STATE (stdin_serial, inferior_ttystate, gdb_stdout);
}
/* NEW_TTY_PREFORK is called before forking a new child process,
--- 490,496 ----
(int) inferior_process_group);
#endif
! serial_print_tty_state (stdin_serial, inferior_ttystate, gdb_stdout);
}
/* NEW_TTY_PREFORK is called before forking a new child process,
Index: monitor.c
===================================================================
RCS file: /cvs/src/src/gdb/monitor.c,v
retrieving revision 1.27
diff -p -r1.27 monitor.c
*** monitor.c 2001/07/10 21:06:34 1.27
--- monitor.c 2001/07/15 20:19:47
*************** monitor_printf (char *pattern,...)
*** 396,403 ****
void
monitor_write (char *buf, int buflen)
{
! if (SERIAL_WRITE (monitor_desc, buf, buflen))
! fprintf_unfiltered (gdb_stderr, "SERIAL_WRITE failed: %s\n",
safe_strerror (errno));
}
--- 396,403 ----
void
monitor_write (char *buf, int buflen)
{
! if (serial_write (monitor_desc, buf, buflen))
! fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n",
safe_strerror (errno));
}
*************** monitor_readchar (void)
*** 415,421 ****
do
{
looping = 0;
! c = SERIAL_READCHAR (monitor_desc, timeout);
if (c >= 0)
c &= 0xff; /* don't lose bit 7 */
--- 415,421 ----
do
{
looping = 0;
! c = serial_readchar (monitor_desc, timeout);
if (c >= 0)
c &= 0xff; /* don't lose bit 7 */
*************** readchar (int timeout)
*** 449,455 ****
do
{
looping = 0;
! c = SERIAL_READCHAR (monitor_desc, timeout);
if (c >= 0)
{
--- 449,455 ----
do
{
looping = 0;
! c = serial_readchar (monitor_desc, timeout);
if (c >= 0)
{
*************** monitor_open (char *args, struct monitor
*** 772,798 ****
xfree (dev_name);
dev_name = xstrdup (args);
! monitor_desc = SERIAL_OPEN (dev_name);
if (!monitor_desc)
perror_with_name (dev_name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (monitor_desc, baud_rate))
{
! SERIAL_CLOSE (monitor_desc);
perror_with_name (dev_name);
}
}
! SERIAL_RAW (monitor_desc);
! SERIAL_FLUSH_INPUT (monitor_desc);
/* some systems only work with 2 stop bits */
! SERIAL_SETSTOPBITS (monitor_desc, mon_ops->stopbits);
current_monitor = mon_ops;
--- 772,798 ----
xfree (dev_name);
dev_name = xstrdup (args);
! monitor_desc = serial_open (dev_name);
if (!monitor_desc)
perror_with_name (dev_name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (monitor_desc, baud_rate))
{
! serial_close (monitor_desc);
perror_with_name (dev_name);
}
}
! serial_raw (monitor_desc);
! serial_flush_input (monitor_desc);
/* some systems only work with 2 stop bits */
! serial_setstopbits (monitor_desc, mon_ops->stopbits);
current_monitor = mon_ops;
*************** monitor_open (char *args, struct monitor
*** 822,828 ****
monitor_expect_prompt (NULL, 0);
}
! SERIAL_FLUSH_INPUT (monitor_desc);
/* Alloc breakpoints */
if (mon_ops->set_break != NULL)
--- 822,828 ----
monitor_expect_prompt (NULL, 0);
}
! serial_flush_input (monitor_desc);
/* Alloc breakpoints */
if (mon_ops->set_break != NULL)
*************** void
*** 863,869 ****
monitor_close (int quitting)
{
if (monitor_desc)
! SERIAL_CLOSE (monitor_desc);
/* Free breakpoint memory */
if (breakaddr != NULL)
--- 863,869 ----
monitor_close (int quitting)
{
if (monitor_desc)
! serial_close (monitor_desc);
/* Free breakpoint memory */
if (breakaddr != NULL)
*************** monitor_read_memory (CORE_ADDR memaddr,
*** 1903,1909 ****
if (current_monitor->getmem.term_cmd)
{
! SERIAL_WRITE (monitor_desc, current_monitor->getmem.term_cmd,
strlen (current_monitor->getmem.term_cmd));
monitor_expect_prompt (NULL, 0);
}
--- 1903,1909 ----
if (current_monitor->getmem.term_cmd)
{
! serial_write (monitor_desc, current_monitor->getmem.term_cmd,
strlen (current_monitor->getmem.term_cmd));
monitor_expect_prompt (NULL, 0);
}
*************** monitor_stop (void)
*** 2223,2229 ****
{
monitor_debug ("MON stop\n");
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
! SERIAL_SEND_BREAK (monitor_desc);
if (current_monitor->stop)
monitor_printf_noecho (current_monitor->stop);
}
--- 2223,2229 ----
{
monitor_debug ("MON stop\n");
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
! serial_send_break (monitor_desc);
if (current_monitor->stop)
monitor_printf_noecho (current_monitor->stop);
}
Index: ocd.c
===================================================================
RCS file: /cvs/src/src/gdb/ocd.c,v
retrieving revision 1.17
diff -p -r1.17 ocd.c
*** ocd.c 2001/07/11 17:52:32 1.17
--- ocd.c 2001/07/15 20:19:54
*************** void
*** 163,169 ****
ocd_close (int quitting)
{
if (ocd_desc)
! SERIAL_CLOSE (ocd_desc);
ocd_desc = NULL;
}
--- 163,169 ----
ocd_close (int quitting)
{
if (ocd_desc)
! serial_close (ocd_desc);
ocd_desc = NULL;
}
*************** ocd_start_remote (PTR dummy)
*** 183,189 ****
immediate_quit++; /* Allow user to interrupt it */
! SERIAL_SEND_BREAK (ocd_desc); /* Wake up the wiggler */
speed = 80; /* Divide clock by 4000 */
--- 183,189 ----
immediate_quit++; /* Allow user to interrupt it */
! serial_send_break (ocd_desc); /* Wake up the wiggler */
speed = 80; /* Divide clock by 4000 */
*************** device the OCD device is attached to (e.
*** 292,298 ****
if (strncmp (name, "wiggler", 7) == 0)
{
! ocd_desc = SERIAL_OPEN ("ocd");
if (!ocd_desc)
perror_with_name (name);
--- 292,298 ----
if (strncmp (name, "wiggler", 7) == 0)
{
! ocd_desc = serial_open ("ocd");
if (!ocd_desc)
perror_with_name (name);
*************** device the OCD device is attached to (e.
*** 309,333 ****
else
/* not using Wigglers.dll */
{
! ocd_desc = SERIAL_OPEN (name);
if (!ocd_desc)
perror_with_name (name);
}
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (ocd_desc, baud_rate))
{
! SERIAL_CLOSE (ocd_desc);
perror_with_name (name);
}
}
! SERIAL_RAW (ocd_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (ocd_desc);
if (from_tty)
{
--- 309,333 ----
else
/* not using Wigglers.dll */
{
! ocd_desc = serial_open (name);
if (!ocd_desc)
perror_with_name (name);
}
if (baud_rate != -1)
{
! if (serial_setbaudrate (ocd_desc, baud_rate))
{
! serial_close (ocd_desc);
perror_with_name (name);
}
}
! serial_raw (ocd_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (ocd_desc);
if (from_tty)
{
*************** readchar (int timeout)
*** 789,795 ****
{
int ch;
! ch = SERIAL_READCHAR (ocd_desc, timeout);
switch (ch)
{
--- 789,795 ----
{
int ch;
! ch = serial_readchar (ocd_desc, timeout);
switch (ch)
{
*************** reset_packet (void)
*** 843,849 ****
static void
output_packet (void)
{
! if (SERIAL_WRITE (ocd_desc, pkt, pktp - pkt))
perror_with_name ("output_packet: write failed");
reset_packet ();
--- 843,849 ----
static void
output_packet (void)
{
! if (serial_write (ocd_desc, pkt, pktp - pkt))
perror_with_name ("output_packet: write failed");
reset_packet ();
*************** ocd_put_packet (unsigned char *buf, int
*** 941,947 ****
}
*packet_ptr++ = -checksum;
! if (SERIAL_WRITE (ocd_desc, packet, packet_ptr - packet))
perror_with_name ("output_packet: write failed");
}
#endif
--- 941,947 ----
}
*packet_ptr++ = -checksum;
! if (serial_write (ocd_desc, packet, packet_ptr - packet))
perror_with_name ("output_packet: write failed");
}
#endif
Index: remote-array.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-array.c,v
retrieving revision 1.16
diff -p -r1.16 remote-array.c
*** remote-array.c 2001/07/11 17:52:32 1.16
--- remote-array.c 2001/07/15 20:19:55
*************** printf_monitor (char *pattern,...)
*** 191,198 ****
if (strlen (buf) > PBUFSIZ)
error ("printf_monitor(): string too long");
! if (SERIAL_WRITE (array_desc, buf, strlen (buf)))
! fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
}
/*
* write_monitor -- send raw data to monitor.
--- 191,198 ----
if (strlen (buf) > PBUFSIZ)
error ("printf_monitor(): string too long");
! if (serial_write (array_desc, buf, strlen (buf)))
! fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
}
/*
* write_monitor -- send raw data to monitor.
*************** printf_monitor (char *pattern,...)
*** 200,207 ****
static void
write_monitor (char data[], int len)
{
! if (SERIAL_WRITE (array_desc, data, len))
! fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
*(data + len + 1) = '\0';
debuglogs (1, "write_monitor(), Sending: \"%s\".", data);
--- 200,207 ----
static void
write_monitor (char data[], int len)
{
! if (serial_write (array_desc, data, len))
! fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
*(data + len + 1) = '\0';
debuglogs (1, "write_monitor(), Sending: \"%s\".", data);
*************** readchar (int timeout)
*** 301,307 ****
{
int c;
! c = SERIAL_READCHAR (array_desc, abs (timeout));
if (sr_get_debug () > 5)
{
--- 301,307 ----
{
int c;
! c = serial_readchar (array_desc, abs (timeout));
if (sr_get_debug () > 5)
{
*************** array_open (char *args, char *name, int
*** 560,580 ****
mips_set_processor_type_command ("lsi33k", 0);
strcpy (dev_name, args);
! array_desc = SERIAL_OPEN (dev_name);
if (array_desc == NULL)
perror_with_name (dev_name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (array_desc, baud_rate))
{
! SERIAL_CLOSE (array_desc);
perror_with_name (name);
}
}
! SERIAL_RAW (array_desc);
#if defined (LOG_FILE)
log_file = fopen (LOG_FILE, "w");
--- 560,580 ----
mips_set_processor_type_command ("lsi33k", 0);
strcpy (dev_name, args);
! array_desc = serial_open (dev_name);
if (array_desc == NULL)
perror_with_name (dev_name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (array_desc, baud_rate))
{
! serial_close (array_desc);
perror_with_name (name);
}
}
! serial_raw (array_desc);
#if defined (LOG_FILE)
log_file = fopen (LOG_FILE, "w");
*************** array_open (char *args, char *name, int
*** 616,622 ****
static void
array_close (int quitting)
{
! SERIAL_CLOSE (array_desc);
array_desc = NULL;
debuglogs (1, "array_close (quitting=%d)", quitting);
--- 616,622 ----
static void
array_close (int quitting)
{
! serial_close (array_desc);
array_desc = NULL;
debuglogs (1, "array_close (quitting=%d)", quitting);
*************** array_wait (ptid_t ptid, struct target_w
*** 705,713 ****
timeout = 0; /* Don't time out -- user program is running. */
#if !defined(__GO32__) && !defined(__MSDOS__) && !defined(_WIN32)
! tty_desc = SERIAL_FDOPEN (0);
! ttystate = SERIAL_GET_TTY_STATE (tty_desc);
! SERIAL_RAW (tty_desc);
i = 0;
/* poll on the serial port and the keyboard. */
--- 705,713 ----
timeout = 0; /* Don't time out -- user program is running. */
#if !defined(__GO32__) && !defined(__MSDOS__) && !defined(_WIN32)
! tty_desc = serial_fdopen (0);
! ttystate = serial_get_tty_state (tty_desc);
! serial_raw (tty_desc);
i = 0;
/* poll on the serial port and the keyboard. */
*************** array_wait (ptid_t ptid, struct target_w
*** 731,740 ****
fputc_unfiltered (c, gdb_stdout);
gdb_flush (gdb_stdout);
}
! c = SERIAL_READCHAR (tty_desc, timeout);
if (c > 0)
{
! SERIAL_WRITE (array_desc, &c, 1);
/* do this so it looks like there's keyboard echo */
if (c == 3) /* exit on Control-C */
break;
--- 731,740 ----
fputc_unfiltered (c, gdb_stdout);
gdb_flush (gdb_stdout);
}
! c = serial_readchar (tty_desc, timeout);
if (c > 0)
{
! serial_write (array_desc, &c, 1);
/* do this so it looks like there's keyboard echo */
if (c == 3) /* exit on Control-C */
break;
*************** array_wait (ptid_t ptid, struct target_w
*** 744,750 ****
#endif
}
}
! SERIAL_SET_TTY_STATE (tty_desc, ttystate);
#else
expect_prompt (1);
debuglogs (4, "array_wait(), got the expect_prompt.");
--- 744,750 ----
#endif
}
}
! serial_set_tty_state (tty_desc, ttystate);
#else
expect_prompt (1);
debuglogs (4, "array_wait(), got the expect_prompt.");
Index: remote-bug.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-bug.c,v
retrieving revision 1.19
diff -p -r1.19 remote-bug.c
*** remote-bug.c 2001/07/10 22:38:38 1.19
--- remote-bug.c 2001/07/15 20:19:58
*************** bug_srec_write_cr (char *s)
*** 398,404 ****
printf ("%c", *p);
do
! SERIAL_WRITE (sr_get_desc (), p, 1);
while (sr_pollchar () != *p);
}
else
--- 398,404 ----
printf ("%c", *p);
do
! serial_write (sr_get_desc (), p, 1);
while (sr_pollchar () != *p);
}
else
Index: remote-e7000.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-e7000.c,v
retrieving revision 1.24
diff -p -r1.24 remote-e7000.c
*** remote-e7000.c 2001/07/13 20:03:52 1.24
--- remote-e7000.c 2001/07/15 20:20:04
*************** puts_e7000debug (char *buf)
*** 154,161 ****
if (remote_debug)
printf_unfiltered ("Sending %s\n", buf);
! if (SERIAL_WRITE (e7000_desc, buf, strlen (buf)))
! fprintf_unfiltered (gdb_stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
/* And expect to see it echoed, unless using the pc interface */
#if 0
--- 154,161 ----
if (remote_debug)
printf_unfiltered ("Sending %s\n", buf);
! if (serial_write (e7000_desc, buf, strlen (buf)))
! fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n", safe_strerror (errno));
/* And expect to see it echoed, unless using the pc interface */
#if 0
*************** putchar_e7000 (int x)
*** 170,182 ****
char b[1];
b[0] = x;
! SERIAL_WRITE (e7000_desc, b, 1);
}
static void
write_e7000 (char *s)
{
! SERIAL_WRITE (e7000_desc, s, strlen (s));
}
static int
--- 170,182 ----
char b[1];
b[0] = x;
! serial_write (e7000_desc, b, 1);
}
static void
write_e7000 (char *s)
{
! serial_write (e7000_desc, s, strlen (s));
}
static int
*************** readchar (int timeout)
*** 198,204 ****
do
{
! c = SERIAL_READCHAR (e7000_desc, timeout);
}
while (c > 127);
--- 198,204 ----
do
{
! c = serial_readchar (e7000_desc, timeout);
}
while (c > 127);
*************** e7000_open (char *args, int from_tty)
*** 645,661 ****
push_target (&e7000_ops);
! e7000_desc = SERIAL_OPEN (dev_name);
if (!e7000_desc)
perror_with_name (dev_name);
! if (SERIAL_SETBAUDRATE (e7000_desc, baudrate))
{
! SERIAL_CLOSE (e7000_desc);
perror_with_name (dev_name);
}
! SERIAL_RAW (e7000_desc);
#ifdef GDB_TARGET_IS_H8300
h8300hmode = 1;
--- 645,661 ----
push_target (&e7000_ops);
! e7000_desc = serial_open (dev_name);
if (!e7000_desc)
perror_with_name (dev_name);
! if (serial_setbaudrate (e7000_desc, baudrate))
{
! serial_close (e7000_desc);
perror_with_name (dev_name);
}
! serial_raw (e7000_desc);
#ifdef GDB_TARGET_IS_H8300
h8300hmode = 1;
*************** e7000_close (int quitting)
*** 678,684 ****
{
if (e7000_desc)
{
! SERIAL_CLOSE (e7000_desc);
e7000_desc = 0;
}
}
--- 678,684 ----
{
if (e7000_desc)
{
! serial_close (e7000_desc);
e7000_desc = 0;
}
}
*************** write_large (CORE_ADDR memaddr, unsigned
*** 1170,1176 ****
compose[where++] = '\n';
compose[where++] = 0;
! SERIAL_WRITE (e7000_desc, compose, where);
j = readchar (0);
if (j == -1)
{
--- 1170,1176 ----
compose[where++] = '\n';
compose[where++] = 0;
! serial_write (e7000_desc, compose, where);
j = readchar (0);
if (j == -1)
{
*************** e7000_load (char *args, int from_tty)
*** 1604,1612 ****
bfd_get_section_contents (pbfd, section, buf + 10, fptr, count);
! if (SERIAL_WRITE (e7000_desc, buf, count + 10))
fprintf_unfiltered (gdb_stderr,
! "e7000_load: SERIAL_WRITE failed: %s\n",
safe_strerror (errno));
expect ("OK");
--- 1604,1612 ----
bfd_get_section_contents (pbfd, section, buf + 10, fptr, count);
! if (serial_write (e7000_desc, buf, count + 10))
fprintf_unfiltered (gdb_stderr,
! "e7000_load: serial_write failed: %s\n",
safe_strerror (errno));
expect ("OK");
Index: remote-es.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-es.c,v
retrieving revision 1.17
diff -p -r1.17 remote-es.c
*** remote-es.c 2001/07/11 17:52:32 1.17
--- remote-es.c 2001/07/15 20:20:08
*************** es1800_open (char *name, int from_tty)
*** 311,351 ****
#ifndef DEBUG_STDIN
! es1800_desc = SERIAL_OPEN (name);
if (es1800_desc == NULL)
{
perror_with_name (name);
}
savename = savestring (name, strlen (name));
! es1800_saved_ttystate = SERIAL_GET_TTY_STATE (es1800_desc);
! if ((fcflag = fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_GETFL, 0)) == -1)
{
perror_with_name ("fcntl serial");
}
es1800_fc_save = fcflag;
fcflag = (fcflag & (FREAD | FWRITE)); /* mask out any funny stuff */
! if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, fcflag) == -1)
{
perror_with_name ("fcntl serial");
}
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (es1800_desc, baud_rate))
{
! SERIAL_CLOSE (es1800_desc);
perror_with_name (name);
}
}
! SERIAL_RAW (es1800_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (es1800_desc);
#endif /* DEBUG_STDIN */
--- 311,351 ----
#ifndef DEBUG_STDIN
! es1800_desc = serial_open (name);
if (es1800_desc == NULL)
{
perror_with_name (name);
}
savename = savestring (name, strlen (name));
! es1800_saved_ttystate = serial_get_tty_state (es1800_desc);
! if ((fcflag = fcntl (deprecated_serial_fd (es1800_desc), F_GETFL, 0)) == -1)
{
perror_with_name ("fcntl serial");
}
es1800_fc_save = fcflag;
fcflag = (fcflag & (FREAD | FWRITE)); /* mask out any funny stuff */
! if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, fcflag) == -1)
{
perror_with_name ("fcntl serial");
}
if (baud_rate != -1)
{
! if (serial_setbaudrate (es1800_desc, baud_rate))
{
! serial_close (es1800_desc);
perror_with_name (name);
}
}
! serial_raw (es1800_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (es1800_desc);
#endif /* DEBUG_STDIN */
*************** es1800_close (int quitting)
*** 427,436 ****
if (es1800_desc != NULL)
{
printf ("\nClosing connection to emulator...\n");
! if (SERIAL_SET_TTY_STATE (es1800_desc, es1800_saved_ttystate) < 0)
print_sys_errmsg ("warning: unable to restore tty state", errno);
! fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, es1800_fc_save);
! SERIAL_CLOSE (es1800_desc);
es1800_desc = NULL;
}
if (savename != NULL)
--- 427,436 ----
if (es1800_desc != NULL)
{
printf ("\nClosing connection to emulator...\n");
! if (serial_set_tty_state (es1800_desc, es1800_saved_ttystate) < 0)
print_sys_errmsg ("warning: unable to restore tty state", errno);
! fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, es1800_fc_save);
! serial_close (es1800_desc);
es1800_desc = NULL;
}
if (savename != NULL)
*************** readchar (void)
*** 1549,1555 ****
{
int ch;
! ch = SERIAL_READCHAR (es1800_desc, timeout);
/* FIXME: doing an error() here will probably cause trouble, at least if from
es1800_wait. */
--- 1549,1555 ----
{
int ch;
! ch = serial_readchar (es1800_desc, timeout);
/* FIXME: doing an error() here will probably cause trouble, at least if from
es1800_wait. */
*************** static void
*** 1579,1585 ****
send_with_reply (char *string, char *buf, int len)
{
send (string);
! SERIAL_WRITE (es1800_desc, "\r", 1);
#ifndef DEBUG_STDIN
expect (string, 1);
--- 1579,1585 ----
send_with_reply (char *string, char *buf, int len)
{
send (string);
! serial_write (es1800_desc, "\r", 1);
#ifndef DEBUG_STDIN
expect (string, 1);
*************** static void
*** 1598,1604 ****
send_command (char *string)
{
send (string);
! SERIAL_WRITE (es1800_desc, "\r", 1);
#ifndef DEBUG_STDIN
expect (string, 0);
--- 1598,1604 ----
send_command (char *string)
{
send (string);
! serial_write (es1800_desc, "\r", 1);
#ifndef DEBUG_STDIN
expect (string, 0);
*************** send (char *string)
*** 1617,1623 ****
{
fprintf (stderr, "Sending: %s\n", string);
}
! SERIAL_WRITE (es1800_desc, string, strlen (string));
}
--- 1617,1623 ----
{
fprintf (stderr, "Sending: %s\n", string);
}
! serial_write (es1800_desc, string, strlen (string));
}
*************** es1800_transparent (char *args, int from
*** 1785,1791 ****
perror_with_name ("ioctl console");
}
! if ((fcflag = fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_GETFL, 0)) == -1)
{
perror_with_name ("fcntl serial");
}
--- 1785,1791 ----
perror_with_name ("ioctl console");
}
! if ((fcflag = fcntl (deprecated_serial_fd (es1800_desc), F_GETFL, 0)) == -1)
{
perror_with_name ("fcntl serial");
}
*************** es1800_transparent (char *args, int from
*** 1793,1799 ****
es1800_fc_save = fcflag;
fcflag = fcflag | FNDELAY;
! if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, fcflag) == -1)
{
perror_with_name ("fcntl serial");
}
--- 1793,1799 ----
es1800_fc_save = fcflag;
fcflag = fcflag | FNDELAY;
! if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, fcflag) == -1)
{
perror_with_name ("fcntl serial");
}
*************** es1800_transparent (char *args, int from
*** 1811,1817 ****
{
es1800_buf[es1800_cnt++] = inputbuf[i++];
}
! if ((cc = SERIAL_WRITE (es1800_desc, es1800_buf, es1800_cnt)) == -1)
{
perror_with_name ("FEL! write:");
}
--- 1811,1817 ----
{
es1800_buf[es1800_cnt++] = inputbuf[i++];
}
! if ((cc = serial_write (es1800_desc, es1800_buf, es1800_cnt)) == -1)
{
perror_with_name ("FEL! write:");
}
*************** es1800_transparent (char *args, int from
*** 1829,1835 ****
perror_with_name ("FEL! read:");
}
! cc = read (DEPRECATED_SERIAL_FD (es1800_desc), inputbuf, inputcnt);
if (cc != -1)
{
for (i = 0; i < cc;)
--- 1829,1835 ----
perror_with_name ("FEL! read:");
}
! cc = read (deprecated_serial_fd (es1800_desc), inputbuf, inputcnt);
if (cc != -1)
{
for (i = 0; i < cc;)
*************** es1800_transparent (char *args, int from
*** 1868,1874 ****
close (console);
! if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, es1800_fc_save) == -1)
{
perror_with_name ("FEL! fcntl");
}
--- 1868,1874 ----
close (console);
! if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, es1800_fc_save) == -1)
{
perror_with_name ("FEL! fcntl");
}
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.22
diff -p -r1.22 remote-mips.c
*** remote-mips.c 2001/07/11 17:52:32 1.22
--- remote-mips.c 2001/07/15 20:20:18
*************** static void
*** 455,465 ****
close_ports (void)
{
mips_is_open = 0;
! SERIAL_CLOSE (mips_desc);
if (udp_in_use)
{
! SERIAL_CLOSE (udp_desc);
udp_in_use = 0;
}
tftp_in_use = 0;
--- 455,465 ----
close_ports (void)
{
mips_is_open = 0;
! serial_close (mips_desc);
if (udp_in_use)
{
! serial_close (udp_desc);
udp_in_use = 0;
}
tftp_in_use = 0;
*************** mips_expect_timeout (const char *string,
*** 551,560 ****
{
int c;
! /* Must use SERIAL_READCHAR here cuz mips_readchar would get confused if we
! were waiting for the mips_monitor_prompt... */
! c = SERIAL_READCHAR (mips_desc, timeout);
if (c == SERIAL_TIMEOUT)
{
--- 551,560 ----
{
int c;
! /* Must use serial_readchar() here cuz mips_readchar would get
! confused if we were waiting for the mips_monitor_prompt... */
! c = serial_readchar (mips_desc, timeout);
if (c == SERIAL_TIMEOUT)
{
*************** mips_getstring (char *string, int n)
*** 607,613 ****
immediate_quit++;
while (n > 0)
{
! c = SERIAL_READCHAR (mips_desc, remote_timeout);
if (c == SERIAL_TIMEOUT)
{
--- 607,613 ----
immediate_quit++;
while (n > 0)
{
! c = serial_readchar (mips_desc, remote_timeout);
if (c == SERIAL_TIMEOUT)
{
*************** mips_getstring (char *string, int n)
*** 626,638 ****
}
/* Read a character from the remote, aborting on error. Returns
! SERIAL_TIMEOUT on timeout (since that's what SERIAL_READCHAR
! returns). FIXME: If we see the string mips_monitor_prompt from
! the board, then we are debugging on the main console port, and we
! have somehow dropped out of remote debugging mode. In this case,
! we automatically go back in to remote debugging mode. This is a
! hack, put in because I can't find any way for a program running on
! the remote board to terminate without also ending remote debugging
mode. I assume users won't have any trouble with this; for one
thing, the IDT documentation generally assumes that the remote
debugging port is not the console port. This is, however, very
--- 626,638 ----
}
/* Read a character from the remote, aborting on error. Returns
! SERIAL_TIMEOUT on timeout (since that's what serial_readchar()
! returns). FIXME: If we see the string mips_monitor_prompt from the
! board, then we are debugging on the main console port, and we have
! somehow dropped out of remote debugging mode. In this case, we
! automatically go back in to remote debugging mode. This is a hack,
! put in because I can't find any way for a program running on the
! remote board to terminate without also ending remote debugging
mode. I assume users won't have any trouble with this; for one
thing, the IDT documentation generally assumes that the remote
debugging port is not the console port. This is, however, very
*************** mips_readchar (int timeout)
*** 656,662 ****
if (state == mips_monitor_prompt_len)
timeout = 1;
! ch = SERIAL_READCHAR (mips_desc, timeout);
if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */
{
--- 656,662 ----
if (state == mips_monitor_prompt_len)
timeout = 1;
! ch = serial_readchar (mips_desc, timeout);
if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */
{
*************** mips_send_packet (const char *s, int get
*** 882,888 ****
fprintf_unfiltered (gdb_stdlog, "Writing \"%s\"\n", packet + 1);
}
! if (SERIAL_WRITE (mips_desc, packet,
HDR_LENGTH + len + TRLR_LENGTH) != 0)
mips_error ("write to target failed: %s", safe_strerror (errno));
--- 882,888 ----
fprintf_unfiltered (gdb_stdlog, "Writing \"%s\"\n", packet + 1);
}
! if (serial_write (mips_desc, packet,
HDR_LENGTH + len + TRLR_LENGTH) != 0)
mips_error ("write to target failed: %s", safe_strerror (errno));
*************** mips_receive_packet (char *buff, int thr
*** 1142,1148 ****
ack + 1);
}
! if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
{
if (throw_error)
mips_error ("write to target failed: %s", safe_strerror (errno));
--- 1142,1148 ----
ack + 1);
}
! if (serial_write (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
{
if (throw_error)
mips_error ("write to target failed: %s", safe_strerror (errno));
*************** mips_receive_packet (char *buff, int thr
*** 1182,1188 ****
ack + 1);
}
! if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
{
if (throw_error)
mips_error ("write to target failed: %s", safe_strerror (errno));
--- 1182,1188 ----
ack + 1);
}
! if (serial_write (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
{
if (throw_error)
mips_error ("write to target failed: %s", safe_strerror (errno));
*************** mips_exit_cleanups (PTR arg)
*** 1295,1301 ****
static void
mips_send_command (const char *cmd, int prompt)
{
! SERIAL_WRITE (mips_desc, cmd, strlen (cmd));
mips_expect (cmd);
mips_expect ("\n");
if (prompt)
--- 1295,1301 ----
static void
mips_send_command (const char *cmd, int prompt)
{
! serial_write (mips_desc, cmd, strlen (cmd));
mips_expect (cmd);
mips_expect ("\n");
if (prompt)
*************** mips_enter_debug (void)
*** 1316,1322 ****
mips_send_command ("db tty0\r", 0);
sleep (1);
! SERIAL_WRITE (mips_desc, "\r", sizeof "\r" - 1);
/* We don't need to absorb any spurious characters here, since the
mips_receive_header will eat up a reasonable number of characters
--- 1316,1322 ----
mips_send_command ("db tty0\r", 0);
sleep (1);
! serial_write (mips_desc, "\r", sizeof "\r" - 1);
/* We don't need to absorb any spurious characters here, since the
mips_receive_header will eat up a reasonable number of characters
*************** mips_initialize (void)
*** 1398,1411 ****
switch (j)
{
case 0: /* First, try sending a CR */
! SERIAL_FLUSH_INPUT (mips_desc);
! SERIAL_WRITE (mips_desc, "\r", 1);
break;
case 1: /* First, try sending a break */
! SERIAL_SEND_BREAK (mips_desc);
break;
case 2: /* Then, try a ^C */
! SERIAL_WRITE (mips_desc, "\003", 1);
break;
case 3: /* Then, try escaping from download */
{
--- 1398,1411 ----
switch (j)
{
case 0: /* First, try sending a CR */
! serial_flush_input (mips_desc);
! serial_write (mips_desc, "\r", 1);
break;
case 1: /* First, try sending a break */
! serial_send_break (mips_desc);
break;
case 2: /* Then, try a ^C */
! serial_write (mips_desc, "\003", 1);
break;
case 3: /* Then, try escaping from download */
{
*************** mips_initialize (void)
*** 1419,1427 ****
packets. In-case we were downloading a large packet
we flush the output buffer before inserting a
termination sequence. */
! SERIAL_FLUSH_OUTPUT (mips_desc);
sprintf (tbuff, "\r/E/E\r");
! SERIAL_WRITE (mips_desc, tbuff, 6);
}
else
{
--- 1419,1427 ----
packets. In-case we were downloading a large packet
we flush the output buffer before inserting a
termination sequence. */
! serial_flush_output (mips_desc);
sprintf (tbuff, "\r/E/E\r");
! serial_write (mips_desc, tbuff, 6);
}
else
{
*************** mips_initialize (void)
*** 1441,1449 ****
for (i = 1; i <= 33; i++)
{
! SERIAL_WRITE (mips_desc, srec, 8);
! if (SERIAL_READCHAR (mips_desc, 0) >= 0)
break; /* Break immediatly if we get something from
the board. */
}
--- 1441,1449 ----
for (i = 1; i <= 33; i++)
{
! serial_write (mips_desc, srec, 8);
! if (serial_readchar (mips_desc, 0) >= 0)
break; /* Break immediatly if we get something from
the board. */
}
*************** device is attached to the target board (
*** 1539,1558 ****
unpush_target (current_ops);
/* Open and initialize the serial port. */
! mips_desc = SERIAL_OPEN (serial_port_name);
if (mips_desc == NULL)
perror_with_name (serial_port_name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (mips_desc, baud_rate))
{
! SERIAL_CLOSE (mips_desc);
perror_with_name (serial_port_name);
}
}
! SERIAL_RAW (mips_desc);
/* Open and initialize the optional download port. If it is in the form
hostname#portnumber, it's a UDP socket. If it is in the form
--- 1539,1558 ----
unpush_target (current_ops);
/* Open and initialize the serial port. */
! mips_desc = serial_open (serial_port_name);
if (mips_desc == NULL)
perror_with_name (serial_port_name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (mips_desc, baud_rate))
{
! serial_close (mips_desc);
perror_with_name (serial_port_name);
}
}
! serial_raw (mips_desc);
/* Open and initialize the optional download port. If it is in the form
hostname#portnumber, it's a UDP socket. If it is in the form
*************** device is attached to the target board (
*** 1562,1568 ****
{
if (strchr (remote_name, '#'))
{
! udp_desc = SERIAL_OPEN (remote_name);
if (!udp_desc)
perror_with_name ("Unable to open UDP port");
udp_in_use = 1;
--- 1562,1568 ----
{
if (strchr (remote_name, '#'))
{
! udp_desc = serial_open (remote_name);
if (!udp_desc)
perror_with_name ("Unable to open UDP port");
udp_in_use = 1;
*************** Give up (and stop debugging it)? "))
*** 2194,2200 ****
if (remote_debug > 0)
printf_unfiltered ("Sending break\n");
! SERIAL_SEND_BREAK (mips_desc);
#if 0
if (mips_is_open)
--- 2194,2200 ----
if (remote_debug > 0)
printf_unfiltered ("Sending break\n");
! serial_send_break (mips_desc);
#if 0
if (mips_is_open)
*************** Give up (and stop debugging it)? "))
*** 2203,2209 ****
/* Send a ^C. */
cc = '\003';
! SERIAL_WRITE (mips_desc, &cc, 1);
sleep (1);
target_mourn_inferior ();
}
--- 2203,2209 ----
/* Send a ^C. */
cc = '\003';
! serial_write (mips_desc, &cc, 1);
sleep (1);
target_mourn_inferior ();
}
*************** send_srec (char *srec, int len, CORE_ADD
*** 2773,2779 ****
{
int ch;
! SERIAL_WRITE (mips_desc, srec, len);
ch = mips_readchar (remote_timeout);
--- 2773,2779 ----
{
int ch;
! serial_write (mips_desc, srec, len);
ch = mips_readchar (remote_timeout);
*************** mips_load_srec (char *args)
*** 2866,2872 ****
send_srec (srec, reclen, abfd->start_address);
! SERIAL_FLUSH_INPUT (mips_desc);
}
/*
--- 2866,2872 ----
send_srec (srec, reclen, abfd->start_address);
! serial_flush_input (mips_desc);
}
/*
*************** pmon_check_ack (char *mesg)
*** 3132,3138 ****
if (!tftp_in_use)
{
! c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc,
remote_timeout);
if ((c == SERIAL_TIMEOUT) || (c != 0x06))
{
--- 3132,3138 ----
if (!tftp_in_use)
{
! c = serial_readchar (udp_in_use ? udp_desc : mips_desc,
remote_timeout);
if ((c == SERIAL_TIMEOUT) || (c != 0x06))
{
*************** pmon_download (char *buffer, int length)
*** 3266,3272 ****
if (tftp_in_use)
fwrite (buffer, 1, length, tftp_file);
else
! SERIAL_WRITE (udp_in_use ? udp_desc : mips_desc, buffer, length);
}
static void
--- 3266,3272 ----
if (tftp_in_use)
fwrite (buffer, 1, length, tftp_file);
else
! serial_write (udp_in_use ? udp_desc : mips_desc, buffer, length);
}
static void
*************** pmon_load_fast (char *file)
*** 3404,3410 ****
if (finished)
{ /* Ignore the termination message: */
! SERIAL_FLUSH_INPUT (udp_in_use ? udp_desc : mips_desc);
}
else
{ /* Deal with termination message: */
--- 3404,3410 ----
if (finished)
{ /* Ignore the termination message: */
! serial_flush_input (udp_in_use ? udp_desc : mips_desc);
}
else
{ /* Deal with termination message: */
Index: remote-nindy.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-nindy.c,v
retrieving revision 1.17
diff -p -r1.17 remote-nindy.c
*** remote-nindy.c 2001/07/11 17:52:32 1.17
--- remote-nindy.c 2001/07/15 20:20:21
*************** static void
*** 158,164 ****
nindy_close (int quitting)
{
if (nindy_serial != NULL)
! SERIAL_CLOSE (nindy_serial);
nindy_serial = NULL;
if (savename)
--- 158,164 ----
nindy_close (int quitting)
{
if (nindy_serial != NULL)
! serial_close (nindy_serial);
nindy_serial = NULL;
if (savename)
*************** static void
*** 285,291 ****
clean_up_tty (PTR ptrarg)
{
struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg;
! SERIAL_SET_TTY_STATE (args->serial, args->state);
xfree (args->state);
warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n");
}
--- 285,291 ----
clean_up_tty (PTR ptrarg)
{
struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg;
! serial_set_tty_state (args->serial, args->state);
xfree (args->state);
warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n");
}
*************** static void (*old_ctrlz) ();
*** 299,305 ****
static void
clean_up_int (void)
{
! SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
xfree (tty_args.state);
signal (SIGINT, old_ctrlc);
--- 299,305 ----
static void
clean_up_int (void)
{
! serial_set_tty_state (tty_args.serial, tty_args.state);
xfree (tty_args.state);
signal (SIGINT, old_ctrlc);
*************** nindy_wait (ptid_t ptid, struct target_w
*** 334,341 ****
/* OPERATE IN PASSTHROUGH MODE UNTIL NINDY SENDS A DLE CHARACTER */
/* Save current tty attributes, and restore them when done. */
! tty_args.serial = SERIAL_FDOPEN (0);
! tty_args.state = SERIAL_GET_TTY_STATE (tty_args.serial);
old_ctrlc = signal (SIGINT, clean_up_int);
#ifdef SIGTSTP
old_ctrlz = signal (SIGTSTP, clean_up_int);
--- 334,341 ----
/* OPERATE IN PASSTHROUGH MODE UNTIL NINDY SENDS A DLE CHARACTER */
/* Save current tty attributes, and restore them when done. */
! tty_args.serial = serial_fdopen (0);
! tty_args.state = serial_get_tty_state (tty_args.serial);
old_ctrlc = signal (SIGINT, clean_up_int);
#ifdef SIGTSTP
old_ctrlz = signal (SIGTSTP, clean_up_int);
*************** nindy_wait (ptid_t ptid, struct target_w
*** 347,365 ****
<CR> and perform echo. */
/* This used to set CBREAK and clear ECHO and CRMOD. I hope this is close
enough. */
! SERIAL_RAW (tty_args.serial);
while (1)
{
/* Input on remote */
! c = SERIAL_READCHAR (nindy_serial, -1);
if (c == SERIAL_ERROR)
{
error ("Cannot read from serial line");
}
else if (c == 0x1b) /* ESC */
{
! c = SERIAL_READCHAR (nindy_serial, -1);
c &= ~0x40;
}
else if (c != 0x10) /* DLE */
--- 347,365 ----
<CR> and perform echo. */
/* This used to set CBREAK and clear ECHO and CRMOD. I hope this is close
enough. */
! serial_raw (tty_args.serial);
while (1)
{
/* Input on remote */
! c = serial_readchar (nindy_serial, -1);
if (c == SERIAL_ERROR)
{
error ("Cannot read from serial line");
}
else if (c == 0x1b) /* ESC */
{
! c = serial_readchar (nindy_serial, -1);
c &= ~0x40;
}
else if (c != 0x10) /* DLE */
*************** nindy_wait (ptid_t ptid, struct target_w
*** 392,398 ****
}
}
! SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
xfree (tty_args.state);
discard_cleanups (old_cleanups);
--- 392,398 ----
}
}
! serial_set_tty_state (tty_args.serial, tty_args.state);
xfree (tty_args.state);
discard_cleanups (old_cleanups);
*************** reset_command (char *args, int from_tty)
*** 541,547 ****
}
if (query ("Really reset the target system?", 0, 0))
{
! SERIAL_SEND_BREAK (nindy_serial);
tty_flush (nindy_serial);
}
}
--- 541,547 ----
}
if (query ("Really reset the target system?", 0, 0))
{
! serial_send_break (nindy_serial);
tty_flush (nindy_serial);
}
}
Index: remote-nrom.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-nrom.c,v
retrieving revision 1.8
diff -p -r1.8 remote-nrom.c
*** remote-nrom.c 2001/07/11 17:52:32 1.8
--- remote-nrom.c 2001/07/15 20:20:21
*************** expect (char *string)
*** 71,77 ****
while (1)
{
! c = SERIAL_READCHAR (ctrl_desc, 5);
if (c == *p++)
{
--- 71,77 ----
while (1)
{
! c = serial_readchar (ctrl_desc, 5);
if (c == *p++)
{
*************** open_socket (char *name, int port)
*** 104,110 ****
struct serial *desc;
sprintf (sockname, "%s:%d", name, port);
! desc = SERIAL_OPEN (sockname);
if (!desc)
perror_with_name (sockname);
--- 104,110 ----
struct serial *desc;
sprintf (sockname, "%s:%d", name, port);
! desc = serial_open (sockname);
if (!desc)
perror_with_name (sockname);
*************** open_socket (char *name, int port)
*** 114,120 ****
static void
load_cleanup (void)
{
! SERIAL_CLOSE (load_desc);
load_desc = NULL;
}
--- 114,120 ----
static void
load_cleanup (void)
{
! serial_close (load_desc);
load_desc = NULL;
}
*************** nrom_load (char *args, int fromtty)
*** 130,136 ****
struct cleanup *old_chain;
/* Tell the netrom to get ready to download. */
! if (SERIAL_WRITE (ctrl_desc, downloadstring, strlen (downloadstring)))
error ("nrom_load: control_send() of `%s' failed", downloadstring);
expect ("Waiting for a connection...\n");
--- 130,136 ----
struct cleanup *old_chain;
/* Tell the netrom to get ready to download. */
! if (serial_write (ctrl_desc, downloadstring, strlen (downloadstring)))
error ("nrom_load: control_send() of `%s' failed", downloadstring);
expect ("Waiting for a connection...\n");
*************** nrom_load (char *args, int fromtty)
*** 181,187 ****
bfd_get_section_contents (pbfd, section, buffer, fptr,
count);
! SERIAL_WRITE (load_desc, buffer, count);
section_address += count;
fptr += count;
section_size -= count;
--- 181,187 ----
bfd_get_section_contents (pbfd, section, buffer, fptr,
count);
! serial_write (load_desc, buffer, count);
section_address += count;
fptr += count;
section_size -= count;
*************** static void
*** 234,242 ****
nrom_close (int quitting)
{
if (load_desc)
! SERIAL_CLOSE (load_desc);
if (ctrl_desc)
! SERIAL_CLOSE (ctrl_desc);
}
/* Pass arguments directly to the NetROM. */
--- 234,242 ----
nrom_close (int quitting)
{
if (load_desc)
! serial_close (load_desc);
if (ctrl_desc)
! serial_close (ctrl_desc);
}
/* Pass arguments directly to the NetROM. */
*************** nrom_passthru (char *args, int fromtty)
*** 247,253 ****
char buf[1024];
sprintf (buf, "%s\n", args);
! if (SERIAL_WRITE (ctrl_desc, buf, strlen (buf)))
error ("nrom_reset: control_send() of `%s'failed", args);
}
--- 247,253 ----
char buf[1024];
sprintf (buf, "%s\n", args);
! if (serial_write (ctrl_desc, buf, strlen (buf)))
error ("nrom_reset: control_send() of `%s'failed", args);
}
Index: remote-os9k.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-os9k.c,v
retrieving revision 1.15
diff -p -r1.15 remote-os9k.c
*** remote-os9k.c 2001/07/11 17:52:32 1.15
--- remote-os9k.c 2001/07/15 20:20:24
*************** printf_monitor (char *pattern,...)
*** 99,106 ****
vsprintf (buf, pattern, args);
va_end (args);
! if (SERIAL_WRITE (monitor_desc, buf, strlen (buf)))
! fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
}
/* Read a character from the remote system, doing all the fancy timeout stuff */
--- 99,106 ----
vsprintf (buf, pattern, args);
va_end (args);
! if (serial_write (monitor_desc, buf, strlen (buf)))
! fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
}
/* Read a character from the remote system, doing all the fancy timeout stuff */
*************** readchar (int timeout)
*** 109,115 ****
{
int c;
! c = SERIAL_READCHAR (monitor_desc, timeout);
if (sr_get_debug ())
putchar (c & 0x7f);
--- 109,115 ----
{
int c;
! c = serial_readchar (monitor_desc, timeout);
if (sr_get_debug ())
putchar (c & 0x7f);
*************** rombug_open (char *args, int from_tty)
*** 311,327 ****
unpush_target (&rombug_ops);
strcpy (dev_name, args);
! monitor_desc = SERIAL_OPEN (dev_name);
if (monitor_desc == NULL)
perror_with_name (dev_name);
/* if baud rate is set by 'set remotebaud' */
! if (SERIAL_SETBAUDRATE (monitor_desc, sr_get_baud_rate ()))
{
! SERIAL_CLOSE (monitor_desc);
perror_with_name ("RomBug");
}
! SERIAL_RAW (monitor_desc);
if (tty_xon || tty_xoff)
{
struct hardware_ttystate
--- 311,327 ----
unpush_target (&rombug_ops);
strcpy (dev_name, args);
! monitor_desc = serial_open (dev_name);
if (monitor_desc == NULL)
perror_with_name (dev_name);
/* if baud rate is set by 'set remotebaud' */
! if (serial_setbaudrate (monitor_desc, sr_get_baud_rate ()))
{
! serial_close (monitor_desc);
perror_with_name ("RomBug");
}
! serial_raw (monitor_desc);
if (tty_xon || tty_xoff)
{
struct hardware_ttystate
*************** rombug_open (char *args, int from_tty)
*** 330,341 ****
}
*tty_s;
! tty_s = (struct hardware_ttystate *) SERIAL_GET_TTY_STATE (monitor_desc);
if (tty_xon)
tty_s->t.c_iflag |= IXON;
if (tty_xoff)
tty_s->t.c_iflag |= IXOFF;
! SERIAL_SET_TTY_STATE (monitor_desc, (serial_ttystate) tty_s);
}
rombug_is_open = 1;
--- 330,341 ----
}
*tty_s;
! tty_s = (struct hardware_ttystate *) serial_get_tty_state (monitor_desc);
if (tty_xon)
tty_s->t.c_iflag |= IXON;
if (tty_xoff)
tty_s->t.c_iflag |= IXOFF;
! serial_set_tty_state (monitor_desc, (serial_ttystate) tty_s);
}
rombug_is_open = 1;
*************** rombug_close (int quitting)
*** 371,377 ****
{
if (rombug_is_open)
{
! SERIAL_CLOSE (monitor_desc);
monitor_desc = NULL;
rombug_is_open = 0;
}
--- 371,377 ----
{
if (rombug_is_open)
{
! serial_close (monitor_desc);
monitor_desc = NULL;
rombug_is_open = 0;
}
*************** rombug_load (char *arg)
*** 947,955 ****
fflush (stdout);
}
! if (SERIAL_WRITE (monitor_desc, buf, bytes_read))
{
! fprintf (stderr, "SERIAL_WRITE failed: (while downloading) %s\n", safe_strerror (errno));
break;
}
i = 0;
--- 947,955 ----
fflush (stdout);
}
! if (serial_write (monitor_desc, buf, bytes_read))
{
! fprintf (stderr, "serial_write failed: (while downloading) %s\n", safe_strerror (errno));
break;
}
i = 0;
*************** static void
*** 1004,1010 ****
cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
! /*SERIAL_RESTORE(0, &ttystate); */
}
static void
--- 1004,1010 ----
cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
! /*serial_restore(0, &ttystate); */
}
static void
*************** connect_command (char *args, int fromtty
*** 1036,1042 ****
do
{
FD_SET (0, &readfds);
! FD_SET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
--- 1036,1042 ----
do
{
FD_SET (0, &readfds);
! FD_SET (deprecated_serial_fd (monitor_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
*************** connect_command (char *args, int fromtty
*** 1071,1077 ****
}
}
! if (FD_ISSET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds))
{
while (1)
{
--- 1071,1077 ----
}
}
! if (FD_ISSET (deprecated_serial_fd (monitor_desc), &readfds))
{
while (1)
{
Index: remote-rdp.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdp.c,v
retrieving revision 1.19
diff -p -r1.19 remote-rdp.c
*** remote-rdp.c 2001/07/13 02:55:57 1.19
--- remote-rdp.c 2001/07/15 20:20:26
*************** remote_rdp_xfer_inferior_memory (CORE_AD
*** 180,186 ****
static unsigned char
get_byte (void)
{
! int c = SERIAL_READCHAR (io, timeout);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
--- 180,186 ----
static unsigned char
get_byte (void)
{
! int c = serial_readchar (io, timeout);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
*************** put_byte (char val)
*** 217,223 ****
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
! SERIAL_WRITE (io, &val, 1);
}
static void
--- 217,223 ----
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
! serial_write (io, &val, 1);
}
static void
*************** put_word (int val)
*** 233,239 ****
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
! SERIAL_WRITE (io, b, 4);
}
--- 233,239 ----
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
! serial_write (io, b, 4);
}
*************** rdp_init (int cold, int tty)
*** 264,271 ****
int restype;
QUIT;
! SERIAL_FLUSH_INPUT (io);
! SERIAL_FLUSH_OUTPUT (io);
if (tty)
printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
--- 264,271 ----
int restype;
QUIT;
! serial_flush_input (io);
! serial_flush_output (io);
if (tty)
printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
*************** rdp_init (int cold, int tty)
*** 277,283 ****
if (cold)
{
put_byte (RDP_RESET);
! while ((restype = SERIAL_READCHAR (io, 1)) > 0)
{
switch (restype)
{
--- 277,283 ----
if (cold)
{
put_byte (RDP_RESET);
! while ((restype = serial_readchar (io, 1)) > 0)
{
switch (restype)
{
*************** rdp_init (int cold, int tty)
*** 304,310 ****
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
put_word (0);
! while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0)
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
--- 304,310 ----
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
put_word (0);
! while (!sync && (restype = serial_readchar (io, 1)) > 0)
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
*************** rdp_init (int cold, int tty)
*** 315,327 ****
break;
case RDP_RESET:
! while ((restype = SERIAL_READCHAR (io, 1)) == RDP_RESET)
;
do
{
printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
}
! while ((restype = SERIAL_READCHAR (io, 1)) > 0);
if (tty)
{
--- 315,327 ----
break;
case RDP_RESET:
! while ((restype = serial_readchar (io, 1)) == RDP_RESET)
;
do
{
printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
}
! while ((restype = serial_readchar (io, 1)) > 0);
if (tty)
{
*************** rdp_init (int cold, int tty)
*** 339,345 ****
case RDP_RES_VALUE:
{
! int resval = SERIAL_READCHAR (io, 1);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
--- 339,345 ----
case RDP_RES_VALUE:
{
! int resval = serial_readchar (io, 1);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
*************** send_rdp (char *template,...)
*** 459,471 ****
pc = va_arg (alist, char *);
val = va_arg (alist, int);
dst = buf;
! SERIAL_WRITE (io, pc, val);
break;
case '-':
/* Send whats in the queue */
if (dst != buf)
{
! SERIAL_WRITE (io, buf, dst - buf);
dst = buf;
}
break;
--- 459,471 ----
pc = va_arg (alist, char *);
val = va_arg (alist, int);
dst = buf;
! serial_write (io, pc, val);
break;
case '-':
/* Send whats in the queue */
if (dst != buf)
{
! serial_write (io, buf, dst - buf);
dst = buf;
}
break;
*************** rdp_execute_finish (void)
*** 995,1006 ****
while (running)
{
int res;
! res = SERIAL_READCHAR (io, 1);
while (res == SERIAL_TIMEOUT)
{
QUIT;
printf_filtered ("Waiting for target..\n");
! res = SERIAL_READCHAR (io, 1);
}
switch (res)
--- 995,1006 ----
while (running)
{
int res;
! res = serial_readchar (io, 1);
while (res == SERIAL_TIMEOUT)
{
QUIT;
printf_filtered ("Waiting for target..\n");
! res = serial_readchar (io, 1);
}
switch (res)
*************** remote_rdp_open (char *args, int from_tt
*** 1111,1122 ****
target_preopen (from_tty);
! io = SERIAL_OPEN (args);
if (!io)
perror_with_name (args);
! SERIAL_RAW (io);
rdp_init (1, from_tty);
--- 1111,1122 ----
target_preopen (from_tty);
! io = serial_open (args);
if (!io)
perror_with_name (args);
! serial_raw (io);
rdp_init (1, from_tty);
*************** remote_rdp_close (int quitting)
*** 1174,1180 ****
{
callback->shutdown (callback);
if (io)
! SERIAL_CLOSE (io);
io = 0;
}
--- 1174,1180 ----
{
callback->shutdown (callback);
if (io)
! serial_close (io);
io = 0;
}
Index: remote-sds.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sds.c,v
retrieving revision 1.17
diff -p -r1.17 remote-sds.c
*** remote-sds.c 2001/07/11 17:52:32 1.17
--- remote-sds.c 2001/07/15 20:20:29
*************** static void
*** 151,157 ****
sds_close (int quitting)
{
if (sds_desc)
! SERIAL_CLOSE (sds_desc);
sds_desc = NULL;
}
--- 151,157 ----
sds_close (int quitting)
{
if (sds_desc)
! serial_close (sds_desc);
sds_desc = NULL;
}
*************** sds_start_remote (PTR dummy)
*** 166,173 ****
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
! SERIAL_WRITE (sds_desc, "{#*\r\n", 5);
! SERIAL_WRITE (sds_desc, "{#}\r\n", 5);
while ((c = readchar (1)) >= 0)
printf_unfiltered ("%c", c);
--- 166,173 ----
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
! serial_write (sds_desc, "{#*\r\n", 5);
! serial_write (sds_desc, "{#}\r\n", 5);
while ((c = readchar (1)) >= 0)
printf_unfiltered ("%c", c);
*************** device is attached to the remote system
*** 201,225 ****
unpush_target (&sds_ops);
! sds_desc = SERIAL_OPEN (name);
if (!sds_desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (sds_desc, baud_rate))
{
! SERIAL_CLOSE (sds_desc);
perror_with_name (name);
}
}
! SERIAL_RAW (sds_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (sds_desc);
if (from_tty)
{
--- 201,225 ----
unpush_target (&sds_ops);
! sds_desc = serial_open (name);
if (!sds_desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (sds_desc, baud_rate))
{
! serial_close (sds_desc);
perror_with_name (name);
}
}
! serial_raw (sds_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (sds_desc);
if (from_tty)
{
*************** readchar (int timeout)
*** 688,694 ****
{
int ch;
! ch = SERIAL_READCHAR (sds_desc, timeout);
if (remote_debug > 1 && ch >= 0)
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
--- 688,694 ----
{
int ch;
! ch = serial_readchar (sds_desc, timeout);
if (remote_debug > 1 && ch >= 0)
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
*************** putmessage (unsigned char *buf, int len)
*** 799,805 ****
header[0], header[1], header[2]);
gdb_flush (gdb_stdlog);
}
! if (SERIAL_WRITE (sds_desc, buf2, p - buf2))
perror_with_name ("putmessage: write failed");
return 1;
--- 799,805 ----
header[0], header[1], header[2]);
gdb_flush (gdb_stdlog);
}
! if (serial_write (sds_desc, buf2, p - buf2))
perror_with_name ("putmessage: write failed");
return 1;
Index: remote-st.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-st.c,v
retrieving revision 1.14
diff -p -r1.14 remote-st.c
*** remote-st.c 2001/07/11 17:52:32 1.14
--- remote-st.c 2001/07/15 20:20:31
*************** printf_stdebug (char *pattern,...)
*** 76,83 ****
vsprintf (buf, pattern, args);
va_end (args);
! if (SERIAL_WRITE (st2000_desc, buf, strlen (buf)))
! fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
}
/* Read a character from the remote system, doing all the fancy timeout
--- 76,83 ----
vsprintf (buf, pattern, args);
va_end (args);
! if (serial_write (st2000_desc, buf, strlen (buf)))
! fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
}
/* Read a character from the remote system, doing all the fancy timeout
*************** readchar (int timeout)
*** 88,94 ****
{
int c;
! c = SERIAL_READCHAR (st2000_desc, timeout);
#ifdef LOG_FILE
putc (c & 0x7f, log_file);
--- 88,94 ----
{
int c;
! c = serial_readchar (st2000_desc, timeout);
#ifdef LOG_FILE
putc (c & 0x7f, log_file);
*************** or target st2000 <host> <port>\n");
*** 280,297 ****
st2000_close (0);
! st2000_desc = SERIAL_OPEN (dev_name);
if (!st2000_desc)
perror_with_name (dev_name);
! if (SERIAL_SETBAUDRATE (st2000_desc, baudrate))
{
! SERIAL_CLOSE (dev_name);
perror_with_name (dev_name);
}
! SERIAL_RAW (st2000_desc);
push_target (&st2000_ops);
--- 280,297 ----
st2000_close (0);
! st2000_desc = serial_open (dev_name);
if (!st2000_desc)
perror_with_name (dev_name);
! if (serial_setbaudrate (st2000_desc, baudrate))
{
! serial_close (dev_name);
perror_with_name (dev_name);
}
! serial_raw (st2000_desc);
push_target (&st2000_ops);
*************** or target st2000 <host> <port>\n");
*** 316,322 ****
static void
st2000_close (int quitting)
{
! SERIAL_CLOSE (st2000_desc);
#if defined (LOG_FILE)
if (log_file)
--- 316,322 ----
static void
st2000_close (int quitting)
{
! serial_close (st2000_desc);
#if defined (LOG_FILE)
if (log_file)
*************** static void
*** 664,670 ****
cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
! /* SERIAL_RESTORE(0, &ttystate); */
}
#if 0
--- 664,670 ----
cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
! /* serial_restore(0, &ttystate); */
}
#if 0
*************** connect_command (char *args, int fromtty
*** 699,705 ****
do
{
FD_SET (0, &readfds);
! FD_SET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
--- 699,705 ----
do
{
FD_SET (0, &readfds);
! FD_SET (deprecated_serial_fd (st2000_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
*************** connect_command (char *args, int fromtty
*** 734,740 ****
}
}
! if (FD_ISSET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds))
{
while (1)
{
--- 734,740 ----
}
}
! if (FD_ISSET (deprecated_serial_fd (st2000_desc), &readfds))
{
while (1)
{
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-utils.c,v
retrieving revision 1.11
diff -p -r1.11 remote-utils.c
*** remote-utils.c 2001/03/06 08:21:13 1.11
--- remote-utils.c 2001/07/15 20:20:32
*************** gr_open (char *args, int from_tty, struc
*** 172,195 ****
if (sr_get_device () == NULL)
usage (gr->ops->to_shortname, NULL);
! sr_set_desc (SERIAL_OPEN (sr_get_device ()));
if (!sr_get_desc ())
perror_with_name ((char *) sr_get_device ());
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (sr_get_desc (), baud_rate) != 0)
{
! SERIAL_CLOSE (sr_get_desc ());
perror_with_name (sr_get_device ());
}
}
! SERIAL_RAW (sr_get_desc ());
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (sr_get_desc ());
/* default retries */
if (sr_get_retries () == 0)
--- 172,195 ----
if (sr_get_device () == NULL)
usage (gr->ops->to_shortname, NULL);
! sr_set_desc (serial_open (sr_get_device ()));
if (!sr_get_desc ())
perror_with_name ((char *) sr_get_device ());
if (baud_rate != -1)
{
! if (serial_setbaudrate (sr_get_desc (), baud_rate) != 0)
{
! serial_close (sr_get_desc ());
perror_with_name (sr_get_device ());
}
}
! serial_raw (sr_get_desc ());
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (sr_get_desc ());
/* default retries */
if (sr_get_retries () == 0)
*************** sr_readchar (void)
*** 222,228 ****
{
int buf;
! buf = SERIAL_READCHAR (sr_get_desc (), sr_get_timeout ());
if (buf == SERIAL_TIMEOUT)
error ("Timeout reading from remote system.");
--- 222,228 ----
{
int buf;
! buf = serial_readchar (sr_get_desc (), sr_get_timeout ());
if (buf == SERIAL_TIMEOUT)
error ("Timeout reading from remote system.");
*************** sr_pollchar (void)
*** 238,244 ****
{
int buf;
! buf = SERIAL_READCHAR (sr_get_desc (), 0);
if (buf == SERIAL_TIMEOUT)
buf = 0;
if (sr_get_debug () > 0)
--- 238,244 ----
{
int buf;
! buf = serial_readchar (sr_get_desc (), 0);
if (buf == SERIAL_TIMEOUT)
buf = 0;
if (sr_get_debug () > 0)
*************** sr_write (char *a, int l)
*** 281,287 ****
{
int i;
! if (SERIAL_WRITE (sr_get_desc (), a, l) != 0)
perror_with_name ("sr_write: Error writing to remote");
if (sr_get_debug () > 0)
--- 281,287 ----
{
int i;
! if (serial_write (sr_get_desc (), a, l) != 0)
perror_with_name ("sr_write: Error writing to remote");
if (sr_get_debug () > 0)
*************** gr_close (int quitting)
*** 398,404 ****
if (sr_is_open ())
{
! SERIAL_CLOSE (sr_get_desc ());
sr_set_desc (NULL);
}
--- 398,404 ----
if (sr_is_open ())
{
! serial_close (sr_get_desc ());
sr_set_desc (NULL);
}
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.57
diff -p -r1.57 remote.c
*** remote.c 2001/07/11 17:52:32 1.57
--- remote.c 2001/07/15 20:20:47
*************** static void
*** 1815,1821 ****
remote_close (int quitting)
{
if (remote_desc)
! SERIAL_CLOSE (remote_desc);
remote_desc = NULL;
}
--- 1815,1821 ----
remote_close (int quitting)
{
if (remote_desc)
! serial_close (remote_desc);
remote_desc = NULL;
}
*************** remote_start_remote (PTR dummy)
*** 2030,2036 ****
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
! SERIAL_WRITE (remote_desc, "+", 1);
/* Let the stub know that we want it to return the thread. */
set_thread (-1, 0);
--- 2030,2036 ----
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
! serial_write (remote_desc, "+", 1);
/* Let the stub know that we want it to return the thread. */
set_thread (-1, 0);
*************** serial device is attached to the remote
*** 2148,2171 ****
unpush_target (target);
! remote_desc = SERIAL_OPEN (name);
if (!remote_desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
{
! SERIAL_CLOSE (remote_desc);
perror_with_name (name);
}
}
! SERIAL_RAW (remote_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (remote_desc);
if (from_tty)
{
--- 2148,2171 ----
unpush_target (target);
! remote_desc = serial_open (name);
if (!remote_desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (remote_desc, baud_rate))
{
! serial_close (remote_desc);
perror_with_name (name);
}
}
! serial_raw (remote_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (remote_desc);
if (from_tty)
{
*************** serial device is attached to the remote
*** 2245,2268 ****
unpush_target (target);
! remote_desc = SERIAL_OPEN (name);
if (!remote_desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
{
! SERIAL_CLOSE (remote_desc);
perror_with_name (name);
}
}
! SERIAL_RAW (remote_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (remote_desc);
if (from_tty)
{
--- 2245,2268 ----
unpush_target (target);
! remote_desc = serial_open (name);
if (!remote_desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (remote_desc, baud_rate))
{
! serial_close (remote_desc);
perror_with_name (name);
}
}
! serial_raw (remote_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (remote_desc);
if (from_tty)
{
*************** remote_async_detach (char *args, int fro
*** 2382,2388 ****
/* Unregister the file descriptor from the event loop. */
if (target_is_async_p ())
! SERIAL_ASYNC (remote_desc, NULL, 0);
target_mourn_inferior ();
if (from_tty)
--- 2382,2388 ----
/* Unregister the file descriptor from the event loop. */
if (target_is_async_p ())
! serial_async (remote_desc, NULL, 0);
target_mourn_inferior ();
if (from_tty)
*************** remote_stop (void)
*** 2765,2773 ****
fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
if (remote_break)
! SERIAL_SEND_BREAK (remote_desc);
else
! SERIAL_WRITE (remote_desc, "\003", 1);
}
/* Ask the user what to do when an interrupt is received. */
--- 2765,2773 ----
fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
if (remote_break)
! serial_send_break (remote_desc);
else
! serial_write (remote_desc, "\003", 1);
}
/* Ask the user what to do when an interrupt is received. */
*************** readchar (int timeout)
*** 3908,3914 ****
{
int ch;
! ch = SERIAL_READCHAR (remote_desc, timeout);
if (ch >= 0)
return (ch & 0x7f);
--- 3908,3914 ----
{
int ch;
! ch = serial_readchar (remote_desc, timeout);
if (ch >= 0)
return (ch & 0x7f);
*************** putpkt_binary (char *buf, int cnt)
*** 4006,4012 ****
fprintf_unfiltered (gdb_stdlog, "...");
gdb_flush (gdb_stdlog);
}
! if (SERIAL_WRITE (remote_desc, buf2, p - buf2))
perror_with_name ("putpkt: write failed");
/* read until either a timeout occurs (-2) or '+' is read */
--- 4006,4012 ----
fprintf_unfiltered (gdb_stdlog, "...");
gdb_flush (gdb_stdlog);
}
! if (serial_write (remote_desc, buf2, p - buf2))
perror_with_name ("putpkt: write failed");
/* read until either a timeout occurs (-2) or '+' is read */
*************** getpkt_sane (char *buf,
*** 4308,4326 ****
fputstr_unfiltered (buf, 0, gdb_stdlog);
fprintf_unfiltered (gdb_stdlog, "\n");
}
! SERIAL_WRITE (remote_desc, "+", 1);
return 0;
}
/* Try the whole thing again. */
retry:
! SERIAL_WRITE (remote_desc, "-", 1);
}
/* We have tried hard enough, and just can't receive the packet. Give up. */
printf_unfiltered ("Ignoring packet error, continuing...\n");
! SERIAL_WRITE (remote_desc, "+", 1);
return 1;
}
--- 4308,4326 ----
fputstr_unfiltered (buf, 0, gdb_stdlog);
fprintf_unfiltered (gdb_stdlog, "\n");
}
! serial_write (remote_desc, "+", 1);
return 0;
}
/* Try the whole thing again. */
retry:
! serial_write (remote_desc, "-", 1);
}
/* We have tried hard enough, and just can't receive the packet. Give up. */
printf_unfiltered ("Ignoring packet error, continuing...\n");
! serial_write (remote_desc, "+", 1);
return 1;
}
*************** remote_async_kill (void)
*** 4351,4357 ****
{
/* Unregister the file descriptor from the event loop. */
if (target_is_async_p ())
! SERIAL_ASYNC (remote_desc, NULL, 0);
/* For some mysterious reason, wait_for_inferior calls kill instead of
mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */
--- 4351,4357 ----
{
/* Unregister the file descriptor from the event loop. */
if (target_is_async_p ())
! serial_async (remote_desc, NULL, 0);
/* For some mysterious reason, wait_for_inferior calls kill instead of
mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */
*************** device is attached to the remote system
*** 5319,5325 ****
unpush_target (&remote_cisco_ops);
! remote_desc = SERIAL_OPEN (name);
if (!remote_desc)
perror_with_name (name);
--- 5319,5325 ----
unpush_target (&remote_cisco_ops);
! remote_desc = serial_open (name);
if (!remote_desc)
perror_with_name (name);
*************** device is attached to the remote system
*** 5330,5346 ****
*/
baud_rate = (baud_rate > 0) ? baud_rate : 9600;
! if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
{
! SERIAL_CLOSE (remote_desc);
perror_with_name (name);
}
! SERIAL_RAW (remote_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! SERIAL_FLUSH_INPUT (remote_desc);
if (from_tty)
{
--- 5330,5346 ----
*/
baud_rate = (baud_rate > 0) ? baud_rate : 9600;
! if (serial_setbaudrate (remote_desc, baud_rate))
{
! serial_close (remote_desc);
perror_with_name (name);
}
! serial_raw (remote_desc);
/* If there is something sitting in the buffer we might take it as a
response to a command, which would be bad. */
! serial_flush_input (remote_desc);
if (from_tty)
{
*************** readtty (void)
*** 5508,5514 ****
/* Make this a zero terminated string and write it out */
tty_input[tty_bytecount] = 0;
! if (SERIAL_WRITE (remote_desc, tty_input, tty_bytecount))
{
perror_with_name ("readtty: write failed");
return FATAL_ERROR;
--- 5508,5514 ----
/* Make this a zero terminated string and write it out */
tty_input[tty_bytecount] = 0;
! if (serial_write (remote_desc, tty_input, tty_bytecount))
{
perror_with_name ("readtty: write failed");
return FATAL_ERROR;
*************** minitelnet (void)
*** 5554,5560 ****
FD_ZERO (&input);
FD_SET (fileno (stdin), &input);
! FD_SET (DEPRECATED_SERIAL_FD (remote_desc), &input);
status = select (tablesize, &input, 0, 0, 0);
if ((status == -1) && (errno != EINTR))
--- 5554,5560 ----
FD_ZERO (&input);
FD_SET (fileno (stdin), &input);
! FD_SET (deprecated_serial_fd (remote_desc), &input);
status = select (tablesize, &input, 0, 0, 0);
if ((status == -1) && (errno != EINTR))
*************** minitelnet (void)
*** 5578,5586 ****
quit_flag = 0;
if (remote_break)
! SERIAL_SEND_BREAK (remote_desc);
else
! SERIAL_WRITE (remote_desc, "\003", 1);
continue;
}
--- 5578,5586 ----
quit_flag = 0;
if (remote_break)
! serial_send_break (remote_desc);
else
! serial_write (remote_desc, "\003", 1);
continue;
}
*************** static int
*** 5650,5663 ****
remote_can_async_p (void)
{
/* We're async whenever the serial device is. */
! return (current_target.to_async_mask_value) && SERIAL_CAN_ASYNC_P (remote_desc);
}
static int
remote_is_async_p (void)
{
/* We're async whenever the serial device is. */
! return (current_target.to_async_mask_value) && SERIAL_IS_ASYNC_P (remote_desc);
}
/* Pass the SERIAL event on and up to the client. One day this code
--- 5650,5663 ----
remote_can_async_p (void)
{
/* We're async whenever the serial device is. */
! return (current_target.to_async_mask_value) && serial_can_async_p (remote_desc);
}
static int
remote_is_async_p (void)
{
/* We're async whenever the serial device is. */
! return (current_target.to_async_mask_value) && serial_is_async_p (remote_desc);
}
/* Pass the SERIAL event on and up to the client. One day this code
*************** remote_async (void (*callback) (enum inf
*** 5685,5696 ****
if (callback != NULL)
{
! SERIAL_ASYNC (remote_desc, remote_async_serial_handler, NULL);
async_client_callback = callback;
async_client_context = context;
}
else
! SERIAL_ASYNC (remote_desc, NULL, NULL);
}
/* Target async and target extended-async.
--- 5685,5696 ----
if (callback != NULL)
{
! serial_async (remote_desc, remote_async_serial_handler, NULL);
async_client_callback = callback;
async_client_context = context;
}
else
! serial_async (remote_desc, NULL, NULL);
}
/* Target async and target extended-async.
Index: ser-unix.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.c,v
retrieving revision 1.14
diff -p -r1.14 ser-unix.c
*** ser-unix.c 2001/07/11 17:52:32 1.14
--- ser-unix.c 2001/07/15 20:20:49
*************** enum {
*** 1184,1190 ****
static void
reschedule (struct serial *scb)
{
! if (SERIAL_IS_ASYNC_P (scb))
{
int next_state;
switch (scb->async_state)
--- 1184,1190 ----
static void
reschedule (struct serial *scb)
{
! if (serial_is_async_p (scb))
{
int next_state;
switch (scb->async_state)
*************** reschedule (struct serial *scb)
*** 1220,1226 ****
next_state = scb->async_state;
break;
}
! if (SERIAL_DEBUG_P (scb))
{
switch (next_state)
{
--- 1220,1226 ----
next_state = scb->async_state;
break;
}
! if (serial_debug_p (scb))
{
switch (next_state)
{
*************** ser_unix_async (struct serial *scb,
*** 1308,1321 ****
{
/* Force a re-schedule. */
scb->async_state = NOTHING_SCHEDULED;
! if (SERIAL_DEBUG_P (scb))
fprintf_unfiltered (gdb_stdlog, "[fd%d->asynchronous]\n",
scb->fd);
reschedule (scb);
}
else
{
! if (SERIAL_DEBUG_P (scb))
fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
scb->fd);
/* De-schedule whatever tasks are currently scheduled. */
--- 1308,1321 ----
{
/* Force a re-schedule. */
scb->async_state = NOTHING_SCHEDULED;
! if (serial_debug_p (scb))
fprintf_unfiltered (gdb_stdlog, "[fd%d->asynchronous]\n",
scb->fd);
reschedule (scb);
}
else
{
! if (serial_debug_p (scb))
fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
scb->fd);
/* De-schedule whatever tasks are currently scheduled. */
Index: serial.c
===================================================================
RCS file: /cvs/src/src/gdb/serial.c,v
retrieving revision 1.11
diff -p -r1.11 serial.c
*** serial.c 2001/07/11 17:52:32 1.11
--- serial.c 2001/07/15 20:20:51
*************** serial_readchar (struct serial *scb, int
*** 350,356 ****
/* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
code is finished. */
! if (0 && SERIAL_IS_ASYNC_P (scb) && timeout < 0)
internal_error (__FILE__, __LINE__,
"serial_readchar: blocking read in async mode");
--- 350,356 ----
/* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
code is finished. */
! if (0 && serial_is_async_p (scb) && timeout < 0)
internal_error (__FILE__, __LINE__,
"serial_readchar: blocking read in async mode");
*************** serial_readchar (struct serial *scb, int
*** 363,369 ****
in case we are getting ready to dump core or something. */
gdb_flush (serial_logfp);
}
! if (SERIAL_DEBUG_P (scb))
{
fprintf_unfiltered (gdb_stdlog, "[");
serial_logchar (gdb_stdlog, 'r', ch, timeout);
--- 363,369 ----
in case we are getting ready to dump core or something. */
gdb_flush (serial_logfp);
}
! if (serial_debug_p (scb))
{
fprintf_unfiltered (gdb_stdlog, "[");
serial_logchar (gdb_stdlog, 'r', ch, timeout);
*************** serial_printf (struct serial *desc, cons
*** 400,406 ****
va_start (args, format);
xvasprintf (&buf, format, args);
! SERIAL_WRITE (desc, buf, strlen (buf));
xfree (buf);
va_end (args);
--- 400,406 ----
va_start (args, format);
xvasprintf (&buf, format, args);
! serial_write (desc, buf, strlen (buf));
xfree (buf);
va_end (args);
*************** static void
*** 554,562 ****
cleanup_tty (serial_ttystate ttystate)
{
printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
! SERIAL_SET_TTY_STATE (tty_desc, ttystate);
xfree (ttystate);
! SERIAL_CLOSE (tty_desc);
}
static void
--- 554,562 ----
cleanup_tty (serial_ttystate ttystate)
{
printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
! serial_set_tty_state (tty_desc, ttystate);
xfree (ttystate);
! serial_close (tty_desc);
}
static void
*************** connect_command (char *args, int fromtty
*** 574,586 ****
printf_unfiltered ("[Entering connect mode. Use ~. or ~^D to escape]\n");
! tty_desc = SERIAL_FDOPEN (0);
port_desc = last_serial_opened;
! ttystate = SERIAL_GET_TTY_STATE (tty_desc);
! SERIAL_RAW (tty_desc);
! SERIAL_RAW (port_desc);
make_cleanup (cleanup_tty, ttystate);
--- 574,586 ----
printf_unfiltered ("[Entering connect mode. Use ~. or ~^D to escape]\n");
! tty_desc = serial_fdopen (0);
port_desc = last_serial_opened;
! ttystate = serial_get_tty_state (tty_desc);
! serial_raw (tty_desc);
! serial_raw (port_desc);
make_cleanup (cleanup_tty, ttystate);
*************** connect_command (char *args, int fromtty
*** 588,594 ****
{
int mask;
! mask = SERIAL_WAIT_2 (tty_desc, port_desc, -1);
if (mask & 2)
{ /* tty input */
--- 588,594 ----
{
int mask;
! mask = serial_wait_2 (tty_desc, port_desc, -1);
if (mask & 2)
{ /* tty input */
*************** connect_command (char *args, int fromtty
*** 596,602 ****
while (1)
{
! c = SERIAL_READCHAR (tty_desc, 0);
if (c == SERIAL_TIMEOUT)
break;
--- 596,602 ----
while (1)
{
! c = serial_readchar (tty_desc, 0);
if (c == SERIAL_TIMEOUT)
break;
*************** connect_command (char *args, int fromtty
*** 605,611 ****
perror_with_name ("connect");
cx = c;
! SERIAL_WRITE (port_desc, &cx, 1);
switch (cur_esc)
{
--- 605,611 ----
perror_with_name ("connect");
cx = c;
! serial_write (port_desc, &cx, 1);
switch (cur_esc)
{
*************** connect_command (char *args, int fromtty
*** 634,640 ****
while (1)
{
! c = SERIAL_READCHAR (port_desc, 0);
if (c == SERIAL_TIMEOUT)
break;
--- 634,640 ----
while (1)
{
! c = serial_readchar (port_desc, 0);
if (c == SERIAL_TIMEOUT)
break;
*************** connect_command (char *args, int fromtty
*** 644,650 ****
cx = c;
! SERIAL_WRITE (tty_desc, &cx, 1);
}
}
}
--- 644,650 ----
cx = c;
! serial_write (tty_desc, &cx, 1);
}
}
}
Index: serial.h
===================================================================
RCS file: /cvs/src/src/gdb/serial.h,v
retrieving revision 1.5
diff -p -r1.5 serial.h
*** serial.h 2001/07/11 17:52:32 1.5
--- serial.h 2001/07/15 20:20:52
*************** struct serial;
*** 35,56 ****
on failure. */
extern struct serial *serial_open (const char *name);
- #define SERIAL_OPEN(NAME) serial_open(NAME)
/* Open a new serial stream using a file handle. */
extern struct serial *serial_fdopen (const int fd);
- #define SERIAL_FDOPEN(FD) serial_fdopen(FD)
/* Push out all buffers, close the device and destroy SCB. */
extern void serial_close (struct serial *scb);
- #define SERIAL_CLOSE(SERIAL_T) serial_close ((SERIAL_T))
/* Push out all buffers and destroy SCB without closing the device. */
extern void serial_un_fdopen (struct serial *scb);
- #define SERIAL_UN_FDOPEN(SERIAL_T) serial_un_fdopen ((SERIAL_T))
/* Read one char from the serial device with TIMEOUT seconds to wait
or -1 to wait forever. Use timeout of 0 to effect a poll.
--- 35,52 ----
*************** enum serial_rc {
*** 69,81 ****
};
extern int serial_readchar (struct serial *scb, int timeout);
- #define SERIAL_READCHAR(SERIAL_T, TIMEOUT) serial_readchar ((SERIAL_T), (TIMEOUT))
/* Write LEN chars from STRING to the port SCB. Returns 0 for
success, non-zero for failure. */
extern int serial_write (struct serial *scb, const char *str, int len);
- #define SERIAL_WRITE(SERIAL_T, STRING,LEN) serial_write (SERIAL_T, STRING, LEN)
/* Write a printf style string onto the serial port. */
--- 65,75 ----
*************** extern void serial_printf (struct serial
*** 84,118 ****
/* Allow pending output to drain. */
extern int serial_drain_output (struct serial *);
- #define SERIAL_DRAIN_OUTPUT(SERIAL_T) serial_drain_output ((SERIAL_T))
/* Flush (discard) pending output. Might also flush input (if this
system can't flush only output). */
extern int serial_flush_output (struct serial *);
- #define SERIAL_FLUSH_OUTPUT(SERIAL_T) serial_flush_output ((SERIAL_T))
/* Flush pending input. Might also flush output (if this system can't
flush only input). */
extern int serial_flush_input (struct serial *);
- #define SERIAL_FLUSH_INPUT(SERIAL_T) serial_flush_input ((SERIAL_T))
/* Send a break between 0.25 and 0.5 seconds long. */
extern int serial_send_break (struct serial *scb);
- #define SERIAL_SEND_BREAK(SERIAL_T) serial_send_break (SERIAL_T)
/* Turn the port into raw mode. */
extern void serial_raw (struct serial *scb);
- #define SERIAL_RAW(SERIAL_T) serial_raw ((SERIAL_T))
/* Return a pointer to a newly malloc'd ttystate containing the state
of the tty. */
extern serial_ttystate serial_get_tty_state (struct serial *scb);
- #define SERIAL_GET_TTY_STATE(SERIAL_T) serial_get_tty_state ((SERIAL_T))
/* Set the state of the tty to TTYSTATE. The change is immediate.
When changing to or from raw mode, input might be discarded.
--- 78,106 ----
*************** extern serial_ttystate serial_get_tty_st
*** 120,149 ****
errno contains the error). */
extern int serial_set_tty_state (struct serial *scb, serial_ttystate ttystate);
- #define SERIAL_SET_TTY_STATE(SERIAL_T, TTYSTATE) serial_set_tty_state ((SERIAL_T), (TTYSTATE))
/* printf_filtered a user-comprehensible description of ttystate on
the specified STREAM. FIXME: At present this sends output to the
default stream - GDB_STDOUT. */
extern void serial_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *);
- #define SERIAL_PRINT_TTY_STATE(SERIAL_T, TTYSTATE, STREAM) serial_print_tty_state ((SERIAL_T), (TTYSTATE), (STREAM))
/* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the
current state (generally obtained from a recent call to
! SERIAL_GET_TTY_STATE), but be careful not to discard any input.
This means that we never switch in or out of raw mode, even if
NEW_TTYSTATE specifies a switch. */
extern int serial_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate);
- #define SERIAL_NOFLUSH_SET_TTY_STATE(SERIAL_T, NEW_TTYSTATE, OLD_TTYSTATE) \
- serial_noflush_set_tty_state ((SERIAL_T), (NEW_TTYSTATE), (OLD_TTYSTATE))
/* Set the baudrate to the decimal value supplied. Returns 0 for
success, -1 for failure. */
extern int serial_setbaudrate (struct serial *scb, int rate);
- #define SERIAL_SETBAUDRATE(SERIAL_T, RATE) serial_setbaudrate ((SERIAL_T), (RATE))
/* Set the number of stop bits to the value specified. Returns 0 for
success, -1 for failure. */
--- 108,132 ----
errno contains the error). */
extern int serial_set_tty_state (struct serial *scb, serial_ttystate ttystate);
/* printf_filtered a user-comprehensible description of ttystate on
the specified STREAM. FIXME: At present this sends output to the
default stream - GDB_STDOUT. */
extern void serial_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *);
/* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the
current state (generally obtained from a recent call to
! serial_get_tty_state()), but be careful not to discard any input.
This means that we never switch in or out of raw mode, even if
NEW_TTYSTATE specifies a switch. */
extern int serial_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate);
/* Set the baudrate to the decimal value supplied. Returns 0 for
success, -1 for failure. */
extern int serial_setbaudrate (struct serial *scb, int rate);
/* Set the number of stop bits to the value specified. Returns 0 for
success, -1 for failure. */
*************** extern int serial_setbaudrate (struct se
*** 153,171 ****
#define SERIAL_2_STOPBITS 3
extern int serial_setstopbits (struct serial *scb, int num);
- #define SERIAL_SETSTOPBITS(SERIAL_T, NUM) serial_setstopbits ((SERIAL_T), (NUM))
/* Asynchronous serial interface: */
/* Can the serial device support asynchronous mode? */
extern int serial_can_async_p (struct serial *scb);
- #define SERIAL_CAN_ASYNC_P(SERIAL_T) serial_can_async_p ((SERIAL_T))
/* Has the serial device been put in asynchronous mode? */
extern int serial_is_async_p (struct serial *scb);
- #define SERIAL_IS_ASYNC_P(SERIAL_T) serial_is_async_p ((SERIAL_T))
/* For ASYNC enabled devices, register a callback and enable
asynchronous mode. To disable asynchronous mode, register a NULL
--- 136,151 ----
*************** extern int serial_is_async_p (struct ser
*** 173,179 ****
typedef void (serial_event_ftype) (struct serial *scb, void *context);
extern void serial_async (struct serial *scb, serial_event_ftype *handler, void *context);
- #define SERIAL_ASYNC(SERIAL_T, HANDLER, CONTEXT) serial_async ((SERIAL_T), (HANDLER), (CONTEXT))
/* Provide direct access to the underlying FD (if any) used to
implement the serial device. This interface is clearly
--- 153,158 ----
*************** extern void serial_async (struct serial
*** 181,198 ****
applicable to the current serial device. */
extern int deprecated_serial_fd (struct serial *scb);
- #define DEPRECATED_SERIAL_FD(SERIAL_T) deprecated_serial_fd ((SERIAL_T))
/* Trace/debug mechanism.
! SERIAL_DEBUG() enables/disables internal debugging.
! SERIAL_DEBUG_P() indicates the current debug state. */
extern void serial_debug (struct serial *scb, int debug_p);
- #define SERIAL_DEBUG(SERIAL_T, DEBUG_P) serial_debug ((SERIAL_T), (DEBUG_P))
extern int serial_debug_p (struct serial *scb);
- #define SERIAL_DEBUG_P(SERIAL_T) serial_debug_p ((SERIAL_T))
/* Details of an instance of a serial object */
--- 160,174 ----
applicable to the current serial device. */
extern int deprecated_serial_fd (struct serial *scb);
/* Trace/debug mechanism.
! serial_debug() enables/disables internal debugging.
! serial_debug_p() indicates the current debug state. */
extern void serial_debug (struct serial *scb, int debug_p);
extern int serial_debug_p (struct serial *scb);
/* Details of an instance of a serial object */
Index: sh3-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/sh3-rom.c,v
retrieving revision 1.10
diff -p -r1.10 sh3-rom.c
*** sh3-rom.c 2001/07/11 17:52:32 1.10
--- sh3-rom.c 2001/07/15 20:20:52
*************** sh3_load (struct serial *desc, char *fil
*** 132,144 ****
{
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, 0, 80, SREC_ALL, hashmark, NULL);
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
! SERIAL_WRITE (desc, "\006", 1); /* Send ACK */
monitor_expect_prompt (NULL, 0);
}
}
--- 132,144 ----
{
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, 0, 80, SREC_ALL, hashmark, NULL);
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
! serial_write (desc, "\006", 1); /* Send ACK */
monitor_expect_prompt (NULL, 0);
}
}
*************** sh3_open (char *args, int from_tty)
*** 270,276 ****
if (parallel_port_name)
{
! parallel = SERIAL_OPEN (parallel_port_name);
if (!parallel)
perror_with_name ("Unable to open parallel port.");
--- 270,276 ----
if (parallel_port_name)
{
! parallel = serial_open (parallel_port_name);
if (!parallel)
perror_with_name ("Unable to open parallel port.");
*************** sh3e_open (char *args, int from_tty)
*** 317,323 ****
if (parallel_port_name)
{
! parallel = SERIAL_OPEN (parallel_port_name);
if (!parallel)
perror_with_name ("Unable to open parallel port.");
--- 317,323 ----
if (parallel_port_name)
{
! parallel = serial_open (parallel_port_name);
if (!parallel)
perror_with_name ("Unable to open parallel port.");
*************** sh3_close (int quitting)
*** 335,341 ****
monitor_close (quitting);
if (parallel_in_use)
{
! SERIAL_CLOSE (parallel);
parallel_in_use = 0;
}
}
--- 335,341 ----
monitor_close (quitting);
if (parallel_in_use)
{
! serial_close (parallel);
parallel_in_use = 0;
}
}
Index: sparcl-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcl-tdep.c,v
retrieving revision 1.13
diff -p -r1.13 sparcl-tdep.c
*** sparcl-tdep.c 2001/07/11 17:52:32 1.13
--- sparcl-tdep.c 2001/07/15 20:20:55
*************** open_tty (char *name)
*** 264,285 ****
{
struct serial *desc;
! desc = SERIAL_OPEN (name);
if (!desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (SERIAL_SETBAUDRATE (desc, baud_rate))
{
! SERIAL_CLOSE (desc);
perror_with_name (name);
}
}
! SERIAL_RAW (desc);
! SERIAL_FLUSH_INPUT (desc);
return desc;
}
--- 264,285 ----
{
struct serial *desc;
! desc = serial_open (name);
if (!desc)
perror_with_name (name);
if (baud_rate != -1)
{
! if (serial_setbaudrate (desc, baud_rate))
{
! serial_close (desc);
perror_with_name (name);
}
}
! serial_raw (desc);
! serial_flush_input (desc);
return desc;
}
*************** readchar (struct serial *desc, int timeo
*** 292,298 ****
int ch;
char s[10];
! ch = SERIAL_READCHAR (desc, timeout);
switch (ch)
{
--- 292,298 ----
int ch;
char s[10];
! ch = serial_readchar (desc, timeout);
switch (ch)
{
*************** debug_serial_write (struct serial *desc,
*** 317,323 ****
{
char s[10];
! SERIAL_WRITE (desc, buf, len);
if (remote_debug > 0)
{
while (len-- > 0)
--- 317,323 ----
{
char s[10];
! serial_write (desc, buf, len);
if (remote_debug > 0)
{
while (len-- > 0)
*************** close_tty (void *ignore)
*** 343,349 ****
if (!remote_desc)
return;
! SERIAL_CLOSE (remote_desc);
remote_desc = NULL;
}
--- 343,349 ----
if (!remote_desc)
return;
! serial_close (remote_desc);
remote_desc = NULL;
}
Index: sparclet-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/sparclet-rom.c,v
retrieving revision 1.7
diff -p -r1.7 sparclet-rom.c
*** sparclet-rom.c 2001/07/11 17:52:32 1.7
--- sparclet-rom.c 2001/07/15 20:20:55
*************** sparclet_load (struct serial *desc, char
*** 173,179 ****
bfd_get_section_contents (abfd, s, buf, i, numbytes);
! SERIAL_WRITE (desc, buf, numbytes);
if (hashmark)
{
--- 173,179 ----
bfd_get_section_contents (abfd, s, buf, i, numbytes);
! serial_write (desc, buf, numbytes);
if (hashmark)
{
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.44
diff -p -r1.44 utils.c
*** utils.c 2001/07/14 18:59:06 1.44
--- utils.c 2001/07/15 20:21:04
*************** quit (void)
*** 842,849 ****
gdb_flush (gdb_stderr);
/* 3. The system-level buffer. */
! SERIAL_DRAIN_OUTPUT (gdb_stdout_serial);
! SERIAL_UN_FDOPEN (gdb_stdout_serial);
annotate_error_begin ();
--- 842,849 ----
gdb_flush (gdb_stderr);
/* 3. The system-level buffer. */
! serial_drain_output (gdb_stdout_serial);
! serial_un_fdopen (gdb_stdout_serial);
annotate_error_begin ();
Index: xmodem.c
===================================================================
RCS file: /cvs/src/src/gdb/xmodem.c,v
retrieving revision 1.5
diff -p -r1.5 xmodem.c
*** xmodem.c 2001/07/11 17:52:32 1.5
--- xmodem.c 2001/07/15 20:21:04
*************** readchar (struct serial *desc, int timeo
*** 40,46 ****
{
int c;
! c = SERIAL_READCHAR (desc, timeout);
if (remote_debug > 0)
fputc_unfiltered (c, gdb_stdlog);
--- 40,46 ----
{
int c;
! c = serial_readchar (desc, timeout);
if (remote_debug > 0)
fputc_unfiltered (c, gdb_stdlog);
*************** xmodem_send_packet (struct serial *desc,
*** 217,223 ****
{
int c;
! SERIAL_WRITE (desc, packet, pktlen);
c = readchar (desc, 3);
switch (c)
--- 217,223 ----
{
int c;
! serial_write (desc, packet, pktlen);
c = readchar (desc, 3);
switch (c)
*************** xmodem_send_packet (struct serial *desc,
*** 238,244 ****
}
}
! SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */
error ("xmodem_send_packet: Excessive retries.");
}
--- 238,244 ----
}
}
! serial_write (desc, "\004", 1); /* Send an EOT */
error ("xmodem_send_packet: Excessive retries.");
}
*************** xmodem_finish_xfer (struct serial *desc)
*** 254,260 ****
{
int c;
! SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */
c = readchar (desc, 3);
switch (c)
--- 254,260 ----
{
int c;
! serial_write (desc, "\004", 1); /* Send an EOT */
c = readchar (desc, 3);
switch (c)
Index: nindy-share/Onindy.c
===================================================================
RCS file: /cvs/src/src/gdb/nindy-share/Onindy.c,v
retrieving revision 1.3
diff -p -r1.3 Onindy.c
*** Onindy.c 2001/07/11 17:52:32 1.3
--- Onindy.c 2001/07/15 20:21:08
*************** static int
*** 185,191 ****
readchar()
{
/* FIXME: Do we really want to be reading without a timeout? */
! return SERIAL_READCHAR (nindy_serial, -1);
}
/******************************************************************************
--- 185,191 ----
readchar()
{
/* FIXME: Do we really want to be reading without a timeout? */
! return serial_readchar (nindy_serial, -1);
}
/******************************************************************************
*************** getpkt (buf)
*** 222,231 ****
fprintf(stderr,
"Bad checksum (recv=0x%02x; calc=0x%02x); retrying\r\n",
recv, csum );
! SERIAL_WRITE (nindy_serial, "-", 1);
}
! SERIAL_WRITE (nindy_serial, "+", 1);
}
--- 222,231 ----
fprintf(stderr,
"Bad checksum (recv=0x%02x; calc=0x%02x); retrying\r\n",
recv, csum );
! serial_write (nindy_serial, "-", 1);
}
! serial_write (nindy_serial, "+", 1);
}
*************** putpkt( cmd )
*** 257,268 ****
resend = 1;
do {
if ( resend ) {
! SERIAL_WRITE ( nindy_serial, "\020", 1 );
! SERIAL_WRITE( nindy_serial, cmd, strlen(cmd) );
! SERIAL_WRITE( nindy_serial, checksum, strlen(checksum) );
}
/* FIXME: do we really want to be reading without timeout? */
! ack = SERIAL_READCHAR (nindy_serial, -1);
if (ack < 0)
{
fprintf (stderr, "error reading from serial port\n");
--- 257,268 ----
resend = 1;
do {
if ( resend ) {
! serial_write ( nindy_serial, "\020", 1 );
! serial_write( nindy_serial, cmd, strlen(cmd) );
! serial_write( nindy_serial, checksum, strlen(checksum) );
}
/* FIXME: do we really want to be reading without timeout? */
! ack = serial_readchar (nindy_serial, -1);
if (ack < 0)
{
fprintf (stderr, "error reading from serial port\n");
Index: nindy-share/nindy.c
===================================================================
RCS file: /cvs/src/src/gdb/nindy-share/nindy.c,v
retrieving revision 1.3
diff -p -r1.3 nindy.c
*** nindy.c 2001/07/11 17:52:32 1.3
--- nindy.c 2001/07/15 20:21:11
*************** rdnin (buf,n,timeout)
*** 235,241 ****
escape_seen = 0;
while (n)
{
! c = SERIAL_READCHAR (nindy_serial, timeout);
switch (c)
{
case SERIAL_ERROR:
--- 235,241 ----
escape_seen = 0;
while (n)
{
! c = serial_readchar (nindy_serial, timeout);
switch (c)
{
case SERIAL_ERROR:
*************** getpkt(buf)
*** 308,321 ****
cs_calc += buf[i];
}
if ( cs_calc == cs_recv ){
! SERIAL_WRITE (nindy_serial, "+", 1);
return hdr[2];
}
/* Bad checksum: report, send NAK, and re-receive
*/
fprintf(stderr, errfmt, cs_recv, cs_calc );
! SERIAL_WRITE (nindy_serial, "-", 1);
}
}
--- 308,321 ----
cs_calc += buf[i];
}
if ( cs_calc == cs_recv ){
! serial_write (nindy_serial, "+", 1);
return hdr[2];
}
/* Bad checksum: report, send NAK, and re-receive
*/
fprintf(stderr, errfmt, cs_recv, cs_calc );
! serial_write (nindy_serial, "-", 1);
}
}
*************** putpkt( msg, len )
*** 367,373 ****
/* Attention, NINDY!
*/
! SERIAL_WRITE (nindy_serial, "\020", 1);
lenlo = len & 0xff;
--- 367,373 ----
/* Attention, NINDY!
*/
! serial_write (nindy_serial, "\020", 1);
lenlo = len & 0xff;
*************** putpkt( msg, len )
*** 387,405 ****
/* Send checksummed message over and over until we get a positive ack
*/
! SERIAL_WRITE (nindy_serial, buf, p - buf);
while (1){
if ( !rdnin(&ack,1,5) ){
/* timed out */
fprintf(stderr,"ACK timed out; resending\r\n");
/* Attention, NINDY! */
! SERIAL_WRITE (nindy_serial, "\020", 1);
! SERIAL_WRITE (nindy_serial, buf, p - buf);
} else if ( ack == '+' ){
return;
} else if ( ack == '-' ){
fprintf( stderr, "Remote NAK; resending\r\n" );
! SERIAL_WRITE (nindy_serial, buf, p - buf);
} else {
fprintf( stderr, "Bad ACK, ignored: <%c>\r\n", ack );
}
--- 387,405 ----
/* Send checksummed message over and over until we get a positive ack
*/
! serial_write (nindy_serial, buf, p - buf);
while (1){
if ( !rdnin(&ack,1,5) ){
/* timed out */
fprintf(stderr,"ACK timed out; resending\r\n");
/* Attention, NINDY! */
! serial_write (nindy_serial, "\020", 1);
! serial_write (nindy_serial, buf, p - buf);
} else if ( ack == '+' ){
return;
} else if ( ack == '-' ){
fprintf( stderr, "Remote NAK; resending\r\n" );
! serial_write (nindy_serial, buf, p - buf);
} else {
fprintf( stderr, "Bad ACK, ignored: <%c>\r\n", ack );
}
*************** try_baudrate (serial, brp)
*** 520,534 ****
unsigned char c;
/* Set specified baud rate and flush all pending input */
! SERIAL_SETBAUDRATE (serial, brp->rate);
tty_flush (serial);
/* Send empty command with bad checksum, hope for NAK ('-') response */
! SERIAL_WRITE (serial, "\020\0\0\001", 4);
/* Anything but a quick '-', including error, eof, or timeout, means that
this baudrate doesn't work. */
! return SERIAL_READCHAR (serial, 1) == '-';
}
/******************************************************************************
--- 520,534 ----
unsigned char c;
/* Set specified baud rate and flush all pending input */
! serial_setbaudrate (serial, brp->rate);
tty_flush (serial);
/* Send empty command with bad checksum, hope for NAK ('-') response */
! serial_write (serial, "\020\0\0\001", 4);
/* Anything but a quick '-', including error, eof, or timeout, means that
this baudrate doesn't work. */
! return serial_readchar (serial, 1) == '-';
}
/******************************************************************************
*************** autobaud( serial, brp )
*** 576,582 ****
ninBaud (brp->string);
/* Change our baud rate back to rate to which we just set NINDY. */
! SERIAL_SETBAUDRATE (serial, brp->rate);
}
/**********************************
--- 576,582 ----
ninBaud (brp->string);
/* Change our baud rate back to rate to which we just set NINDY. */
! serial_setbaudrate (serial, brp->rate);
}
/**********************************
*************** ninBaud( baudrate )
*** 615,621 ****
csum += *p;
}
sprintf (msg, "\020z%s#%02x", baudrate, csum);
! SERIAL_WRITE (nindy_serial, msg, strlen (msg));
}
else
{
--- 615,621 ----
csum += *p;
}
sprintf (msg, "\020z%s#%02x", baudrate, csum);
! serial_write (nindy_serial, msg, strlen (msg));
}
else
{
*************** ninConnect( name, baudrate, brk, silent,
*** 714,730 ****
p = xmalloc(strlen(prefix[i]) + strlen(name) + 1 );
strcpy( p, prefix[i] );
strcat( p, name );
! nindy_serial = SERIAL_OPEN (p);
if (nindy_serial != NULL) {
#ifdef TIOCEXCL
/* Exclusive use mode (hp9000 does not support it) */
ioctl(nindy_serial->fd,TIOCEXCL,NULL);
#endif
! SERIAL_RAW (nindy_serial);
if (brk)
{
! SERIAL_SEND_BREAK (nindy_serial);
}
brp = parse_baudrate( baudrate );
--- 714,730 ----
p = xmalloc(strlen(prefix[i]) + strlen(name) + 1 );
strcpy( p, prefix[i] );
strcat( p, name );
! nindy_serial = serial_open (p);
if (nindy_serial != NULL) {
#ifdef TIOCEXCL
/* Exclusive use mode (hp9000 does not support it) */
ioctl(nindy_serial->fd,TIOCEXCL,NULL);
#endif
! serial_raw (nindy_serial);
if (brk)
{
! serial_send_break (nindy_serial);
}
brp = parse_baudrate( baudrate );
Index: nindy-share/ttyflush.c
===================================================================
RCS file: /cvs/src/src/gdb/nindy-share/ttyflush.c,v
retrieving revision 1.3
diff -p -r1.3 ttyflush.c
*** ttyflush.c 2001/07/11 17:52:32 1.3
--- ttyflush.c 2001/07/15 20:21:11
*************** tty_flush (serial)
*** 31,40 ****
{
while (1)
{
! SERIAL_FLUSH_INPUT (serial);
! SERIAL_FLUSH_OUTPUT (serial);
sleep(1);
! switch (SERIAL_READCHAR (serial, 0))
{
case SERIAL_TIMEOUT:
case SERIAL_ERROR:
--- 31,40 ----
{
while (1)
{
! serial_flush_input (serial);
! serial_flush_output (serial);
sleep(1);
! switch (serial_readchar (serial, 0))
{
case SERIAL_TIMEOUT:
case SERIAL_ERROR: