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


Interface   Data Structures   File List   Data Fields   Globals  

CDF_err.c File Reference

Implementation to produce Compressed Data Format for the diagnostic contributions. More...

#include <LSE/CDF_err.h>
#include <LSE/CDF_errdef.h>
#include <CDF_err_def.h>
#include <EDS/EBF_tem.h>
#include <EDS/EBF_err.h>
#include <EDS/EBF_tkr.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_cid.h>
#include <EDS/EDR_tkr.h>
#include <EDS/EDR_err.h>
#include <LDT/BFP.h>
#include <PBI/FFS.ih>
#include <string.h>
#include <dprintf.h>

Defines

#define TAG0   0xd
#define TAG1   0x2
#define TAG2   0x7
#define TAG3   0x8
#define TAGS   ((TAG3<<12) | (TAG2<<8) | (TAG1<<4) | TAG0)

Typedefs

typedef unsigned int(* cdf_err_tem_compress_rtn )(CDF_errTem *err, unsigned int *buf, unsigned int pos, unsigned int tag)

Functions

int CDF_errCfg_sizeof (int level)
 Returns the size, in bytes of the GEM compression configuration needed to support the specified level.
int CDF_errCfg_construct (CDF_errCfg *cfg, int level, void **mem)
 Constructs the CDF_erfCfg compression configuration.
int CDF_err_sizeof (int level, const CDF_errCfg *cfg)
 Returns the size, in bytes of the ERR compression structure needed to support the specified level.
int CDF_err_construct (CDF_err *cdf, int level, const CDF_errCfg *cfg, const LSEW_dgmFw *dgmFw, void **mem)
 Constructs the CDF_err compression context.
static __inline void cdf_err_tkr_analyze_timeout (CDF_errTkrTimeout *timeout, const unsigned short *err, const EDR_errTkr *tkr)
static __inline unsigned int cdf_err_analyze_rc_pe (CDF_errTkrRc_pe *pe_rec, const unsigned short int *err, const EDR_errTkr *tkr, unsigned int tag)
static __inline unsigned int cdf_err_tem_analyze (CDF_errTem *tem_rec, const EDR_errTem *tem, unsigned int tag, unsigned int msk)
unsigned int CDF_err_compose (CDF_err *cdf, const EDR_err *err)
 Analyzes the error contribution of TEMs.
static __inline int cdf_err_tem_cable_phase_match (unsigned short int pe, unsigned int tag)
 Checks if the TEM cable phase error word has the same value for all tag members and that value matches the value predicted from the event tag.
unsigned int collapse (unsigned int lo, unsigned int hi)
unsigned int expand4to32 (int w)
static unsigned int cdf_err_tem_compress_copy (CDF_errTem *tem, unsigned int *buf, unsigned int pos, unsigned int tag)
 Compresses all other (not TEM BUG A or B) error records.
static unsigned int cdf_err_tem_compress_bug_a (CDF_errTem *tem, unsigned int *buf, unsigned int pos, unsigned int tag)
 Compresses the TEM BUG A error records.
static unsigned int cdf_err_tem_compress_bug_b (CDF_errTem *tem, unsigned int *buf, unsigned int pos, unsigned int tag)
 Compresses the TEM BUG B error records.
static __inline
cdf_err_tem_compress_rtn 
cdf_err_tem_classify (const CDF_errTemHeader *hdr, unsigned int tag)
 Compresses the fixed length information an error event.
unsigned int CDF_err_compress (CDF_err *cdf, unsigned int *buf, unsigned int pos)
 Compresses the ERR contributions.


Detailed Description

Implementation to produce Compressed Data Format for the diagnostic contributions.

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


Function Documentation

unsigned int CDF_err_compose ( CDF_err cdf,
const EDR_err *  err 
)

Analyzes the error contribution of TEMs.

Returns:
A bit mask of the CAL and TKR contributions that are seriously flawed, that is, one should not trust the unpacking.
Parameters:
cdf The error context block to compose
err The unpacked error records

cdf->to = ctids;

References _CDF_err::cal, _CDF_err::map, _CDF_err::tag, _CDF_err::tems, and _CDF_err::tkr.

unsigned int CDF_err_compress ( CDF_err cdf,
unsigned int *  buf,
unsigned int  pos 
)

Compresses the ERR contributions.

Returns:
The updated write bit position
Parameters:
cdf The ERR compression data formatting handle
buf The output buffer
pos The position of the next bit to fill
Overview
The compression takes advantage of the fact that the vast majority of TEM error records are from the TEM TKR bug. Statistically speaking the the error records fall into the following categories
  • Only TKR CC errors 15%
  • TKR RC errors 85%

The 85% TKR RC errors are broken done as
  • Pure phasing errors 35%
  • Pure TO 10%
  • Mixed phasing + TO 35%
  • Zoo events 5%
This is further broken down into conforming cases and exception cases. Currently only the conforming cases are handled. All exception cases get funnelled into a copy.
Conforming
  • Mixed phasing + T0 CC == 0x1ff0 00 35% list of phasing errors RCs
  • Pure phasing errors CC == 0x1ff0 01 35% none
  • Pure TO CC == 0x1ff0 10 0 10% none
  • TKR CC errors CC == 0x1000 10 1 15% none
  • Nonconforming bug a CC == 0x1ff0 11 0 5%
