Class TesterSequence
- java.lang.Object
-
- cbsw.lhcb.pdmdb.TesterSequence
-
public class TesterSequence extends java.lang.Object
This class encapsulates a sequence of Commands.
It also implements many of the static methods called by
Command
The command sequence is unmarshalled from XML and executed by reflection.
A very basic sequence in XML that configures a PDMDB (H-type) could be:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <testerSequence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <command label="muDAQ configure" targetClass="TesterSequence" targetMethod="configureMuDaq"/> <command label="Configure master link" targetClass="TesterSequence" targetMethod="configureMasterLink" data="i2c" stopOnFail="true"/> <command label="SCA setup" targetClass="TesterSequence" targetMethod="setupSca"/> <command label="DTM0 program GBTX" targetClass="TesterSequence" targetMethod="configureDtm" data="0"/> <command label="DTM0 program FPGA" targetClass="TesterSequence" targetMethod="programFpga" data="0"/> <command label="DTM2 program GBTX" targetClass="TesterSequence" targetMethod="configureDtm" data="1"/> <command label="DTM2 program FPGA" targetClass="TesterSequence" targetMethod="programFpga" data="1"/> <command label="Train e-ports" targetClass="TesterSequence" targetMethod="trainEports" data="0?1"/> <command label="Configure EC0" targetClass="TesterSequence" targetMethod="configureClaros" data="0"/> <command label="Configure EC1" targetClass="TesterSequence" targetMethod="configureClaros" data="1"/> <command label="Configure EC2" targetClass="TesterSequence" targetMethod="configureClaros" data="2"/> <command label="Configure EC3" targetClass="TesterSequence" targetMethod="configureClaros" data="3"/> </testerSequence>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
TesterSequence.TestTask
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.io.BufferedWriter
commandResponseFile
(package private) static ScanAction
dacAction
(package private) static Inventory
dtmInventory
(package private) static java.nio.file.Path
eyeScanDataDirectory
(package private) static Inventory
inventory
(package private) static ScanAction
ps1Action
(package private) static ScanAction
ps2Action
(package private) static ScanAction
ps3Action
(package private) static ScanAction
ps4Action
(package private) static ScanAction
ps5Action
(package private) static javax.swing.JTextField
rootDirectoryTF
(package private) static TesterSequence
staticThis
(package private) static Inventory
tcmInventory
static java.nio.file.Path
testDirectory
(package private) static java.lang.String
testSubdirectory
(package private) static java.io.BufferedWriter
testSummaryXml
(package private) static javax.swing.JTextArea
textArea
(package private) static ScanAction
thrAction
-
Constructor Summary
Constructors Constructor Description TesterSequence()
No-argument constructor called during unmarshalling
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
bitflipSummary(java.lang.String[] args)
Writes summary of bitflip measurements to XML.void
chooseDataDirectory()
Creates dialog to choose the root directory for test datastatic java.lang.String
clockSummary(java.lang.String[] args)
Writes summary of clock measurements to XML.static java.lang.String
configureAsics(java.lang.String[] args)
Configures FE ASICs.static java.lang.String
configureDtm(java.lang.String[] args)
Configures the DTM module.static java.lang.String
configureEc(java.lang.String[] args)
Configures ASICs for one EC.static java.lang.String
configureGbts(java.lang.String[] args)
Configures the master LpGBTstatic java.lang.String
configureMasterLink(java.lang.String[] args)
Configures the master GBTXstatic java.lang.String
configureMuDaq(java.lang.String[] args)
Configures the muDaq registersstatic java.lang.String
configurePicoTDC(java.lang.String[] args)
Configures picoTDC.static java.lang.String
doEyeScan(java.lang.String[] args)
Does MGT eye scan.static java.lang.String
doScan2(java.lang.String[] args)
Performs a 2D (2 parameter) scan.static java.lang.String
endOfTests(java.lang.String[] args)
Closes test data files.static java.lang.String
fuseMasterGbtx(java.lang.String[] args)
Fuses GBTX registersstatic java.lang.String
getAdc(java.util.HashMap<java.lang.String,java.lang.String> args)
Acquires ADC test samples.void
go()
Executes all the steps of the sequence.static java.lang.String
goTo(java.lang.String[] args)
Jumps to a specified step in the sequence.static java.lang.String
gpioControl(java.lang.String[] args)
Controls the GPIOs.static java.lang.String
idDialog()
static java.lang.String
identify(java.lang.String[] args)
Prompts for the (Challenger) assembly ID of the PDMDB.void
launch()
Launches the sequence in its own thread (usingSwingWorker
).static java.lang.String
loadInventory(java.lang.String[] args)
Loads the inventory document of PDMDBs.static void
logMessage(java.lang.CharSequence msg)
Writes a message to the command/response file.javax.swing.JPanel
makePanel()
Convenience method to make a GUI panelvoid
pause()
Pauses the sequence.static java.lang.String
pdSignalTest(java.lang.String[] args)
Performs PD signal loopback tests (Oxford tester).static java.lang.String
postSeafTestOpens(java.lang.String[] args)
Updates the inventory with results of the SEAF open pins test.static java.lang.String
postSeafTestShorts(java.lang.String[] args)
Updates the inventory with results of the SEAF shorted pair test.static java.lang.String
powerSummary(java.lang.String[] args)
Writes summary of power measurements to XML.void
prepare()
Prepares to run the sequence.static java.lang.String
prepareTests(java.lang.String[] args)
Creates directories and files for test data.static java.lang.String
programFpga(java.lang.String[] args)
Programs the PDMDB FPGA.void
recording()
Toggles the recording flag.static java.lang.String
resetMuDaq(java.lang.String[] args)
Resets muDaq.void
resume()
Continues the sequence after pause.static java.lang.String
scan(java.lang.String[] args)
Scan PDMDB/TCM/DTM barcodes(package private) static java.lang.String
scanModule(java.lang.String name)
static java.lang.String
seafShortsTest(java.lang.String[] args)
Static SEAF pin shorts tests.static java.lang.String
seafTest(java.lang.String[] args)
Static SEAF pin continuity tests.static java.lang.String
setAdcCurrentSource(java.lang.String[] args)
Enables/disables ADC current source.static java.lang.String
setAdcGain(java.lang.String[] args)
Sets ADC gain.static java.lang.String
setDac(java.lang.String[] args)
Sets DAC.static java.lang.String
setGpio(java.lang.String[] args)
Sets GPIO outputs.static java.lang.String
setGpioDirection(java.lang.String[] args)
Sets GPIO direction.static java.lang.String
setMgtOnOff(java.lang.String[] args)
Switches muDaq K7 transceiver on or off.static java.lang.String
setMgtReset(java.lang.String[] args)
Resets muDaq MGT transceiver.static java.lang.String
setupSca(java.lang.String[] args)
Configures up the SCA.static java.lang.String
spiTest(java.lang.String[] args)
Performs a test of the SPI interface.void
step()
Executes the next step of the sequence.static java.lang.String
temperatureSummary(java.lang.String[] args)
Writes summary of temperature measurements to XML.static java.lang.String
trainEports(java.lang.String[] args)
Performs the automatic GBTX ePort phase training.static java.lang.String
writeInventory(java.lang.String[] args)
Writes the modfied inventory of PDMDBs.static void
xml(java.lang.CharSequence text)
Writes lines to XML summary file.
-
-
-
Field Detail
-
textArea
static javax.swing.JTextArea textArea
-
rootDirectoryTF
static javax.swing.JTextField rootDirectoryTF
-
testSubdirectory
static java.lang.String testSubdirectory
-
testDirectory
public static java.nio.file.Path testDirectory
-
commandResponseFile
static java.io.BufferedWriter commandResponseFile
-
testSummaryXml
static java.io.BufferedWriter testSummaryXml
-
eyeScanDataDirectory
static java.nio.file.Path eyeScanDataDirectory
-
inventory
static Inventory inventory
-
tcmInventory
static Inventory tcmInventory
-
dtmInventory
static Inventory dtmInventory
-
staticThis
static TesterSequence staticThis
-
thrAction
static ScanAction thrAction
-
ps1Action
static ScanAction ps1Action
-
ps2Action
static ScanAction ps2Action
-
ps3Action
static ScanAction ps3Action
-
ps4Action
static ScanAction ps4Action
-
ps5Action
static ScanAction ps5Action
-
dacAction
static ScanAction dacAction
-
-
Method Detail
-
makePanel
public javax.swing.JPanel makePanel()
Convenience method to make a GUI panel
- Returns:
- The panel
-
chooseDataDirectory
public void chooseDataDirectory()
Creates dialog to choose the root directory for test data
Timestamped subdirectories are created in this directory for each cycle of a sequence
-
logMessage
public static void logMessage(java.lang.CharSequence msg)
Writes a message to the command/response file.
Does nothing if testDirectory or commandResponseFile are null.
- Parameters:
msg
- The CharSequence to write.
-
scanModule
static java.lang.String scanModule(java.lang.String name)
-
scan
public static java.lang.String scan(java.lang.String[] args)
Scan PDMDB/TCM/DTM barcodes
Callable by
Command
- Parameters:
args
- Command args- Returns:
- Command response
-
loadInventory
public static java.lang.String loadInventory(java.lang.String[] args)
Loads the inventory document of PDMDBs.
Callable by
Command
.Call this method at the start of a test sequence.
- Parameters:
args
- Directory path of inventory file.- Returns:
- Command response.
-
writeInventory
public static java.lang.String writeInventory(java.lang.String[] args)
Writes the modfied inventory of PDMDBs.
Callable by
Command
.Call this method at the end of a test sequence.
- Parameters:
args
- Path of database XML file.- Returns:
- Command response.
-
idDialog
public static java.lang.String idDialog()
-
identify
public static java.lang.String identify(java.lang.String[] args)
Prompts for the (Challenger) assembly ID of the PDMDB.
Callable by
Command
.Call this method at the start of a test sequence.
- Parameters:
args
- None.- Returns:
- Command response.
-
prepareTests
public static java.lang.String prepareTests(java.lang.String[] args)
Creates directories and files for test data.
Callable by
Command
.Call this method at the start of a test sequence.
- Parameters:
args
- Not used.- Returns:
- Command response.
-
endOfTests
public static java.lang.String endOfTests(java.lang.String[] args)
Closes test data files.
Callable by
Command
.Call this method at the end of a test sequence to close the output files.
- Parameters:
args
- Not used.- Returns:
- Command response.
-
xml
public static void xml(java.lang.CharSequence text)
Writes lines to XML summary file.
If testDirectory or testSummaryXml are null, this method does nothing.
- Parameters:
text
- CharSequence to write.
-
configureDtm
public static java.lang.String configureDtm(java.lang.String[] args)
Configures the DTM module.
Callable by
Command
.- Holds both DTM GBTXs in reset.
- Deasserts reset for GBTX0 and configures it.
- Deasserts reset for GBTX1 and configures it.
- Parameters:
args
- {dtmIndex}.dtmIndex is the index of the DTM in the list unmarshalled from XML, not the DTM label.
- Returns:
- Command response.
-
trainEports
public static java.lang.String trainEports(java.lang.String[] args)
Performs the automatic GBTX ePort phase training.
Callable by
Command
.- Parameters:
args
- {dtmIndex}.dtmIndex is the index of the DTM in the list unmarshalled from XML, not the DTM label.
- Returns:
- Command response.
-
seafTest
public static java.lang.String seafTest(java.lang.String[] args)
Static SEAF pin continuity tests.
Callable by
Command
.This test used in combination with Chimaera2 tester and special firmware in PDMDB. Do not activate this test with CLARO front-ends connected.
Before calling this, call gpioControl() to drive 0 on all EC GPIOs and call setDac() to set the EC DACs to 0.
- Parameters:
args
- Unused.- Returns:
- Command response.
-
seafShortsTest
public static java.lang.String seafShortsTest(java.lang.String[] args)
Static SEAF pin shorts tests.
Callable by
Command
.- Parameters:
args
- {dtmIndex}.dtmIndex is the index of the DTM in the list unmarshalled from XML, not the DTM label.
- Returns:
- Command response.
-
pdSignalTest
public static java.lang.String pdSignalTest(java.lang.String[] args)
Performs PD signal loopback tests (Oxford tester).
Callable by
Command
.The Oxford tester board loops back the PD signals in pairs. The firmware has IOBUFs on the IOs that allow either end of the loop to be the driver and the other end the receiver. There are 84 pairs per DTM FPGA.
For this test, to avoid signal contention, each of the 3 DTM FPGAs must have different firmware as the IO pairing is different for each.
This test is not very meaningful for PDMDB-H since many of the signals are not routed on the PCB so that most of the loopbacks are broken.
- Parameters:
args
- {dtmIndex,data}.dtmIndex is the index of the DTM in the list unmarshalled from XML, not the DTM label. data is a comma-separated list of up to 14 byte values that set the level asserted by each IO.
- Returns:
- Command response including a hexadecimal string of the signals read back from each IO for each direction of the test.
-
programFpga
public static java.lang.String programFpga(java.lang.String[] args)
Programs the PDMDB FPGA.
Callable by
Command
.- Parameters:
args
- {dtmIndex,binFile}.dtmIndex is the index of the DTM in the list unmarshalled from XML, not the DTM label. binFile is the FPGA configuration .bin file location.
- Returns:
- Command response.
-
configureMuDaq
public static java.lang.String configureMuDaq(java.lang.String[] args)
Configures the muDaq registers
Callable by
Command
.- Parameters:
args
- See MuDaq.configure().- Returns:
- Command response provided by MuDaq.configure().
-
resetMuDaq
public static java.lang.String resetMuDaq(java.lang.String[] args)
Resets muDaq.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
setMgtOnOff
public static java.lang.String setMgtOnOff(java.lang.String[] args)
Switches muDaq K7 transceiver on or off.
Callable by
Command
.- Parameters:
args
- {mgtId,txOn,rxOn}.There are 8 MGTs with mgtId=0-7. txOn=0 to switch off the transmitter, txOn=1 to switch on. Similarly for the receiver.
- Returns:
- Command response.
-
setMgtReset
public static java.lang.String setMgtReset(java.lang.String[] args)
Resets muDaq MGT transceiver.
Callable by
Command
.- Parameters:
args
- {mgtId,txReset,rxReset}.There are 8 transceivers with mgtId=0-7. txReset=0 to deassert the receiver reset, txReset=1 to assert reset. Similarly for the receiver.
- Returns:
- Command response.
-
configureMasterLink
public static java.lang.String configureMasterLink(java.lang.String[] args)
Configures the master GBTX
Callable by
Command
.To allow configuration of un-fused master GBTX this function selects either the I2C interface (<gbtI2c> in XML) or the generic interface (<gbtx> in XML) which can be set to either I2C or IC
- Parameters:
args
- {interface}.interface=i2c to use the I2C interface, anything else to use the generic interface.
- Returns:
- Command response.
-
configureGbts
public static java.lang.String configureGbts(java.lang.String[] args)
Configures the master LpGBT
Callable by
Command
.To allow configuration of un-fused master GBT this function selects either the I2C interface (<gbtI2c> in XML) or the generic interface (<gbt> in XML) which can be set to either I2C or IC
- Parameters:
args
- {interface}.interface=i2c to use the I2C interface, anything else to use the generic interface.
- Returns:
- Command response.
-
fuseMasterGbtx
public static java.lang.String fuseMasterGbtx(java.lang.String[] args)
Fuses GBTX registers
Callable by
Command
.This function is called as part of the module testing sequence.
Caution - it irreversibly burns the TCM GBTX e-fuses.
The GBTX must have CONFIGSEL=1 (I2C) for this procedure and GBTFUSE3V3 must be enabled.
- Parameters:
args
- {fuseMode}fuseMode="enable" to allow fusing, "ignore" to disallow fusing, "force" to force re-fusing an already fused GBTX.
- Returns:
- Command response.
-
setupSca
public static java.lang.String setupSca(java.lang.String[] args)
Configures up the SCA.
Callable by
Command
- Parameters:
args
- Not used.- Returns:
- Command response.
-
setDac
public static java.lang.String setDac(java.lang.String[] args)
Sets DAC.
Callable by
Command
.- Parameters:
args
- {channel,value}.There are 4 DACs with channel=0-3. The DACs are 8 bit with allowed range value=0-255.
- Returns:
- Command response.
-
setGpio
public static java.lang.String setGpio(java.lang.String[] args)
Sets GPIO outputs.
Callable by
Command
.- Parameters:
args
- {channel,value}.There are 32 GPIOs with channel=0-31. value=0 to deassert the GPIO output, value=1 to assert.
- Returns:
- Command response.
-
setGpioDirection
public static java.lang.String setGpioDirection(java.lang.String[] args)
Sets GPIO direction.
Callable by
Command
.- Parameters:
args
- {channel,direction}.There are 32 GPIOs with channel=0-31. direction=0 to set the GPIO as input, direction=1 to set as output.
- Returns:
- Command response.
-
gpioControl
public static java.lang.String gpioControl(java.lang.String[] args)
- Parameters:
args
- {testid:expected,gpio:direction:value,gpio:direction:value,...}.testid is a word to identify this test. expected is the expected value when read back (0 or 1). gpio is the integer GPIO ID. direction can be in or out. value=0 to deassert the GPIO, value=1 to assert.
- Returns:
- Command response.
-
setAdcCurrentSource
public static java.lang.String setAdcCurrentSource(java.lang.String[] args)
Enables/disables ADC current source.
Callable by
Command
.- Parameters:
args
- {channel,enable}.There are 31 ADCs for which the current source may be enabled with channel=0-30. enable=0 to disable the current source, enable=1 to enable.
- Returns:
- Command response.
-
setAdcGain
public static java.lang.String setAdcGain(java.lang.String[] args)
Sets ADC gain.
Callable by
Command
.- Parameters:
args
- Not used- Returns:
- Command response.
-
getAdc
public static java.lang.String getAdc(java.util.HashMap<java.lang.String,java.lang.String> args)
Acquires ADC test samples.
Callable by
Command
.- Parameters:
args
- {samples,bins,binMinimum,binWidth,binMaximum,rmsMaximum,svg}.- Returns:
- Command response.
-
configureEc
public static java.lang.String configureEc(java.lang.String[] args)
Configures ASICs for one EC.
Callable by
Command
.- Parameters:
args
- {ecIndex}.ecIndex is the index of the EC in the list unmarshalled from XML, not the EC label.
- Returns:
- Command response.
-
doEyeScan
public static java.lang.String doEyeScan(java.lang.String[] args)
Does MGT eye scan.
Callable by
Command
.- Parameters:
args
- {mgtId,prescale,maxErrors}.- Returns:
- Command response.
-
doScan2
public static java.lang.String doScan2(java.lang.String[] args)
Performs a 2D (2 parameter) scan.
Callable by
Command
.Does nothing if testDirectory is null.
The actions performed at each step are defined by ScanAction instances. The scan index [1,2] respectively refer to the [inner,outer] scan loop.
- Parameters:
args
- {scanMode,scanRepeat,scan1Start,scan1End,scan1Increment,scan2Start,scan2End,scan2Increment}. Optional. Defaults {scanType1,1,0,511,1,0,511,1}.- Returns:
- Command response.
-
spiTest
public static java.lang.String spiTest(java.lang.String[] args)
Performs a test of the SPI interface.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
bitflipSummary
public static java.lang.String bitflipSummary(java.lang.String[] args)
Writes summary of bitflip measurements to XML.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
clockSummary
public static java.lang.String clockSummary(java.lang.String[] args)
Writes summary of clock measurements to XML.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
powerSummary
public static java.lang.String powerSummary(java.lang.String[] args)
Writes summary of power measurements to XML.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
postSeafTestOpens
public static java.lang.String postSeafTestOpens(java.lang.String[] args)
Updates the inventory with results of the SEAF open pins test.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
postSeafTestShorts
public static java.lang.String postSeafTestShorts(java.lang.String[] args)
Updates the inventory with results of the SEAF shorted pair test.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
temperatureSummary
public static java.lang.String temperatureSummary(java.lang.String[] args)
Writes summary of temperature measurements to XML.
Callable by
Command
.- Parameters:
args
- Not used.- Returns:
- Command response.
-
configureAsics
public static java.lang.String configureAsics(java.lang.String[] args)
Configures FE ASICs.
Callable by
Command
.All ASICs connected to boards with identifier matching regex are configured.
- Parameters:
args
- 0=identifier- Returns:
- Command response.
-
configurePicoTDC
public static java.lang.String configurePicoTDC(java.lang.String[] args)
Configures picoTDC.
Callable by
Command
.- Parameters:
args
- 0=configFile- Returns:
- Command response.
-
goTo
public static java.lang.String goTo(java.lang.String[] args)
Jumps to a specified step in the sequence.
Callable by
Command
.Use this method to implement simple loops in a sequence.
- Parameters:
args
- {goto,iterations,wait}.goto is an integer that identifies the step in the sequence to jump to. iterations is the integer number of iterations. wait is the time in seconds to wait between iterations.
- Returns:
- Command response.
-
prepare
public void prepare()
Prepares to run the sequence.
The current sequence position is set to the beginning.
-
pause
public void pause()
Pauses the sequence.
The currently running step will continue to execute until it completes.
-
resume
public void resume()
Continues the sequence after pause.
-
recording
public void recording()
Toggles the recording flag.
-
step
public void step()
Executes the next step of the sequence.
-
go
public void go()
Executes all the steps of the sequence.
-
launch
public void launch()
Launches the sequence in its own thread (using
SwingWorker
).
-
-