Class TesterSequence

java.lang.Object
cbsw.lhcb.pdmdb.TesterSequence

public class TesterSequence extends 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>

  • Field Details

  • Constructor Details

    • TesterSequence

      public TesterSequence()

      No-argument constructor called during unmarshalling

  • Method Details

    • makePanel

      public 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(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 String scanModule(String name)
    • scan

      public static String scan(String[] args)

      Scan PDMDB/TCM/DTM barcodes

      Callable by Command

      Parameters:
      args - Command args
      Returns:
      Command response
    • loadInventory

      public static String loadInventory(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 String writeInventory(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 String idDialog()
    • identify

      public static String identify(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 String prepareTests(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 String endOfTests(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(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 String configureDtm(String[] args)

      Configures the DTM module.

      Callable by Command.

      1. Holds both DTM GBTXs in reset.
      2. Deasserts reset for GBTX0 and configures it.
      3. 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

      @Deprecated public static String trainEports(String[] args)
      Deprecated.

      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 String programFpga(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

      @Deprecated public static String configureMuDaq(String[] args)
      Deprecated.

      Configures the muDaq registers

      Callable by Command.

      Parameters:
      args - See MuDaq.configure().
      Returns:
      Command response provided by MuDaq.configure().
    • resetMuDaq

      public static String resetMuDaq(String[] args)

      Resets muDaq.

      Callable by Command.

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • setMgtOnOff

      public static String setMgtOnOff(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 String setMgtReset(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 String configureMasterLink(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

      @Deprecated public static String configureGbts(String[] args)
      Deprecated.

      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 String fuseMasterGbtx(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 String setupSca(String[] args)

      Configures up the SCA.

      Callable by Command

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • setDac

      public static String setDac(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 String setGpio(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 String setGpioDirection(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 String gpioControl(String[] args)

      Controls the GPIOs.

      Callable by Command.

      Set and test multiple GPIOs in one call.

      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 String setAdcCurrentSource(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 String setAdcGain(String[] args)

      Sets ADC gain.

      Callable by Command.

      Parameters:
      args - Not used
      Returns:
      Command response.
    • getAdc

      public static String getAdc(HashMap<String,String> args)

      Acquires ADC test samples.

      Callable by Command.

      Parameters:
      args - {samples,bins,binMinimum,binWidth,binMaximum,rmsMaximum,svg}.
      Returns:
      Command response.
    • configureEc

      public static String configureEc(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 String doEyeScan(String[] args)

      Does MGT eye scan.

      Callable by Command.

      Parameters:
      args - {mgtId,prescale,maxErrors}.
      Returns:
      Command response.
    • doScan2

      public static String doScan2(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 Consumer 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 String spiTest(String[] args)

      Performs a test of the SPI interface.

      Callable by Command.

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • bitflipSummary

      public static String bitflipSummary(String[] args)

      Writes summary of bitflip measurements to XML.

      Callable by Command.

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • clockSummary

      public static String clockSummary(String[] args)

      Writes summary of clock measurements to XML.

      Callable by Command.

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • powerSummary

      public static String powerSummary(String[] args)

      Writes summary of power measurements to XML.

      Callable by Command.

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • postSeafTestOpens

      public static String postSeafTestOpens(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 String postSeafTestShorts(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 String temperatureSummary(String[] args)

      Writes summary of temperature measurements to XML.

      Callable by Command.

      Parameters:
      args - Not used.
      Returns:
      Command response.
    • configureAsics

      @Deprecated public static String configureAsics(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

      @Deprecated public static String configurePicoTDC(String[] args)
      Deprecated.

      Configures picoTDC.

      Callable by Command.

      Parameters:
      args - 0=configFile
      Returns:
      Command response.
    • goTo

      public static String goTo(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).