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


Interface   Data Structures   File List   Data Fields   Globals  

CDF_tkr.c File Reference

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

#include <LSE/CDF_tkr.h>
#include <LSE/CDF_tkrdef.h>
#include <LSE/LFR_key.h>
#include <LSE/LSE_cdm.h>
#include <CDF_tkr_def.h>
#include <EDS/EDR_tkr.h>
#include <TCC_DB/TCC_DB_schema.h>
#include <CDM/CDM_pubdefs.h>
#include <PBI/FFS.ih>
#include <dprintf.h>
#include <string.h>

Defines

#define print_splits(_twr, _lyr, _lo, _hi)
#define print_invalid_strip(twr, lyr, ixy)
#define print_twr_lyr_hdr()
#define print_twr_lyr(twr, lyr, ixy, err)
#define print_lo_check(strip, err)
#define print_hi_check(strip, cnt, err)
#define print_newline()

Functions

static __inline void splits_default_construct (CDF_tkr_splits *splits)
 Initializes the track split points to their default values.
static __inline int splits_construct (CDF_tkr_splits *splits, const TCC_DB_schema *schema)
 Constructs the Tracker Split Point database.
static __inline int lyrs_check (const CDF_tkr_splits_layer *splits, int itwr, int ixy, const EDR_tkrLayer *lyrs, int lyrMap)
 Checks that the split points for the active X or Y layer are consistent with the configuration.
static int fill_splits (CDF_tkr_splits *splits, int twr, int lyr, int lo, int hi)
 The TCC_DB_fill_splits call back routine. This fills the split points in terms of the strip addresses.
int CDF_tkrCfg_sizeof (int level)
 Returns the size, in bytes of the TKR compression configuration needed to support the specified level.
int CDF_tkrCfg_construct (CDF_tkrCfg *cfg, int level, void **mem)
 Constructs the CDF_tkr compression configuration.
int CDF_tkr_sizeof (int level, const CDF_tkrCfg *cfg)
 Returns the size, in bytes of the CAL compression structure needed to support the specified level.
int CDF_tkr_construct (CDF_tkr *cdf, int level, const CDF_tkrCfg *cfg, const LSEW_dgmFw *dgmFw, void **mem)
 Constructs the CDF_cal compression context.
void CDF_tkr_begin (CDF_tkr *cdf, CDF_tkrBdy *bdy)
 Fills int the TKR portion of the datagram contribution used in when decoding an TKR event.
int CDF_tkr_check (CDF_tkr *cdf, const EDR_tkr *tkr)
 Checks that the splits points of all struck layers are consistent with the configuration.


Detailed Description

Implementation to produce Compressed Data Format for the TKR contributors.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: CDF_tkr.c,v 1.4 2011/03/26 17:35:24 russell Exp $


Function Documentation

void CDF_tkr_begin ( CDF_tkr cdf,
CDF_tkrBdy bdy 
)

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

Parameters:
cdf The CDF_tkr compress context structure
bdy The CDF_acdBdy structure to fill

References _CDF_tkr_refs::cfg, _CDF_tkrBdy::cfg, and _CDF_tkr::refs.

int CDF_tkr_check ( CDF_tkr cdf,
const EDR_tkr *  tkr 
)

Checks that the splits points of all struck layers are consistent with the configuration.

Return values:
==0 if successful
< 0 serious structural problems
> 0 a bit mask (low 16 bits) of the towers that can not be compressed.
Parameters:
cdf The CDF_cal compress context structure
tkr The unpacked tracker record

References _CDF_tkr::ign_map, _CDF_tkr_splits_tower::layers, lyrs_check(), _CDF_tkr::splits, and _CDF_tkr_splits::towers.

int CDF_tkr_construct ( CDF_tkr cdf,
int  level,
const CDF_tkrCfg *  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_tkr, else this routine will believe that the only the variable allocation of cdf needs to be allocated.

References _CDF_tkr_refs::cfg, _LFR_ref::cs, _LFR_ref::key, LFR_keyGet(), LSE_cdmFind(), _CDF_tkr::refs, _CDF_tkr::splits, splits_construct(), and splits_default_construct().

int CDF_tkr_sizeof ( int  level,
const CDF_tkrCfg *  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_tkrCfg_construct ( CDF_tkrCfg *  cfg,
int  level,
void **  mem 
)

Constructs the CDF_tkr 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_tkrCfg, else this routine will believe that the only the variable allocation of cdf needs to be allocated.

int CDF_tkrCfg_sizeof ( int  level  ) 

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

Parameters:
level The maximum compression level to support

static int fill_splits ( CDF_tkr_splits splits,
int  twr,
int  lyr,
int  lo,
int  hi 
) [static]

The TCC_DB_fill_splits call back routine. This fills the split points in terms of the strip addresses.

Returns:
Always 0 indicating success
Parameters:
splits The split point limit structure to be filled in
twr The target tower number, 0-15
lyr The targer layer number, 0-35
  • 0-17 are x layers,
  • 17-35 are y layers
lo The number of GTFEs servicing the low side readout
hi The number of GTFEs servicing the high side readout
This call back routine relieves the TCC_DB routines from understanding the way its information is consumed and/or organized for use. The TCC_DB routines only provide information in the form of how many GTFEs service the low and high ends of a layer. It is up to this routine to organize the information as it sees fit.

References _CDF_tkr_splits_limit::hi, _CDF_tkr_splits_tower::layers, _CDF_tkr_splits_layer::limit, _CDF_tkr_splits_limit::lo, and _CDF_tkr_splits::towers.

Referenced by splits_construct().

static __inline int lyrs_check ( const CDF_tkr_splits_layer splits,
int  itwr,
int  ixy,
const EDR_tkrLayer *  lyrs,
int  lyrMap 
) [static]

Checks that the split points for the active X or Y layer are consistent with the configuration.

Return values:
== -1, Serious structural error
> 0, Tower has structural problems that prevent it from being compressed. The value returned is the tower bit mask in the low 16 bits. The calling routine can thus accumulate a list of such towers.
== 0, Tower is okay
Parameters:
splits The split points (in terms of strip numbers) for each layer in the tower
itwr The tower number
ixy Layer base, if ixy=0, then x layers, else y layers
lyrs The unpacked data for this tower
lyrMap The map of layers with data.
Serious error
Currently the only serious error is if there is a layer not deemed in error by the unpacker, but that has a strip number not within the range.
Compression error
The compression code can handle out of order strips as long as all strips are within their allowed strip numbers.

References _CDF_tkr_splits_limit::hi, _CDF_tkr_splits_layer::limit, and _CDF_tkr_splits_limit::lo.

Referenced by CDF_tkr_check().

static int splits_construct ( CDF_tkr_splits splits,
const TCC_DB_schema *  schema 
) [static]

Constructs the Tracker Split Point database.

Returns:
Status
Parameters:
splits The Tracker Split Point database to fill
schema The Tracker Configuration database
If a TCC_DB CDM database is found, then the values are taken from there, otherwise, they are just defaulted to the mid-point (12/12)

References fill_splits().

Referenced by CDF_tkr_construct().

static __inline void splits_default_construct ( CDF_tkr_splits splits  )  [static]

Initializes the track split points to their default values.

Parameters:
splits The TKR split point limits structure to initialize

References _CDF_tkr_splits::limits, and _CDF_tkr_splits_limit::lo.

Referenced by CDF_tkr_construct().


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