JLab Pipeline TI Library  3v6.1
Initialization/Configuration

Modules

 Master Configuration
 
 Slave Configuration
 

Functions

int tiInit (unsigned int tAddr, unsigned int mode, int iFlag)
 Initialize the TIp register space into local memory, and setup registers given user input. More...
 
unsigned int tiFind ()
 Find the TI within the prescribed "GEO Slot to A24 VME Address" range from slot 3 to 21. More...
 
int tiReload ()
 Reload the firmware on the FPGA. More...
 
int tiReset ()
 Perform a soft reset of the TI. More...
 
int tiSetCrateID (unsigned int crateID)
 Set the crate ID. More...
 
int tiSetInstantBlockLevelChange (int enable)
 Set TS to instantly change blocklevel when broadcast is received. More...
 
int tiSetTriggerSource (int trig)
 Set the trigger source This routine will set a library variable to be set in the TI registers at a call to tiIntEnable. More...
 
int tiSetTriggerSourceMask (int trigmask)
 Set trigger sources with specified trigmask This routine is for special use when tiSetTriggerSource(...) does not set all of the trigger sources that is required by the user. More...
 
int tiEnableTriggerSource ()
 Enable trigger sources Enable trigger sources set by tiSetTriggerSource(...) or tiSetTriggerSourceMask(...) More...
 
int tiDisableTriggerSource (int fflag)
 Disable trigger sources. More...
 
int tiSetSyncSource (unsigned int sync)
 Set the Sync source mask. More...
 
int tiSetEventFormat (int format)
 Set the event format. More...
 
int tiSetFPInputReadout (int enable)
 Set whether or not the latched pattern of FP Inputs in block readout. More...
 
int tiEnableFiber (unsigned int fiber)
 Enable Fiber transceiver. More...
 
int tiDisableFiber (unsigned int fiber)
 Disnable Fiber transceiver. More...
 
int tiSetBusySource (unsigned int sourcemask, int rFlag)
 Set the busy source with a given sourcemask sourcemask bits: More...
 
void tiEnableBusError ()
 Enable Bus Errors to terminate Block Reads. More...
 
void tiDisableBusError ()
 Disable Bus Errors to terminate Block Reads. More...
 
int tiSetTriggerPulse (int trigger, int delay, int width, int delay_step)
 Set the characteristics of a specified trigger. More...
 
int tiSetPromptTriggerWidth (int width)
 Set the width of the prompt trigger from OT#2. More...
 
void tiSetSyncDelayWidth (unsigned int delay, unsigned int width, int widthstep)
 Set the delay time and width of the Sync signal. More...
 
int tiSetAdr32 (unsigned int a32base)
 Routine to set the A32 Base. More...
 
int tiDisableA32 ()
 Disable A32. More...
 
int tiResetEventCounter ()
 Reset the L1A counter, as incremented by the TI. More...
 
int tiEnableVXSSignals ()
 Enable trigger and sync signals sent through the VXS to the Signal Distribution (SD) module. More...
 
int tiDisableVXSSignals ()
 Disable trigger and sync signals sent through the VXS to the Signal Distribution (SD) module. More...
 
int tiSetOutputPort (unsigned int set1, unsigned int set2, unsigned int set3, unsigned int set4)
 Set (or unset) high level for the output ports on the front panel labelled as O#1-4. More...
 
int tiSetClockSource (unsigned int source)
 Set the clock to the specified source. More...
 
void tiSetFiberDelay (unsigned int delay, unsigned int offset)
 Set the fiber delay required to align the sync and triggers for all crates. More...
 
int tiDisableDataReadout ()
 Disable the necessity to readout the TI for every block. More...
 
int tiEnableDataReadout ()
 Enable readout the TI for every block. More...
 
void tiResetSyncHistory ()
 Reset the SyncCommand history buffer. More...
 
void tiUserSyncReset (int enable, int pflag)
 Control level of the SyncReset signal. More...
 
int tiResetMGTRx ()
 Reset the MGT Rx CDR. More...
 
int tiSetTSInputDelay (int chan, int delay)
 Set the input delay for the specified front panel TSinput (1-6) More...
 
int tiSetTokenTestMode (int mode)
 Turn on Token out test mode. More...
 
