JLab fADC125 Library  1.2.1
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups
Initialization/Configuration

Modules

 Pulser Initialization/Configuration
 

Functions

int fa125Init (UINT32 addr, UINT32 addr_inc, int nadc, int iFlag)
 Initialize the fa125 Library. More...
 
int fa125Slot (unsigned int i)
 Convert an index into a slot number, where the index is the element of an array of fA125s in the order in which they were initialized. More...
 
int fa125SetProcMode (int id, int pmode, unsigned int PL, unsigned int PTW, unsigned int NSB, unsigned int NSA, unsigned int NP)
 Configure the processing type/mode. More...
 
int fa125PowerOff (int id)
 Power Off the fADC125. More...
 
int fa125PowerOn (int id)
 Power On the fADC125. More...
 
int fa125SetOffset (int id, int chan, int dacData)
 Set the DAC offset for a specific fADC125 Channel. More...
 
int fa125SetOffsetFromFile (int id, char *filename)
 Set the DAC offset for a specific fADC125 Channel from a specified file. More...
 
int fa125SetThreshold (int id, unsigned short tvalue, unsigned short chan)
 Set the readout threshold for a specific fADC125 Channel. More...
 
int fa125SetChannelDisable (int id, int channel)
 Disable a specific fADC125 Channel. More...
 
int fa125SetChannelDisableMask (int id, unsigned int cmask0, unsigned int cmask1, unsigned int cmask2)
 Disable specific fADC125 Channels using three separate channel masks. More...
 
int fa125SetChannelEnable (int id, int channel)
 Enable a specific fADC125 Channel. More...
 
int fa125SetChannelEnableMask (int id, unsigned int cmask0, unsigned int cmask1, unsigned int cmask2)
 Enable specific fADC125 Channels using three separate channel masks. More...
 
int fa125SetCommonThreshold (int id, unsigned short tvalue)
 Set a common readout threshold for all fADC125 Channels. More...
 
void fa125GSetCommonThreshold (unsigned short tvalue)
 Set a common readout threshold for all fADC125 Channels for all initialized modules. More...
 
int fa125SetPulserAmplitude (int id, int chan, int dacData)
 Set the output Pulser Amplitude for the specified connector. More...
 
int fa125SetClockSource (int id, int clksrc)
 Set the clock source for the specified fADC125. More...
 
int fa125SetTriggerSource (int id, int trigsrc)
 Set the trigger source for the specified fADC125. More...
 
int fa125SetSyncResetSource (int id, int srsrc)
 Set the Sync Reset source for the specified fADC125. More...
 
int fa125Enable (int id)
 Enable buffers and FIFOs for data acquisition. More...
 
int fa125Disable (int id)
 Disable buffers and FIFOs for data acquisition. More...
 
int fa125Reset (int id, int reset)
 Perform the selected Reset to a specific fADC125. More...
 
int fa125ResetCounters (int id)
 Reset all counters (trigger count, clock count, sync reset count, trig2 count) More...
 
int fa125ResetToken (int id)
 Returns the token to the first module This routine only has an effect on the first module of the Multiblock setup. More...
 
int fa125SetBlocklevel (int id, int blocklevel)
 Set the number of events in the block. More...
 
int fa125SetPPG (int id, int fe_chip, unsigned short *sdata, int nsamples)
 Setup fADC125 Progammable Pulse Generator. More...
 
int fa125PPGEnable (int id)
 Enable the programmable pulse generator. More...
 
int fa125PPGDisable (int id)
 Disable the programmable pulse generator. More...
 

Detailed Description

Function Documentation

int fa125Disable ( int  id)

Disable buffers and FIFOs for data acquisition.

Parameters
idSlot number
Returns
OK if successful, otherwise ERROR.

References FA125_FE_TEST_COLLECT_ON, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125Enable ( int  id)

Enable buffers and FIFOs for data acquisition.

Parameters
idSlot number
Returns
OK if successful, otherwise ERROR.

References FA125_FE_TEST_COLLECT_ON, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

void fa125GSetCommonThreshold ( unsigned short  tvalue)

Set a common readout threshold for all fADC125 Channels for all initialized modules.

Parameters
tvalueThreshold Value
Returns
OK if successful, otherwise ERROR.

References fa125SetCommonThreshold(), fa125Slot(), and nfa125.

int fa125Init ( UINT32  addr,
UINT32  addr_inc,
int  nadc,
int  iFlag 
)

Initialize the fa125 Library.

Parameters
addr
  • A24 VME Address of the fADC125