Copy
  • Copy 111 0
Exceptions
  • Mixed phasing + TO CC != 0x1ff0 1111 00 summary word + list RCs
  • Pure phasing CC != 0x1ff0 1111 01 summary word
  • Pure TO CC != 0x1ff0 1111 10 0
  • TKR CC errors CC != 0x1000 1111 10 1 summary word
  • Nonconforming bug a CC != 0x1ff0 1111 11 0 summary word

References cdf_err_tem_classify(), _CDF_errTem::hdr, _CDF_err::map, _CDF_errTemHeader::phase, _CDF_errTemHeader::summary, _CDF_err::tag, _CDF_err::tems, and _CDF_errTemHeader::timeout.

int CDF_err_construct ( CDF_err cdf,
int  level,
const CDF_errCfg *  cfg,
const LSEW_dgmFw dgmFw,
void **  mem 
)

Constructs the CDF_err compression context.

Return values:
Status 
Parameters:
cdf The CDF_err 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_err, else this routine will believe that the only the variable allocation of cdf needs to be allocated.

int CDF_err_sizeof ( int  level,
const CDF_errCfg *  cfg 
)

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

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

static __inline int cdf_err_tem_cable_phase_match ( unsigned short int  pe,
unsigned int  tag 
) [static]

Checks if the TEM cable phase error word has the same value for all tag members and that value matches the value predicted from the event tag.

Return values:
== 0, matches the value
!= 0, does not match
Parameters:
pe The value of the cable phase error word
tag The predicted tag value

Referenced by cdf_err_tem_classify().

static __inline cdf_err_compress_rtn cdf_err_tem_classify ( const CDF_errTemHeader hdr,
unsigned int  tag 
) [static]

Compresses the fixed length information an error event.

Returns:
The updated write bit position
Parameters:
hdr The information to be added to the header
tag The event tag
Overiew
This classifies the TEM error block by the values of the three potential header word
  • The TEM error summary word
  • The TEM phasing error, if present
  • The TEM timeout word, if present
These last two are conditionally present as defined by the TEM error summary word.
High Level recognition.
The TEM error block is classified into one of the three following categories
  • TEM BUG A, the present of all TKR GTCC phasing errors and the TEM cable phasing error, having all its tag value members equal with a value corresponding to one more than the event sequence tag. This is the most common error, occurring at 4 times the rate of TEM BUG B.
  • TEM BUG B, the absence of any TKR GTCC phasing errors and the present of TEM cable phasing error, having all its tag value members equal with a value corresponding to one less than the event sequence tag.

  • OTHER, all other conditions. This rarely happens but includes real TEM errors and events with CAL errors

References cdf_err_tem_cable_phase_match(), cdf_err_tem_compress_bug_a(), cdf_err_tem_compress_bug_b(), cdf_err_tem_compress_copy(), _CDF_errTemHeader::phase, and _CDF_errTemHeader::summary.

Referenced by CDF_err_compress().

static unsigned int cdf_err_tem_compress_bug_a ( CDF_errTem tem,
unsigned int *  buf,
unsigned int  pos,
unsigned int  tag 
) [static]

Compresses the TEM BUG A error records.

Returns:
The updated write bit position
Parameters:
tem The unpacked TEM error record
buf The output buffer
pos The position of the next bit to fill
tag The event tag

References _CDF_errTkrTimeout0::b, cdf_err_tem_compress_copy(), CDF_ERR_TEM_TYPE_K_BUG_A, _CDF_errTem::hdr, _CDF_errTkrTimeout::rc0, _CDF_errTkr::rc_pe, _CDF_errTkrTimeout::rcn, _CDF_errTkr::summary, _CDF_errTemHeader::summary, _CDF_errTkr::timeout, _CDF_errTem::tkr, and _CDF_errTem::type.

Referenced by cdf_err_tem_classify().

static unsigned int cdf_err_tem_compress_bug_b ( CDF_errTem tem,
unsigned int *  buf,
unsigned int  pos,
unsigned int  tag 
) [static]

Compresses the TEM BUG B error records.

Returns:
The updated write bit position
Parameters:
tem The unpacked error record
buf The output buffer
pos The position of the next bit to fill
tag The event tag

References CDF_ERR_TEM_TYPE_K_BUG_B, and _CDF_errTem::type.

Referenced by cdf_err_tem_classify().

static unsigned int cdf_err_tem_compress_copy ( CDF_errTem tem,
unsigned int *  buf,
unsigned int  pos,
unsigned int  tag 
) [static]

Compresses all other (not TEM BUG A or B) error records.

Returns:
The updated write bit position
Parameters:
tem The unpacked error record
buf The output buffer
pos The position of the next bit to fill
tag The event tag

References CDF_ERR_TEM_TYPE_K_OTHER, _CDF_errTem::edr, and _CDF_errTem::type.

Referenced by cdf_err_tem_classify(), and cdf_err_tem_compress_bug_a().

int CDF_errCfg_construct ( CDF_errCfg *  cfg,
int  level,
void **  mem 
)

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

int CDF_errCfg_sizeof ( int  level  ) 

Returns the size, in bytes of the GEM 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