GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FES / V6-5-0 > fes_ux / rhel4-32


Interface   Data Structures   File List   Data Fields   Globals  

fesXctl.c File Reference

Routines for external control of the Front End Simulator. More...

#include <fesXctl.h>
#include <fesXctlP.h>
#include <fesConfig.h>
#include <fesMsgs.h>
#include <fesParm.h>
#include <fesText.h>
#include <fesUtil.h>
#include <EMSG/EMSG_pubdefs.h>
#include <NMSG/nmsgLib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>

Functions

int fesXctlInit (const char *cFile)
 Initialize the control client.
int fesXctlLogDisp (int first, int nLine, int pSize)
 Display the contents of the message log file.
int fesXctlRunInit (const char *file, long long bMask, int intvl, int expn, int oneShot, int reptCt, int distr, int skipCt, int procCt, int evNmbr, int evGamma, int calStrbe, int acdPath)
 Initialize a run.
int fesXctlRunStart (int mode)
 Start a run.
int fesXctlRunPause (void)
 Pause a run.
int fesXctlRunTerm (void)
 Terminate a run.
int fesXctlRunStatShow (int allUnits, int allSides, int percent, int remote)
 Show run status.
int fesXctlPpsWait (int timeout)
 Wait for next PPS interrupt.


Detailed Description

Routines for external control of the Front End Simulator.

Author:
Owen H Saxton
$Id: fesXctl.c,v 1.13 2010/08/19 23:27:53 saxton Exp $

Function Documentation

int fesXctlInit ( const char *  cFile  ) 

Initialize the control client.

This routine initializes the control client software.

Parameters:
cFile The address of the name of the FES configuration file to use. If NULL, the default is used.
Return values:
FES_SUCCESS The client was initialized successfully.
FES_NOCONFIG Unable to open configuration file.
FES_CONFGERR Error parsing configuration file.
FES_NOCONTRL No control node in system.

References fesConfigCtlIndexGet(), fesConfigInit(), and fesConfigNodeGet().

int fesXctlLogDisp ( int  first,
int  nLine,
int  pSize 
)

Display the contents of the message log file.

This routine reads the message log file and displays its contents, starting from a specified line.

Parameters:
first The first line to display, numbering from 0. If negative, counts backwards from the end of the file.
nLine The number of lines to display. If not positive, all lines up to the end of the file are displayed.
pSize The page size to use. This is the number of lines to display at a time before pausing to prompt for the next page. If zero, the default value of 24 is used. If negative, the output is not paused.
Returns:
Always 0.

References fesTextDisp().

int fesXctlPpsWait ( int  timeout  ) 

Wait for next PPS interrupt.

This routine waits until the next PPS interrupt occurs.

Parameters:
timeout The maximum time (seconds) to wait for an interrupt. If not positive, the value 1 is used.
Return values:
FES_SUCCESS Success.
FES_CANTCONN Cannot connect to control node.
FES_EMSGSEND Error sending network message.
FES_EREMOTE An error occurred remotely.

int fesXctlRunInit ( const char *  file,
long long  bMask,
int  intvl,
int  expn,
int  oneShot,
int  reptCt,
int  distr,
int  skipCt,
int  procCt,
int  evNmbr,
int  evGamma,
int  calStrbe,
int  acdPath 
)

Initialize a run.

A run is initialized on all enabled worker nodes. This causes the nodes to read their data files and fill the FPGA memories on the boards specified in the bMask parameter. The boards are set to receive timing and run signals from the control board.