addr_inc
  • Amount to increment addr to find the next fADC125
nadc
  • Number of times to increment
iFlag17 bit integer
      Low 6 bits - Specifies the default Signal distribution (clock,trigger) 
                   sources for the board (Internal, FrontPanel, VXS, VME(Soft))
      bit    0:  defines Sync Reset source
                0  VXS (P0)
                1  VME (software)
      bits 2-1:  defines Trigger source
          (0) 0 0  VXS (P0)
          (1) 0 1  Internal Timer
          (2) 1 0  Internal Multiplicity Sum
          (3) 1 1  P2 Connector (Backplane)
      bit    3:  NOT USED WITH THIS FIRMWARE VERSION
      bits 5-4:  defines Clock Source
          (0) 0 0  P2 Connector (Backplane)
          (1) 0 1  VXS (P0)
          (2) 1 0  Internal 125MHz Clock
      bit   16:  Exit before board initialization (just map structure pointer)
                0: Initialize fa125(s)
                1: Skip initialization
      bit   17:  Use fa125AddrList instead of addr and addr_inc
                 for VME addresses.
                0: Initialize with addr and addr_inc
                1: Use fa125AddrList 
      bit   18:  Skip firmware check.  Useful for firmware updating.
                0: Perform firmware check
                :1 Skip firmware check
Returns
OK, or ERROR if the address is invalid or a board is not present.

References FA125_ADR32_ENABLE, FA125_ADRMB_ENABLE, FA125_CTRL1_ENABLE_BERR, FA125_CTRL1_ENABLE_MULTIBLOCK, FA125_CTRL1_FIRST_BOARD, FA125_CTRL1_LAST_BOARD, FA125_FE_SUPPORTED_FIRMWARE, FA125_ID, FA125_INIT_SKIP, FA125_INIT_SKIP_FIRMWARE_CHECK, FA125_INIT_USE_ADDRLIST, FA125_MAIN_SUPPORTED_FIRMWARE, FA125_MAX_A32_MEM, FA125_MAX_A32MB_SIZE, FA125_PROC_SUPPORTED_FIRMWARE, fa125A24Offset, fa125A32Base, fa125A32Offset, fa125AddrList, fa125Clear(), fa125ID, fa125MaxSlot, fa125MinSlot, fa125p, fa125pd, FA125pmb, fa125SetClockSource(), fa125SetSyncResetSource(), fa125SetTriggerSource(), fa125TriggerSource, fa125_a24::fe, fa125_a24_main::id, fa125_a24::main, nfa125, fa125_a24::proc, fa125_a24_main::slot_ga, fa125_a24_main::version, fa125_a24_fe::version, and fa125_a24_proc::version.

int fa125PowerOff ( int  id)

Power Off the fADC125.

Parameters
idSlot number
Returns
OK if successful, otherwise ERROR.

References fa125ID, FA125LOCK, fa125p, FA125UNLOCK, fa125_a24_main::id, fa125_a24::main, and fa125_a24_main::pwrctl.

int fa125PowerOn ( int  id)

Power On the fADC125.

Parameters
idSlot number
Returns
OK if successful, otherwise ERROR.

References FA125_PWRCTL_KEY_ON, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, fa125_a24_main::id, fa125_a24::main, and fa125_a24_main::pwrctl.

int fa125PPGDisable ( int  id)

Disable the programmable pulse generator.

Parameters
idSlot number
See Also
fa125SetPPG fa125PPGEnable
Returns
OK if successful, otherwise ERROR.

References FA125_FE_CONFIG1_PLAYBACK_ENABLE, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125PPGEnable ( int  id)

Enable the programmable pulse generator.

Parameters
idSlot number
See Also
fa125SetPPG fa125PPGDisable
Returns
OK if successful, otherwise ERROR.

References FA125_FE_CONFIG1_PLAYBACK_ENABLE, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125Reset ( int  id,
int  reset 
)

Perform the selected Reset to a specific fADC125.

Parameters
idSlot number
resetType of reset to perform
  • 0: Soft Reset - Reset of all state machines and FIFOs. Register values will remain.
  • 1: Hard Reset - Soft reset + reset of all register values.
Returns
OK if successful, otherwise ERROR.

References fa125_a24_main::blockCSR, FA125_BLOCKCSR_PULSE_HARD_RESET, FA125_BLOCKCSR_PULSE_SOFT_RESET, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::main.

int fa125ResetCounters ( int  id)

Reset all counters (trigger count, clock count, sync reset count, trig2 count)

