GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCI / V6-1-0 > lci / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

Functions
configure.c File Reference

Routines that manipulate the configuration structure and the associated data file. More...

#include <configure_p.h>
#include <lci_p.h>
#include <LCI/LCI_msgs.h>
#include <LCFG/LCFG.h>
#include <LSEC/LSEC_ctx.h>
#include <LSEC/LSEC.h>
#include <FBS/FBS_pubrtos.h>
#include <LEM/msg_macros.h>
#include <LEM/defs.h>
#include <LEM/encode.h>
#include <LEM/decode.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/BSWP.h>
#include <PBS/MBA.h>
#include <PBS/TASK.h>
#include <PBS/TOV.h>
#include <PBS/WCT.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>

Functions

unsigned LCI_confBufferModel (unsigned select, LEM_micr *cr, unsigned *mods)
 Set the TEM buffer model.
unsigned LCI_confCache (LCI_configuration *cnf, unsigned latc_fid)
 Read in the LATC files.
unsigned LCI_confClose (LCI_configuration *cnf)
 Close the file that acts as the source of the configuration.
void LCI_confCopy (LCI_configuration *cnfIn, LCI_configuration *cnfOut)
 Copy a configuration.
LCI_configurationLCI_confCreate (LSEC_control *lsec)
 Create a new configuration structure.
void LCI_confDelete (LCI_configuration *cnf)
 Free memory previously allocated with a call to LCI_confCreate.
unsigned LCI_configure (LCI_configuration *cnf, LEM_micr *cr, unsigned runId)
 Load the configuration onto the LAT.
unsigned LCI_confMode (LCI_configuration *cnf)
 Return the configuration type.
void LCI_confNodeId (LCI_configuration *cnf, unsigned siu_id)
 Set the destination address to be used in the TAM configuration.
unsigned LCI_confOpen (LCI_configuration *cnf, const char *fn)
 Open the file and associate it with this configuration structure.
unsigned LCI_confOpenFid (LCI_configuration *cnf, unsigned fid)
 Open the file and associate it with this configuration structure.
unsigned LCI_confPeriod (LCI_configuration *cnf)
 Return the period between triggers.
unsigned LCI_confRead (LCI_configuration *cnf)
 Get the values for the next step of the configuration.
void LCI_confReport (LCI_configuration *cnf, FILE *fp)
 Produce a formatted report of the contents of a binary configuration.
void LCI_confTimes (LCI_configuration *cnf, int clear, long long *lci_time, long long *lat_time)
 Return accumulated configuration times.
unsigned LCI_confTriggers (LCI_configuration *cnf)
 Return the number of triggers required.

Detailed Description

Routines that manipulate the configuration structure and the associated data file.

Author:
James Swain & Owen Saxton

$Id: configure.c,v 1.30 2014/02/12 21:41:42 saxton Exp $


Function Documentation

unsigned LCI_confBufferModel ( unsigned  select,
LEM_micr *  cr,
unsigned *  mods 
)

Set the TEM buffer model.

This routine sets the value of the buffer model select bit in the TEM CONFIGURATION register, necessary because the calibration requires non-standard single buffering. It optionally also returns the operational state of the various data acquisition modules (TEMs, GEM and AEM), needed for event data checking.

Parameters:
selectZero to select the multi buffer model, non-zero to select the single buffer model
crPointer to the multi-item command/response list.
modsPointer to an integer to receive the bit mask of operational acquisition modules, or NULL if this information is not required.
Return values:
LCI_SUCCESSSuccess
LCI_TEMCRThe command and response masks don't have the same TEMs present
LEM_*If there was an error reading or loading one of the registers

Referenced by LCI_calibrate(), and LCI_terminate().

unsigned LCI_confCache ( LCI_configuration cnf,
unsigned  latc_fid 
)

Read in the LATC files.

Parameters:
cnfPointer to an initialised configuration structure
latc_fidID of the LATC configuration to cache
Return values:
LCI_SUCCESSif all goes well
LCFG_BADFOPENif the fid, or any of the names the LAT configuration master file contains, does not match a valid file.
LCFG_BADTYPEif the LATC file contains a bad type identifier
LCFG_BADREADif an error occurs whilst the file is being read

References _LCI_configuration::latc, and _LCI_configuration::rld.

Referenced by LCI_calibrate().

unsigned LCI_confClose ( LCI_configuration cnf)

Close the file that acts as the source of the configuration.

Parameters:
cnfPointer to an opened configuration
Return values:
LCI_SUCCESSIf the file closes successfully
LCI_FCLOSEIf there is an error closing the file

References _LCI_configuration::fd.

Referenced by LCI_terminate().

void LCI_confCopy ( LCI_configuration cnfIn,
LCI_configuration cnfOut 
)

Copy a configuration.

Parameters:
cnfInThe configuration structure to be copied from
cnfOutThe configuration structure to be copied to
LCI_configuration* LCI_confCreate ( LSEC_control *  lsec)

Create a new configuration structure.

Parameters:
lsecThe LSEC handle.
Returns:
Pointer to an allocated, initialised configuration structure

References _LCI_configuration::lsec.

Referenced by LCI_newController().

void LCI_confDelete ( LCI_configuration cnf)

