Selaa lähdekoodia

Begin preparing for the creation of the first macro state

Baglio Tabifata 4 vuotta sitten
vanhempi
commit
e4e7c52456

+ 5 - 0
src/net/hkzlab/devices/PAL16R4Specs.java

@@ -56,4 +56,9 @@ public class PAL16R4Specs implements PALSpecs {
     public String toString() {
         return "PAL16R4";
     }
+
+    @Override
+    public int getROUT_READMaskShift() {
+        return 1;
+    }
 }

+ 5 - 0
src/net/hkzlab/devices/PAL16R6Specs.java

@@ -56,4 +56,9 @@ public class PAL16R6Specs implements PALSpecs {
     public String toString() {
         return "PAL16R6";
     }
+
+    @Override
+    public int getROUT_READMaskShift() {
+        return 0;
+    }
 }

+ 2 - 0
src/net/hkzlab/devices/PALSpecs.java

@@ -12,4 +12,6 @@ public interface PALSpecs {
     public int getIO_WRITEMask();
     public int getROUT_READMask();
     public int getROUT_WRITEMask();
+
+    public int getROUT_READMaskShift();
 }

+ 12 - 1
src/net/hkzlab/dupal/boardio/DuPALAnalyzer.java

@@ -5,10 +5,13 @@ import org.slf4j.LoggerFactory;
 
 import net.hkzlab.devices.PALSpecs;
 import net.hkzlab.dupal.dupalproto.DuPALProto;
+import net.hkzlab.palanalisys.MacroState;
 
 public class DuPALAnalyzer {
     private final Logger logger = LoggerFactory.getLogger(DuPALAnalyzer.class);
 
+    private final MacroState[] mStates;
+
     private final DuPALManager dpm;
     private final PALSpecs pspecs;
     private int IOasOUT_Mask = -1;
@@ -17,6 +20,8 @@ public class DuPALAnalyzer {
         this.dpm = dpm;
         this.pspecs = pspecs;
         this.IOasOUT_Mask = IOasOUT_Mask;
+
+        this.mStates = new MacroState[2^pspecs.getNumROUTPins()];
     } 
     
     public DuPALAnalyzer(final DuPALManager dpm, final PALSpecs pspecs) {
@@ -79,7 +84,7 @@ public class DuPALAnalyzer {
 
     private void internal_analisys() {
         logger.info("Device: " + pspecs + " Outs: " + Integer.toBinaryString(IOasOUT_Mask)+"b");
-        int pins;
+        int pins, mstate_idx;
 
         writePINs(0x00); // Set the address to 0, enable the /OE pin and leave clock to low
         pins = readPINs();
@@ -87,6 +92,8 @@ public class DuPALAnalyzer {
         int routstate = pins & pspecs.getROUT_READMask();
         logger.info("Registered output states at start: " + Integer.toBinaryString(routstate) + "b");
         logger.info("Output states at start: " + Integer.toBinaryString(pins & IOasOUT_Mask) + "b");
+
+        mstate_idx = routstate >> pspecs.getROUT_READMaskShift();
     }
 
     private int readPINs() {
@@ -98,4 +105,8 @@ public class DuPALAnalyzer {
         dpm.writeCommand(DuPALProto.buildWRITECommand(addr));
         return DuPALProto.handleWRITEResponse(dpm.readResponse());
     }
+
+    static private String buildMSTag(int idx) {
+        return "MS_"+Integer.toHexString(idx);
+    }
 }