GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-1 > lsew / sun-gcc
#include "LSE/CDF_dgn_std_cal.h"
#include "CDF_dgn_def.h"
#include "EDS/EBF_dir.h"
#include "EDS/EBF_cal.h"
#include "EDS/EDR_cal.h"
#include "EDS/EDA_cal.h"
#include "EDS/EDR_calUnpack.h"
#include "EDS/FFS.h"
#include "LDT/RLE.h"
#include "LDT/BFP.h"
#include "LDT/BWP.h"
#include "LDT/BW.h"
#include "dprintf.h"
#include <string.h>
Defines | |
#define | analyze_cal_stats_twr(_twr, _which, _cols, _lo, _hi) |
#define | print_cal_stats(_stats) |
#define | PACK_CALCOLMAP(_columns_0, _columns_1, _columns_2, _colMap) |
Functions | |
static __inline int | mapTower (unsigned short int *colMapP, const EBF_dirCtbDsc *contributor) |
Creates the address map for the specified tower. | |
static __inline int | mapTower4 (unsigned short int *colMapP, const EBF_dirCtbDsc *contributor) |
Maps the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout. | |
static __inline unsigned int | dgn_std_cal_twr_extract (CDF_dgn_std_cal_twr *cdgn, unsigned int err, int twr, const unsigned int *dgn, const EBF_dirCtbDsc *dsc) |
Extracts the 8 12-bit log accept maps for the two log ends into 3 32-bit values. In addition, the equivalent set of 3x32 log accepts maps are filled using the data as the source. | |
static int | dgn_std_cal_compress_set (unsigned int *buf, unsigned int pos, unsigned int d, unsigned int p, unsigned int n) |
Compresses one set of 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_std_cal_compress (unsigned int *buf, unsigned int pos, CDF_dgn_std_cal_twr *dgn, int cnt) |
Encodes the CAL log accept data for all towers. | |
static __inline unsigned int | dgn_std_cal_twr_layer_map (unsigned short int colMap[8], const EBF_dirCtbDsc *dsc) |
int | CDF_dgn_std_cal_cfg_sizeof (int level) |
Returns the size, in bytes of the DGN compression configuration needed to support the specified level. | |
int | CDF_dgn_std_cal_cfg_construct (CDF_dgn_std_cal_cfg *cfg, int level, void **mem) |
Constructs the CDF_dgnCalCfg compression configuration. | |
int | CDF_dgn_std_cal_sizeof (int level, const CDF_dgn_std_cal_cfg *cfg) |
Returns the size, in bytes of the CAL DGN compression structure needed to support the specified level. | |
int | CDF_dgn_std_cal_construct (CDF_dgn_std_cal *cdf, int level, const CDF_dgn_std_cal_cfg *cfg, const LSEW_dgmFw *dgmFw, void **mem) |
Constructs the CAL standard diagnostic compression context. | |
unsigned int | CDF_dgn_std_cal_prepare (CDF_dgn_std_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_std_cal_compress (CDF_dgn_std_cal *cdf, unsigned int *buf, unsigned int pos) |
Compresses the CAL diagnostic data when data is taken with standard physics triggers. |
CVS $Id: CDF_dgn_std_cal.c,v 1.1 2009/04/30 18:21:09 russell Exp $
#define PACK_CALCOLMAP | ( | _columns_0, | |||
_columns_1, | |||||
_columns_2, | |||||
_colMap | ) |
Value:
{ \ unsigned short int _colMap_2; \ unsigned short int _colMap_5; \ \ \ _colMap_2 = _colMap[2]; \ \ _columns_0 = (_colMap[0] << 0) \ | (_colMap[1] << 12) \ | (_colMap_2 << 24); \ \ \ _colMap_5 = _colMap[5]; \ \ _columns_1 = (_colMap_2 >> 8) \ | (_colMap[3] << 4) \ | (_colMap[4] << 16) \ | (_colMap_5 << 28); \ \ \ _columns_2 = (_colMap[5] >> 4) \ | (_colMap[6] << 8) \ | (_colMap[7] << 20); \ }
int CDF_dgn_std_cal_cfg_construct | ( | CDF_dgn_std_cal_cfg * | cfg, | |
int | level, | |||
void ** | mem | |||
) |
Constructs the CDF_dgnCalCfg compression configuration.
Status |
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. |
int CDF_dgn_std_cal_cfg_sizeof | ( | int | level | ) |
Returns the size, in bytes of the DGN compression configuration needed to support the specified level.
level | The maximum compression level to support |
unsigned int CDF_dgn_std_cal_compress | ( | CDF_dgn_std_cal * | cdf, | |
unsigned int * | buf, | |||
unsigned int | pos | |||
) |
Compresses the CAL diagnostic data when data is taken with standard physics triggers.
cdf | The CAL diagnostic context | |
buf | The output bit buffer | |
pos | The output bit index |
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.
int CDF_dgn_std_cal_construct | ( | CDF_dgn_std_cal * | cdf, | |
int | level, | |||
const CDF_dgn_std_cal_cfg * | cfg, | |||
const LSEW_dgmFw * | dgmFw, | |||
void ** | mem | |||
) |
Constructs the CAL standard diagnostic compression context.
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_std_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_std_cal structure before allocating any new memory. This routine updates the memory pointer to the next available address. |
unsigned int CDF_dgn_std_cal_prepare | ( | CDF_dgn_std_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.
cdf | The context for CAL standard diagnostics | |
map | A left justified map indicating which towers have a CAL diagnostic contribution, either TRG or ACCEPT | |
amap | A left justified map indicating which towers have a non-empty 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. |
int CDF_dgn_std_cal_sizeof | ( | int | level, | |
const CDF_dgn_std_cal_cfg * | cfg | |||
) |
Returns the size, in bytes of the CAL DGN compression structure needed to support the specified level.
level | The maximum compression level to support | |
cfg | Target specific configuration |
static __inline unsigned int dgn_std_cal_compress | ( | unsigned int * | buf, | |
unsigned int | pos, | |||
CDF_dgn_std_cal_twr * | dgn, | |||
int | cnt | |||
) | [static] |
Encodes the CAL log accept data for all towers.
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 |
static int dgn_std_cal_compress_set | ( | unsigned int * | buf, | |
unsigned int | pos, | |||
unsigned int | d, | |||
unsigned int | p, | |||
unsigned int | n | |||
) | [static] |
Compresses one set of 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.
buf | The output buffer | |
pos | The current bit position in the output buffer | |
d | The 32-bit map of which logs contributed to the CAL data. | |
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. |
static __inline unsigned int dgn_std_cal_twr_extract | ( | CDF_dgn_std_cal_twr * | cdgn, | |
unsigned int | err, | |||
int | twr, | |||
const unsigned int * | dgn, | |||
const EBF_dirCtbDsc * | dsc | |||
) | [static] |
Extracts the 8 12-bit log accept maps for the two log ends into 3 32-bit values. In addition, the equivalent set of 3x32 log accepts maps are filled using the data as the source.
cdgn | The structure to receive the 2x3x32-bit log accepts from the diagnostic data and 3x32-bit log accepts from the CAL data | |
err | A flag, non zero if erroring tower | |
twr | The tower number (debug only) | |
dgn | The CAL diagnostic data | |
dsc | The contribution descriptor for the tower. This is used to access the CAL data. In principle, the diagnostic data could be located using this descriptor, but that would entail paging across the tracker data to find it. This has already been done once, no reason to find it again. |
static __inline int mapTower | ( | unsigned short int * | colMapP, | |
const EBF_dirCtbDsc * | contributor | |||
) | [static] |
Creates the address map for the specified tower.
colMapP | The CAL column maps to fill, one for each layer, LSB = column 0 | |
contributor | The CAL contributor descriptor |
static __inline int mapTower4 | ( | unsigned short int * | colMapP, | |
const EBF_dirCtbDsc * | contributor | |||
) | [static] |
Maps the CAL data from 1 tower into a Cal Tower Record (ctr) This routine assumes 4 range readout.
colMapP | The CAL column maps to fill, one for each layer, LSB = column 0 | |
contributor | The CAL contributor descriptor |