int tiSetTokenOutTest (int level)
 Set the level of the token out signal. More...
 

Detailed Description

Function Documentation

◆ tiDisableA32()

int tiDisableA32 ( )

Disable A32.

Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::adr32, TI_VMECONTROL_A32, TILOCK, TIUNLOCK, and TI_A24RegStruct::vmeControl.

◆ tiDisableBusError()

void tiDisableBusError ( )

Disable Bus Errors to terminate Block Reads.

See also
tiEnableBusError
Returns
OK if successful, otherwise ERROR

References TI_VMECONTROL_BERR, TILOCK, and TI_A24RegStruct::vmeControl.

Referenced by tiGetCurrentBlockLevel().

◆ tiDisableDataReadout()

int tiDisableDataReadout ( )

Disable the necessity to readout the TI for every block.

For instances when the TI data is not required for analysis When a block is "ready", a call to tiResetBlockReadout must be made.

See also
tiEnableDataReadout tiResetBlockReadout
Returns
OK if successful, otherwise ERROR

◆ tiDisableFiber()

int tiDisableFiber ( unsigned int  fiber)

Disnable Fiber transceiver.

See also
tiEnableFiber
Parameters
fiberinteger indicative of the transceiver to disable
Returns
OK if successful, ERROR otherwise.

References TI_A24RegStruct::fiber, TILOCK, and TIUNLOCK.

◆ tiDisableTriggerSource()

int tiDisableTriggerSource ( int  fflag)

Disable trigger sources.

Parameters
fflag
  • 0: Disable Triggers
  • >0: Disable Triggers and generate enough triggers to fill the current block
Returns
OK if successful, ERROR otherwise

References TI_TRIGSRC_LOOPBACK, tiFillToEndBlock(), TILOCK, tiMaster, TIUNLOCK, and TI_A24RegStruct::trigsrc.

Referenced by tiIntDisable().

◆ tiDisableVXSSignals()

int tiDisableVXSSignals ( )

Disable trigger and sync signals sent through the VXS to the Signal Distribution (SD) module.

This may be required to eliminate the possibility of accidental signals being sent during Clock Synchronization or Trigger Enable/Disabling by the TI Master or TS.

See also
tiEnableVXSSignals
Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::fiber, TI_FIBER_ENABLE_P0, TILOCK, and TIUNLOCK.

◆ tiEnableBusError()

void tiEnableBusError ( )

Enable Bus Errors to terminate Block Reads.

See also
tiDisableBusError
Returns
OK if successful, otherwise ERROR

References TI_VMECONTROL_BERR, TILOCK, and TI_A24RegStruct::vmeControl.

Referenced by tiGetCurrentBlockLevel().

◆ tiEnableDataReadout()

int tiEnableDataReadout ( )

Enable readout the TI for every block.

See also
tiDisableDataReadout
Returns
OK if successful, otherwise ERROR

◆ tiEnableFiber()

int tiEnableFiber ( unsigned int  fiber)

Enable Fiber transceiver.

Note: All Fiber are enabled by default (no harm, except for 1-2W power usage)

See also
tiDisableFiber
Parameters
fiberinteger indicative of the transceiver to enable
Returns
OK if successful, ERROR otherwise.

References TI_A24RegStruct::fiber, TILOCK, and TIUNLOCK.

Referenced by tiAddSlave().

◆ tiEnableTriggerSource()

int tiEnableTriggerSource ( )

Enable trigger sources Enable trigger sources set by tiSetTriggerSource(...) or tiSetTriggerSourceMask(...)

See also
tiSetTriggerSource
tiSetTriggerSourceMask
Returns
OK if successful, ERROR otherwise

References TILOCK, tiTriggerSource, TIUNLOCK, and TI_A24RegStruct::trigsrc.

◆ tiEnableVXSSignals()

int tiEnableVXSSignals ( )

Enable trigger and sync signals sent through the VXS to the Signal Distribution (SD) module.

This may be required to eliminate the possibility of accidental signals being sent during Clock Synchronization or Trigger Enable/Disabling by the TI Master or TS.

See also
tiDisableVXSSignals
Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::fiber, TI_FIBER_ENABLE_P0, TILOCK, and TIUNLOCK.

◆ tiFind()

unsigned int tiFind ( )

