JLab fADC250-V2 Library  0x42
Data Readout

Functions

int faReadBlock (int id, volatile UINT32 *data, int nwrds, int rflag)
 General Data readout routine. More...
 
int faReadBlockStatus (int id, volatile UINT32 *data, int nwrds, int rflag)
 For asychronous calls to faReadBlock, this routine completes the block transfer. More...
 
int faPrintBlock (int id, int rflag)
 Print the current available block to standard out. More...
 
void faTrig (int id)
 Pulse a software trigger to the module. More...
 
void faGTrig ()
 Pulse a software trigger to all initialized fADC250s. More...
 
void faTrig2 (int id)
 Pulse a software playback trigger to the module. More...
 
void faGTrig2 ()
 Pulse a software playback trigger to all initialized fADC250s. More...
 
int faDready (int id, int dflag)
 Return Event/Block count. More...
 
int faBready (int id)
 Return a Block Ready status. More...
 
unsigned int faGBready ()
 Return a Block Ready status mask for all initialized fADC250s. More...
 
unsigned int faGBlockReady (unsigned int slotmask, int nloop)
 Return a Block Ready status mask for fADCs indicated in supplied slotmask. More...
 
int faProcPedConfig (int id, int nsamples, int maxvalue)
 Configure pedestal parameters to be used by processing algorythm. More...
 
int faGProcPedConfig (int nsamples, int maxvalue)
 Configure pedestal parameters to be used by processing algorythm for all initialized modules. More...
 
int faSampleConfig (int id, int nsamples, int maxvalue)
 Configure output of sample data from . More...
 
int faGSampleConfig (int nsamples, int maxvalue)
 Configure output of sample data from for all initialized modules. More...
 
int faReadAllChannelSamples (int id, volatile unsigned int *data)
 Read the current sample data from the specified channel and module. More...
 
int faReadScalers (int id, volatile unsigned int *data, unsigned int chmask, int rflag)
 Scaler Data readout routine. More...
 
int faPrintScalers (int id, int rflag)
 Scaler Print Out routine. More...
 
int faHistoryBufferDReady (int id)
 Return whether or not the history buffer has been triggered. More...
 
int faReadHistoryBuffer (int id, volatile unsigned int *data, int nwrds)
 Read out history buffer from the module. More...
 

Detailed Description

Function Documentation

◆ faBready()

int faBready ( int  id)

Return a Block Ready status.

Parameters
idSlot number
Returns
1 if block is ready for readout, 0 if not, otherwise ERROR.

References fadc_struct::csr, FA_CSR_BLOCK_READY, fadcID, FALOCK, FAp, and FAUNLOCK.

◆ faDready()

int faDready ( int  id,
int  dflag 
)

Return Event/Block count.

Parameters
idSlot number
dflag
  • 0: Event Count
  • >0: Block count
Returns
OK if successful, otherwise ERROR.

References fadc_struct::blk_count, fadc_struct::ev_count, FA_BLOCK_COUNT_MASK, FA_EVENT_COUNT_MASK, fadcID, FALOCK, FAp, and FAUNLOCK.

◆ faGBlockReady()

unsigned int faGBlockReady ( unsigned int  slotmask,
int  nloop 
)

Return a Block Ready status mask for fADCs indicated in supplied slotmask.

Parameters
slotmaskSlotmask Slotmask of fADCs to check for block ready
nloopNumber of times to iterate through slotmask.
Returns
block ready mask, otherwise ERROR.

References fadc_struct::csr, FA_CSR_BLOCK_READY, fadcID, FALOCK, FAp, and FAUNLOCK.

◆ faGBready()

unsigned int faGBready ( )

Return a Block Ready status mask for all initialized fADC250s.

Returns
block ready mask, otherwise ERROR.

References fadc_struct::csr, FA_CSR_BLOCK_READY, fadcID, FALOCK, FAp, FAUNLOCK, and nfadc.

◆ faGProcPedConfig()

int faGProcPedConfig ( int  nsamples,
int  maxvalue 
)

Configure pedestal parameters to be used by processing algorythm for all initialized modules.

Parameters
nsamplesNumber of samples to contribute to sum
maxvalueMaximum sample value to be included in the sum
Returns
OK if successful, otherwise ERROR.

References faProcPedConfig(), faSlot(), and nfadc.

◆ faGSampleConfig()

int faGSampleConfig ( int  nsamples,
int  maxvalue 
)

Configure output of sample data from for all initialized modules.

