GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-2-3 > lsew / rhel5-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 dbg_report_header(tag)
#define dbg_report_tem(tem, cid, nbits)
#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 __inline int cdf_err_gtcc_find_width (const EBF_err *err, int idx, int wc)
 Ors the number of bits that will be used to pack the overflows on this GTCC. This is determined by or'ing the overflow count for each GTRC and using this to determine the number of bits it takes to pack th maximum overflow count.
static __inline unsigned int cdf_err_gtcc_pack (unsigned int *buf, unsigned int pos, const EBF_err *err, int idx, int wc, int nbits)
 Finds the maximum number of overflows in a GTRC.
static unsigned int cdf_err_tem_compress_tov (CDF_errTem *tem, unsigned int *buf, unsigned int pos, unsigned int tag)
 Compresses error records consisting only of FIFO full.
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_errTem *tem, 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.7 2012/11/30 17:31:59 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 TKR overflows followed by the TEM TKR bug. Statistically speaking the the error records fall into the following categories Code
  • TKR oveflow 99% 0
the rest are (and are prefixed by a 1
  • 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 1 00 35% list of phasing errors RCs
  • Pure phasing errors CC == 0x1ff0 1 01 35% none
  • Pure TO CC == 0x1ff0 1 10 0 10% none
  • TKR CC errors CC == 0x1000 1 10 1 15% none
  • Nonconforming bug a CC == 0x1ff0 1 11 10 5%
Copy
  • Copy 1 11 10
Exceptions
  • Mixed phasing + TO CC != 0x1ff0 1 11 10 Copy
  • Pure phasing CC != 0x1ff0 1 11 10 Copy
  • Pure TO CC != 0x1ff0 11 10 Copy
  • TKR CC errors CC != 0x1000 11 10 Copy
  • Nonconforming bug a CC != 0x1ff0 11 10 Copy

References cdf_err_tem_classify(), _CDF_err::map, _CDF_err::tag, and _CDF_err::tems.

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.

static __inline int cdf_err_gtcc_find_width ( const EBF_err *  err,
int  idx,
int  wc 
) [static]

Ors the number of bits that will be used to pack the overflows on this GTCC. This is determined by or'ing the overflow count for each GTRC and using this to determine the number of bits it takes to pack th maximum overflow count.

Parameters:
[in] err The error record
[in] idx The index to the beginning of this GTRC
[in] wc The count of words in this GTRC

(ncnt < pcnt ? ncnt : pcnt) + 1;

Referenced by cdf_err_tem_compress_tov().

static __inline unsigned int cdf_err_gtcc_pack ( unsigned int *  buf,
unsigned int  pos,
const EBF_err *  err,
int  idx,
int  wc,
int  nbits 
) [static]

Finds the maximum number of overflows in a GTRC.

Parameters:
[in] buf The output buffer
[in] pos The current bit position in the output buffer
[in] err The error record
[in] idx The index to the beginning of this GTRC
[in] wc The count of words in this GTRC
[in] nbits The number of bits to use in packing the overflow count

Referenced by cdf_err_tem_compress_tov().

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_errTem tem,
unsigned int  tag 
) [static]

Compresses the fixed length information an error event.

Returns:
The updated write bit position
Parameters:
tem 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
plus the value of TKR FIFO overflow only flag

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_err_tem_compress_tov(), _CDF_errTem::hdr, _CDF_errTemHeader::phase, _CDF_errTkr::summary, _CDF_errTemHeader::summary, and _CDF_errTem::tkr.

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().

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

Compresses error records consisting only of FIFO full.

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_gtcc_find_width(), cdf_err_gtcc_pack(), _CDF_errTem::edr, and _CDF_errTem::type.

Referenced by cdf_err_tem_classify().

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 Fri Nov 30 11:07:28 2012 by  doxygen 1.5.8