Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN | |||
HPSSVTDataBuffer.java | +21 | -13 | 1.1 -> 1.2 |
corrections to buffer writing
diff -u -r1.1 -r1.2 --- HPSSVTDataBuffer.java 5 Apr 2012 20:32:09 -0000 1.1 +++ HPSSVTDataBuffer.java 5 Apr 2012 23:57:51 -0000 1.2 @@ -9,20 +9,20 @@
/** * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSSVTDataBuffer.java,v 1.1 2012/04/05 20:32:09 omoreno Exp $
+ * @version $Id: HPSSVTDataBuffer.java,v 1.2 2012/04/05 23:57:51 jeremy Exp $
*/ public class HPSSVTDataBuffer {
+ // Map the fpga to the data emerging from it + private static Map<Integer, List<Integer>> fpgaToData = new HashMap<Integer, List<Integer>>(); +
private static final HPSSVTDataBuffer instance = new HPSSVTDataBuffer(); private static List<Integer> data = new ArrayList<Integer>(); int[] header = new int[8]; int temp = 23; // C int numFpga = 8;
- - // Map the fpga to the data emerging from it - private static Map<Integer, List<Integer>> fpgaToData = new HashMap<Integer, List<Integer>>(); -
+
// Mask used to encode SVT data header information private static final int FPGA_MASK = 0xFFFF; private static final int TEMP_MASK = 0xFFFF;
@@ -57,14 +57,20 @@
/** * */
- public static Integer[] readoutBuffer(int fpga)
+ public static int[] readoutBuffer(int fpga)
{
- - Integer[] datum = (Integer[]) fpgaToData.get(fpga).toArray();
+ int[] data = new int[fpgaToData.get(fpga).size()]; + int index = 0; + for(Integer datum : fpgaToData.get(fpga)){ + data[index] = datum; + index++; + } + + // Clear the buffer
fpgaToData.get(fpga).clear(); // Return the
- return (Integer[]) data.toArray();
+ return data;
} /**
@@ -82,10 +88,10 @@
} // Tail
- fpgaToData.get(fpga).add(0);
+ //fpgaToData.get(fpga).add(0);
// Frame Size
- fpgaToData.get(fpga).add(0, fpgaToData.get(fpga).size());
+ //fpgaToData.get(fpga).add(0, fpgaToData.get(fpga).size());
}
@@ -97,7 +103,7 @@
// Create the headers for each of the banks //--- FPGA 7 ---//
- fpgaToData.get(7).add(0x00070101); // Tag = 7, UI32, Idx = 1
+ //fpgaToData.get(7).add(0x00070101); // Tag = 7, UI32, Idx = 1
// Insert the temperature information. All temperatures are currently // set to 23 C
@@ -130,9 +136,10 @@
fpgaToData.get(7).add(header[index]); }
- int buff = 0;
+ //int buff = 0;
//--- FPGA 0-6 ---//
+ /*
for(int fpga = 0; fpga < numFpga - 1; fpga++){ buff = (buff &= ~(0x1 << 8)) | ((1 & ID_MASK) << 8); buff = (buff &= ~(FPGA_MASK << 16)) | ((fpga & FPGA_MASK) << 16);
@@ -140,6 +147,7 @@
fpgaToData.get(fpga).add(buff); }
+ */
} }
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1