Update/correct copyright notices.
[deliverable/binutils-gdb.git] / gdb / ocd.c
index 1a50978db826a350a9c5f1dda5fd45d032c9c192..609edcdd7d290898466a302de47e7a3b47ecc2cf 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -1,5 +1,6 @@
 /* Target communications support for Macraigor Systems' On-Chip Debugging
-   Copyright 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "bfd.h"
 #include "symfile.h"
 #include "target.h"
-#include "gdb_wait.h"
 #include "gdbcmd.h"
 #include "objfiles.h"
 #include "gdb-stabs.h"
-#include "dcache.h"
 #include <sys/types.h>
 #include <signal.h>
 #include "serial.h"
 #include "ocd.h"
+#include "regcache.h"
 
 /* Prototypes for local functions */
 
@@ -181,7 +181,7 @@ ocd_start_remote (PTR dummy)
 
   target_type = *(enum ocd_target_type *) dummy;
 
-  immediate_quit = 1;          /* Allow user to interrupt it */
+  immediate_quit++;            /* Allow user to interrupt it */
 
   SERIAL_SEND_BREAK (ocd_desc);        /* Wake up the wiggler */
 
@@ -243,7 +243,7 @@ ocd_start_remote (PTR dummy)
     ocd_error ("OCD_SET_CTL_FLAGS:", error_code);
 #endif
 
-  immediate_quit = 0;
+  immediate_quit--;
 
 /* This is really the job of start_remote however, that makes an assumption
    that the target is about to print out a status message of some sort.  That
@@ -273,8 +273,6 @@ ocd_start_remote (PTR dummy)
 /* Open a connection to a remote debugger.
    NAME is the filename used for communication.  */
 
-static DCACHE *ocd_dcache;
-
 void
 ocd_open (char *name, int from_tty, enum ocd_target_type target_type,
          struct target_ops *ops)
@@ -292,8 +290,6 @@ device the OCD device is attached to (e.g. /dev/ttya).");
 
   unpush_target (current_ops);
 
-  ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes);
-
   if (strncmp (name, "wiggler", 7) == 0)
     {
       ocd_desc = SERIAL_OPEN ("ocd");
@@ -384,8 +380,6 @@ ocd_resume (int pid, int step, enum target_signal siggnal)
 {
   int pktlen;
 
-  dcache_flush (ocd_dcache);
-
   if (step)
     ocd_do_command (OCD_STEP, &last_run_status, &pktlen);
   else
@@ -761,18 +755,22 @@ ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 \f
 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
    to or from debugger address MYADDR.  Write to inferior if SHOULD_WRITE is
-   nonzero.  Returns length of data written or read; 0 for error.  */
+   nonzero.  Returns length of data written or read; 0 for error.  TARGET
+   is ignored.  */
 
 /* ARGSUSED */
 int
-ocd_xfer_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;        /* ignored */
+ocd_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
+                struct mem_attrib *attrib, struct target_ops *target)
 {
-  return dcache_xfer_memory (ocd_dcache, memaddr, myaddr, len, should_write);
+  int res;
+
+  if (should_write)
+    res = ocd_write_bytes (memaddr, myaddr, len);
+  else
+    res = ocd_read_bytes (memaddr, myaddr, len);
+
+  return res;
 }
 \f
 void
@@ -884,7 +882,7 @@ stu_put_packet (unsigned char *buf, int len)
   unsigned char c;
 
   if (len == 0 || len > 256)
-    abort ();                  /* Can't represent 0 length packet */
+    internal_error (__FILE__, __LINE__, "failed internal consistency check");                  /* Can't represent 0 length packet */
 
   reset_packet ();
 
@@ -1315,7 +1313,7 @@ bdm_reset_command (char *args, int from_tty)
     error ("Not connected to OCD device.");
 
   ocd_do_command (OCD_RESET, &status, &pktlen);
-  dcache_flush (ocd_dcache);
+  dcache_invalidate (target_dcache);
   registers_changed ();
 }
 
This page took 0.02513 seconds and 4 git commands to generate.