Free memory previously allocated with a call to LCI_confCreate.

Parameters:
cnfA configuration structure created by a call to LCI_confCreate

Referenced by LCI_deleteController().

unsigned LCI_configure ( LCI_configuration cnf,
LEM_micr *  cr,
unsigned  runId 
)

Load the configuration onto the LAT.

Parameters:
cnfPointer to a populated configuration structure
crPointer to the common configuration multi-item command response list
runIdThe current run ID.
Returns:
LCI_SUCCESS if all goes well, or one of the LEM errors if there is a problem loading the configuration onto the LAT

References LCI_cnfValues::acd, LCI_cnfValues::cal, LCI_gemInput::delay, LCI_cnfInput::gem, _LCI_configuration::inp, _LCI_configuration::lat_time, LCI_gemInput::latcDelay, _LCI_configuration::lci_time, LCI_version::mode, _LCI_configuration::rld, _LCI_configuration::siu_id, LCI_cnfValues::tkr, _LCI_configuration::val, and _LCI_configuration::ver.

unsigned LCI_confMode ( LCI_configuration cnf)

Return the configuration type.

Parameters:
cnfPointer to the configuration structure
Returns:
One of LSEC_MODE_XXX

References LCI_version::mode, and _LCI_configuration::ver.

Referenced by LCI_calibrate().

void LCI_confNodeId ( LCI_configuration cnf,
unsigned  siu_id 
)

Set the destination address to be used in the TAM configuration.

Parameters:
cnfPointer to the configuration structure
siu_idLATp address of the node that the events will be collected on

References _LCI_configuration::siu_id.

Referenced by LCI_calibrate().

unsigned LCI_confOpen ( LCI_configuration cnf,
const char *  fn 
)

Open the file and associate it with this configuration structure.

Parameters:
cnfPointer to an initialised configuration structure
fnName of file to open
Return values:
LCI_SUCCESSif the file opens successfully
LCI_FOPENif the file failed to open successfully
LCI_FREADif there is an error recovering the version information (including file too short).
LCI_VERSIONif the file version information is bad (unknown type, major version mismatch, minor version decrease).

References LCI_cnfInput::acd, LCI_cnfValues::acd, LCI_cnfInput::cal, LCI_cnfValues::cal, _LCI_configuration::fd, LCI_cnfInput::gem, _LCI_configuration::inp, _LCI_configuration::lci, LCI_version::maj, LCI_version::min, LCI_version::mode, _LCI_configuration::rld, LCI_cnfInput::tkr, LCI_cnfValues::tkr, _LCI_configuration::val, and _LCI_configuration::ver.

Referenced by LCI_confOpenFid().

unsigned LCI_confOpenFid ( LCI_configuration cnf,
unsigned  fid 
)

Open the file and associate it with this configuration structure.

Parameters:
cnfPointer to an initialised configuration structure
fidThe ID of the file to open
Return values:
LCI_SUCCESSif the file opens successfully
LCI_FOPENif the file failed to open successfully
LCI_FREADif there is an error recovering the version information (including file too short).
LCI_VERSIONif the file version information is bad (unknown type, major version mismatch, minor version decrease).

References _LCI_configuration::lci, and LCI_confOpen().

Referenced by LCI_calibrate().

unsigned LCI_confPeriod ( LCI_configuration cnf)

Return the period between triggers.

Parameters:
cnfPointer to an initialised, populated configuration structure
Returns:
The period between triggers (in 50ns clock ticks)

References LCI_cnfInput::gem, _LCI_configuration::inp, and LCI_gemInput::period.

unsigned LCI_confRead ( LCI_configuration cnf)

Get the values for the next step of the configuration.

Parameters:
cnfPointer to an opened configuration
Return values:
LCI_SUCCESSif a configuration was read successfully
LCI_ENDOFILEif there are no more configurations in the file (returned, but not reported).
LCI_FREADif there is an error during the read or the configuration is incomplete

References LCI_version::mode, and _LCI_configuration::ver.

void LCI_confReport ( LCI_configuration cnf,
FILE *  fp 
)

Produce a formatted report of the contents of a binary configuration.

Parameters:
cnfPointer to the configuration structure to output
fpPointer to file to print report

References LCI_version::maj, LCI_version::min, LCI_version::mode, and _LCI_configuration::ver.

void LCI_confTimes ( LCI_configuration cnf,
int  clear,
long long *  lci_time,
long long *  lat_time 
)

Return accumulated configuration times.

Parameters:
cnfPointer to an initialised, populated configuration structure.
clearIf TRUE, clear the times after copying them.
lci_timeAddress of a variable to receive the accumulated time taken to do LCI configurations or NULL if the time is not wanted.
lat_timeAddress of a variable to receive the accumulated time taken to do any LAT configurations or NULL if the time is not wanted.

References _LCI_configuration::lat_time, and _LCI_configuration::lci_time.

Referenced by LCI_calibrate().

unsigned LCI_confTriggers ( LCI_configuration cnf)

Return the number of triggers required.

Parameters:
cnfPointer to an initialised, populated configuration structure
Returns:
Number of triggers to request for this configuration

References LCI_cnfInput::gem, _LCI_configuration::inp, and LCI_gemInput::nev.