GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-1-0 > lsew / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

CDF_cal.c File Reference

Implementation to produce Compressed Data Format for the CAL contributors. More...

#include <LSE/CDF_cal.h>
#include <LSE/CDF_caldef.h>
#include <LSE/CDF_cal_prd_model.h>
#include <LSE/LFR_key.h>
#include <LSE/LSE_cdm.h>
#include <CDF_cal_def.h>
#include <EDS/ECR_cal.h>
#include <EDS/EDA_cal.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_cid.h>
#include <LDT/HDE.h>
#include <CAL_DB/CAL_DB_schema_pedestals.h>
#include <CAL_DB/CAL_DB_schema_gains.h>
#include <CDM/CDM_pubdefs.h>
#include <PBI/FFS.ih>
#include <PBI/Fletcher.h>
#include <string.h>
#include <dprintf.h>

Classes

struct  _Checksums
 Contains the checksums for the CAL pedestals and gains. More...

Typedefs

typedef struct _Checksums Checksums
 Typedef for struct _Checksums.

Functions

static int cal_com_construct (CDF_cal_com *cal, void **mem)
 Constructs the data structures common to all data taking modes.
static int cal_prd_construct (CDF_cal_prd *prd, const ECR_cal *cal)
 Fills the range prediction data structures.
static Checksums cal_calib_fill (ECR_cal *cal, const CAL_DB_schema_pedestals *peds, const CAL_DB_schema_gains *gains)
 Transforms the contents of the input data into an ECR_cal structure.
int CDF_calCfg_sizeof (int level)
 Returns the size, in bytes of the CAL compression configuration needed to support the specified level.
int CDF_calCfg_construct (CDF_calCfg *cfg, int level, void **mem)
 Constructs the CDF_calCfg compression configuration.
int CDF_cal_sizeof (int level, const CDF_calCfg *cfg)
 Returns the size, in bytes of the CAL compression structure needed to support the specified level.
int CDF_cal_construct (CDF_cal *cdf, int level, const CDF_calCfg *cfg, const LSEW_dgmFw *dgmFw, void **mem)
 Constructs the CDF_cal compression context.
unsigned int CDF_cal_copy (CDF_cal *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir)
 Makes a straight copy of the CAL data. This is usually only used when the data is not in a form that the sophisticated compression routines expect.
void CDF_cal_begin (CDF_cal *cdf, CDF_calBdy *bdy)
 Fills int the CAL portion of the datagram contribution used in when decoding an CAL event.


Detailed Description

Implementation to produce Compressed Data Format for the CAL contributors.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: CDF_cal.c,v 1.3 2011/03/26 17:35:23 russell Exp $


Function Documentation

static Checksums cal_calib_fill ( ECR_cal *  cal,
const CAL_DB_schema_pedestals *  peds,
const CAL_DB_schema_gains *  gains 
) [static]

Transforms the contents of the input data into an ECR_cal structure.

Returns:
The pedestal and gain checksums
Parameters:
cal The CDF_cal_com data structure to fill
peds The CAL pedestals database
gains The CAL gains database

References _Checksums::gains, and _Checksums::peds.

Referenced by cal_com_construct().

static int cal_com_construct ( CDF_cal_com cal,
void **  mem 
) [static]

Constructs the data structures common to all data taking modes.

Parameters:
cal The CAL common data structure to construct
mem Pointer to free memory pointer, return as the the updated pointer

References cal_calib_fill(), cal_prd_construct(), _CDF_cal_com::calib, _LFR_ref::cs, _Checksums::gains, _CDF_cal_refs::gains, _CDF_cal_com::hde, _LFR_ref::key, LFR_keyGet(), LSE_cdmFind(), _Checksums::peds, _CDF_cal_refs::peds, _CDF_cal_com::prd, and _CDF_cal_com::refs.

Referenced by CDF_cal_construct().

static int cal_prd_construct ( CDF_cal_prd prd,
const ECR_cal *  cal 
) [static]

Fills the range prediction data structures.

Returns:
Status. Currently the only failure mode is if one of the generated constants occupies more bits than it is allocated.
Parameters:
prd The range prediction data structure to fill
cal The CAL calibration constants used in the filling of the range prediction data structure

References _CDF_cal_prd_tower::logs, _CDF_cal_prd_log::n, _CDF_cal_prd_log::p, _CDF_cal_prd_log_end_table::tbls, _CDF_cal_prd::twrs, and _CDF_cal_prd_log_end::ui.

Referenced by cal_com_construct().

void CDF_cal_begin ( CDF_cal cdf,
CDF_calBdy bdy 
)

Fills int the CAL portion of the datagram contribution used in when decoding an CAL event.

Parameters:
cdf The CDF_cal compress context structure
bdy The CDF_calBdy structure to fill

References _CDF_cal::com, _CDF_cal_refs::gains, _CDF_calBdy::gains, _CDF_cal_refs::peds, _CDF_calBdy::peds, and _CDF_cal_com::refs.

int CDF_cal_construct ( CDF_cal cdf,
int  level,
const CDF_calCfg *  cfg,
const LSEW_dgmFw dgmFw,
void **  mem 
)

Constructs the CDF_cal compression context.

Return values:
Status 
Parameters:
cdf The CDF_cal compress context structure to fill
level The maximum compression level that needs to be supported
cfg Target specific configuration parameter
dgmFw The datagram framework handle
mem Pointer to free memory pointer, return as the the updated pointer. If cdf is equal to the current contents of mem, then mem will be advanced by the size of CDF_cal, else this routine will believe that the only the variable allocation of cdf needs to be allocated.

References cal_com_construct(), _CDF_cal::com, _CDF_cal_com::hde, _CDF_cal::ped, and _CDF_cal_ped::stats.

unsigned int CDF_cal_copy ( CDF_cal cdf,
unsigned int *  buf,
unsigned int  pos,
const EBF_dir *  dir 
)

Makes a straight copy of the CAL data. This is usually only used when the data is not in a form that the sophisticated compression routines expect.

Returns:
The updated write bit position
Parameters:
cdf The CAL compression data formatting handle
buf The output buffer
pos The position of the next bit to fill
dir The directory describing the event to be formatted

Referenced by cdf_cal_ped_copy(), and CDF_cal_std_compress().

int CDF_cal_sizeof ( int  level,
const CDF_calCfg *  cfg 
)

Returns the size, in bytes of the CAL compression structure needed to support the specified level.

Parameters:
level The maximum compression level to support
cfg Target specific configuration

int CDF_calCfg_construct ( CDF_calCfg *  cfg,
int  level,
void **  mem 
)

Constructs the CDF_calCfg compression configuration.

Return values:
Status 
Parameters:
cfg Target specific configuration
level The maximum compression level that needs to be supported
mem Pointer to free memory pointer, return as the the updated pointer. If cfg is equal to the current contents of mem, then mem will be advanced by the size of CDF_calCfg, else this routine will believe that the only the variable allocation of cdf needs to be allocated.

int CDF_calCfg_sizeof ( int  level  ) 

Returns the size, in bytes of the CAL compression configuration needed to support the specified level.

Parameters:
level The maximum compression level to support


Generated on Thu Aug 4 13:00:08 2011 by  doxygen 1.5.8