Parameters
nsamplesNumber of samples to contribute to sum
maxvalueMaximum sample value to be included in the sum
Returns
OK if successful, otherwise ERROR.

References faSampleConfig(), faSlot(), and nfadc.

◆ faGTrig()

void faGTrig ( )

Pulse a software trigger to all initialized fADC250s.

References fadcID, faTrig(), and nfadc.

◆ faGTrig2()

void faGTrig2 ( )

Pulse a software playback trigger to all initialized fADC250s.

References fadcID, faTrig2(), and nfadc.

◆ faHistoryBufferDReady()

int faHistoryBufferDReady ( int  id)

Return whether or not the history buffer has been triggered.

Parameters
idSlot number
Returns
1 if history buffer data is ready for readout, 0 if not, otherwise ERROR.

References FA_SUM_THRESHOLD_DREADY, fadcID, FALOCK, FAp, FAUNLOCK, and fadc_struct::sum_threshold.

◆ faPrintBlock()

int faPrintBlock ( int  id,
int  rflag 
)

Print the current available block to standard out.

Parameters
idSlot number
rflagNot used
Returns
Number of words read if successful, otherwise ERROR.

References fadc_struct::ctrl1, fadc_struct::ev_count, FA_DATA_BLKNUM_MASK, FA_DATA_BLOCK_HEADER, FA_DATA_BLOCK_TRAILER, FA_DATA_INVALID, FA_DATA_TRIGNUM_MASK, FA_DATA_TYPE_DEFINE, FA_DATA_TYPE_MASK, FA_ENABLE_BERR, FA_EVENT_COUNT_MASK, faDataDecode(), fadcID, FALOCK, FAp, FApd, and FAUNLOCK.

◆ faPrintScalers()

int faPrintScalers ( int  id,
int  rflag 
)

Scaler Print Out routine.

Print out the scalers as well as the timer counter.

Parameters
idSlot number
rflag- Printout Flag
  • bit 0: Latch Scalers before read
  • bit 1: Clear Scalers after read
Returns
OK if successful, otherwise ERROR.

References FA_SCALER_CTRL_ENABLE, FA_SCALER_CTRL_LATCH, FA_SCALER_CTRL_MASK, FA_SCALER_CTRL_RESET, fadcID, FALOCK, FAp, FAUNLOCK, fadc_struct::scaler, fadc_struct::scaler_ctrl, and fadc_struct::time_count.

◆ faProcPedConfig()

int faProcPedConfig ( int  id,
int  nsamples,
int  maxvalue 
)

Configure pedestal parameters to be used by processing algorythm.

Parameters
idSlot number
nsamplesNumber of samples to contribute to sum
maxvalueMaximum sample value to be included in the sum
Returns
OK if successful, otherwise ERROR.

References fadc_struct::config7, FA_ADC_MAX_NPED, FA_ADC_MIN_NPED, fadcID, FALOCK, FAp, and FAUNLOCK.

Referenced by faGProcPedConfig().

◆ faReadAllChannelSamples()

int faReadAllChannelSamples ( int  id,
volatile unsigned int *  data 
)

Read the current sample data from the specified channel and module.

Parameters
idSlot number
datalocal memory address to place data
  • Least significant 16bits contain lesser channel number data
Returns
Number of words stored in data if successful, otherwise ERROR.

References fadc_struct::adc_config, fadc_struct::adc_status, FA_ADC_CONFIG0_CHAN_READ_ENABLE, FA_ADC_STATUS2_CHAN_DATA_MASK, FA_MAX_ADC_CHANNELS, fadcID, FALOCK, FAp, and FAUNLOCK.

◆ faReadBlock()

int faReadBlock ( int  id,
volatile UINT32 *  data,
int  nwrds,
int  rflag 
)

General Data readout routine.

Parameters
idSlot number of module to read
datalocal memory address to place data
nwrdsMax number of words to transfer
rflagReadout Flag
             0 - programmed I/O from the specified board
             1 - DMA transfer using Universe/Tempe DMA Engine 
                   (DMA VME transfer Mode must be setup prior)
             2 - Multiblock DMA transfer (Multiblock must be enabled
                    and daisychain in place or SD being used)
Returns
Number of words inserted into data if successful. Otherwise ERROR.

