GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCI / V6-0-0 > lci / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

configure.c File Reference

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

#include "LCI/LCI_msgs.h"
#include "configure_p.h"
#include "enums_p.h"
#include "macros_p.h"
#include "LATC/latc.h"
#include "LATC/lrd.h"
#include "LSEC/LSEC_ctx.h"
#include "LSEC/enums.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.
unsigned int * LCI_confConsignCtx (LCI_configuration *cnf, unsigned int *buf)
 Copy the current configuration values into the buffer.
void LCI_confCopy (LCI_configuration *cnfIn, LCI_configuration *cnfOut)
 Copy a configuration.
LCI_configurationLCI_confCreate (void)
 Allocate memory for a configuration structure and initialise (clear) it.
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_confRange (LCI_configuration *cnf)
 Return the readout range.
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.
unsigned int LCI_confSizeofCtx32 (LCI_configuration *cnf)
 Calculate the number of 32-bit words required to hold the current configuration values.
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

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:
select Zero to select the multi buffer model, non-zero to select the single buffer model
cr Pointer to the multi-item command/response list.
mods Pointer to an integer to receive the bit mask of operational acquisition modules, or NULL if this information is not required.
Return values:
LCI_SUCCESS Success
LCI_TEMCR The command and response masks don't have the same TEMs present
LEM_* If there was an error reading or loading one of the registers

unsigned LCI_confCache ( LCI_configuration cnf,
unsigned  latc_fid 
)

Read in the LATC files.

Parameters:
cnf Pointer to an initialised configuration structure
latc_fid ID of the LATC configuration to cache
Return values:
LCI_SUCCESS if all goes well
LATC_BADFOPEN if the fid, or any of the names the LAT configuration master file contains, does not match a valid file.
LATC_BADTYPE if the LATC file contains a bad type identifier
LATC_BADREAD if an error occurs whilst the file is being read

unsigned LCI_confClose ( LCI_configuration cnf  ) 

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

Parameters:
cnf Pointer to an opened configuration
Return values:
LCI_SUCCESS If the file closes successfully
LCI_FCLOSE If there is an error closing the file

unsigned int* LCI_confConsignCtx ( LCI_configuration cnf,
unsigned int *  buf 
)

Copy the current configuration values into the buffer.

Parameters:
cnf pointer to a configuration structure
buf Location to place the current configuration values
Returns:
Pointer to the next output location

void LCI_confCopy ( LCI_configuration cnfIn,
LCI_configuration cnfOut 
)

Copy a configuration.

Parameters:
cnfIn The configuration structure to be copied from
cnfOut The configuration structure to be copied to

LCI_configuration* LCI_confCreate ( void   ) 

Allocate memory for a configuration structure and initialise (clear) it.

Returns:
Pointer to an allocated, initialised configuration structure

void LCI_confDelete ( LCI_configuration cnf  ) 

Free memory previously allocated with a call to LCI_confCreate.

Parameters:
cnf A configuration structure created by a call to LCI_confCreate

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

Load the configuration onto the LAT.

Parameters:
cnf Pointer to a populated configuration structure
cr Pointer to the common configuration multi-item command response list
runId The 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

unsigned LCI_confMode ( LCI_configuration cnf  ) 

Return the configuration type.

Parameters:
cnf Pointer to the configuration structure
Returns:
One of LSEC_MODE_XXX

void LCI_confNodeId ( LCI_configuration cnf,
unsigned  siu_id 
)

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

Parameters:
cnf Pointer to the configuration structure
siu_id LATp address of the node that the events will be collected on

unsigned LCI_confOpen ( LCI_configuration cnf,
const char *  fn 
)

Open the file and associate it with this configuration structure.

Parameters:
cnf Pointer to an initialised configuration structure
fn Name of file to open
Return values:
LCI_SUCCESS if the file opens successfully
LCI_FOPEN if the file failed to open successfully
LCI_FREAD if there is an error recovering the version information
LCI_VERSION if the file version information is bad (unknown type, major version mismatch, minor version decrease).
LCI_ENDOFILE if the file has no actual configurations (returned, but not reported).

unsigned LCI_confOpenFid ( LCI_configuration cnf,
unsigned  fid 
)

Open the file and associate it with this configuration structure.

Parameters:
cnf Pointer to an initialised configuration structure
fid The ID of the file to open
Return values:
LCI_SUCCESS if the file opens successfully
LCI_FOPEN if the file failed to open successfully
LCI_FREAD if there is an error recovering the version information
LCI_VERSION if the file version information is bad (unknown type, major version mismatch, minor version decrease).
LCI_ENDOFILE if the file has no actual configurations (returned, but not reported).

unsigned LCI_confPeriod ( LCI_configuration cnf  ) 

Return the period between triggers.

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

unsigned LCI_confRange ( LCI_configuration cnf  ) 

Return the readout range.

Parameters:
cnf Pointer to the configuration structure
Returns:
The range for this configuration (LSEC_XXX_RANGE)

unsigned LCI_confRead ( LCI_configuration cnf  ) 

Get the values for the next step of the configuration.

Parameters:
cnf Pointer to an opened configuration
Return values:
LCI_SUCCESS if a configuration was read successfully
LCI_ENDOFILE if there are no more configurations in the file (returned, but not reported).
LCI_confRead if there is an error during the read or the configuration is incomplete

void LCI_confReport ( LCI_configuration cnf,
FILE *  fp 
)

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

Parameters:
cnf Pointer to the configuration structure to output
fp Pointer to file to print report

unsigned int LCI_confSizeofCtx32 ( LCI_configuration cnf  ) 

Calculate the number of 32-bit words required to hold the current configuration values.

Parameters:
cnf Pointer to a configuration structure
Returns:
Number of 32-bit words required to hold the current configuration values

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

Return accumulated configuration times.

Parameters:
cnf Pointer to an initialised, populated configuration structure.
clear If TRUE, clear the times after copying them.
lci_time Address of a variable to receive the accumulated time taken to do LCI configurations or NULL if the time is not wanted.
lat_time Address of a variable to receive the accumulated time taken to do any LAT configurations or NULL if the time is not wanted.

unsigned LCI_confTriggers ( LCI_configuration cnf  ) 

Return the number of triggers required.

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


Generated on Thu Aug 20 14:53:30 2009 by  doxygen 1.5.3