Parameters
idSlot number
Returns
OK if successful, otherwise ERROR.

References fa125_a24_proc::clock125_count, FA125_PROC_CLOCK125COUNT_RESET, FA125_PROC_SYNCCOUNT_RESET, FA125_PROC_TRIG2COUNT_RESET, FA125_PROC_TRIGCOUNT_RESET, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, fa125_a24::proc, fa125_a24_proc::sync_count, fa125_a24_proc::trig2_count, and fa125_a24_proc::trig_count.

int fa125ResetToken ( int  id)

Returns the token to the first module This routine only has an effect on the first module of the Multiblock setup.

Parameters
idSlot number
Returns
OK if successful, otherwise ERROR.

References fa125_a24_main::blockCSR, FA125_BLOCKCSR_TAKE_TOKEN, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::main.

int fa125SetBlocklevel ( int  id,
int  blocklevel 
)

Set the number of events in the block.

Parameters
idSlot number
blocklevelNumber of events per block
Returns
OK if successful, otherwise ERROR.

References fa125_a24_proc::blocklevel, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::proc.

int fa125SetChannelDisable ( int  id,
int  channel 
)

Disable a specific fADC125 Channel.

Parameters
idSlot number
chanChannel Number
Returns
OK if successful, otherwise ERROR.

References FA125_FE_CONFIG2_CH_MASK, FA125_MAX_ADC_CHANNELS, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125SetChannelDisableMask ( int  id,
unsigned int  cmask0,
unsigned int  cmask1,
unsigned int  cmask2 
)

Disable specific fADC125 Channels using three separate channel masks.

Parameters
idSlot number
cmask0Disable channel mask for channels 0-23
cmask1Disable channel mask for channels 24-47
cmask2Disable channel mask for channels 48-71
Returns
OK if successful, otherwise ERROR.

References FA125_FE_CONFIG2_CH_MASK, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125SetChannelEnable ( int  id,
int  channel 
)

Enable a specific fADC125 Channel.

Parameters
idSlot number
chanChannel Number
Returns
OK if successful, otherwise ERROR.

References FA125_FE_CONFIG2_CH_MASK, FA125_MAX_ADC_CHANNELS, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125SetChannelEnableMask ( int  id,
unsigned int  cmask0,
unsigned int  cmask1,
unsigned int  cmask2 
)

Enable specific fADC125 Channels using three separate channel masks.

Parameters
idSlot number
cmask0Enable channel mask for channels 0-23
cmask1Enable channel mask for channels 24-47
cmask2Enable channel mask for channels 48-71
Returns
OK if successful, otherwise ERROR.

References FA125_FE_CONFIG2_CH_MASK, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125SetClockSource ( int  id,
int  clksrc 
)

Set the clock source for the specified fADC125.

Parameters
idSlot number
clksrcDefines Clock Source 0 P2 Clock 1 VXS (P0) 2 Internal 125MHz Clock
Returns
OK if successful, otherwise ERROR.

References fa125_a24_main::clock, FA125_CLOCK_INTERNAL, FA125_CLOCK_P0, FA125_CLOCK_P2, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::main.

Referenced by fa125Init().

int fa125SetCommonThreshold ( int  id,
unsigned short  tvalue 
)

Set a common readout threshold for all fADC125 Channels.

Parameters
idSlot number
tvalueThreshold Value
Returns
OK if successful, otherwise ERROR.

References FA125_MAX_ADC_CHANNELS, and fa125SetThreshold().

Referenced by fa125GSetCommonThreshold().

int fa125SetOffset ( int  id,
int  chan,
int  dacData 
)

Set the DAC offset for a specific fADC125 Channel.

Parameters
idSlot number
chanChannel Number
dacDataDAC value to set
Returns
OK if successful, otherwise ERROR.

References fa125ID, and fa125p.

Referenced by fa125SetOffsetFromFile().

int fa125SetOffsetFromFile ( int  id,
char *  filename 
)

Set the DAC offset for a specific fADC125 Channel from a specified file.

Parameters
idSlot number
filenameName of file from which to read DAC offsets Format must be of the type: dac0 dac1 dac2 ... dac71
Returns
OK if successful, otherwise ERROR.

References fa125ID, fa125p, and fa125SetOffset().

int fa125SetPPG ( int  id,
int  fe_chip,
unsigned short *  sdata,
int  nsamples 
)

Setup fADC125 Progammable Pulse Generator.