References fadc_struct::csr, fadc_struct::ctrl1, fadc_struct::ev_count, FA_BLOCKERROR_DMADONE_ERROR, FA_BLOCKERROR_NO_ERROR, FA_BLOCKERROR_TERM_ON_WORDCOUNT, FA_BLOCKERROR_UNKNOWN_BUS_ERROR, FA_BLOCKERROR_ZERO_WORD_COUNT, FA_CSR_BERR_STATUS, FA_DATA_BLKNUM_MASK, FA_DATA_BLOCK_HEADER, FA_DATA_BLOCK_TRAILER, FA_DATA_TRIGNUM_MASK, FA_DATA_TYPE_DEFINE, FA_DATA_TYPE_MASK, FA_DUMMY_DATA, FA_ENABLE_BERR, FA_EVENT_COUNT_MASK, FA_FIRST_BOARD, FA_MAX_ADC_CHANNELS, FA_MAX_DATA_PER_CHANNEL, fadcA32Offset, fadcBlockError, fadcID, fadcMaxSlot, faGetTokenStatus(), FALOCK, FAp, FApd, FApmb, and FAUNLOCK.

◆ faReadBlockStatus()

int faReadBlockStatus ( int  id,
volatile UINT32 *  data,
int  nwrds,
int  rflag 
)

For asychronous calls to faReadBlock, this routine completes the block transfer.

Parameters
idSlot number of module to read
datalocal memory address to place data
nwrdsMax number of words to transfer
rflagReadout Flag
             0 - programmed I/O from the specified board
             1 - DMA transfer using Universe/Tempe DMA Engine 
                   (DMA VME transfer Mode must be setup prior)
             2 - Multiblock DMA transfer (Multiblock must be enabled
                    and daisychain in place or SD being used)
Returns
Number of words read if successful, otherwise ERROR.

References fadc_struct::csr, FA_CSR_BERR_STATUS, FA_MAX_ADC_CHANNELS, FA_MAX_DATA_PER_CHANNEL, fadcID, fadcMaxSlot, FALOCK, FAp, and FAUNLOCK.

◆ faReadHistoryBuffer()

int faReadHistoryBuffer ( int  id,
volatile unsigned int *  data,
int  nwrds 
)

Read out history buffer from the module.

Parameters
idSlot number
datalocal memory address to place data
nwrdsMax number of words to transfer
Returns
Number of words read if successful, otherwise ERROR.

References FA_SUM_DATA_ARM_HISTORY_BUFFER, FA_SUM_DATA_SAMPLE_MASK, fadcID, FALOCK, FAp, FAUNLOCK, and fadc_struct::sum_data.

◆ faReadScalers()

int faReadScalers ( int  id,
volatile unsigned int *  data,
unsigned int  chmask,
int  rflag 
)

Scaler Data readout routine.

Readout the desired scalers (indicated by the channel mask), as well as the timer counter. The timer counter will be the last word in the "data" array.

Parameters
idSlot number
data- local memory address to place data
chmask- Channel Mask (indicating which channels to read)
rflag- Readout Flag
  • bit 0: Latch Scalers before read
  • bit 1: Clear Scalers after read
Returns
OK if successful, otherwise ERROR.

References FA_SCALER_CTRL_ENABLE, FA_SCALER_CTRL_LATCH, FA_SCALER_CTRL_MASK, FA_SCALER_CTRL_RESET, fadcID, FALOCK, FAp, FAUNLOCK, fadc_struct::scaler, fadc_struct::scaler_ctrl, and fadc_struct::time_count.

◆ faSampleConfig()

int faSampleConfig ( int  id,
int  nsamples,
int  maxvalue 
)

Configure output of sample data from .

Parameters
idSlot number
nsamplesNumber of samples to contribute to sum
maxvalueMaximum sample value to be included in the sum
Returns
OK if successful, otherwise ERROR.

References fadc_struct::config6, FA_ADC_MAX_MNPED, FA_ADC_MIN_MNPED, fadcID, FALOCK, FAp, and FAUNLOCK.

Referenced by faGSampleConfig().

◆ faTrig()

void faTrig ( int  id)

Pulse a software trigger to the module.

Parameters
idSlot number

References fadc_struct::csr, fadc_struct::ctrl1, FA_CSR_TRIGGER, FA_ENABLE_SOFT_TRIG, fadcID, FALOCK, FAp, and FAUNLOCK.

Referenced by faGTrig().

◆ faTrig2()

void faTrig2 ( int  id)

Pulse a software playback trigger to the module.

Parameters
idSlot number

References fadc_struct::csr, fadc_struct::ctrl1, FA_CSR_SOFT_PULSE_TRIG2, FA_ENABLE_SOFT_TRIG, fadcID, FALOCK, FAp, and FAUNLOCK.

Referenced by faGTrig2().