add doc/CONVENTIONS
authormegacz <adam@megacz.com>
Thu, 1 Jan 2009 06:22:59 +0000 (22:22 -0800)
committermegacz <adam@megacz.com>
Thu, 1 Jan 2009 06:22:59 +0000 (22:22 -0800)
doc/CONVENTIONS [new file with mode: 0644]
src/edu/berkeley/slipway/FakeBoard.java

diff --git a/doc/CONVENTIONS b/doc/CONVENTIONS
new file mode 100644 (file)
index 0000000..1777f2f
--- /dev/null
@@ -0,0 +1,18 @@
+
+- cartesian coordinates
+
+    - always referred to as "col" and "row", not "x" and "y", since
+      the latter often have other meanings.
+
+    - whenever they appear together, __col__ comes first; not row.
+      This is cartesian convention.
+
+    - 0,0 is the "lower left" corner of the device when the
+      manufacturer specifies a canonical orientation.
+
+    - the unit of measurement is the smallest regular resource
+
+    - resources which occupy more than one unit are always addressed
+      by the lower-leftmost unit occupied.
+
+   
index dd36102..a9be38a 100644 (file)
@@ -1,24 +1,68 @@
 package edu.berkeley.slipway;
 
-import edu.berkeley.obits.*;
-import org.ibex.util.Log;
 import java.io.*;
 import java.util.*;
-import gnu.io.*;
+import com.ftdi.usb.*;
+import com.atmel.fpslic.*;
+import edu.berkeley.abits.*;
+import org.ibex.util.*;
 
-public class FakeBoard implements Board {
+// FEATURE: more state checking (ie must have reset high before uart-mode, etc)
 
-    public FakeBoard() {
-        
+/**
+ * Slipway board (Fpslic via FTDI USB-UART, running <tt>SlipwaySlave.c</tt>)
+ */
+public class FakeBoard extends FpslicDevice implements Board {
+
+    private byte[][][] cache;
+    public FakeBoard(int width, int height) {
+        super(width, height);
+        cache = new byte[256][][];
+        for(int i=0; i < cache.length; i++) {
+            cache[i] = new byte[256][];
+            for(int j=0; j < cache.length; j++) {
+                cache[i][j] = new byte[256];
+            }
+        }
+    }
+
+    public void flush() { }
+    public void mode4(int z, int y, int x, int d) {
+        cache[z][y][x] = (byte)d;
+    }
+    public byte mode4(int z, int y, int x) {
+        return cache[z][y][x];
+    }
+
+    public void reset() throws IOException { }
+
+    public OutputStream getConfigStream() throws IOException {
+        return new OutputStream() {
+            public void flush() { }
+            public void write(int b) { }
+            public void write(byte[] b, int x, int y) { }
+        };
     }
 
-    public void reset() {
-        System.err.println("FakeBoard: reset()");
+    public InputStream  getInputStream() throws IOException {
+        return new InputStream() {
+            public int available() { return 0; }
+            public int read() { return -1; }
+            public int read(byte[] b, int x, int y) { return -1; }
+        };
     }
-    public void boot(Reader r) throws Exception {
 
+    public OutputStream getOutputStream() throws IOException {
+        return new OutputStream() {
+            public void flush() { }
+            public void write(int b) { }
+            public void write(byte[] b, int x, int y) { }
+        };
     }
-    public InputStream getInputStream() { throw new Error(); }
-    public OutputStream getOutputStream() { throw new Error(); }
+
+    public void selfTest(SelfTestResultListener resultListener) throws Exception { }
+
+    public Device getDevice() { return this; }
 
 }
+