* ser-go32.c: Clean up lots of compilation nits.
[deliverable/binutils-gdb.git] / gdb / ser-go32.c
index 844f8613fda65b057eccc7244a1dcaa9a41077e0..5b3ad9064a8a55f265b040e5b470b9bd2f64190e 100644 (file)
@@ -21,11 +21,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "serial.h"
 #include <sys/dos.h>
 
-#define SIGNATURE 0x4154
-#define VERSION 1
-#define OFFSET 0x104
-
-#define peek(a,b) (*(unsigned short *)(0xe0000000 + (a)*16 + (b)))
+/* This is unused for now.  We just return a placeholder. */
+struct go32_ttystate
+{
+  int bogus;
+};
 
 typedef struct {
   short jmp_op;
@@ -38,6 +38,33 @@ typedef struct {
   short iov;
 } ASYNC_STRUCT;
 
+static int go32_open PARAMS ((serial_t scb, const char *name));
+static void go32_raw PARAMS ((serial_t scb));
+static int wait_for PARAMS ((serial_t scb, int timeout));
+static int go32_readchar PARAMS ((serial_t scb, int timeout));
+static int rate_to_code PARAMS ((int rate));
+static int go32_setbaudrate PARAMS ((serial_t scb, int rate));
+static int go32_write PARAMS ((serial_t scb, const char *str, int len));
+static void go32_restore PARAMS ((serial_t scb));
+static void go32_close PARAMS ((serial_t scb));
+static serial_ttystate go32_get_tty_state PARAMS ((serial_t scb));
+static int go32_set_tty_state PARAMS ((serial_t scb, serial_ttystate state));
+static int strncasecmp PARAMS ((char *str1, char *str2, int len));
+static char *aptr PARAMS ((short p));
+static ASYNC_STRUCT *getivec PARAMS ((int which));
+static int dos_async_init PARAMS ((int port));
+static void dos_async_tx PARAMS ((const char c));
+static int dos_async_ready PARAMS (());
+static int dos_async_rx PARAMS (());
+static int dosasync_read PARAMS ((int fd, char *buf, int len, int timeout));
+static int dosasync_write PARAMS ((int fd, const char *buf, int len));
+
+#define SIGNATURE 0x4154
+#define VERSION 1
+#define OFFSET 0x104
+
+#define peek(a,b) (*(unsigned short *)(0xe0000000 + (a)*16 + (b)))
+
 static ASYNC_STRUCT *async;
 static int iov;
 #define com_rb iov
@@ -222,7 +249,7 @@ go32_open (scb, name)
   if (strncasecmp (name, "com", 3) != 0)
     {
       errno = ENOENT;
-      return 1;
+      return -1;
     }
 
   port = name[3] - '0';
@@ -230,12 +257,12 @@ go32_open (scb, name)
   if ((port != 1) && (port != 2))
     {
       errno = ENOENT;
-      return 1;
+      return -11;
     }
 
   scb->fd = dos_async_init(port);
   if (!scb->fd)
-    return 1;
+    return -1;
 
   return 0;
 }
@@ -257,7 +284,31 @@ go32_readchar (scb, timeout)
   if (dosasync_read(scb->fd, &buf, 1, timeout))  
     return buf;
   else
-    return -2; /* Timeout, I guess */
+    return SERIAL_TIMEOUT;
+}
+
+/* go32_{get set}_tty_state() are both dummys to fill out the function
+   vector.  Someday, they may do something real... */
+
+static serial_ttystate
+go32_get_tty_state(scb)
+     serial_t scb;
+{
+  struct go32_ttystate *state;
+
+  state = (struct go32_ttystate *)xmalloc(sizeof *state);
+
+  return (serial_ttystate)state;
+}
+
+static int
+go32_set_tty_state(scb, ttystate)
+     serial_t scb;
+     serial_ttystate ttystate;
+{
+  struct go32_ttystate *state;
+
+  return 0;
 }
 
 static int
@@ -275,15 +326,12 @@ go32_write (scb, str, len)
      int len;
 {
   dosasync_write(scb->fd, str, len);
-}
 
-static void
-go32_close ()
-{
+  return 0;
 }
 
 static void
-go32_restore (scb)
+go32_close (scb)
      serial_t scb;
 {
 }
@@ -297,7 +345,8 @@ static struct serial_ops go32_ops =
   go32_readchar,
   go32_write,
   go32_raw,
-  go32_restore,
+  go32_get_tty_state,
+  go32_set_tty_state,
   go32_setbaudrate
 };
 
This page took 0.02518 seconds and 4 git commands to generate.