|
Message
From: cvs at opencores.org<cvs@o...>
Date: Thu Jan 24 12:21:50 CET 2008
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/08/01 24:12:21 Modified: jop/java/tools/src/com/jopdesign/tools JavaDown.java Log: Fixed JavaDown so it works with USB. Revision Changes Path 1.6 jop/java/tools/src/com/jopdesign/tools/JavaDown.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/tools/JavaDown.java.diff?r1=1.5&r2=1.6 (In the diff below, changes in quantity of whitespace are not shown.) Index: JavaDown.java =================================================================== RCS file: /cvsroot/jeuneS2/jop/java/tools/src/com/jopdesign/tools/JavaDown.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- JavaDown.java 9 Sep 2007 16:35:56 -0000 1.5 +++ JavaDown.java 24 Jan 2008 11:21:50 -0000 1.6 @@ -8,6 +8,7 @@ //import javax.comm.*; public class JavaDown { + static boolean echo = false; static boolean usb = false; @@ -31,15 +32,6 @@ final static char prog_char[] = { '|', '/', '-', '\\', '|', '/', '-', '\\' }; public static void main(String[] args) { - /* String driverName = "com.sun.comm.Win32Driver"; - try { - CommDriver commdriver = (CommDriver) Class.forName(driverName) - .newInstance(); - commdriver.initialize(); - } catch (Exception e2) { - e2.printStackTrace(); - } - */ sysoutStream = System.out; sysinStream = System.in; @@ -77,6 +69,7 @@ try { serialPort.setSerialPortParams(115200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); + serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); } catch (UnsupportedCommOperationException e) { sysoutStream.println(e); } @@ -92,7 +85,6 @@ } static public boolean downLoad(String fname) { - sysoutStream.println("TEST"); FileReader fileIn = null; try { fileIn = new FileReader(fname); @@ -138,12 +130,15 @@ if ((cnt & 0x3f) == 0) { sysoutStream.print(prog_char[(cnt >> 6) & 0x07] + "\r"); } - } + + if (!usb) { while (rplyCnt > 0) { - iStream.read(); + sysoutStream.print(rplyCnt+" "); + sysoutStream.println((char)iStream.read()); --rplyCnt; } + } sysoutStream.println(cnt + " words external RAM (" + (cnt / 256) + " KB)"); @@ -158,6 +153,7 @@ } static public void echo() { + // start monitoring System.in in seperate thread new Thread() { public void run() { @@ -198,20 +194,4 @@ // who closes the serial port now? // serialPort.close(); } - - public static void setOutputStream(OutputStream outputStream) { - JavaDown.outputStream = outputStream; - } - - public static void setIStream(InputStream stream) { - JavaDown.iStream = stream; - } -
- public static void setSysoutStream(PrintStream sysoutStream) {
- JavaDown.sysoutStream = sysoutStream;
- }
-
- public static void setSysinStream(InputStream sysinStream) {
- JavaDown.sysinStream = sysinStream;
- }
}
|
 |