Find the TI within the prescribed "GEO Slot to A24 VME Address" range from slot 3 to 21.

Returns
A24 VME address if found. Otherwise, 0

References TI_BOARDID_TYPE_MASK, and TI_BOARDID_TYPE_TI.

Referenced by tiInit().

◆ tiInit()

int tiInit ( unsigned int  tAddr,
unsigned int  mode,
int  iFlag 
)

Initialize the TIp register space into local memory, and setup registers given user input.

Parameters
tAddrAddress or Slot Number
  • A24 VME Address of the TI (0x000016 - 0xffffff)
  • Slot number of TI (1 - 21)
modeReadout/Triggering Mode
  • 0 External Trigger - Interrupt Mode
  • 1 TI/TImaster Trigger - Interrupt Mode
  • 2 External Trigger - Polling Mode
  • 3 TI/TImaster Trigger - Polling Mode
iFlagInitialization bit mask
  • 0 Do not initialize the board, just setup the pointers to the registers
  • 1 Use Slave Fiber 5, instead of 1
  • 2 Ignore firmware check
Returns
OK if successful, otherwise ERROR.

References TI_A24RegStruct::boardID, TI_INIT_NO_INIT, TI_INIT_SLAVE_FIBER_5, and tiFind().

◆ tiReload()

int tiReload ( )

Reload the firmware on the FPGA.

Returns
OK if successful, ERROR otherwise

References TI_A24RegStruct::JTAGPROMBase, TI_A24RegStruct::reset, TI_RESET_JTAG, TILOCK, and TIUNLOCK.

◆ tiReset()

int tiReset ( )

Perform a soft reset of the TI.

Returns
OK if successful, ERROR otherwise

References TI_A24RegStruct::reset, TI_RESET_SOFT, TILOCK, and TIUNLOCK.

◆ tiResetEventCounter()

int tiResetEventCounter ( )

Reset the L1A counter, as incremented by the TI.

Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::reset, TI_RESET_SCALERS_RESET, TILOCK, and TIUNLOCK.

◆ tiResetMGTRx()

int tiResetMGTRx ( )

Reset the MGT Rx CDR.

References TI_A24RegStruct::reset, TI_RESET_MGT_RX_RESET, TILOCK, and TIUNLOCK.

◆ tiResetSyncHistory()

void tiResetSyncHistory ( )

Reset the SyncCommand history buffer.

References TI_A24RegStruct::reset, TI_RESET_SYNC_HISTORY, TILOCK, and TIUNLOCK.

◆ tiSetAdr32()

int tiSetAdr32 ( unsigned int  a32base)

Routine to set the A32 Base.

Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::adr32, TI_ADR32_BASE_MASK, TI_VMECONTROL_A32, tiA32Base, tiA32Offset, TILOCK, TIpd, TIUNLOCK, and TI_A24RegStruct::vmeControl.

◆ tiSetBusySource()

int tiSetBusySource ( unsigned int  sourcemask,
int  rFlag 
)

Set the busy source with a given sourcemask sourcemask bits:

Parameters
sourcemask
  • 0: SWA
  • 1: SWB
  • 2: P2
  • 3: FP-FTDC
  • 4: FP-FADC
  • 5: FP
  • 6: Unused
  • 7: Loopack
  • 8-15: Fiber 1-8
rFlag- decision to reset the global source flags
  • 0: Keep prior busy source settings and set new "sourcemask"
  • 1: Reset, using only that specified with "sourcemask"
Returns
OK if successful, ERROR otherwise.

References TI_A24RegStruct::busy, TI_BUSY_SOURCEMASK, TILOCK, and TIUNLOCK.

Referenced by tiAddSlave().

◆ tiSetClockSource()

int tiSetClockSource ( unsigned int  source)

Set the clock to the specified source.

Parameters
source
  • 0: Onboard clock
  • 1: External clock (HFBR1 input)
  • 5: External clock (HFBR5 input)
Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::clock, TI_A24RegStruct::reset, TI_A24RegStruct::runningMode, TI_CLOCK_HFBR1, TI_CLOCK_HFBR5, TI_CLOCK_INTERNAL, TI_CLOCK_MASK, TI_RESET_CLK125, TI_RESET_CLK250, TI_RUNNINGMODE_DISABLE, TI_RUNNINGMODE_ENABLE, TILOCK, and TIUNLOCK.

