Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
[fw/altos] / ao-tools / altosui / AltosDebug.java
index ca2e5a9046625465130c0f4dd1ec55f9c10cba48..9aa35d3f2f834813d7cfdd51a5dbf2a631b750ee 100644 (file)
@@ -19,11 +19,10 @@ package altosui;
 
 import java.lang.*;
 import java.io.*;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.LinkedList;
-import java.util.Iterator;
-import altosui.AltosSerial;
-import altosui.AltosRomconfig;
+import java.util.concurrent.*;
+import java.util.*;
+
+import libaltosJNI.*;
 
 public class AltosDebug extends AltosSerial {
 
@@ -62,8 +61,8 @@ public class AltosDebug extends AltosSerial {
 
        void ensure_debug_mode() {
                if (!debug_mode) {
-                       printf("m 0\nD\n");
-                       flush_reply();
+                       printf("D\n");
+                       flush_input();
                        debug_mode = true;
                }
        }
@@ -103,7 +102,7 @@ public class AltosDebug extends AltosSerial {
                throws IOException, InterruptedException {
                byte[]  data = new byte[length];
 
-               flush_reply();
+               flush_input();
                ensure_debug_mode();
                printf("I %x %x\n", length, address);
                int i = 0;
@@ -155,7 +154,7 @@ public class AltosDebug extends AltosSerial {
        public byte[] read_bytes(int length)
                throws IOException, InterruptedException {
 
-               flush_reply();
+               flush_input();
                ensure_debug_mode();
                printf("G %x\n", length);
                int i = 0;
@@ -261,4 +260,8 @@ public class AltosDebug extends AltosSerial {
        public void reset() {
                printf ("R\n");
        }
+
+       public AltosDebug (altos_device in_device) throws FileNotFoundException, AltosSerialInUseException {
+               super(in_device);
+       }
 }
\ No newline at end of file