2002-06-11 Daniel Jacobowitz <drow@mvista.com>
[deliverable/binutils-gdb.git] / gdb / remote-array.c
index beb0c6bda00d68c4ed0a97ddf869001331a75a9d..ed0c40e44362e161304bd025d1a4d2a8374774d2 100644 (file)
@@ -1,6 +1,8 @@
 /* Remote debugging interface for Array Tech RAID controller..
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001 Free Software Foundation, Inc.
+
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
 
    This module talks to a debug monitor called 'MONITOR', which
@@ -23,8 +25,7 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
- */
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "gdbcore.h"
@@ -90,7 +91,7 @@ static int timeout = 30;
  * Descriptor for I/O to remote machine.  Initialize it to NULL so that
  * array_open knows that we don't have a file open when the program starts.
  */
-serial_t array_desc = NULL;
+struct serial *array_desc = NULL;
 
 /*
  * this array of registers need to match the indexes used by GDB. The
@@ -191,8 +192,9 @@ 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_unfiltered (gdb_stderr, "serial_write failed: %s\n", 
+                       safe_strerror (errno));
 }
 /*
  * write_monitor -- send raw data to monitor.
@@ -200,8 +202,9 @@ 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_unfiltered (gdb_stderr, "serial_write failed: %s\n",
+                       safe_strerror (errno));
 
   *(data + len + 1) = '\0';
   debuglogs (1, "write_monitor(), Sending: \"%s\".", data);
@@ -301,7 +304,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 +563,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 +619,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);
@@ -694,7 +697,7 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
   int old_timeout = timeout;
   int result, i;
   char c;
-  serial_t tty_desc;
+  struct serial *tty_desc;
   serial_ttystate ttystate;
 
   debuglogs (1, "array_wait (), printing extraneous text.");
@@ -705,9 +708,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 +734,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 +747,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.");
@@ -994,8 +997,7 @@ array_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 
 static int
 array_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-                  struct mem_attrib *attrib ATTRIBUTE_UNUSED,
-                  struct target_ops *target ATTRIBUTE_UNUSED)
+                  struct mem_attrib *attrib, struct target_ops *target)
 {
   if (write)
     return array_write_inferior_memory (memaddr, myaddr, len);
@@ -1053,7 +1055,7 @@ array_insert_breakpoint (CORE_ADDR addr, char *shadow)
        }
     }
 
-  fprintf (stderr, "Too many breakpoints (> 16) for monitor\n");
+  fprintf_unfiltered (gdb_stderr, "Too many breakpoints (> 16) for monitor\n");
   return 1;
 }
 
@@ -1078,8 +1080,9 @@ array_remove_breakpoint (CORE_ADDR addr, char *shadow)
          return 0;
        }
     }
-  fprintf (stderr, "Can't find breakpoint associated with 0x%s\n",
-          paddr_nz (addr));
+  fprintf_unfiltered (gdb_stderr,
+                     "Can't find breakpoint associated with 0x%s\n",
+                     paddr_nz (addr));
   return 1;
 }
 
This page took 0.02684 seconds and 4 git commands to generate.