◆ tiSetCrateID()

int tiSetCrateID ( unsigned int  crateID)

Set the crate ID.

Returns
OK if successful, ERROR otherwise

References TI_A24RegStruct::boardID, TI_BOARDID_CRATEID_MASK, tiCrateID, TILOCK, and TIUNLOCK.

◆ tiSetEventFormat()

int tiSetEventFormat ( int  format)

Set the event format.

Parameters
format- integer number indicating the event format
  • 0: 32 bit event number only
  • 1: 32 bit event number + 32 bit timestamp
  • 2: 32 bit event number + higher 16 bits of timestamp + higher 16 bits of eventnumber
  • 3: 32 bit event number + 32 bit timestamp
    • higher 16 bits of timestamp + higher 16 bits of eventnumber
Returns
OK if successful, ERROR otherwise

References TI_A24RegStruct::dataFormat, TI_DATAFORMAT_HIGHERBITS_WORD, TI_DATAFORMAT_TIMING_WORD, TILOCK, and TIUNLOCK.

◆ tiSetFiberDelay()

void tiSetFiberDelay ( unsigned int  delay,
unsigned int  offset 
)

Set the fiber delay required to align the sync and triggers for all crates.

Returns
Current fiber delay setting

References TI_A24RegStruct::fiberSyncDelay, TI_A24RegStruct::reset, TI_A24RegStruct::syncDelay, TILOCK, tiMaster, and TIUNLOCK.

◆ tiSetFPInputReadout()

int tiSetFPInputReadout ( int  enable)

Set whether or not the latched pattern of FP Inputs in block readout.

Parameters
enable
  • 0: Disable
  • >0: Enable
Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::dataFormat, TI_DATAFORMAT_FPINPUT_READOUT, TILOCK, and TIUNLOCK.

◆ tiSetInstantBlockLevelChange()

int tiSetInstantBlockLevelChange ( int  enable)

Set TS to instantly change blocklevel when broadcast is received.

Parameters
enableOption to enable or disable this feature
  • 0: Disable !0: Enable
Returns
OK if successful, ERROR otherwise

References TI_VMECONTROL_BLOCKLEVEL_UPDATE, TILOCK, TIUNLOCK, and TI_A24RegStruct::vmeControl.

◆ tiSetOutputPort()

int tiSetOutputPort ( unsigned int  set1,
unsigned int  set2,
unsigned int  set3,
unsigned int  set4 
)

Set (or unset) high level for the output ports on the front panel labelled as O#1-4.

Parameters
set1O#1
set2O#2
set3O#3
set4O#4
Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::output, TILOCK, and TIUNLOCK.

◆ tiSetPromptTriggerWidth()

int tiSetPromptTriggerWidth ( int  width)

Set the width of the prompt trigger from OT#2.

Parameters
widthOutput width will be set to (width + 2) * 4ns

This routine is only functional for Firmware type=2 (modTI)

Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::eventNumber_hi, TI_PROMPT_TRIG_WIDTH_MASK, TILOCK, and TIUNLOCK.

◆ tiSetSyncDelayWidth()

void tiSetSyncDelayWidth ( unsigned int  delay,
unsigned int  width,
int  widthstep 
)

Set the delay time and width of the Sync signal.

Parameters
delaythe delay (latency) set in units of 4ns.
widththe width set in units of 4ns.
twidthif this is non-zero, set width in units of 32ns.

References TI_A24RegStruct::syncDelay, TI_A24RegStruct::syncWidth, TI_SYNCDELAY_MASK, TI_SYNCWIDTH_LONGWIDTH_ENABLE, TI_SYNCWIDTH_MASK, TILOCK, and TIUNLOCK.

◆ tiSetSyncSource()

int tiSetSyncSource ( unsigned int  sync)

Set the Sync source mask.

Parameters
sync- MASK indicating the sync source bit: description
  • 0: P0
  • 1: HFBR1
  • 2: HFBR5
  • 3: FP
  • 4: LOOPBACK
Returns
OK if successful, ERROR otherwise

References TI_A24RegStruct::sync, TI_SYNC_SOURCEMASK, TILOCK, and TIUNLOCK.

◆ tiSetTokenOutTest()

