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


Interface   Data Structures   File List   Data Fields   Globals  

CDF_dgn_ped_cal.c File Reference

Compresses the CAL contribution to the diagnostic data. More...

#include <LSE/CDF_dgn_ped_cal.h>
#include <CDF_dgn_def.h>
#include <EDS/EBF_dir.h>
#include <LDT/BFP.h>
#include <LDT/BWP.h>
#include <LDT/BW.h>
#include <PBI/FFS.ih>
#include <dprintf.h>

Functions

static __inline unsigned int dgn_ped_cal_twr_extract (CDF_dgn_ped_cal_twr *cdgn, const unsigned int *dgn)
 Extracts the 8 12-bit log accept maps for the two log ends into 3 32-bit values.
static int dgn_ped_cal_encode32 (unsigned int *buf, unsigned int pos, unsigned int p, unsigned int n)
 Compresses the positive and negative maps of 32 bits of which CAL logs where over-threshold (from the diagnostic data). This routine will typically be called 3 times for the 3 sets of maps representing the 96 logs.
static __inline unsigned int dgn_ped_cal_compress (unsigned int *buf, unsigned int pos, CDF_dgn_ped_cal_twr *dgn, int cnt)
 Encodes the CAL log accept data for all towers.
int CDF_dgn_ped_cal_cfg_sizeof (int level)
 Returns the size, in bytes of the DGN compression configuration needed to support the specified level.
int CDF_dgn_ped_cal_cfg_construct (CDF_dgn_ped_cal_cfg *cfg, int level, void **mem)
 Constructs the CDF_dgnCalCfg compression configuration.
int CDF_dgn_ped_cal_sizeof (int level, const CDF_dgn_ped_cal_cfg *cfg)
 Returns the size, in bytes of the CAL DGN compression structure needed to support the specified level.
int CDF_dgn_ped_cal_construct (CDF_dgn_ped_cal *cdf, int level, const CDF_dgn_ped_cal_cfg *cfg, const LSEW_dgmFw *dgmFw, void **mem)
 Constructs the CAL standard diagnostic compression context.
unsigned int CDF_dgn_ped_cal_prepare (CDF_dgn_ped_cal *cdf, unsigned int map, unsigned int amap, unsigned int emap, const unsigned **dgns, const EBF_dirCtbDsc *dscs)
 Prepares the cal diagnostic data for compression.
unsigned int CDF_dgn_ped_cal_compress (CDF_dgn_ped_cal *cdf, unsigned int *buf, unsigned int pos)
 Compresses the CAL diagnostic data when data is taken with standard physics triggers.


Detailed Description

Compresses the CAL contribution to the diagnostic data.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: CDF_dgn_ped_cal.c,v 1.2 2011/03/26 17:35:23 russell Exp $

Function Documentation

int CDF_dgn_ped_cal_cfg_construct ( CDF_dgn_ped_cal_cfg cfg,
int  level,
void **  mem 
)

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

Referenced by CDF_dgn_ped_cfg_construct().

int CDF_dgn_ped_cal_cfg_sizeof ( int  level  ) 

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

Parameters:
level The maximum compression level to support

Referenced by CDF_dgn_ped_cfg_sizeof().

unsigned int CDF_dgn_ped_cal_compress ( CDF_dgn_ped_cal *  cdf,
unsigned int *  buf,
unsigned int  pos 
)

Compresses the CAL diagnostic data when data is taken with standard physics triggers.

Returns:
The updated bit index
Parameters:
cdf The CAL diagnostic context
buf The output bit buffer
pos The output bit index
The CAL diagnostic data consists of two pieces
  • The trigger information
  • The log accept information

These are encoded in two separate blocks on a per tower basis, that is the trigger information for all towers is encoded first, followed by the log accept data for all towers.

References CDF_dgn_gen_trg_compress(), and dgn_ped_cal_compress().

Referenced by CDF_dgn_ped_compress().

int CDF_dgn_ped_cal_construct ( CDF_dgn_ped_cal *  cdf,
int  level,
const CDF_dgn_ped_cal_cfg cfg,
const LSEW_dgmFw dgmFw,
void **  mem 
)