Parameters:
file The stem of the file name containing the data to be run. For each board, the full file name is obtained by prepending the name of the board's associated disk, and appending the name of the board.
bMask The 40-bit mask word specifying which boards are to participate in the run. Bits 0 - 15 select tracker boards 0 - 15; bits 16 - 31 select calorimeter boards 0 - 15; bits 32 - 39 select ACD boards 0 - 7.
intvl The time interval, in 50 ns units, between events in the run.
expn The expansion factor, used to increase the time between the transitions of an event. It multiplies each such time in the data file. The default is 1.
oneShot The value of the one-shot time, in 50 ns units, to be set in each board. This is the time that the TREQ (or VETO) outputs will remain in the on state for any transition. The default value is 0, which causes the TREQ outputs to remain on for as long as the transition lasts.
reptCt The number of times that each data file is to be read and sent to its associated board. When the final end-of-file is reached, the board is put into a quiescent state by continually sending it null transitions (i.e. transitions which assert no TREQ outputs and contain no hit data). The default value is 0, which causes the data file to be re-read indefinitely.
distr The event time distribution, which can be either constant or exponential.
skipCt The number of events to be skipped at the beginning of the file.
procCt The number of events to be processed.
evNmbr If TRUE, the unassigned ACD channels are used to supply an 11-bit event number (10-bit if evGamma is also true) for each event.
evGamma If TRUE, unassigned ACD channel 10 is used to show the gamma event flag in each event data record.
calStrbe If TRUE, the FES is to be run in calibration mode, pausing after each event, waiting for the next CALSTROBE pulse.
acdPath The ACD path to be used, specified as follows:
  • 0: primary
  • 1: redundant
Return values:
FES_SUCCESS Success.
FES_CANTCONN Cannot connect to control node.
FES_EMSGSEND Error sending network message.
FES_EREMOTE An error occurred remotely.

int fesXctlRunPause ( void   ) 

Pause a run.

The current run is paused. All the boards in the system are taken out of the run state.

Return values:
FES_SUCCESS Success.
FES_CANTCONN Cannot connect to control node.
FES_EMSGSEND Error sending network message.
FES_EREMOTE An error occurred remotely.

int fesXctlRunStart ( int  mode  ) 

Start a run.

A previously initialized run is started. Each board in the system is put into the run state, processing the data that has been loaded into its FPGA memories. TREQ lines are set according to each transition, and the corresponding data sent out if requested by the acquisition system.

Parameters:
mode A four-bit mode word which determines if, and how, the run is to be externally controlled. It consists of the logical OR of one or more of the following:
Return values:
FES_SUCCESS Success.
FES_CANTCONN Cannot connect to control node.
FES_EMSGSEND Error sending network message.
FES_EREMOTE An error occurred remotely.

int fesXctlRunStatShow ( int  allUnits,
int  allSides,
int  percent,
int  remote 
)

Show run status.

Run status information, consisting of one line for each board participating in the current run, is displayed. The information shown is only for the FPGA on side 0 of the board and includes the number of events requested, the number acknowledged, the transition memory level, the data memory level, and the run state. Problems with a board are indicated by the number of events requested not increasing at the expected rate, by the number of events acknowledged increasing too rapidly, or by any memory level falling to a very low value.

Parameters:
allUnits If TRUE, display data from all units instead of just those participating in the most recent run.
allSides If TRUE, display data from all sides of each board instead of just side 0.
percent If TRUE, display memory levels as a percentage of the maximum value, instead of the actual value.
remote If TRUE, display the information on the console of the remote server machine.
Returns:
Always 0.

References fesRunStat_s::dMemLvl0, fesRunStat_s::dMemLvl1, fesRunStat_s::evtAck0, fesRunStat_s::evtAck1, fesRunStat_s::evtReq, fesConfigNameGet(), fesConfigTypeGet(), fesRunStat_s::index, fesRunStat_s::running, fesRunStat_s::side, and fesRunStat_s::tMemLvl.

int fesXctlRunTerm ( void   ) 

Terminate a run.

The current run is immediately terminated. All boards in the system are taken out of the run state, the input data files are closed, and the tasks sending data to the boards' FPGA memories are terminated.

Return values:
FES_SUCCESS Success.
FES_CANTCONN Cannot connect to control node.
FES_EMSGSEND Error sending network message.
FES_EREMOTE An error occurred remotely.


Generated on Sat Apr 9 19:57:47 2011 by  doxygen 1.5.8