]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/ser-go32.c
[binutils, ARM, 4/16] BF insns infrastructure with array of relocs in struct arm_it
[thirdparty/binutils-gdb.git] / gdb / ser-go32.c
index 4268e2c150a859466f1f0b05dbef2e99e63c961f..bf7bffbe58440393b9fa1dd9971f7ffe6e9e96c1 100644 (file)
@@ -1,5 +1,5 @@
 /* Remote serial interface for local (hardwired) serial ports for GO32.
-   Copyright (C) 1992-2013 Free Software Foundation, Inc.
+   Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
    Contributed by Nigel Stephens, Algorithmics Ltd. (nigel@algor.co.uk).
 
@@ -24,9 +24,6 @@
 #include "defs.h"
 #include "gdbcmd.h"
 #include "serial.h"
-#include <string.h>
-
-
 /*
  * NS16550 UART registers
  */
@@ -596,9 +593,26 @@ dos_close (struct serial *scb)
 }
 \f
 
+/* Implementation of the serial_ops flush_output method.  */
 
 static int
-dos_noop (struct serial *scb)
+dos_flush_output (struct serial *scb)
+{
+  return 0;
+}
+
+/* Implementation of the serial_ops setparity method.  */
+
+static int
+dos_setparity (struct serial *scb, int parity)
+{
+  return 0;
+}
+
+/* Implementation of the serial_ops drain_output method.  */
+
+static int
+dos_drain_output (struct serial *scb)
 {
   return 0;
 }
@@ -619,6 +633,8 @@ dos_readchar (struct serial *scb, int timeout)
   then = rawclock () + (timeout * RAWHZ);
   while ((c = dos_getc (port)) < 0)
     {
+      QUIT;
+
       if (timeout >= 0 && (rawclock () - then) >= 0)
        return SERIAL_TIMEOUT;
     }
@@ -646,7 +662,7 @@ dos_get_tty_state (struct serial *scb)
        return NULL;
     }
 
-  state = (struct dos_ttystate *) xmalloc (sizeof *state);
+  state = XNEW (struct dos_ttystate);
   *state = *port;
   return (serial_ttystate) state;
 }
@@ -656,7 +672,7 @@ dos_copy_tty_state (struct serial *scb, serial_ttystate ttystate)
 {
   struct dos_ttystate *state;
 
-  state = (struct dos_ttystate *) xmalloc (sizeof *state);
+  state = XNEW (struct dos_ttystate);
   *state = *(struct dos_ttystate *) ttystate;
 
   return (serial_ttystate) state;
@@ -672,17 +688,6 @@ dos_set_tty_state (struct serial *scb, serial_ttystate ttystate)
   return 0;
 }
 
-static int
-dos_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate,
-                          serial_ttystate old_ttystate)
-{
-  struct dos_ttystate *state;
-
-  state = (struct dos_ttystate *) new_ttystate;
-  dos_setbaudrate (scb, state->baudrate);
-  return 0;
-}
-
 static int
 dos_flush_input (struct serial *scb)
 {
@@ -793,10 +798,12 @@ dos_write (struct serial *scb, const void *buf, size_t count)
   size_t fifosize = port->fifo ? 16 : 1;
   long then;
   size_t cnt;
-  const char *str = buf;
+  const char *str = (const char *) buf;
 
   while (count > 0)
     {
+      QUIT;
+
       /* Send the data, fifosize bytes at a time.  */
       cnt = fifosize > count ? count : fifosize;
       port->txbusy = 1;
@@ -848,16 +855,15 @@ dos_sendbreak (struct serial *scb)
 }
 
 
-static struct serial_ops dos_ops =
+static const struct serial_ops dos_ops =
 {
   "hardwire",
-  0,
   dos_open,
   dos_close,
   NULL,                                /* fdopen, not implemented */
   dos_readchar,
   dos_write,
-  dos_noop,                    /* flush output */
+  dos_flush_output,
   dos_flush_input,
   dos_sendbreak,
   dos_raw,
@@ -865,10 +871,10 @@ static struct serial_ops dos_ops =
   dos_copy_tty_state,
   dos_set_tty_state,
   dos_print_tty_state,
-  dos_noflush_set_tty_state,
   dos_setbaudrate,
   dos_setstopbits,
-  dos_noop,                    /* Wait for output to drain.  */
+  dos_setparity,
+  dos_drain_output,
   (void (*)(struct serial *, int))NULL /* Change into async mode.  */
 };
 
@@ -881,7 +887,7 @@ gdb_pipe (int pdes[2])
 }
 
 static void
-dos_info (char *arg, int from_tty)
+info_serial_command (const char *arg, int from_tty)
 {
   struct dos_ttystate *port;
 #ifdef DOS_STATS
@@ -909,9 +915,6 @@ dos_info (char *arg, int from_tty)
 #endif
 }
 
-/* -Wmissing-prototypes */
-extern initialize_file_ftype _initialize_ser_dos;
-
 void
 _initialize_ser_dos (void)
 {
@@ -981,6 +984,6 @@ Show COM4 interrupt request."), NULL,
                            NULL, /* FIXME: i18n: */
                            &setlist, &showlist);
 
-  add_info ("serial", dos_info,
+  add_info ("serial", info_serial_command,
            _("Print DOS serial port status."));
 }