int tiSetTokenOutTest ( int  level)

Set the level of the token out signal.

Parameters
level
  • >0: High
  • 0: Low
See also
tiSetTokenTestMode
Returns
OK if successful, otherwise ERROR

References TI_VMECONTROL_TOKENOUT_HI, TILOCK, TIUNLOCK, and TI_A24RegStruct::vmeControl.

◆ tiSetTokenTestMode()

int tiSetTokenTestMode ( int  mode)

Turn on Token out test mode.

See also
tiSetTokenOutTest
Returns
OK if successful, otherwise ERROR

References TI_VMECONTROL_TOKEN_TESTMODE, TILOCK, TIUNLOCK, and TI_A24RegStruct::vmeControl.

◆ tiSetTriggerPulse()

int tiSetTriggerPulse ( int  trigger,
int  delay,
int  width,
int  delay_step 
)

Set the characteristics of a specified trigger.

Parameters
trigger
  • 1: set for trigger 1
  • 2: set for trigger 2 (playback trigger)
delaydelay in units of delay_step
widthpulse width in units of 4ns
delay_stepstep size of the delay
  • 0: 16ns !0: 64ns (with an offset of ~4.1 us)
Returns
OK if successful, otherwise ERROR

References TI_TRIGDELAY_TRIG1_64NS_STEP, TI_TRIGDELAY_TRIG1_DELAY_MASK, TI_TRIGDELAY_TRIG1_WIDTH_MASK, TI_TRIGDELAY_TRIG2_64NS_STEP, TI_TRIGDELAY_TRIG2_DELAY_MASK, TI_TRIGDELAY_TRIG2_WIDTH_MASK, TILOCK, TIUNLOCK, and TI_A24RegStruct::trigDelay.

◆ tiSetTriggerSource()

int tiSetTriggerSource ( int  trig)

Set the trigger source This routine will set a library variable to be set in the TI registers at a call to tiIntEnable.

Parameters
trig- integer indicating the trigger source
  • 0: P0
  • 1: HFBR#1
  • 2: Front Panel (TRG)
  • 3: Front Panel TS Inputs
  • 4: TS (rev2)
  • 5: Random
  • 6-9: TS Partition 1-4
  • 10: HFBR#5
  • 11: Pulser Trig 2 then Trig1 after specified delay
Returns
OK if successful, ERROR otherwise

References TI_TRIGSRC_VME, and tiMaster.

◆ tiSetTriggerSourceMask()

int tiSetTriggerSourceMask ( int  trigmask)

Set trigger sources with specified trigmask This routine is for special use when tiSetTriggerSource(...) does not set all of the trigger sources that is required by the user.

Parameters
trigmaskbits:
  • 0: P0
  • 1: HFBR #1
  • 2: TI Master Loopback
  • 3: Front Panel (TRG) Input
  • 4: VME Trigger
  • 5: Front Panel TS Inputs
  • 6: TS (rev 2) Input
  • 7: Random Trigger
  • 8: FP/Ext/GTP
  • 9: P2 Busy
  • 10: HFBR #5
  • 11: Pulser Trig2 with delayed Trig1 (only compatible with 2 and 7)
Returns
OK if successful, ERROR otherwise

References TI_TRIGSRC_SOURCEMASK, and tiTriggerSource.

◆ tiSetTSInputDelay()

int tiSetTSInputDelay ( int  chan,
int  delay 
)

Set the input delay for the specified front panel TSinput (1-6)

Parameters
chanFront Panel TSInput Channel (1-6)
delayDelay in units of 4ns (0=8ns)
Returns
OK if successful, otherwise ERROR

References TI_A24RegStruct::fpDelay, TI_FPDELAY_MASK, TILOCK, and TIUNLOCK.

◆ tiUserSyncReset()

void tiUserSyncReset ( int  enable,
int  pflag 
)

Control level of the SyncReset signal.

See also
tiSetUserSyncResetReceive
Parameters
enable
  • >0: High
  • 0: Low
pflag
  • >0: Print status to standard out
  • 0: Supress status message

References TI_A24RegStruct::syncCommand, TI_SYNCCOMMAND_SYNCRESET_HIGH, TI_SYNCCOMMAND_SYNCRESET_LOW, TILOCK, and TIUNLOCK.