* Makefile.tpl: Rearrange.
[deliverable/binutils-gdb.git] / gdb / ocd.c
index 72e05e8817897078a522e96ca20355bf81e4df07..4dfda5d6d4b734a804783d6dd4c3919bd393b28b 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -1,6 +1,7 @@
 /* Target communications support for Macraigor Systems' On-Chip Debugging
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -41,7 +42,7 @@
 
 static int ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len);
 
-static int ocd_start_remote (PTR dummy);
+static int ocd_start_remote (void *dummy);
 
 static int readchar (int timeout);
 
@@ -163,14 +164,14 @@ void
 ocd_close (int quitting)
 {
   if (ocd_desc)
-    SERIAL_CLOSE (ocd_desc);
+    serial_close (ocd_desc);
   ocd_desc = NULL;
 }
 
 /* Stub for catch_errors.  */
 
 static int
-ocd_start_remote (PTR dummy)
+ocd_start_remote (void *dummy)
 {
   unsigned char buf[10], *p;
   int pktlen;
@@ -183,7 +184,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 */
 
@@ -253,9 +254,7 @@ ocd_start_remote (PTR dummy)
   flush_cached_frames ();
   registers_changed ();
   stop_pc = read_pc ();
-  set_current_frame (create_new_frame (read_fp (), stop_pc));
-  select_frame (get_current_frame (), 0);
-  print_stack_frame (selected_frame, -1, 1);
+  print_stack_frame (get_selected_frame (), -1, 1);
 
   buf[0] = OCD_LOG_FILE;
   buf[1] = 3;                  /* close existing WIGGLERS.LOG */
@@ -290,44 +289,24 @@ device the OCD device is attached to (e.g. /dev/ttya).");
 
   unpush_target (current_ops);
 
-  if (strncmp (name, "wiggler", 7) == 0)
-    {
-      ocd_desc = SERIAL_OPEN ("ocd");
-      if (!ocd_desc)
-       perror_with_name (name);
-
-      buf[0] = OCD_LOG_FILE;
-      buf[1] = 1;              /* open new or overwrite existing WIGGLERS.LOG */
-      ocd_put_packet (buf, 2);
-      p = ocd_get_packet (buf[0], &pktlen, remote_timeout);
-
-      buf[0] = OCD_SET_CONNECTION;
-      buf[1] = 0x01;           /* atoi (name[11]); */
-      ocd_put_packet (buf, 2);
-      p = ocd_get_packet (buf[0], &pktlen, remote_timeout);
-    }
-  else
-    /* not using Wigglers.dll */
-    {
-      ocd_desc = SERIAL_OPEN (name);
-      if (!ocd_desc)
-       perror_with_name (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)
     {
@@ -446,7 +425,7 @@ interrupt_query (void)
 Give up (and stop debugging it)? "))
     {
       target_mourn_inferior ();
-      return_to_top_level (RETURN_QUIT);
+      throw_exception (RETURN_QUIT);
     }
 
   target_terminal_inferior ();
@@ -789,7 +768,7 @@ readchar (int timeout)
 {
   int ch;
 
-  ch = SERIAL_READCHAR (ocd_desc, timeout);
+  ch = serial_readchar (ocd_desc, timeout);
 
   switch (ch)
     {
@@ -843,7 +822,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 +920,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
This page took 0.044859 seconds and 4 git commands to generate.