Constructs the CAL standard diagnostic compression context.

Returns:
Status
Parameters:
cdf The CAL standard diagnostic compression context to construct
level The compression level
cfg The CAL standard diagnostic compression configuration information. Currently this is unused, but is provided for future usage if necessary.
dgmFw The datagram framework. This would be used if the compression of the CAL standard diagnostic data needed to store any context information in the datagram header.
mem A pointer to the memory to allocate any variable length structures the CDF_dgn_ped_cal context may need. Currently there are none. If this pointer is the same as cdf, the memory pointer is advanced by the size of the CDF_dgn_ped_cal structure before allocating any new memory. This routine updates the memory pointer to the next available address.

Referenced by CDF_dgn_ped_construct().

unsigned int CDF_dgn_ped_cal_prepare ( CDF_dgn_ped_cal *  cdf,
unsigned int  map,
unsigned int  amap,
unsigned int  emap,
const unsigned **  dgns,
const EBF_dirCtbDsc *  dscs 
)

Prepares the cal diagnostic data for compression.

Returns:
A 32 bit value composed of two1 16-maps, one for which towers had the CAL HI trigger set (upper 16 bits) and which towers had the CAL LO trigger set (lower 16 bits).
Parameters:
cdf The context for CAL standard diagnostics
map A left justified map indicating which towers have a CAL contribution.
amap A left justified map indicating which towers have only an accept contribution.
emap A left justified map of towers with errors
dgns An array of pointers, indexed by tower number, giving the address of that tower's diagnostic block.
dscs The array of pointers to the tower contribution descriptors.
This routine provides information used to compress both the CAL diagnostic data itself, but also information used in constructing the summary header. This summary information indicates which towers have non-zero CAL HI and LO trigger bits set.

References dgn_ped_cal_twr_extract().

Referenced by CDF_dgn_ped_compress().

int CDF_dgn_ped_cal_sizeof ( int  level,
const CDF_dgn_ped_cal_cfg cfg 
)

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

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

Referenced by CDF_dgn_ped_sizeof().

static __inline unsigned int dgn_ped_cal_compress ( unsigned int *  buf,
unsigned int  pos,
CDF_dgn_ped_cal_twr *  dgn,
int  cnt 
) [static]

Encodes the CAL log accept data for all towers.

Returns:
The updated bit index
Parameters:
buf The output bit buffer
pos The output bit index
dgn The prepared diagnostic data for the list of towers with non-empty diagnostic data
cnt The count of dgn

References dgn_ped_cal_encode32().

Referenced by CDF_dgn_ped_cal_compress().

static int dgn_ped_cal_encode32 ( unsigned int *  buf,
unsigned int  pos,
unsigned int  p,
unsigned int  n 
) [static]

Compresses the positive and negative maps of 32 bits of which CAL logs where over-threshold (from the diagnostic data). This routine will typically be called 3 times for the 3 sets of maps representing the 96 logs.

Returns:
The updated write bit position
Parameters:
buf The output buffer
pos The current bit position in the output buffer
p The 32-bit map of which logs contributed to the positive end diagnostic accepts.
n The 32-bit map of which logs contributed to the negative end diagnostic accepts.
The data map, serves as a template for the compression. If the electronics functions correctly, this map will match the OR of the positive and negative maps. If this is true, then the compress is more efficient, but this routine will still compress the data.

Referenced by dgn_ped_cal_compress().

static __inline unsigned int dgn_ped_cal_twr_extract ( CDF_dgn_ped_cal_twr *  cdgn,
const unsigned int *  dgn 
) [static]

Extracts the 8 12-bit log accept maps for the two log ends into 3 32-bit values.

Returns:
The trigger bits (16 CAL HI, 16 CAL LO, 8 for each end)
Parameters:
cdgn The structure to receive the 2x3x32-bit log accepts
dgn The CAL diagnostic data

References PACK_CALDGNMAP.

Referenced by CDF_dgn_ped_cal_prepare().


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