GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSE / V2-3-0 > qse / sun-gcc
#include "QSE/QDF_cal.h"
#include "QSE/QDF_gem.h"
#include "QSE/QDF_exc.h"
#include "QSD/QFR_file.h"
#include "QDF_cal_def.h"
#include "QDF_cal_prd.h"
#include "QDF_cal_prd_def.h"
#include "QDF_exc_def.h"
#include "dprintf.h"
#include "LSE/CDF_caldef.h"
#include "EDS/FFS.h"
#include "EDS/ECR_cal.h"
#include "LDT/BFU.h"
#include "LDT/BIT.h"
#include "LDT/HDD.h"
Defines | |
#define | NULL ((void *)0) |
#define | print_cal_hdr(style_map, style, map) |
#define | print_cal_adrs_hdr(void) |
#define | print_cal_adrs_twr(twr) |
#define | print_cal_adrs_twr_scheme(scheme) |
#define | print_cal_adrs_maps(atwr) |
#define | V(_i, _j) (((_i) - (_j)) & 0x3) |
Typedefs | |
typedef void(* | CalPhaRestore3 )(unsigned short int *vals, const QDF_cal_prd_log_end *tbls, int rng, unsigned short int seed, const signed short int *difs) |
Signature for the function to restore the other '3' pha values. | |
typedef BFU(* | CalStdUnpackPhas )(QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, int style) |
Function prototype for unpacking the pha values. | |
Functions | |
static __inline BFU | cal_std_unpack_adrs (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu) |
Decodes the CAL address list. | |
static __inline BFU | cal_unpack_adrs_twr (QDF_calCtx *ctx, QDF_calEvtAdrsTwr *atwr, const unsigned int *src, unsigned int max, BFU bfu) |
Decodes the address map for a single tower. Once this routine determines the encoding scheme, it is merely dispatches to the correct decoder. | |
static __inline BFU | cal_unpack_adrs_twr_list (QDF_calEvtAdrsTwr *atwr, const unsigned int *src, int max, BFU bfu) |
Unpacks the hit log addresses for one tower when they are stored as a list. | |
static __inline BFU | cal_unpack_adrs_twr_qmap (QDF_calEvtAdrsTwr *atwr, const unsigned int *src, int max, BFU bfu) |
Unpacks the quad tree address map for one tower. | |
static __inline unsigned int | restore (unsigned int pattern) |
Restores 2 interleaved rows to the non-interleaved form. | |
static BFU | cal_std_unpack_phas (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu) |
Decodes the CAL values. | |
static void | cal_std_restore_phas (const QDF_calCtx *ctx, QDF_calEvt *evt, CalPhaRestore3 pha_restore3) |
Restores the 'other' 3 ranges when data is in the four range readout mode. | |
static void | phaA_restore3 (unsigned short int *vals, const QDF_cal_prd_log_end *tbls, int rng, unsigned short int seed, const signed short int *difs) |
Restores the value for the 'other 3' ranges PHAs. | |
static void | phaB_restore3 (unsigned short int *vals, const QDF_cal_prd_log_end *tbls, int rng, unsigned short int seed, const signed short int *difs) |
Restores the value for the 'other 3' ranges PHAs. | |
static BFU | cal_std_unpack_phas_unknown (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, int style) |
Catches the unimplemented decoding styles. | |
static BFU | cal_std_unpack_phas_max_dif (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, int style) |
Decodes the CAL values. | |
static BFU | cal_std_unpack_phas_exp_man (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, int style) |
Decodes the CAL values. | |
static BFU | cal_std_unpack_phas_exp_man_s (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, int style) |
Decodes the CAL values. | |
static BFU | cal_unpack_phas_max_dif_twr (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, unsigned int max, BFU bfu, int twr, int exp_dif, int exp_max) |
Decodes the adc values when packed as the maximum and difference. | |
static BFU | cal_unpack_phas_exp_man_twr (QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, unsigned int max, BFU bfu, int twr, int nexp, const unsigned char map[256]) |
Decodes the adc values. | |
static int | cal_pha_mappings_get (unsigned int present, unsigned char map[256]) |
Create the mappings from an exponent to state for both the max and min exponent values. | |
static unsigned int | cal_pha_compose (const ECR_calTower *ctwr, short int pha_max, unsigned short int pha_dif, int n_is_max, int lyr, int col) |
Composes the EBF_calDataLog word. | |
static BFU | calStd4Decode (QDF_calCtx *ctx, QDF_calEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, CalPhaRestore3 pha_restore3) |
Decodes 4-range, 0-suppressed CAL events that where encoded prior to the fix to the pha prediction model. | |
BFU | QDF_calStd1Decode (QDF_calCtx *ctx, QDF_calEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu) |
Decodes the single-range, 0-suppress, CAL events. | |
BFU | QDF_calStd4Decode (QDF_calCtx *ctx, QDF_calEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu) |
Decodes 4-range, 0-suppressed CAL events that where encoded prior to the fix to the pha prediction model. | |
BFU | QDF_calAStd4Decode (QDF_calCtx *ctx, QDF_calEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu) |
Decodes 4-range, 0-suppressed CAL events that where encoded prior to the fix to the pha prediction model. | |
BFU | QDF_calBStd4Decode (QDF_calCtx *ctx, QDF_calEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu) |
Decodes 4-range, 0-suppressed CAL events that where encoded after the fix to the pha prediction model. | |
Variables | |
static unsigned short int | Indices [4] |
static unsigned char | Bases [4] |
static unsigned char | Orders [4] |
CVS $Id: QDF_cal_std.c,v 1.7 2010/09/02 21:35:39 russell Exp $
void(* CalPhaRestore3)(unsigned short int *vals, const QDF_cal_prd_log_end *tbls, int rng, unsigned short int seed, const signed short int *difs) |
Signature for the function to restore the other '3' pha values.
vals | The restored values, vals[0] is the starting value The other 3 hold the residuals | |
tbls | The prediction constants for one log end | |
rng | The 'best' range | |
seed | The 'best' range's pha value, used to predict the other 3 ranges | |
difs | Filled in with the residuals |
BFU(* CalStdUnpackPhas)(QDF_calCtx *ctx, QDF_calStdEvt *evt, const unsigned int *src, const unsigned int max, BFU bfu, int style) |
Function prototype for unpacking the pha values.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
style | The packing style |
static __inline unsigned int cal_pha_compose | ( | const ECR_calTower * | ctwr, | |
short int | pha_max, | |||
unsigned short int | pha_dif, | |||
int | n_is_max, | |||
int | lyr, | |||
int | col | |||
) | [static] |
Composes the EBF_calDataLog word.
ctwr | The calibration constants for this tower | |
pha_max | The maximum of the two pedestal subtracted PHA values | |
pha_dif | The difference between the two PHA values (always positive since the smaller is always subtracted from the larger | |
n_is_max | If true, the negative log end is the maximum PHA value else, the positive log end is the maximum PHA value | |
lyr | The layer number of this log | |
col | The column number of this log |
static int cal_pha_mappings_get | ( | unsigned int | present, | |
unsigned char | map[256] | |||
) | [static] |
Create the mappings from an exponent to state for both the max and min exponent values.
present | 2-15 bit masks, the upper 15 representing the values of the present when considering all the maximum PHA values, the left justified (within the lower 16-bits) 15-bit mask representing those values of the exponent present when considering the difference of the two PHA values | |
map | A mapping array taking an packed exponent value and converting it into two nibbles, the upper nibble representing the value of the exponent of the maximum PHA value and the lower representing the value of minimum exponent. |
static void cal_std_restore_phas | ( | const QDF_calCtx * | ctx, | |
QDF_calEvt * | evt, | |||
CalPhaRestore3 | pha_restore3 | |||
) | [static] |
Restores the 'other' 3 ranges when data is in the four range readout mode.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
pha_restore3 | The function to restore the other '3' pha values |
BFU cal_std_unpack_adrs | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu | |||
) | [static] |
Decodes the CAL address list.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
BFU cal_std_unpack_phas | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu | |||
) | [static] |
Decodes the CAL values.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
static BFU cal_std_unpack_phas_exp_man | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu, | |||
int | style | |||
) | [static] |
Decodes the CAL values.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
style | The packing style |
static BFU cal_std_unpack_phas_exp_man_s | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu, | |||
int | style | |||
) | [static] |
Decodes the CAL values.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
style | The packing style |
static BFU cal_std_unpack_phas_max_dif | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu, | |||
int | style | |||
) | [static] |
Decodes the CAL values.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
style | The packing style |
static BFU cal_std_unpack_phas_unknown | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu, | |||
int | style | |||
) | [static] |
Catches the unimplemented decoding styles.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
style | The packing style |
static __inline BFU cal_unpack_adrs_twr | ( | QDF_calCtx * | ctx, | |
QDF_calEvtAdrsTwr * | atwr, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu | |||
) | [static] |
Decodes the address map for a single tower. Once this routine determines the encoding scheme, it is merely dispatches to the correct decoder.
ctx | The CAL compressed data decoding context | |
atwr | The tower address block to complete | |
src | The source bit array | |
bfu | Current decoding context (where and which word) | |
max | The maximum bit position |
static __inline BFU cal_unpack_adrs_twr_list | ( | QDF_calEvtAdrsTwr * | atwr, | |
const unsigned int * | src, | |||
int | max, | |||
BFU | bfu | |||
) | [static] |
Unpacks the hit log addresses for one tower when they are stored as a list.
atwr | The tower address block to complete | |
src | The source bit array | |
max | The maximum bit position | |
bfu | Current decoding context (where and which word) |
static __inline BFU cal_unpack_adrs_twr_qmap | ( | QDF_calEvtAdrsTwr * | atwr, | |
const unsigned int * | src, | |||
int | max, | |||
BFU | bfu | |||
) | [static] |
Unpacks the quad tree address map for one tower.
atwr | The tower address block to complete | |
src | The source bit array | |
max | The maximum bit position | |
bfu | Current decoding context (where and which word) |
static BFU cal_unpack_phas_exp_man_twr | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu, | |||
int | itwr, | |||
int | nexp, | |||
const unsigned char | map[256] | |||
) | [static] |
Decodes the adc values.
ctx | The decoding context | |
evt | The destination event structure | |
src | The source array | |
max | The maximum bit offset in the source array (i.e the length in bits, of src) | |
bfu | Current decoding context (where and which word) | |
itwr | The tower number | |
nexp | Number of bits to encode the exponent | |
map | The mapping of max/dif exponents to encoding index, This maybe be NULL, in which case the 8 extracted bits (nexp must be 8 in this case) will be used as is, i.e. no mapping function will be used, |
static BFU cal_unpack_phas_max_dif_twr | ( | QDF_calCtx * | ctx, | |
QDF_calStdEvt * | evt, | |||
const unsigned int * | src, | |||
unsigned int | max, | |||
BFU | bfu, | |||
int | itwr, | |||
int | exp_dif, | |||
int | exp_max | |||
) | [static] |
Decodes the adc values when packed as the maximum and difference.
ctx | The CAL compressed data decoding context | |
evt | The destination event structure | |
src | The source array | |
max | The maximum bit offset in the source array (i.e the length in bits, of src) | |
bfu | Current decoding context (where and which word) | |
itwr | The tower number | |
exp_dif | Leading zeroes in the difference pha value | |
exp_max | Leading zeroes in the maximum pha value |
static BFU calStd4Decode | ( | QDF_calCtx * | ctx, | |
QDF_calEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu, | |||
CalPhaRestore3 | pha_restore3 | |||
) | [inline, static] |
Decodes 4-range, 0-suppressed CAL events that where encoded prior to the fix to the pha prediction model.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer | |
pha_restore3 | Restores the other 3 pha values |
static void phaA_restore3 | ( | unsigned short int * | vals, | |
const QDF_cal_prd_log_end * | tbls, | |||
int | rng, | |||
unsigned short int | seed, | |||
const signed short int * | difs | |||
) | [static] |
Restores the value for the 'other 3' ranges PHAs.
vals | The restored values, vals[0] is the starting value The other 3 hold the residuals | |
tbls | The prediction constants for one log end | |
rng | The 'best' range | |
seed | The 'best' range's pha value, used to predict the other 3 ranges | |
difs | Filled in with the residuals |
static void phaB_restore3 | ( | unsigned short int * | vals, | |
const QDF_cal_prd_log_end * | tbls, | |||
int | rng, | |||
unsigned short int | seed, | |||
const signed short int * | difs | |||
) | [static] |
Restores the value for the 'other 3' ranges PHAs.
vals | The restored values, vals[0] is the starting value The other 3 hold the residuals | |
tbls | The prediction constants for one log end | |
rng | The 'best' range | |
seed | The 'best' range's pha value, used to predict the other 3 ranges | |
difs | Filled in with the residuals |
BFU QDF_calAStd4Decode | ( | QDF_calCtx * | ctx, | |
QDF_calEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu | |||
) |
Decodes 4-range, 0-suppressed CAL events that where encoded prior to the fix to the pha prediction model.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
BFU QDF_calBStd4Decode | ( | QDF_calCtx * | ctx, | |
QDF_calEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu | |||
) |
Decodes 4-range, 0-suppressed CAL events that where encoded after the fix to the pha prediction model.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
BFU QDF_calStd1Decode | ( | QDF_calCtx * | ctx, | |
QDF_calEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu | |||
) |
Decodes the single-range, 0-suppress, CAL events.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
BFU QDF_calStd4Decode | ( | QDF_calCtx * | ctx, | |
QDF_calEvt * | evt, | |||
const unsigned int * | src, | |||
const unsigned int | max, | |||
BFU | bfu | |||
) |
Decodes 4-range, 0-suppressed CAL events that where encoded prior to the fix to the pha prediction model.
ctx | The CAL compressed data decoding context | |
evt | The CAL event data to fill in | |
src | The data source, i.e. the bit stream | |
max | The maximum bit position | |
bfu | The current bit position and temporary buffer |
static __inline unsigned int restore | ( | unsigned int | pattern | ) | [static] |
Restores 2 interleaved rows to the non-interleaved form.
pattern | The interleaved pattern |
unsigned char Bases[4] [static] |
Initial value:
{ V(0,0) | (V(0,0) << 2) | (V(0,2) << 4), V(1,1) | (V(2,1) << 2) | (V(1,1) << 4), V(2,2) | (V(2,2) << 2) | (V(1,2) << 4), V(3,3) | (V(2,3) << 2) | (V(1,3) << 4) }
unsigned short int Indices[4] [static] |
Initial value:
{ 0 | (1 << 4) | (2 << 8), 3 | (2 << 4) | (4 << 8), 2 | (5 << 4) | (4 << 8), 6 | (5 << 4) | (4 << 8) }
unsigned char Orders[4] [static] |
Initial value:
{ (0 << 0) | (1 << 2) | (2 << 4), (0 << 0) | (1 << 2) | (2 << 4), (0 << 0) | (2 << 2) | (1 << 4), (2 << 0) | (1 << 2) | (0 << 4) }