package edu.berkeley.slipway;
+import com.ftdi.usb.*;
import com.atmel.fpslic.*;
import edu.berkeley.obits.*;
-import org.ibex.util.Log;
+import org.ibex.util.*;
import java.io.*;
import java.util.*;
import gnu.io.*;
System.load(new File("build/"+System.mapLibraryName("FtdiUartNative")).getAbsolutePath());
}
- private final Chip chip;
+ private final FpslicRaw chip;
private final InputStream in;
private final OutputStream out;
public OutputStream getOutputStream() { return out; }
public FtdiBoard() throws Exception {
- chip = new ChipImpl();
+ chip = new FpslicRaw(new FpslicPinsUsb(new FtdiUart(0x6666, 0x3133, 1500 * 1000)));
String bstFile = this.getClass().getName();
bstFile = bstFile.substring(0, bstFile.lastIndexOf('.'));
bstFile = bstFile.replace('.', '/')+"/slipway_drone.bst";
}
public void reset() throws IOException {
- chip.doReset();
+ chip.reset();
}
public void boot(Reader r) throws Exception {
- Chip d = chip;
- d.selfTest();
-
- OutputStream os = d.getConfigStream();
+ chip.selfTest();
+ int total = 75090/9;
+ OutputStream os = new ProgressOutputStream("bootstrap bitstream:", chip.getConfigStream(), total);
BufferedReader br = new BufferedReader(r);
- br.readLine();
int bytes = 0;
while(true) {
String s = br.readLine();
if (s==null) break;
- int in = Integer.parseInt(s, 2);
bytes++;
- os.write((byte)in);
- if ((bytes % 1000)==0) {
- os.flush();
- System.out.print("wrote " + bytes + " bytes\r");
- }
+ os.write((byte)Integer.parseInt(s, 2));
+ if ((bytes % 1000)==0) os.flush();
}
os.close();
}