* Rename remote-es1800.c to remote-es.c
[deliverable/binutils-gdb.git] / gdb / remote-st2000.c
index f7904fa9d5062cdd9bd7e5d4693fef8eaab39d19..833aa206760cb505b2e43611abcf7e2694785175 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    as mentioned in the following comment (left in for comic relief):
 
   "This is like remote.c but is for an esoteric situation--
-   having a 29k board in a PC hooked up to a unix machine with
+   having an a29k board in a PC hooked up to a unix machine with
    a serial line, and running ctty com1 on the PC, through which
    the unix machine can run ebmon.  Not to mention that the PC
    has PC/NFS, so it can access the same executables that gdb can,
@@ -60,7 +60,8 @@ static int timeout = 24;
 /* Descriptor for I/O to remote machine.  Initialize it to -1 so that
    st2000_open knows that we don't have a file open when the program
    starts.  */
-int st2000_desc = -1;
+
+static serial_t st2000_desc;
 
 /* Send data to stdebug.  Works just like printf. */
 
@@ -77,19 +78,20 @@ printf_stdebug(va_alist)
   pattern = va_arg(args, char *);
 
   vsprintf(buf, pattern, args);
-  if (!serial_write(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 stuff.  */
+/* Read a character from the remote system, doing all the fancy timeout
+   stuff.  */
+
 static int
 readchar(timeout)
      int timeout;
 {
   int c;
 
-  c = serial_readchar(timeout);
+  c = SERIAL_READCHAR(st2000_desc, timeout);
 
 #ifdef LOG_FILE
   putc(c & 0x7f, log_file);
@@ -98,7 +100,7 @@ readchar(timeout)
   if (c >= 0)
     return c & 0x7f;
 
-  if (c == -2)
+  if (c == SERIAL_TIMEOUT)
     {
       if (timeout == 0)
        return c;               /* Polls shouldn't generate timeout errors */
@@ -296,9 +298,14 @@ 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);
 
-  serial_setbaudrate(baudrate);
+  SERIAL_SETBAUDRATE(st2000_desc, baudrate);
+
+  SERIAL_RAW(st2000_desc);
 
   push_target(&st2000_ops);
 
@@ -324,7 +331,7 @@ static void
 st2000_close (quitting)
      int quitting;
 {
-  serial_close();
+  SERIAL_CLOSE(st2000_desc);
 
 #if defined (LOG_FILE)
   if (log_file) {
@@ -601,6 +608,7 @@ static void
 st2000_mourn_inferior ()
 {
   remove_breakpoints ();
+  unpush_target (&st2000_ops);
   generic_mourn_inferior ();   /* Do all the proper things now */
 }
 
@@ -661,7 +669,7 @@ st2000_command (args, fromtty)
      char      *args;
      int       fromtty;
 {
-  if (st2000_desc < 0)
+  if (!st2000_desc)
     error("st2000 target not open.");
   
   if (!args)
@@ -674,15 +682,18 @@ st2000_command (args, fromtty)
 /* Connect the user directly to STDBUG.  This command acts just like the
    'cu' or 'tip' command.  Use <CR>~. or <CR>~^D to break out.  */
 
-static struct ttystate ttystate;
+/*static struct ttystate ttystate;*/
 
 static void
 cleanup_tty()
 {
   printf("\r\n[Exiting connect mode]\r\n");
-  serial_restore(0, &ttystate);
+/*  SERIAL_RESTORE(0, &ttystate);*/
 }
 
+#if 0
+/* This all should now be in serial.c */
+
 static void
 connect_command (args, fromtty)
      char      *args;
@@ -762,6 +773,7 @@ connect_command (args, fromtty)
        }
     }
 }
+#endif /* 0 */
 
 /* Define the target subroutine names */
 
@@ -795,6 +807,8 @@ the speed to connect at in bits per second.",
   0,                           /* lookup_symbol */
   st2000_create_inferior,
   st2000_mourn_inferior,
+  0,                           /* can_run */
+  0,                           /* notice_signals */
   process_stratum,
   0,                           /* next */
   1,
This page took 0.02494 seconds and 4 git commands to generate.