aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog52
-rw-r--r--gdb/dsrec.c10
-rw-r--r--gdb/inflow.c25
-rw-r--r--gdb/monitor.c28
-rw-r--r--gdb/nindy-share/Onindy.c14
-rw-r--r--gdb/nindy-share/nindy.c32
-rw-r--r--gdb/nindy-share/ttyflush.c6
-rw-r--r--gdb/ocd.c22
-rw-r--r--gdb/remote-array.c32
-rw-r--r--gdb/remote-bug.c2
-rw-r--r--gdb/remote-e7000.c26
-rw-r--r--gdb/remote-es.c40
-rw-r--r--gdb/remote-mips.c78
-rw-r--r--gdb/remote-nindy.c20
-rw-r--r--gdb/remote-nrom.c16
-rw-r--r--gdb/remote-os9k.c30
-rw-r--r--gdb/remote-rdp.c34
-rw-r--r--gdb/remote-sds.c20
-rw-r--r--gdb/remote-st.c22
-rw-r--r--gdb/remote-utils.c18
-rw-r--r--gdb/remote.c68
-rw-r--r--gdb/ser-unix.c8
-rw-r--r--gdb/serial.c28
-rw-r--r--gdb/serial.h30
-rw-r--r--gdb/sh3-rom.c10
-rw-r--r--gdb/sparcl-tdep.c16
-rw-r--r--gdb/sparclet-rom.c2
-rw-r--r--gdb/utils.c4
-rw-r--r--gdb/xmodem.c8
29 files changed, 365 insertions, 336 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 90eab1b..a3a2ff0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,57 @@
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.
+
+2001-07-14 Andrew Cagney <ac131313@redhat.com>
+
* mn10200-tdep.c: Replace value_ptr with ``struct value *''.
* mcore-tdep.c: Ditto.
* sparc-tdep.c: Ditto.
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 01fba79..5f2c2d7 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -84,7 +84,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
srec[reclen] = '\0';
puts_debug ("sent -->", srec, "<--");
}
- SERIAL_WRITE (desc, srec, reclen);
+ serial_write (desc, srec, reclen);
for (s = abfd->sections; s; s = s->next)
if (s->flags & SEC_LOAD)
@@ -121,7 +121,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
acknowledgement is sent back. */
do
{
- SERIAL_WRITE (desc, srec, reclen);
+ serial_write (desc, srec, reclen);
if (ui_load_progress_hook)
if (ui_load_progress_hook (section_name, (unsigned long) i))
error ("Canceled the download");
@@ -157,14 +157,14 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
puts_debug ("sent -->", srec, "<--");
}
- SERIAL_WRITE (desc, srec, reclen);
+ serial_write (desc, srec, reclen);
/* Some monitors need these to wake up properly. (Which ones? -sts) */
- SERIAL_WRITE (desc, "\r\r", 2);
+ serial_write (desc, "\r\r", 2);
if (remote_debug)
puts_debug ("sent -->", "\r\r", "<---");
- SERIAL_FLUSH_INPUT (desc);
+ serial_flush_input (desc);
report_transfer_performance (data_count, start_time, end_time);
}
diff --git a/gdb/inflow.c b/gdb/inflow.c
index f24704d..801bb92 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -129,19 +129,20 @@ gdb_has_a_terminal (void)
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. */
+ /* 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);
+ stdin_serial = serial_fdopen (0);
if (stdin_serial != NULL)
{
- our_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
+ our_ttystate = serial_get_tty_state (stdin_serial);
if (our_ttystate != NULL)
{
@@ -182,11 +183,11 @@ terminal_init_inferior_with_pgrp (int pgrp)
{
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). */
+ /* 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);
+ inferior_ttystate = serial_get_tty_state (stdin_serial);
#ifdef PROCESS_GROUP_TYPE
inferior_process_group = pgrp;
@@ -236,7 +237,7 @@ terminal_inferior (void)
/* 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);
+ result = serial_set_tty_state (stdin_serial, inferior_ttystate);
OOPSY ("setting tty state");
if (!job_control)
@@ -334,7 +335,7 @@ terminal_ours_1 (int output_only)
if (inferior_ttystate)
xfree (inferior_ttystate);
- inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
+ inferior_ttystate = serial_get_tty_state (stdin_serial);
#ifdef HAVE_TERMIOS
inferior_process_group = tcgetpgrp (0);
#endif
@@ -359,7 +360,7 @@ terminal_ours_1 (int output_only)
though, since readline will deal with raw mode when/if it needs to.
*/
- SERIAL_NOFLUSH_SET_TTY_STATE (stdin_serial, our_ttystate,
+ serial_noflush_set_tty_state (stdin_serial, our_ttystate,
inferior_ttystate);
if (job_control)
@@ -489,7 +490,7 @@ child_terminal_info (char *args, int from_tty)
(int) inferior_process_group);
#endif
- SERIAL_PRINT_TTY_STATE (stdin_serial, inferior_ttystate, gdb_stdout);
+ serial_print_tty_state (stdin_serial, inferior_ttystate, gdb_stdout);
}
/* NEW_TTY_PREFORK is called before forking a new child process,
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 6e601b0..d1a48f2 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -396,8 +396,8 @@ monitor_printf (char *pattern,...)
void
monitor_write (char *buf, int buflen)
{
- if (SERIAL_WRITE (monitor_desc, buf, buflen))
- fprintf_unfiltered (gdb_stderr, "SERIAL_WRITE failed: %s\n",
+ if (serial_write (monitor_desc, buf, buflen))
+ fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n",
safe_strerror (errno));
}
@@ -415,7 +415,7 @@ monitor_readchar (void)
do
{
looping = 0;
- c = SERIAL_READCHAR (monitor_desc, timeout);
+ c = serial_readchar (monitor_desc, timeout);
if (c >= 0)
c &= 0xff; /* don't lose bit 7 */
@@ -449,7 +449,7 @@ readchar (int timeout)
do
{
looping = 0;
- c = SERIAL_READCHAR (monitor_desc, timeout);
+ c = serial_readchar (monitor_desc, timeout);
if (c >= 0)
{
@@ -772,27 +772,27 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
xfree (dev_name);
dev_name = xstrdup (args);
- monitor_desc = SERIAL_OPEN (dev_name);
+ 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))
+ if (serial_setbaudrate (monitor_desc, baud_rate))
{
- SERIAL_CLOSE (monitor_desc);
+ serial_close (monitor_desc);
perror_with_name (dev_name);
}
}
- SERIAL_RAW (monitor_desc);
+ serial_raw (monitor_desc);
- SERIAL_FLUSH_INPUT (monitor_desc);
+ serial_flush_input (monitor_desc);
/* some systems only work with 2 stop bits */
- SERIAL_SETSTOPBITS (monitor_desc, mon_ops->stopbits);
+ serial_setstopbits (monitor_desc, mon_ops->stopbits);
current_monitor = mon_ops;
@@ -822,7 +822,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
monitor_expect_prompt (NULL, 0);
}
- SERIAL_FLUSH_INPUT (monitor_desc);
+ serial_flush_input (monitor_desc);
/* Alloc breakpoints */
if (mon_ops->set_break != NULL)
@@ -863,7 +863,7 @@ void
monitor_close (int quitting)
{
if (monitor_desc)
- SERIAL_CLOSE (monitor_desc);
+ serial_close (monitor_desc);
/* Free breakpoint memory */
if (breakaddr != NULL)
@@ -1903,7 +1903,7 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
if (current_monitor->getmem.term_cmd)
{
- SERIAL_WRITE (monitor_desc, 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);
}
@@ -2223,7 +2223,7 @@ monitor_stop (void)
{
monitor_debug ("MON stop\n");
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
- SERIAL_SEND_BREAK (monitor_desc);
+ serial_send_break (monitor_desc);
if (current_monitor->stop)
monitor_printf_noecho (current_monitor->stop);
}
diff --git a/gdb/nindy-share/Onindy.c b/gdb/nindy-share/Onindy.c
index f89bafd..f544183 100644
--- a/gdb/nindy-share/Onindy.c
+++ b/gdb/nindy-share/Onindy.c
@@ -185,7 +185,7 @@ static int
readchar()
{
/* FIXME: Do we really want to be reading without a timeout? */
- return SERIAL_READCHAR (nindy_serial, -1);
+ return serial_readchar (nindy_serial, -1);
}
/******************************************************************************
@@ -222,10 +222,10 @@ getpkt (buf)
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);
}
- SERIAL_WRITE (nindy_serial, "+", 1);
+ serial_write (nindy_serial, "+", 1);
}
@@ -257,12 +257,12 @@ putpkt( cmd )
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) );
+ 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);
+ ack = serial_readchar (nindy_serial, -1);
if (ack < 0)
{
fprintf (stderr, "error reading from serial port\n");
diff --git a/gdb/nindy-share/nindy.c b/gdb/nindy-share/nindy.c
index f32b1a2..77dd734 100644
--- a/gdb/nindy-share/nindy.c
+++ b/gdb/nindy-share/nindy.c
@@ -235,7 +235,7 @@ rdnin (buf,n,timeout)
escape_seen = 0;
while (n)
{
- c = SERIAL_READCHAR (nindy_serial, timeout);
+ c = serial_readchar (nindy_serial, timeout);
switch (c)
{
case SERIAL_ERROR:
@@ -308,14 +308,14 @@ getpkt(buf)
cs_calc += buf[i];
}
if ( cs_calc == cs_recv ){
- SERIAL_WRITE (nindy_serial, "+", 1);
+ 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);
+ serial_write (nindy_serial, "-", 1);
}
}
@@ -367,7 +367,7 @@ putpkt( msg, len )
/* Attention, NINDY!
*/
- SERIAL_WRITE (nindy_serial, "\020", 1);
+ serial_write (nindy_serial, "\020", 1);
lenlo = len & 0xff;
@@ -387,19 +387,19 @@ putpkt( msg, len )
/* Send checksummed message over and over until we get a positive ack
*/
- SERIAL_WRITE (nindy_serial, buf, p - buf);
+ 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);
+ 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);
+ serial_write (nindy_serial, buf, p - buf);
} else {
fprintf( stderr, "Bad ACK, ignored: <%c>\r\n", ack );
}
@@ -520,15 +520,15 @@ try_baudrate (serial, brp)
unsigned char c;
/* Set specified baud rate and flush all pending input */
- SERIAL_SETBAUDRATE (serial, brp->rate);
+ 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);
+ 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) == '-';
+ return serial_readchar (serial, 1) == '-';
}
/******************************************************************************
@@ -576,7 +576,7 @@ autobaud( serial, brp )
ninBaud (brp->string);
/* Change our baud rate back to rate to which we just set NINDY. */
- SERIAL_SETBAUDRATE (serial, brp->rate);
+ serial_setbaudrate (serial, brp->rate);
}
/**********************************
@@ -615,7 +615,7 @@ ninBaud( baudrate )
csum += *p;
}
sprintf (msg, "\020z%s#%02x", baudrate, csum);
- SERIAL_WRITE (nindy_serial, msg, strlen (msg));
+ serial_write (nindy_serial, msg, strlen (msg));
}
else
{
@@ -714,17 +714,17 @@ ninConnect( name, baudrate, brk, silent, old_protocol )
p = xmalloc(strlen(prefix[i]) + strlen(name) + 1 );
strcpy( p, prefix[i] );
strcat( p, name );
- nindy_serial = SERIAL_OPEN (p);
+ 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);
+ serial_raw (nindy_serial);
if (brk)
{
- SERIAL_SEND_BREAK (nindy_serial);
+ serial_send_break (nindy_serial);
}
brp = parse_baudrate( baudrate );
diff --git a/gdb/nindy-share/ttyflush.c b/gdb/nindy-share/ttyflush.c
index 786850a..f9aaa2e 100644
--- a/gdb/nindy-share/ttyflush.c
+++ b/gdb/nindy-share/ttyflush.c
@@ -31,10 +31,10 @@ tty_flush (serial)
{
while (1)
{
- SERIAL_FLUSH_INPUT (serial);
- SERIAL_FLUSH_OUTPUT (serial);
+ serial_flush_input (serial);
+ serial_flush_output (serial);
sleep(1);
- switch (SERIAL_READCHAR (serial, 0))
+ switch (serial_readchar (serial, 0))
{
case SERIAL_TIMEOUT:
case SERIAL_ERROR:
diff --git a/gdb/ocd.c b/gdb/ocd.c
index 72e05e8..8c98d34 100644
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -163,7 +163,7 @@ void
ocd_close (int quitting)
{
if (ocd_desc)
- SERIAL_CLOSE (ocd_desc);
+ serial_close (ocd_desc);
ocd_desc = NULL;
}
@@ -183,7 +183,7 @@ ocd_start_remote (PTR dummy)
immediate_quit++; /* Allow user to interrupt it */
- SERIAL_SEND_BREAK (ocd_desc); /* Wake up the wiggler */
+ serial_send_break (ocd_desc); /* Wake up the wiggler */
speed = 80; /* Divide clock by 4000 */
@@ -292,7 +292,7 @@ device the OCD device is attached to (e.g. /dev/ttya).");
if (strncmp (name, "wiggler", 7) == 0)
{
- ocd_desc = SERIAL_OPEN ("ocd");
+ ocd_desc = serial_open ("ocd");
if (!ocd_desc)
perror_with_name (name);
@@ -309,25 +309,25 @@ device the OCD device is attached to (e.g. /dev/ttya).");
else
/* not using Wigglers.dll */
{
- ocd_desc = SERIAL_OPEN (name);
+ ocd_desc = serial_open (name);
if (!ocd_desc)
perror_with_name (name);
}
if (baud_rate != -1)
{
- if (SERIAL_SETBAUDRATE (ocd_desc, baud_rate))
+ if (serial_setbaudrate (ocd_desc, baud_rate))
{
- SERIAL_CLOSE (ocd_desc);
+ serial_close (ocd_desc);
perror_with_name (name);
}
}
- SERIAL_RAW (ocd_desc);
+ 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);
+ serial_flush_input (ocd_desc);
if (from_tty)
{
@@ -789,7 +789,7 @@ readchar (int timeout)
{
int ch;
- ch = SERIAL_READCHAR (ocd_desc, timeout);
+ ch = serial_readchar (ocd_desc, timeout);
switch (ch)
{
@@ -843,7 +843,7 @@ reset_packet (void)
static void
output_packet (void)
{
- if (SERIAL_WRITE (ocd_desc, pkt, pktp - pkt))
+ if (serial_write (ocd_desc, pkt, pktp - pkt))
perror_with_name ("output_packet: write failed");
reset_packet ();
@@ -941,7 +941,7 @@ ocd_put_packet (unsigned char *buf, int len)
}
*packet_ptr++ = -checksum;
- if (SERIAL_WRITE (ocd_desc, packet, packet_ptr - packet))
+ if (serial_write (ocd_desc, packet, packet_ptr - packet))
perror_with_name ("output_packet: write failed");
}
#endif
diff --git a/gdb/remote-array.c b/gdb/remote-array.c
index dc7589a..eca1692 100644
--- a/gdb/remote-array.c
+++ b/gdb/remote-array.c
@@ -191,8 +191,8 @@ printf_monitor (char *pattern,...)
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));
+ 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.
@@ -200,8 +200,8 @@ printf_monitor (char *pattern,...)
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));
+ 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);
@@ -301,7 +301,7 @@ readchar (int timeout)
{
int c;
- c = SERIAL_READCHAR (array_desc, abs (timeout));
+ c = serial_readchar (array_desc, abs (timeout));
if (sr_get_debug () > 5)
{
@@ -560,21 +560,21 @@ array_open (char *args, char *name, int from_tty)
mips_set_processor_type_command ("lsi33k", 0);
strcpy (dev_name, args);
- array_desc = SERIAL_OPEN (dev_name);
+ 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))
+ if (serial_setbaudrate (array_desc, baud_rate))
{
- SERIAL_CLOSE (array_desc);
+ serial_close (array_desc);
perror_with_name (name);
}
}
- SERIAL_RAW (array_desc);
+ serial_raw (array_desc);
#if defined (LOG_FILE)
log_file = fopen (LOG_FILE, "w");
@@ -616,7 +616,7 @@ array_open (char *args, char *name, int from_tty)
static void
array_close (int quitting)
{
- SERIAL_CLOSE (array_desc);
+ serial_close (array_desc);
array_desc = NULL;
debuglogs (1, "array_close (quitting=%d)", quitting);
@@ -705,9 +705,9 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
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);
+ 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. */
@@ -731,10 +731,10 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
fputc_unfiltered (c, gdb_stdout);
gdb_flush (gdb_stdout);
}
- c = SERIAL_READCHAR (tty_desc, timeout);
+ c = serial_readchar (tty_desc, timeout);
if (c > 0)
{
- SERIAL_WRITE (array_desc, &c, 1);
+ serial_write (array_desc, &c, 1);
/* do this so it looks like there's keyboard echo */
if (c == 3) /* exit on Control-C */
break;
@@ -744,7 +744,7 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
#endif
}
}
- SERIAL_SET_TTY_STATE (tty_desc, ttystate);
+ serial_set_tty_state (tty_desc, ttystate);
#else
expect_prompt (1);
debuglogs (4, "array_wait(), got the expect_prompt.");
diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c
index ff757a5..7ada9ec 100644
--- a/gdb/remote-bug.c
+++ b/gdb/remote-bug.c
@@ -398,7 +398,7 @@ bug_srec_write_cr (char *s)
printf ("%c", *p);
do
- SERIAL_WRITE (sr_get_desc (), p, 1);
+ serial_write (sr_get_desc (), p, 1);
while (sr_pollchar () != *p);
}
else
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 5c46587..fcc175f 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -154,8 +154,8 @@ puts_e7000debug (char *buf)
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));
+ 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
@@ -170,13 +170,13 @@ putchar_e7000 (int x)
char b[1];
b[0] = x;
- SERIAL_WRITE (e7000_desc, b, 1);
+ serial_write (e7000_desc, b, 1);
}
static void
write_e7000 (char *s)
{
- SERIAL_WRITE (e7000_desc, s, strlen (s));
+ serial_write (e7000_desc, s, strlen (s));
}
static int
@@ -198,7 +198,7 @@ readchar (int timeout)
do
{
- c = SERIAL_READCHAR (e7000_desc, timeout);
+ c = serial_readchar (e7000_desc, timeout);
}
while (c > 127);
@@ -645,17 +645,17 @@ e7000_open (char *args, int from_tty)
push_target (&e7000_ops);
- e7000_desc = SERIAL_OPEN (dev_name);
+ e7000_desc = serial_open (dev_name);
if (!e7000_desc)
perror_with_name (dev_name);
- if (SERIAL_SETBAUDRATE (e7000_desc, baudrate))
+ if (serial_setbaudrate (e7000_desc, baudrate))
{
- SERIAL_CLOSE (e7000_desc);
+ serial_close (e7000_desc);
perror_with_name (dev_name);
}
- SERIAL_RAW (e7000_desc);
+ serial_raw (e7000_desc);
#ifdef GDB_TARGET_IS_H8300
h8300hmode = 1;
@@ -678,7 +678,7 @@ e7000_close (int quitting)
{
if (e7000_desc)
{
- SERIAL_CLOSE (e7000_desc);
+ serial_close (e7000_desc);
e7000_desc = 0;
}
}
@@ -1170,7 +1170,7 @@ write_large (CORE_ADDR memaddr, unsigned char *myaddr, int len)
compose[where++] = '\n';
compose[where++] = 0;
- SERIAL_WRITE (e7000_desc, compose, where);
+ serial_write (e7000_desc, compose, where);
j = readchar (0);
if (j == -1)
{
@@ -1604,9 +1604,9 @@ e7000_load (char *args, int from_tty)
bfd_get_section_contents (pbfd, section, buf + 10, fptr, count);
- if (SERIAL_WRITE (e7000_desc, buf, count + 10))
+ if (serial_write (e7000_desc, buf, count + 10))
fprintf_unfiltered (gdb_stderr,
- "e7000_load: SERIAL_WRITE failed: %s\n",
+ "e7000_load: serial_write failed: %s\n",
safe_strerror (errno));
expect ("OK");
diff --git a/gdb/remote-es.c b/gdb/remote-es.c
index 7aa4d62..ff12e88 100644
--- a/gdb/remote-es.c
+++ b/gdb/remote-es.c
@@ -311,41 +311,41 @@ es1800_open (char *name, int from_tty)
#ifndef DEBUG_STDIN
- es1800_desc = SERIAL_OPEN (name);
+ 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);
+ es1800_saved_ttystate = serial_get_tty_state (es1800_desc);
- if ((fcflag = fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_GETFL, 0)) == -1)
+ 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)
+ 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))
+ if (serial_setbaudrate (es1800_desc, baud_rate))
{
- SERIAL_CLOSE (es1800_desc);
+ serial_close (es1800_desc);
perror_with_name (name);
}
}
- SERIAL_RAW (es1800_desc);
+ 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);
+ serial_flush_input (es1800_desc);
#endif /* DEBUG_STDIN */
@@ -427,10 +427,10 @@ es1800_close (int quitting)
if (es1800_desc != NULL)
{
printf ("\nClosing connection to emulator...\n");
- if (SERIAL_SET_TTY_STATE (es1800_desc, es1800_saved_ttystate) < 0)
+ 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);
+ fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, es1800_fc_save);
+ serial_close (es1800_desc);
es1800_desc = NULL;
}
if (savename != NULL)
@@ -1549,7 +1549,7 @@ readchar (void)
{
int ch;
- ch = SERIAL_READCHAR (es1800_desc, timeout);
+ ch = serial_readchar (es1800_desc, timeout);
/* FIXME: doing an error() here will probably cause trouble, at least if from
es1800_wait. */
@@ -1579,7 +1579,7 @@ static void
send_with_reply (char *string, char *buf, int len)
{
send (string);
- SERIAL_WRITE (es1800_desc, "\r", 1);
+ serial_write (es1800_desc, "\r", 1);
#ifndef DEBUG_STDIN
expect (string, 1);
@@ -1598,7 +1598,7 @@ static void
send_command (char *string)
{
send (string);
- SERIAL_WRITE (es1800_desc, "\r", 1);
+ serial_write (es1800_desc, "\r", 1);
#ifndef DEBUG_STDIN
expect (string, 0);
@@ -1617,7 +1617,7 @@ send (char *string)
{
fprintf (stderr, "Sending: %s\n", string);
}
- SERIAL_WRITE (es1800_desc, string, strlen (string));
+ serial_write (es1800_desc, string, strlen (string));
}
@@ -1785,7 +1785,7 @@ es1800_transparent (char *args, int from_tty)
perror_with_name ("ioctl console");
}
- if ((fcflag = fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_GETFL, 0)) == -1)
+ if ((fcflag = fcntl (deprecated_serial_fd (es1800_desc), F_GETFL, 0)) == -1)
{
perror_with_name ("fcntl serial");
}
@@ -1793,7 +1793,7 @@ es1800_transparent (char *args, int from_tty)
es1800_fc_save = fcflag;
fcflag = fcflag | FNDELAY;
- if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, fcflag) == -1)
+ if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, fcflag) == -1)
{
perror_with_name ("fcntl serial");
}
@@ -1811,7 +1811,7 @@ es1800_transparent (char *args, int from_tty)
{
es1800_buf[es1800_cnt++] = inputbuf[i++];
}
- if ((cc = SERIAL_WRITE (es1800_desc, es1800_buf, es1800_cnt)) == -1)
+ if ((cc = serial_write (es1800_desc, es1800_buf, es1800_cnt)) == -1)
{
perror_with_name ("FEL! write:");
}
@@ -1829,7 +1829,7 @@ es1800_transparent (char *args, int from_tty)
perror_with_name ("FEL! read:");
}
- cc = read (DEPRECATED_SERIAL_FD (es1800_desc), inputbuf, inputcnt);
+ cc = read (deprecated_serial_fd (es1800_desc), inputbuf, inputcnt);
if (cc != -1)
{
for (i = 0; i < cc;)
@@ -1868,7 +1868,7 @@ es1800_transparent (char *args, int from_tty)
close (console);
- if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, es1800_fc_save) == -1)
+ if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, es1800_fc_save) == -1)
{
perror_with_name ("FEL! fcntl");
}
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 5adb729..0f6d995 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -455,11 +455,11 @@ static void
close_ports (void)
{
mips_is_open = 0;
- SERIAL_CLOSE (mips_desc);
+ serial_close (mips_desc);
if (udp_in_use)
{
- SERIAL_CLOSE (udp_desc);
+ serial_close (udp_desc);
udp_in_use = 0;
}
tftp_in_use = 0;
@@ -551,10 +551,10 @@ mips_expect_timeout (const char *string, int timeout)
{
int c;
-/* Must use SERIAL_READCHAR here cuz mips_readchar would get confused if we
- were waiting for the mips_monitor_prompt... */
+ /* 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);
+ c = serial_readchar (mips_desc, timeout);
if (c == SERIAL_TIMEOUT)
{
@@ -607,7 +607,7 @@ mips_getstring (char *string, int n)
immediate_quit++;
while (n > 0)
{
- c = SERIAL_READCHAR (mips_desc, remote_timeout);
+ c = serial_readchar (mips_desc, remote_timeout);
if (c == SERIAL_TIMEOUT)
{
@@ -626,13 +626,13 @@ mips_getstring (char *string, int n)
}
/* 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
+ 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
@@ -656,7 +656,7 @@ mips_readchar (int timeout)
if (state == mips_monitor_prompt_len)
timeout = 1;
- ch = SERIAL_READCHAR (mips_desc, timeout);
+ ch = serial_readchar (mips_desc, timeout);
if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */
{
@@ -882,7 +882,7 @@ mips_send_packet (const char *s, int get_ack)
fprintf_unfiltered (gdb_stdlog, "Writing \"%s\"\n", packet + 1);
}
- if (SERIAL_WRITE (mips_desc, packet,
+ if (serial_write (mips_desc, packet,
HDR_LENGTH + len + TRLR_LENGTH) != 0)
mips_error ("write to target failed: %s", safe_strerror (errno));
@@ -1142,7 +1142,7 @@ mips_receive_packet (char *buff, int throw_error, int timeout)
ack + 1);
}
- if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
+ 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,7 +1182,7 @@ mips_receive_packet (char *buff, int throw_error, int timeout)
ack + 1);
}
- if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
+ if (serial_write (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
{
if (throw_error)
mips_error ("write to target failed: %s", safe_strerror (errno));
@@ -1295,7 +1295,7 @@ mips_exit_cleanups (PTR arg)
static void
mips_send_command (const char *cmd, int prompt)
{
- SERIAL_WRITE (mips_desc, cmd, strlen (cmd));
+ serial_write (mips_desc, cmd, strlen (cmd));
mips_expect (cmd);
mips_expect ("\n");
if (prompt)
@@ -1316,7 +1316,7 @@ mips_enter_debug (void)
mips_send_command ("db tty0\r", 0);
sleep (1);
- SERIAL_WRITE (mips_desc, "\r", sizeof "\r" - 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
@@ -1398,14 +1398,14 @@ mips_initialize (void)
switch (j)
{
case 0: /* First, try sending a CR */
- SERIAL_FLUSH_INPUT (mips_desc);
- SERIAL_WRITE (mips_desc, "\r", 1);
+ serial_flush_input (mips_desc);
+ serial_write (mips_desc, "\r", 1);
break;
case 1: /* First, try sending a break */
- SERIAL_SEND_BREAK (mips_desc);
+ serial_send_break (mips_desc);
break;
case 2: /* Then, try a ^C */
- SERIAL_WRITE (mips_desc, "\003", 1);
+ serial_write (mips_desc, "\003", 1);
break;
case 3: /* Then, try escaping from download */
{
@@ -1419,9 +1419,9 @@ mips_initialize (void)
packets. In-case we were downloading a large packet
we flush the output buffer before inserting a
termination sequence. */
- SERIAL_FLUSH_OUTPUT (mips_desc);
+ serial_flush_output (mips_desc);
sprintf (tbuff, "\r/E/E\r");
- SERIAL_WRITE (mips_desc, tbuff, 6);
+ serial_write (mips_desc, tbuff, 6);
}
else
{
@@ -1441,9 +1441,9 @@ mips_initialize (void)
for (i = 1; i <= 33; i++)
{
- SERIAL_WRITE (mips_desc, srec, 8);
+ serial_write (mips_desc, srec, 8);
- if (SERIAL_READCHAR (mips_desc, 0) >= 0)
+ if (serial_readchar (mips_desc, 0) >= 0)
break; /* Break immediatly if we get something from
the board. */
}
@@ -1539,20 +1539,20 @@ device is attached to the target board (e.g., /dev/ttya).\n"
unpush_target (current_ops);
/* Open and initialize the serial port. */
- mips_desc = SERIAL_OPEN (serial_port_name);
+ 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))
+ if (serial_setbaudrate (mips_desc, baud_rate))
{
- SERIAL_CLOSE (mips_desc);
+ serial_close (mips_desc);
perror_with_name (serial_port_name);
}
}
- SERIAL_RAW (mips_desc);
+ 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
@@ -1562,7 +1562,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
{
if (strchr (remote_name, '#'))
{
- udp_desc = SERIAL_OPEN (remote_name);
+ udp_desc = serial_open (remote_name);
if (!udp_desc)
perror_with_name ("Unable to open UDP port");
udp_in_use = 1;
@@ -2194,7 +2194,7 @@ Give up (and stop debugging it)? "))
if (remote_debug > 0)
printf_unfiltered ("Sending break\n");
- SERIAL_SEND_BREAK (mips_desc);
+ serial_send_break (mips_desc);
#if 0
if (mips_is_open)
@@ -2203,7 +2203,7 @@ Give up (and stop debugging it)? "))
/* Send a ^C. */
cc = '\003';
- SERIAL_WRITE (mips_desc, &cc, 1);
+ serial_write (mips_desc, &cc, 1);
sleep (1);
target_mourn_inferior ();
}
@@ -2773,7 +2773,7 @@ send_srec (char *srec, int len, CORE_ADDR addr)
{
int ch;
- SERIAL_WRITE (mips_desc, srec, len);
+ serial_write (mips_desc, srec, len);
ch = mips_readchar (remote_timeout);
@@ -2866,7 +2866,7 @@ mips_load_srec (char *args)
send_srec (srec, reclen, abfd->start_address);
- SERIAL_FLUSH_INPUT (mips_desc);
+ serial_flush_input (mips_desc);
}
/*
@@ -3132,7 +3132,7 @@ pmon_check_ack (char *mesg)
if (!tftp_in_use)
{
- c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc,
+ c = serial_readchar (udp_in_use ? udp_desc : mips_desc,
remote_timeout);
if ((c == SERIAL_TIMEOUT) || (c != 0x06))
{
@@ -3266,7 +3266,7 @@ pmon_download (char *buffer, int length)
if (tftp_in_use)
fwrite (buffer, 1, length, tftp_file);
else
- SERIAL_WRITE (udp_in_use ? udp_desc : mips_desc, buffer, length);
+ serial_write (udp_in_use ? udp_desc : mips_desc, buffer, length);
}
static void
@@ -3404,7 +3404,7 @@ pmon_load_fast (char *file)
if (finished)
{ /* Ignore the termination message: */
- SERIAL_FLUSH_INPUT (udp_in_use ? udp_desc : mips_desc);
+ serial_flush_input (udp_in_use ? udp_desc : mips_desc);
}
else
{ /* Deal with termination message: */
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 0acd90d..18862c2 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -158,7 +158,7 @@ static void
nindy_close (int quitting)
{
if (nindy_serial != NULL)
- SERIAL_CLOSE (nindy_serial);
+ serial_close (nindy_serial);
nindy_serial = NULL;
if (savename)
@@ -285,7 +285,7 @@ static void
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);
+ 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");
}
@@ -299,7 +299,7 @@ static void (*old_ctrlz) ();
static void
clean_up_int (void)
{
- SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
+ serial_set_tty_state (tty_args.serial, tty_args.state);
xfree (tty_args.state);
signal (SIGINT, old_ctrlc);
@@ -334,8 +334,8 @@ nindy_wait (ptid_t ptid, struct target_waitstatus *status)
/* 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);
+ 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);
@@ -347,19 +347,19 @@ nindy_wait (ptid_t ptid, struct target_waitstatus *status)
<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);
+ serial_raw (tty_args.serial);
while (1)
{
/* Input on remote */
- c = SERIAL_READCHAR (nindy_serial, -1);
+ 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 = serial_readchar (nindy_serial, -1);
c &= ~0x40;
}
else if (c != 0x10) /* DLE */
@@ -392,7 +392,7 @@ nindy_wait (ptid_t ptid, struct target_waitstatus *status)
}
}
- SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
+ serial_set_tty_state (tty_args.serial, tty_args.state);
xfree (tty_args.state);
discard_cleanups (old_cleanups);
@@ -541,7 +541,7 @@ reset_command (char *args, int from_tty)
}
if (query ("Really reset the target system?", 0, 0))
{
- SERIAL_SEND_BREAK (nindy_serial);
+ serial_send_break (nindy_serial);
tty_flush (nindy_serial);
}
}
diff --git a/gdb/remote-nrom.c b/gdb/remote-nrom.c
index 3409723..436c3d2 100644
--- a/gdb/remote-nrom.c
+++ b/gdb/remote-nrom.c
@@ -71,7 +71,7 @@ expect (char *string)
while (1)
{
- c = SERIAL_READCHAR (ctrl_desc, 5);
+ c = serial_readchar (ctrl_desc, 5);
if (c == *p++)
{
@@ -104,7 +104,7 @@ open_socket (char *name, int port)
struct serial *desc;
sprintf (sockname, "%s:%d", name, port);
- desc = SERIAL_OPEN (sockname);
+ desc = serial_open (sockname);
if (!desc)
perror_with_name (sockname);
@@ -114,7 +114,7 @@ open_socket (char *name, int port)
static void
load_cleanup (void)
{
- SERIAL_CLOSE (load_desc);
+ serial_close (load_desc);
load_desc = NULL;
}
@@ -130,7 +130,7 @@ nrom_load (char *args, int fromtty)
struct cleanup *old_chain;
/* Tell the netrom to get ready to download. */
- if (SERIAL_WRITE (ctrl_desc, downloadstring, strlen (downloadstring)))
+ if (serial_write (ctrl_desc, downloadstring, strlen (downloadstring)))
error ("nrom_load: control_send() of `%s' failed", downloadstring);
expect ("Waiting for a connection...\n");
@@ -181,7 +181,7 @@ nrom_load (char *args, int fromtty)
bfd_get_section_contents (pbfd, section, buffer, fptr,
count);
- SERIAL_WRITE (load_desc, buffer, count);
+ serial_write (load_desc, buffer, count);
section_address += count;
fptr += count;
section_size -= count;
@@ -234,9 +234,9 @@ static void
nrom_close (int quitting)
{
if (load_desc)
- SERIAL_CLOSE (load_desc);
+ serial_close (load_desc);
if (ctrl_desc)
- SERIAL_CLOSE (ctrl_desc);
+ serial_close (ctrl_desc);
}
/* Pass arguments directly to the NetROM. */
@@ -247,7 +247,7 @@ nrom_passthru (char *args, int fromtty)
char buf[1024];
sprintf (buf, "%s\n", args);
- if (SERIAL_WRITE (ctrl_desc, buf, strlen (buf)))
+ if (serial_write (ctrl_desc, buf, strlen (buf)))
error ("nrom_reset: control_send() of `%s'failed", args);
}
diff --git a/gdb/remote-os9k.c b/gdb/remote-os9k.c
index 1b693eb..6c117b2 100644
--- a/gdb/remote-os9k.c
+++ b/gdb/remote-os9k.c
@@ -99,8 +99,8 @@ printf_monitor (char *pattern,...)
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));
+ 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 */
@@ -109,7 +109,7 @@ readchar (int timeout)
{
int c;
- c = SERIAL_READCHAR (monitor_desc, timeout);
+ c = serial_readchar (monitor_desc, timeout);
if (sr_get_debug ())
putchar (c & 0x7f);
@@ -311,17 +311,17 @@ rombug_open (char *args, int from_tty)
unpush_target (&rombug_ops);
strcpy (dev_name, args);
- monitor_desc = SERIAL_OPEN (dev_name);
+ 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 ()))
+ if (serial_setbaudrate (monitor_desc, sr_get_baud_rate ()))
{
- SERIAL_CLOSE (monitor_desc);
+ serial_close (monitor_desc);
perror_with_name ("RomBug");
}
- SERIAL_RAW (monitor_desc);
+ serial_raw (monitor_desc);
if (tty_xon || tty_xoff)
{
struct hardware_ttystate
@@ -330,12 +330,12 @@ rombug_open (char *args, int from_tty)
}
*tty_s;
- tty_s = (struct hardware_ttystate *) SERIAL_GET_TTY_STATE (monitor_desc);
+ 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);
+ serial_set_tty_state (monitor_desc, (serial_ttystate) tty_s);
}
rombug_is_open = 1;
@@ -371,7 +371,7 @@ rombug_close (int quitting)
{
if (rombug_is_open)
{
- SERIAL_CLOSE (monitor_desc);
+ serial_close (monitor_desc);
monitor_desc = NULL;
rombug_is_open = 0;
}
@@ -947,9 +947,9 @@ rombug_load (char *arg)
fflush (stdout);
}
- if (SERIAL_WRITE (monitor_desc, buf, bytes_read))
+ if (serial_write (monitor_desc, buf, bytes_read))
{
- fprintf (stderr, "SERIAL_WRITE failed: (while downloading) %s\n", safe_strerror (errno));
+ fprintf (stderr, "serial_write failed: (while downloading) %s\n", safe_strerror (errno));
break;
}
i = 0;
@@ -1004,7 +1004,7 @@ static void
cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
- /*SERIAL_RESTORE(0, &ttystate); */
+ /*serial_restore(0, &ttystate); */
}
static void
@@ -1036,7 +1036,7 @@ connect_command (char *args, int fromtty)
do
{
FD_SET (0, &readfds);
- FD_SET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds);
+ FD_SET (deprecated_serial_fd (monitor_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
@@ -1071,7 +1071,7 @@ connect_command (char *args, int fromtty)
}
}
- if (FD_ISSET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds))
+ if (FD_ISSET (deprecated_serial_fd (monitor_desc), &readfds))
{
while (1)
{
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index 11d18d1..22f5b3e 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -180,7 +180,7 @@ remote_rdp_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
static unsigned char
get_byte (void)
{
- int c = SERIAL_READCHAR (io, timeout);
+ int c = serial_readchar (io, timeout);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
@@ -217,7 +217,7 @@ put_byte (char val)
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
- SERIAL_WRITE (io, &val, 1);
+ serial_write (io, &val, 1);
}
static void
@@ -233,7 +233,7 @@ put_word (int val)
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
- SERIAL_WRITE (io, b, 4);
+ serial_write (io, b, 4);
}
@@ -264,8 +264,8 @@ rdp_init (int cold, int tty)
int restype;
QUIT;
- SERIAL_FLUSH_INPUT (io);
- SERIAL_FLUSH_OUTPUT (io);
+ serial_flush_input (io);
+ serial_flush_output (io);
if (tty)
printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
@@ -277,7 +277,7 @@ rdp_init (int cold, int tty)
if (cold)
{
put_byte (RDP_RESET);
- while ((restype = SERIAL_READCHAR (io, 1)) > 0)
+ while ((restype = serial_readchar (io, 1)) > 0)
{
switch (restype)
{
@@ -304,7 +304,7 @@ rdp_init (int cold, int tty)
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
put_word (0);
- while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0)
+ while (!sync && (restype = serial_readchar (io, 1)) > 0)
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
@@ -315,13 +315,13 @@ rdp_init (int cold, int tty)
break;
case RDP_RESET:
- while ((restype = SERIAL_READCHAR (io, 1)) == RDP_RESET)
+ while ((restype = serial_readchar (io, 1)) == RDP_RESET)
;
do
{
printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
}
- while ((restype = SERIAL_READCHAR (io, 1)) > 0);
+ while ((restype = serial_readchar (io, 1)) > 0);
if (tty)
{
@@ -339,7 +339,7 @@ rdp_init (int cold, int tty)
case RDP_RES_VALUE:
{
- int resval = SERIAL_READCHAR (io, 1);
+ int resval = serial_readchar (io, 1);
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
@@ -459,13 +459,13 @@ send_rdp (char *template,...)
pc = va_arg (alist, char *);
val = va_arg (alist, int);
dst = buf;
- SERIAL_WRITE (io, pc, val);
+ serial_write (io, pc, val);
break;
case '-':
/* Send whats in the queue */
if (dst != buf)
{
- SERIAL_WRITE (io, buf, dst - buf);
+ serial_write (io, buf, dst - buf);
dst = buf;
}
break;
@@ -995,12 +995,12 @@ rdp_execute_finish (void)
while (running)
{
int res;
- res = SERIAL_READCHAR (io, 1);
+ res = serial_readchar (io, 1);
while (res == SERIAL_TIMEOUT)
{
QUIT;
printf_filtered ("Waiting for target..\n");
- res = SERIAL_READCHAR (io, 1);
+ res = serial_readchar (io, 1);
}
switch (res)
@@ -1111,12 +1111,12 @@ remote_rdp_open (char *args, int from_tty)
target_preopen (from_tty);
- io = SERIAL_OPEN (args);
+ io = serial_open (args);
if (!io)
perror_with_name (args);
- SERIAL_RAW (io);
+ serial_raw (io);
rdp_init (1, from_tty);
@@ -1174,7 +1174,7 @@ remote_rdp_close (int quitting)
{
callback->shutdown (callback);
if (io)
- SERIAL_CLOSE (io);
+ serial_close (io);
io = 0;
}
diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c
index 73fab94..fd4e657 100644
--- a/gdb/remote-sds.c
+++ b/gdb/remote-sds.c
@@ -151,7 +151,7 @@ static void
sds_close (int quitting)
{
if (sds_desc)
- SERIAL_CLOSE (sds_desc);
+ serial_close (sds_desc);
sds_desc = NULL;
}
@@ -166,8 +166,8 @@ sds_start_remote (PTR dummy)
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);
+ serial_write (sds_desc, "{#*\r\n", 5);
+ serial_write (sds_desc, "{#}\r\n", 5);
while ((c = readchar (1)) >= 0)
printf_unfiltered ("%c", c);
@@ -201,25 +201,25 @@ device is attached to the remote system (e.g. /dev/ttya).");
unpush_target (&sds_ops);
- sds_desc = SERIAL_OPEN (name);
+ sds_desc = serial_open (name);
if (!sds_desc)
perror_with_name (name);
if (baud_rate != -1)
{
- if (SERIAL_SETBAUDRATE (sds_desc, baud_rate))
+ if (serial_setbaudrate (sds_desc, baud_rate))
{
- SERIAL_CLOSE (sds_desc);
+ serial_close (sds_desc);
perror_with_name (name);
}
}
- SERIAL_RAW (sds_desc);
+ 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);
+ serial_flush_input (sds_desc);
if (from_tty)
{
@@ -688,7 +688,7 @@ readchar (int timeout)
{
int ch;
- ch = SERIAL_READCHAR (sds_desc, timeout);
+ ch = serial_readchar (sds_desc, timeout);
if (remote_debug > 1 && ch >= 0)
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
@@ -799,7 +799,7 @@ putmessage (unsigned char *buf, int len)
header[0], header[1], header[2]);
gdb_flush (gdb_stdlog);
}
- if (SERIAL_WRITE (sds_desc, buf2, p - buf2))
+ if (serial_write (sds_desc, buf2, p - buf2))
perror_with_name ("putmessage: write failed");
return 1;
diff --git a/gdb/remote-st.c b/gdb/remote-st.c
index cda69b6..2a15b38 100644
--- a/gdb/remote-st.c
+++ b/gdb/remote-st.c
@@ -76,8 +76,8 @@ printf_stdebug (char *pattern,...)
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));
+ 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
@@ -88,7 +88,7 @@ readchar (int timeout)
{
int c;
- c = SERIAL_READCHAR (st2000_desc, timeout);
+ c = serial_readchar (st2000_desc, timeout);
#ifdef LOG_FILE
putc (c & 0x7f, log_file);
@@ -280,18 +280,18 @@ or target st2000 <host> <port>\n");
st2000_close (0);
- st2000_desc = SERIAL_OPEN (dev_name);
+ st2000_desc = serial_open (dev_name);
if (!st2000_desc)
perror_with_name (dev_name);
- if (SERIAL_SETBAUDRATE (st2000_desc, baudrate))
+ if (serial_setbaudrate (st2000_desc, baudrate))
{
- SERIAL_CLOSE (dev_name);
+ serial_close (dev_name);
perror_with_name (dev_name);
}
- SERIAL_RAW (st2000_desc);
+ serial_raw (st2000_desc);
push_target (&st2000_ops);
@@ -316,7 +316,7 @@ or target st2000 <host> <port>\n");
static void
st2000_close (int quitting)
{
- SERIAL_CLOSE (st2000_desc);
+ serial_close (st2000_desc);
#if defined (LOG_FILE)
if (log_file)
@@ -664,7 +664,7 @@ static void
cleanup_tty (void)
{
printf ("\r\n[Exiting connect mode]\r\n");
-/* SERIAL_RESTORE(0, &ttystate); */
+/* serial_restore(0, &ttystate); */
}
#if 0
@@ -699,7 +699,7 @@ connect_command (char *args, int fromtty)
do
{
FD_SET (0, &readfds);
- FD_SET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds);
+ FD_SET (deprecated_serial_fd (st2000_desc), &readfds);
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
}
while (numfds == 0);
@@ -734,7 +734,7 @@ connect_command (char *args, int fromtty)
}
}
- if (FD_ISSET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds))
+ if (FD_ISSET (deprecated_serial_fd (st2000_desc), &readfds))
{
while (1)
{
diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c
index 92827f2..e703f3d 100644
--- a/gdb/remote-utils.c
+++ b/gdb/remote-utils.c
@@ -172,24 +172,24 @@ gr_open (char *args, int from_tty, struct gr_settings *gr)
if (sr_get_device () == NULL)
usage (gr->ops->to_shortname, NULL);
- sr_set_desc (SERIAL_OPEN (sr_get_device ()));
+ 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)
+ if (serial_setbaudrate (sr_get_desc (), baud_rate) != 0)
{
- SERIAL_CLOSE (sr_get_desc ());
+ serial_close (sr_get_desc ());
perror_with_name (sr_get_device ());
}
}
- SERIAL_RAW (sr_get_desc ());
+ 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 ());
+ serial_flush_input (sr_get_desc ());
/* default retries */
if (sr_get_retries () == 0)
@@ -222,7 +222,7 @@ sr_readchar (void)
{
int buf;
- buf = SERIAL_READCHAR (sr_get_desc (), sr_get_timeout ());
+ buf = serial_readchar (sr_get_desc (), sr_get_timeout ());
if (buf == SERIAL_TIMEOUT)
error ("Timeout reading from remote system.");
@@ -238,7 +238,7 @@ sr_pollchar (void)
{
int buf;
- buf = SERIAL_READCHAR (sr_get_desc (), 0);
+ buf = serial_readchar (sr_get_desc (), 0);
if (buf == SERIAL_TIMEOUT)
buf = 0;
if (sr_get_debug () > 0)
@@ -281,7 +281,7 @@ sr_write (char *a, int l)
{
int i;
- if (SERIAL_WRITE (sr_get_desc (), a, l) != 0)
+ if (serial_write (sr_get_desc (), a, l) != 0)
perror_with_name ("sr_write: Error writing to remote");
if (sr_get_debug () > 0)
@@ -398,7 +398,7 @@ gr_close (int quitting)
if (sr_is_open ())
{
- SERIAL_CLOSE (sr_get_desc ());
+ serial_close (sr_get_desc ());
sr_set_desc (NULL);
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 72a7913..e6c3c91 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1815,7 +1815,7 @@ static void
remote_close (int quitting)
{
if (remote_desc)
- SERIAL_CLOSE (remote_desc);
+ serial_close (remote_desc);
remote_desc = NULL;
}
@@ -2030,7 +2030,7 @@ remote_start_remote (PTR dummy)
immediate_quit++; /* Allow user to interrupt it */
/* Ack any packet which the remote side has already sent. */
- SERIAL_WRITE (remote_desc, "+", 1);
+ serial_write (remote_desc, "+", 1);
/* Let the stub know that we want it to return the thread. */
set_thread (-1, 0);
@@ -2148,24 +2148,24 @@ serial device is attached to the remote system\n\
unpush_target (target);
- remote_desc = SERIAL_OPEN (name);
+ remote_desc = serial_open (name);
if (!remote_desc)
perror_with_name (name);
if (baud_rate != -1)
{
- if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
+ if (serial_setbaudrate (remote_desc, baud_rate))
{
- SERIAL_CLOSE (remote_desc);
+ serial_close (remote_desc);
perror_with_name (name);
}
}
- SERIAL_RAW (remote_desc);
+ 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);
+ serial_flush_input (remote_desc);
if (from_tty)
{
@@ -2245,24 +2245,24 @@ serial device is attached to the remote system\n\
unpush_target (target);
- remote_desc = SERIAL_OPEN (name);
+ remote_desc = serial_open (name);
if (!remote_desc)
perror_with_name (name);
if (baud_rate != -1)
{
- if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
+ if (serial_setbaudrate (remote_desc, baud_rate))
{
- SERIAL_CLOSE (remote_desc);
+ serial_close (remote_desc);
perror_with_name (name);
}
}
- SERIAL_RAW (remote_desc);
+ 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);
+ serial_flush_input (remote_desc);
if (from_tty)
{
@@ -2382,7 +2382,7 @@ remote_async_detach (char *args, int from_tty)
/* Unregister the file descriptor from the event loop. */
if (target_is_async_p ())
- SERIAL_ASYNC (remote_desc, NULL, 0);
+ serial_async (remote_desc, NULL, 0);
target_mourn_inferior ();
if (from_tty)
@@ -2765,9 +2765,9 @@ remote_stop (void)
fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
if (remote_break)
- SERIAL_SEND_BREAK (remote_desc);
+ serial_send_break (remote_desc);
else
- SERIAL_WRITE (remote_desc, "\003", 1);
+ serial_write (remote_desc, "\003", 1);
}
/* Ask the user what to do when an interrupt is received. */
@@ -3908,7 +3908,7 @@ readchar (int timeout)
{
int ch;
- ch = SERIAL_READCHAR (remote_desc, timeout);
+ ch = serial_readchar (remote_desc, timeout);
if (ch >= 0)
return (ch & 0x7f);
@@ -4006,7 +4006,7 @@ putpkt_binary (char *buf, int cnt)
fprintf_unfiltered (gdb_stdlog, "...");
gdb_flush (gdb_stdlog);
}
- if (SERIAL_WRITE (remote_desc, buf2, p - buf2))
+ if (serial_write (remote_desc, buf2, p - buf2))
perror_with_name ("putpkt: write failed");
/* read until either a timeout occurs (-2) or '+' is read */
@@ -4308,19 +4308,19 @@ getpkt_sane (char *buf,
fputstr_unfiltered (buf, 0, gdb_stdlog);
fprintf_unfiltered (gdb_stdlog, "\n");
}
- SERIAL_WRITE (remote_desc, "+", 1);
+ serial_write (remote_desc, "+", 1);
return 0;
}
/* Try the whole thing again. */
retry:
- SERIAL_WRITE (remote_desc, "-", 1);
+ 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);
+ serial_write (remote_desc, "+", 1);
return 1;
}
@@ -4351,7 +4351,7 @@ remote_async_kill (void)
{
/* Unregister the file descriptor from the event loop. */
if (target_is_async_p ())
- SERIAL_ASYNC (remote_desc, NULL, 0);
+ 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. */
@@ -5319,7 +5319,7 @@ device is attached to the remote system (e.g. host:port).");
unpush_target (&remote_cisco_ops);
- remote_desc = SERIAL_OPEN (name);
+ remote_desc = serial_open (name);
if (!remote_desc)
perror_with_name (name);
@@ -5330,17 +5330,17 @@ device is attached to the remote system (e.g. host:port).");
*/
baud_rate = (baud_rate > 0) ? baud_rate : 9600;
- if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
+ if (serial_setbaudrate (remote_desc, baud_rate))
{
- SERIAL_CLOSE (remote_desc);
+ serial_close (remote_desc);
perror_with_name (name);
}
- SERIAL_RAW (remote_desc);
+ 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);
+ serial_flush_input (remote_desc);
if (from_tty)
{
@@ -5508,7 +5508,7 @@ readtty (void)
/* Make this a zero terminated string and write it out */
tty_input[tty_bytecount] = 0;
- if (SERIAL_WRITE (remote_desc, tty_input, tty_bytecount))
+ if (serial_write (remote_desc, tty_input, tty_bytecount))
{
perror_with_name ("readtty: write failed");
return FATAL_ERROR;
@@ -5554,7 +5554,7 @@ minitelnet (void)
FD_ZERO (&input);
FD_SET (fileno (stdin), &input);
- FD_SET (DEPRECATED_SERIAL_FD (remote_desc), &input);
+ FD_SET (deprecated_serial_fd (remote_desc), &input);
status = select (tablesize, &input, 0, 0, 0);
if ((status == -1) && (errno != EINTR))
@@ -5578,9 +5578,9 @@ minitelnet (void)
quit_flag = 0;
if (remote_break)
- SERIAL_SEND_BREAK (remote_desc);
+ serial_send_break (remote_desc);
else
- SERIAL_WRITE (remote_desc, "\003", 1);
+ serial_write (remote_desc, "\003", 1);
continue;
}
@@ -5650,14 +5650,14 @@ static int
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);
+ 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);
+ 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
@@ -5685,12 +5685,12 @@ remote_async (void (*callback) (enum inferior_event_type event_type, void *conte
if (callback != NULL)
{
- SERIAL_ASYNC (remote_desc, remote_async_serial_handler, 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);
+ serial_async (remote_desc, NULL, NULL);
}
/* Target async and target extended-async.
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index e12e776..f7ab28a 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -1184,7 +1184,7 @@ enum {
static void
reschedule (struct serial *scb)
{
- if (SERIAL_IS_ASYNC_P (scb))
+ if (serial_is_async_p (scb))
{
int next_state;
switch (scb->async_state)
@@ -1220,7 +1220,7 @@ reschedule (struct serial *scb)
next_state = scb->async_state;
break;
}
- if (SERIAL_DEBUG_P (scb))
+ if (serial_debug_p (scb))
{
switch (next_state)
{
@@ -1308,14 +1308,14 @@ ser_unix_async (struct serial *scb,
{
/* Force a re-schedule. */
scb->async_state = NOTHING_SCHEDULED;
- if (SERIAL_DEBUG_P (scb))
+ if (serial_debug_p (scb))
fprintf_unfiltered (gdb_stdlog, "[fd%d->asynchronous]\n",
scb->fd);
reschedule (scb);
}
else
{
- if (SERIAL_DEBUG_P (scb))
+ if (serial_debug_p (scb))
fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
scb->fd);
/* De-schedule whatever tasks are currently scheduled. */
diff --git a/gdb/serial.c b/gdb/serial.c
index 38e1e0e..3442a4b 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -350,7 +350,7 @@ serial_readchar (struct serial *scb, int timeout)
/* 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)
+ if (0 && serial_is_async_p (scb) && timeout < 0)
internal_error (__FILE__, __LINE__,
"serial_readchar: blocking read in async mode");
@@ -363,7 +363,7 @@ serial_readchar (struct serial *scb, int timeout)
in case we are getting ready to dump core or something. */
gdb_flush (serial_logfp);
}
- if (SERIAL_DEBUG_P (scb))
+ if (serial_debug_p (scb))
{
fprintf_unfiltered (gdb_stdlog, "[");
serial_logchar (gdb_stdlog, 'r', ch, timeout);
@@ -400,7 +400,7 @@ serial_printf (struct serial *desc, const char *format,...)
va_start (args, format);
xvasprintf (&buf, format, args);
- SERIAL_WRITE (desc, buf, strlen (buf));
+ serial_write (desc, buf, strlen (buf));
xfree (buf);
va_end (args);
@@ -554,9 +554,9 @@ static void
cleanup_tty (serial_ttystate ttystate)
{
printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
- SERIAL_SET_TTY_STATE (tty_desc, ttystate);
+ serial_set_tty_state (tty_desc, ttystate);
xfree (ttystate);
- SERIAL_CLOSE (tty_desc);
+ serial_close (tty_desc);
}
static void
@@ -574,13 +574,13 @@ connect_command (char *args, int fromtty)
printf_unfiltered ("[Entering connect mode. Use ~. or ~^D to escape]\n");
- tty_desc = SERIAL_FDOPEN (0);
+ tty_desc = serial_fdopen (0);
port_desc = last_serial_opened;
- ttystate = SERIAL_GET_TTY_STATE (tty_desc);
+ ttystate = serial_get_tty_state (tty_desc);
- SERIAL_RAW (tty_desc);
- SERIAL_RAW (port_desc);
+ serial_raw (tty_desc);
+ serial_raw (port_desc);
make_cleanup (cleanup_tty, ttystate);
@@ -588,7 +588,7 @@ connect_command (char *args, int fromtty)
{
int mask;
- mask = SERIAL_WAIT_2 (tty_desc, port_desc, -1);
+ mask = serial_wait_2 (tty_desc, port_desc, -1);
if (mask & 2)
{ /* tty input */
@@ -596,7 +596,7 @@ connect_command (char *args, int fromtty)
while (1)
{
- c = SERIAL_READCHAR (tty_desc, 0);
+ c = serial_readchar (tty_desc, 0);
if (c == SERIAL_TIMEOUT)
break;
@@ -605,7 +605,7 @@ connect_command (char *args, int fromtty)
perror_with_name ("connect");
cx = c;
- SERIAL_WRITE (port_desc, &cx, 1);
+ serial_write (port_desc, &cx, 1);
switch (cur_esc)
{
@@ -634,7 +634,7 @@ connect_command (char *args, int fromtty)
while (1)
{
- c = SERIAL_READCHAR (port_desc, 0);
+ c = serial_readchar (port_desc, 0);
if (c == SERIAL_TIMEOUT)
break;
@@ -644,7 +644,7 @@ connect_command (char *args, int fromtty)
cx = c;
- SERIAL_WRITE (tty_desc, &cx, 1);
+ serial_write (tty_desc, &cx, 1);
}
}
}
diff --git a/gdb/serial.h b/gdb/serial.h
index 1863d21..a0dbe72 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -35,22 +35,18 @@ struct serial;
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.
@@ -69,13 +65,11 @@ enum serial_rc {
};
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. */
@@ -84,35 +78,29 @@ extern void serial_printf (struct serial *desc, const char *,...) ATTR_FORMAT (p
/* 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.
@@ -120,30 +108,25 @@ extern serial_ttystate serial_get_tty_state (struct serial *scb);
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.
+ 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. */
@@ -153,19 +136,16 @@ extern int serial_setbaudrate (struct serial *scb, int rate);
#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
@@ -173,7 +153,6 @@ extern int serial_is_async_p (struct serial *scb);
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
@@ -181,18 +160,15 @@ extern void serial_async (struct serial *scb, serial_event_ftype *handler, void
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. */
+ 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 */
diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c
index b47031e..2b07bd8 100644
--- a/gdb/sh3-rom.c
+++ b/gdb/sh3-rom.c
@@ -132,13 +132,13 @@ sh3_load (struct serial *desc, char *file, int hashmark)
{
monitor_printf ("il;s:x\r");
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
- SERIAL_WRITE (desc, "\006", 1); /* Send ACK */
+ 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 */
+ serial_write (desc, "\006", 1); /* Send ACK */
monitor_expect_prompt (NULL, 0);
}
}
@@ -270,7 +270,7 @@ sh3_open (char *args, int from_tty)
if (parallel_port_name)
{
- parallel = SERIAL_OPEN (parallel_port_name);
+ parallel = serial_open (parallel_port_name);
if (!parallel)
perror_with_name ("Unable to open parallel port.");
@@ -317,7 +317,7 @@ sh3e_open (char *args, int from_tty)
if (parallel_port_name)
{
- parallel = SERIAL_OPEN (parallel_port_name);
+ parallel = serial_open (parallel_port_name);
if (!parallel)
perror_with_name ("Unable to open parallel port.");
@@ -335,7 +335,7 @@ sh3_close (int quitting)
monitor_close (quitting);
if (parallel_in_use)
{
- SERIAL_CLOSE (parallel);
+ serial_close (parallel);
parallel_in_use = 0;
}
}
diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c
index 9c2cb6b..0a88e5a 100644
--- a/gdb/sparcl-tdep.c
+++ b/gdb/sparcl-tdep.c
@@ -264,22 +264,22 @@ open_tty (char *name)
{
struct serial *desc;
- desc = SERIAL_OPEN (name);
+ desc = serial_open (name);
if (!desc)
perror_with_name (name);
if (baud_rate != -1)
{
- if (SERIAL_SETBAUDRATE (desc, baud_rate))
+ if (serial_setbaudrate (desc, baud_rate))
{
- SERIAL_CLOSE (desc);
+ serial_close (desc);
perror_with_name (name);
}
}
- SERIAL_RAW (desc);
+ serial_raw (desc);
- SERIAL_FLUSH_INPUT (desc);
+ serial_flush_input (desc);
return desc;
}
@@ -292,7 +292,7 @@ readchar (struct serial *desc, int timeout)
int ch;
char s[10];
- ch = SERIAL_READCHAR (desc, timeout);
+ ch = serial_readchar (desc, timeout);
switch (ch)
{
@@ -317,7 +317,7 @@ debug_serial_write (struct serial *desc, char *buf, int len)
{
char s[10];
- SERIAL_WRITE (desc, buf, len);
+ serial_write (desc, buf, len);
if (remote_debug > 0)
{
while (len-- > 0)
@@ -343,7 +343,7 @@ close_tty (void *ignore)
if (!remote_desc)
return;
- SERIAL_CLOSE (remote_desc);
+ serial_close (remote_desc);
remote_desc = NULL;
}
diff --git a/gdb/sparclet-rom.c b/gdb/sparclet-rom.c
index ea2c158..071bf89 100644
--- a/gdb/sparclet-rom.c
+++ b/gdb/sparclet-rom.c
@@ -173,7 +173,7 @@ sparclet_load (struct serial *desc, char *file, int hashmark)
bfd_get_section_contents (abfd, s, buf, i, numbytes);
- SERIAL_WRITE (desc, buf, numbytes);
+ serial_write (desc, buf, numbytes);
if (hashmark)
{
diff --git a/gdb/utils.c b/gdb/utils.c
index fa8191c..c66167b 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -842,8 +842,8 @@ quit (void)
gdb_flush (gdb_stderr);
/* 3. The system-level buffer. */
- SERIAL_DRAIN_OUTPUT (gdb_stdout_serial);
- SERIAL_UN_FDOPEN (gdb_stdout_serial);
+ serial_drain_output (gdb_stdout_serial);
+ serial_un_fdopen (gdb_stdout_serial);
annotate_error_begin ();
diff --git a/gdb/xmodem.c b/gdb/xmodem.c
index c428bc8..7b8d77d 100644
--- a/gdb/xmodem.c
+++ b/gdb/xmodem.c
@@ -40,7 +40,7 @@ readchar (struct serial *desc, int timeout)
{
int c;
- c = SERIAL_READCHAR (desc, timeout);
+ c = serial_readchar (desc, timeout);
if (remote_debug > 0)
fputc_unfiltered (c, gdb_stdlog);
@@ -217,7 +217,7 @@ xmodem_send_packet (struct serial *desc, unsigned char *packet, int len, int has
{
int c;
- SERIAL_WRITE (desc, packet, pktlen);
+ serial_write (desc, packet, pktlen);
c = readchar (desc, 3);
switch (c)
@@ -238,7 +238,7 @@ xmodem_send_packet (struct serial *desc, unsigned char *packet, int len, int has
}
}
- SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */
+ serial_write (desc, "\004", 1); /* Send an EOT */
error ("xmodem_send_packet: Excessive retries.");
}
@@ -254,7 +254,7 @@ xmodem_finish_xfer (struct serial *desc)
{
int c;
- SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */
+ serial_write (desc, "\004", 1); /* Send an EOT */
c = readchar (desc, 3);
switch (c)