GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LSE / V1-3-6
Constituent: lsew     Tag: linux-gcc
#include "LSE/CDF_acd_ped.h"
#include "CDF_acd_def.h"
#include "EDS/ACD_rec.h"
#include "EDS/ECR_acd.h"
#include "EDS/EBF_dir.h"
#include "EDS/EBF_ctb.h"
#include "EDS/EBF_cid.h"
#include "EDS/ACD_unpack.h"
#include "EDS/FFS.h"
#include "LDT/BFP.h"
#include "LDT/HDE.h"
#include "LDT/BIT.h"
#include "EDS/TMR.h"
#include "dprintf.h"
#include <string.h>
Include dependency graph for CDF_acd_ped.c:
Functions | |
static __inline unsigned int | acd_ped_pack (CDF_acd *cdf, unsigned int *buf, unsigned int pos, const ACD_rec *acd) |
Compresses the ACD data when zero suppression has been disabled. | |
static __inline unsigned int | acd_ped_unpack (CDF_acd_ped_data *evt, const ACD_rec *acd, const ECR_acdPedestals *peds) |
Unpacks ACD_unpack style data to CDF_acd_data style. This is easier to pack. | |
static __inline unsigned int | acd_ped_prepare (CDF_acd_ped_data *evt, const ACD_rec *acd, const ECR_acdPedestals *peds) |
Prepares the ACD for compression. This involves
| |
static unsigned int | acd_ped_pack_cables (unsigned int *buf, unsigned int pos, unsigned int cables) |
Packs the any cable masks (missing or timed out). | |
static __inline unsigned int | acd_ped_pack_chnx (unsigned int *buf, unsigned int pos, unsigned int status, const unsigned int *lists) |
Packs cable oriented chnanel exception bit lists as address arrays. | |
static __inline unsigned int | acd_ped_pack_phax (unsigned int *buf, int pos, unsigned int status, const CDF_acd_ped_chn *phaxs, int nphaxs) |
Packs the address and value of any channels with have a PHA value with the parity error or range 1 bit set. | |
static __inline unsigned int | acd_ped_pack_phas (unsigned int *buf, unsigned int pos, HDE *hde, CDF_acd_ped_data *acd) |
Packs the ACD data that falls with the limits of the specified Huffman table. | |
static __inline unsigned int | pack_short (unsigned int *buf, unsigned int pos, short int val) |
Packs the number of bits needed to contain the short integer and its value. | |
static unsigned int | acd_ped_copy (CDF_acd *cdf, unsigned int *buf, unsigned int pos, unsigned int status, const unsigned int *dat, unsigned int nbytes) |
Copies the ACD data when zero suppression has been disabled. This is generally used if and only if the ACD has something seriously wrong with it. | |
unsigned int | CDF_acd_ped_compress (CDF_acd *cdf, unsigned int *buf, unsigned int pos, const EBF_dir *dir) |
Compresses the ACD data when zero suppression has been disabled. |
CVS $Id: CDF_acd_ped.c,v 1.4 2007/04/08 20:36:14 russell Exp $
The format of the compressed ACD pedestal data picks on the following statistical facts
In order to accomodate future improvements to the format, a 2 bit format field introduces the data. The following describes format 0.
Bit | Description |
0 | Decoding overran that available data |
1 | Decoding underan that available data |
2 | Parity error on a cable |
3 | Illegal Cable Number Encountered |
4 | Out of order cable number |
5 | Duplicate Cable Number Encountered |
6 | Cable timeout |
7 | Cable overrun, too much stuff on a cable |
8 | PHA overrun, too few PHA values on a cable |
9 | PHA underrun, too many PHA values on a cable |
10 | Reserved |
11 | Reserved |
Block | Presence | Description
|
Header | Always | Fixed length header describing overall format
|
Missing Cable List | Conditional; Primary Exceptions Present | 1-bit exception present flag, followed by, if true a 12-bit mask indicating which cables are missing data
|
Timeout Cable List | Conditional; Primary Exceptions Present | 1-bit exception present flag, followed by, if true a 12-bit mask indicating which cables have timeouts
|
Header Parity Error List | Conditional; Primary Exceptions Present | 1-bit exception present flag, followed by, if true a 12-bit mask indicating which cables have header parity errors
|
Channel Exception Lists | Conditional, Primary Exceptions Present | 1-bit exception present flag, followed by, if true, 8 lists of channel addresses for each of the bit in the possible 8 channel exception states
|
PHA Exception List | Conditional, Primary Exceptions Present | List of channels addresses plus values for those PHA value having either a data parity error or its range 1 bit set.
|
Secondary Exception List Present | Conditional; Primary Exception Present List, Secondary Exception List Present | This bit provides an escape if more exception fields are needed
|
PHA, Non-Standard List | Always | List of channel address for those PHA values that have either their data parity error bit set, their range 1 bit set, or whosepedestal subtracted PHA value falls are outside the encoding table bounds.
|
PHA Out-of-Range List | Always | The encoding tables cover only a limited range of the possible pedestal subtracted values. This has a fixed table of contents field, describing the smallest and largest entries, followed by a list of addresses and there associated entries. The address field is 1-stop bit + 8-bit address. This is followed by the pedestal subtract index.
|
PHA Huffman Encode List | Always | One Huffman code for each channel not list in the invalid PHA list |
Bit | Width | Meaning |
0 | 2 | Format Number |
3 | 1 | Primary Exceptions Present |
Exception | Width | Description |
0 | 1 | Missing Cable List |
1 | 1 | Timeout Cable List |
2 | 1 | Header Parity Error List |
2 | 1 | Channel Exception List |
3 | 1 | PHA exception list |
4 | 1 | Secondary Exception List |
Status Bit Number | Description |
0 | Accept bit is not 0 |
1 | PHA Accept bit is 0 |
2 | PHA Valid bit is 0 |
/par PHA, Exceptions List This is an fixed header followed by a 1 stop bit + 8 channel bit address + a value field. The fixed header describes the contents of the value field which is composed of (optionally)
The table of contents is
Bit | Width | Meaning |
0 | 1 | Range Bit Present |
1 | 4 | Number of bits in PHA field |
5 | 1 | Data Parity Error Bit Present |
For example, if the are no channels with data parity errors, but one channel with a range 1 bit set and the maximum range of the PHA index of 0x21, then this value will be
Range Present = 1 Number of Bits = 6 Data Parity Error = 0 -> Table of contents = 1 0110 0 = 0x4c
Bit | |
0-3 | Number of bits needed to hold the minimum ADC index |
4-7 | Number of bits needed to hold the maximum ADC index |
The encode ADC index takes the number of bits needed to encode the range from min to max.
|
Copies the ACD data when zero suppression has been disabled. This is generally used if and only if the ACD has something seriously wrong with it.
|
|
Compresses the ACD data when zero suppression has been disabled.
|
|
Packs the any cable masks (missing or timed out).
|
|
Packs cable oriented chnanel exception bit lists as address arrays.
|
|
Packs the ACD data that falls with the limits of the specified Huffman table.
|
|
Packs the address and value of any channels with have a PHA value with the parity error or range 1 bit set.
Bit 5 - Rng 1 bit present flag Bits 1-4 - Size of the ADC value Bit 0 - Data Parity Error present flag For each entry, the following value is packed [ADR] - 8 bits [RNG] - 1 bit, present iff flag bit indicates as such [ADC] - 0-12 bits [PE] - 1 bit, present iff flag bit indicates as such [STOP] - 1 bit, if 1, no more values present |
|
Prepares the ACD for compression. This involves
|
|
Unpacks ACD_unpack style data to CDF_acd_data style. This is easier to pack.
|
|
Compresses the ACD data when zero suppression has been disabled.
|
|
Packs the number of bits needed to contain the short integer and its value.
|