Parameters
idSlot number
fe_chipFront End FPGA to write to
sdataArray of sample data to be programmed
nsamplesNumber of samples contained in sdata
See Also
fa125PPGEnable fa125PPGDisable
Returns
OK if successful, otherwise ERROR.

References FA125_FE_TEST_WAVEFORM_PPG_DATA_MASK, FA125_FE_TEST_WAVEFORM_WRITE_PPG_DATA, FA125_PPG_MAX_SAMPLES, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125SetProcMode ( int  id,
int  pmode,
unsigned int  PL,
unsigned int  PTW,
unsigned int  NSB,
unsigned int  NSA,
unsigned int  NP 
)

Configure the processing type/mode.

Parameters
idSlot number
pmodeProcessing Mode
  • 1 - Raw Window
  • 2 - Pulse Raw Window (not supported)
  • 3 - Pulse Integral (not supported)
  • 4 - High-resolution time (not supported)
  • 7 - Mode 3 + Mode 4 (not supported)
  • 8 - Mode 1 + Mode 4 (not supported)
PLWindow Latency
PTWWindow Width
NSBNumber of samples before pulse over threshold
NSANumber of samples after pulse over threshold
NPNumber of pulses processed per window

Note:

  • PL must be greater than PTW
  • NSA+NSB must be an odd number
Returns
OK if successful, otherwise ERROR.

References FA125_DEFAULT_NP, FA125_DEFAULT_NSA, FA125_DEFAULT_NSB, FA125_DEFAULT_PL, FA125_DEFAULT_PTW, FA125_FE_CONFIG1_ENABLE, FA125_MAX_NSA, FA125_MAX_NSB, FA125_MAX_PL, FA125_MAX_PTW, FA125_PROC_MODE_RAWWINDOW, FA125_SUPPORTED_MODES, FA125_SUPPORTED_NMODES, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

int fa125SetPulserAmplitude ( int  id,
int  chan,
int  dacData 
)

Set the output Pulser Amplitude for the specified connector.

Parameters
idSlot number
chanConnector number (0-2)
dacDataPulser Amplitude.
Returns
OK if successful, otherwise ERROR.

References fa125ID, and fa125p.

int fa125SetSyncResetSource ( int  id,
int  srsrc 
)

Set the Sync Reset source for the specified fADC125.

Parameters
idSlot number
srsrcSync Reset source
  • 0: Software (VME)
  • 1: P0 (VXS)
Returns
OK if successful, otherwise ERROR.

References fa125_a24_proc::ctrl2, FA125_FE_TEST_SYNCRESET_ENABLE, FA125_PROC_CTRL2_SYNCRESET_P0, FA125_PROC_CTRL2_SYNCRESET_SOURCE_MASK, FA125_PROC_CTRL2_SYNCRESET_VME, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, fa125_a24::fe, and fa125_a24::proc.

Referenced by fa125Init().

int fa125SetThreshold ( int  id,
unsigned short  tvalue,
unsigned short  chan 
)

Set the readout threshold for a specific fADC125 Channel.

Parameters
idSlot number
tvalueThreshold Value
chanChannel Number
Returns
OK if successful, otherwise ERROR.

References FA125_FE_THRESHOLD_MASK, FA125_MAX_ADC_CHANNELS, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, and fa125_a24::fe.

Referenced by fa125SetCommonThreshold().

int fa125SetTriggerSource ( int  id,
int  trigsrc 
)

Set the trigger source for the specified fADC125.

Parameters
idSlot number
trigsrcDefines Trigger Source 0 P0 (VXS) 1 Software (VME) 2 Internal Sum 3 P2
Returns
OK if successful, otherwise ERROR.

References FA125_TRIGSRC_TRIGGER_INTERNAL_SUM, FA125_TRIGSRC_TRIGGER_P0, FA125_TRIGSRC_TRIGGER_P2, FA125_TRIGSRC_TRIGGER_SOFTWARE, fa125ID, FA125LOCK, fa125p, FA125UNLOCK, fa125_a24::proc, and fa125_a24_proc::trigsrc.

Referenced by fa125Init().

int fa125Slot ( unsigned int  i)

Convert an index into a slot number, where the index is the element of an array of fA125s in the order in which they were initialized.

Parameters
iInitialization number
Returns
Slot number if Successfull, otherwise ERROR.

References fa125ID, and nfa125.

Referenced by fa125FirmwareGCheckErrors(), fa125FirmwareGEraseFull(), fa125FirmwareGVerifyFull(), fa125FirmwareGWriteFull(), fa125GetTokenMask(), fa125GSetCommonThreshold(), and fa125GStatus().