X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcom%2Fatmel%2Ffpslic%2FFpslicBoard.java;fp=src%2Fcom%2Fatmel%2Ffpslic%2FFpslicBoard.java;h=4016b600f946652c234113e5d26618517305a803;hb=5301afc9e47f0dd6f96858d1c70407e0df5b53cf;hp=0000000000000000000000000000000000000000;hpb=d76f7c4ce28a3b84ada73282f3ca00a9b716cf93;p=slipway.git
diff --git a/src/com/atmel/fpslic/FpslicBoard.java b/src/com/atmel/fpslic/FpslicBoard.java
new file mode 100644
index 0000000..4016b60
--- /dev/null
+++ b/src/com/atmel/fpslic/FpslicBoard.java
@@ -0,0 +1,139 @@
+package com.atmel.fpslic;
+
+import edu.berkeley.abits.*;
+import java.io.*;
+
+/**
+ * Implementation of Board for Fpslic devices; subclass must
+ * implement methods to wiggle pins on the chip.
+ */
+public abstract class FpslicBoard implements Board {
+
+ public FpslicBoard() throws IOException { }
+
+ public void reset() throws IOException {
+ avrrstPin(false);
+ configDataPin(false);
+ resetPin(false);
+ cclkPin(false);
+
+ conPin(false);
+ flush();
+
+ resetPin(false);
+ try { Thread.sleep(500); } catch (Exception e) { }
+ if (initPin()) throw new IOException("INIT was still high after pulling RESET low");
+
+ resetPin(true);
+ try { Thread.sleep(500); } catch (Exception e) { }
+ if (!initPin()) throw new IOException("INIT was still low after releasing RESET");
+
+ sendConfigBits(0,2);
+ flush();
+ }
+
+ public OutputStream getConfigStream() throws IOException {
+ reset();
+ return new OutputStream() {
+ int bytes = 0;
+ int bits = 0;
+ public void write(int in) throws IOException {
+ for(int i=7; i>=0; i--) {
+ bits++;
+ sendConfigBits((((in & 0xff) & (1<=0; i--) {
+ boolean bit = (bits & (1<