Class TesterSequence
- java.lang.Object
-
- cbsw.lhcb.pdmdb.TesterSequence
-
public class TesterSequence extends java.lang.ObjectThis class encapsulates a sequence of Commands.
It also implements many of the static methods called by
CommandThe 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) classTesterSequence.TestTask
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.io.BufferedWritercommandResponseFile(package private) static ScanActiondacAction(package private) static InventorydtmInventory(package private) static java.nio.file.PatheyeScanDataDirectory(package private) static Inventoryinventory(package private) static ScanActionps1Action(package private) static ScanActionps2Action(package private) static ScanActionps3Action(package private) static ScanActionps4Action(package private) static ScanActionps5Action(package private) static javax.swing.JTextFieldrootDirectoryTF(package private) static TesterSequencestaticThis(package private) static InventorytcmInventorystatic java.nio.file.PathtestDirectory(package private) static java.lang.StringtestSubdirectory(package private) static java.io.BufferedWritertestSummaryXml(package private) static javax.swing.JTextAreatextArea(package private) static ScanActionthrAction
-
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.StringbitflipSummary(java.lang.String[] args)Writes summary of bitflip measurements to XML.voidchooseDataDirectory()Creates dialog to choose the root directory for test datastatic java.lang.StringclockSummary(java.lang.String[] args)Writes summary of clock measurements to XML.static java.lang.StringconfigureAsics(java.lang.String[] args)Configures FE ASICs.static java.lang.StringconfigureDtm(java.lang.String[] args)Configures the DTM module.static java.lang.StringconfigureEc(java.lang.String[] args)Configures ASICs for one EC.static java.lang.StringconfigureGbts(java.lang.String[] args)Configures the master LpGBTstatic java.lang.StringconfigureMasterLink(java.lang.String[] args)Configures the master GBTXstatic java.lang.StringconfigureMuDaq(java.lang.String[] args)Configures the muDaq registersstatic java.lang.StringconfigurePicoTDC(java.lang.String[] args)Configures picoTDC.static java.lang.StringdoEyeScan(java.lang.String[] args)Does MGT eye scan.static java.lang.StringdoScan2(java.lang.String[] args)Performs a 2D (2 parameter) scan.static java.lang.StringendOfTests(java.lang.String[] args)Closes test data files.static java.lang.StringfuseMasterGbtx(java.lang.String[] args)Fuses GBTX registersstatic java.lang.StringgetAdc(java.util.HashMap<java.lang.String,java.lang.String> args)Acquires ADC test samples.voidgo()Executes all the steps of the sequence.static java.lang.StringgoTo(java.lang.String[] args)Jumps to a specified step in the sequence.static java.lang.StringgpioControl(java.lang.String[] args)Controls the GPIOs.static java.lang.StringidDialog()static java.lang.Stringidentify(java.lang.String[] args)Prompts for the (Challenger) assembly ID of the PDMDB.voidlaunch()Launches the sequence in its own thread (usingSwingWorker).static java.lang.StringloadInventory(java.lang.String[] args)Loads the inventory document of PDMDBs.static voidlogMessage(java.lang.CharSequence msg)Writes a message to the command/response file.javax.swing.JPanelmakePanel()Convenience method to make a GUI panelvoidpause()Pauses the sequence.static java.lang.StringpostSeafTestOpens(java.lang.String[] args)Updates the inventory with results of the SEAF open pins test.static java.lang.StringpostSeafTestShorts(java.lang.String[] args)Updates the inventory with results of the SEAF shorted pair test.static java.lang.StringpowerSummary(java.lang.String[] args)Writes summary of power measurements to XML.voidprepare()Prepares to run the sequence.static java.lang.StringprepareTests(java.lang.String[] args)Creates directories and files for test data.static java.lang.StringprogramFpga(java.lang.String[] args)Programs the PDMDB FPGA.voidrecording()Toggles the recording flag.static java.lang.StringresetMuDaq(java.lang.String[] args)Resets muDaq.voidresume()Continues the sequence after pause.static java.lang.Stringscan(java.lang.String[] args)Scan PDMDB/TCM/DTM barcodes(package private) static java.lang.StringscanModule(java.lang.String name)static java.lang.StringsetAdcCurrentSource(java.lang.String[] args)Enables/disables ADC current source.static java.lang.StringsetAdcGain(java.lang.String[] args)Sets ADC gain.static java.lang.StringsetDac(java.lang.String[] args)Sets DAC.static java.lang.StringsetGpio(java.lang.String[] args)Sets GPIO outputs.static java.lang.StringsetGpioDirection(java.lang.String[] args)Sets GPIO direction.static java.lang.StringsetMgtOnOff(java.lang.String[] args)Switches muDaq K7 transceiver on or off.static java.lang.StringsetMgtReset(java.lang.String[] args)Resets muDaq MGT transceiver.static java.lang.StringsetupSca(java.lang.String[] args)Configures up the SCA.static java.lang.StringspiTest(java.lang.String[] args)Performs a test of the SPI interface.voidstep()Executes the next step of the sequence.static java.lang.StringtemperatureSummary(java.lang.String[] args)Writes summary of temperature measurements to XML.static java.lang.StringtrainEports(java.lang.String[] args)Performs the automatic GBTX ePort phase training.static java.lang.StringwriteInventory(java.lang.String[] args)Writes the modfied inventory of PDMDBs.static voidxml(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.
-
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).
-
-