GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSSP / dev > qssp / linux-gcc
#include <QSSP/QASC.h>
#include <QSSP/QASC_sample.h>
#include <QASC_pvtdefs.h>
#include <QSP/QFCP_cache.h>
#include <QSD/QSD_acdMap.h>
#include <QSD/QFC_member.h>
#include <QSD/QFR_file.h>
#include <EMP/ASC_ascCtb.h>
#include <EMP/ASC_ids.h>
#include <LSF/LSF_reason.h>
#include <EFC_DB/EH_ids.h>
#include <ZLIB/zlib.h>
#include <PBI/Endianness.h>
#include <PBI/Check.h>
#include <PBI/Ofs.h>
#include <string.h>
#include <stdio.h>
Defines | |
#define | NULL ((void *)0) |
#define | RND_8(_v) ((_v + 7) & ~0x7) |
Rounds-up an integer to the nearest multiply of 8. This is used to set allocations to quadwords. | |
Functions | |
static QASC_STATUS | expand_raw0 (QASC_sampleV0 *qasc, const ASC_ascBdy_Raw0 *asc, unsigned int size) |
Expand the ASC data in the raw format to QASC format. | |
static QASC_STATUS | expand_gzip0 (QASC_sampleV0 *qasc, const ASC_ascBdy_Gzip0 *asc, unsigned int size) |
Expand the ASC data in the raw format to QASC format. | |
static int | do_inflate (const void *src, unsigned int srcSize, void *dst, unsigned int dstSize) |
Decompress the source buffer to the destination buffer. | |
static void | add_samples (QASC_sampleV0 *dst, const QASC_sampleV0 *src) |
Adds the source sample, src, to the destination sample, dst. | |
static __inline QFCP_cache * | qasc_file_cache_get (void) |
Returns a pointer to the file cache. | |
QASC * | QASC_alloc (void *must_be_null) |
Allocates and constructs a QASC handle. | |
QASC * | QASC_construct (QASC *qasc, void *must_be_null) |
The constructor for a QASC control structure. | |
void | QASC_destruct (QASC *qasc) |
The destructor for a QASC control structure. | |
const QASC_ctx * | QASC_ctxGet (const QASC *qasc) |
Locates the statistics context (meta-data). | |
int | QASC_sizeof (void *must_be_null) |
Return the size, in bytes, of the buffer needed to handle a QASC datagram. | |
QASC_status | QASC_expand (QASC *qasc, const LSF_contribution *ctb) |
Routine to check integrity and swap/uncompress input data into a 2nd buffer. | |
const LSF_contribution * | QASC_updateAtDatagram (QASC *qasc, const LSF_datagram *dgm) |
Updates the context at datagram time. | |
int | QASC_updateAtContribution (QASC *qasc, const LSF_contribution *ctb) |
Updates the context at datagram time. | |
int | QASC_updateAtRecord (QASC *qasc, const LSF_record *rec) |
Updates the context at record time. | |
int | QASC_idxGemGet (int group, int channel) |
Maps an ACD GEM group and channel into a universal index. | |
int | QASC_idxAemGet (int board, int channel) |
Maps an ACD AEM board number and channel into a universal index. | |
static __inline void | swap32bN (unsigned int *d32, const unsigned int *s32, int n32) |
Swaps the specified number of 32-bit integers, presumed to be in a big endian representation to the local endianness.. This is a NOOP on big endian machines. | |
static __inline int | inflater (const void *src, unsigned int srcSize, void *dst, unsigned int dstSize) |
Decompress the source buffer to the destination buffe. | |
static __inline void | pointV0_transfer (QSSP_pointV0 *dst, const EMP_hdrEvt *src) |
Transfer an EMP_hdrEvt structure to a QSSP_point structure. | |
static __inline void | span_transfer (QSSP_spanV1 *dst, const EMP_hdr *src) |
Transfers the contents of an EMP_hdr structure to a QSSP_spanV1 structure. | |
static void __inline | monitor_transfer (QASC_monitorV0 *dst, const ASC_stats *src, unsigned int nsampled) |
Transfers the contents of an ASC_stats structure plus the number of events sampled to a QASC_monitorV0 structure. |
CVS $Id: QASC.c,v 1.4 2011/03/29 00:14:57 russell Exp $
#define RND_8 | ( | _v | ) | ((_v + 7) & ~0x7) |
Rounds-up an integer to the nearest multiply of 8. This is used to set allocations to quadwords.
Referenced by qasc_file_cache_get(), and qstd_file_cache_get().
static void add_samples | ( | QASC_sampleV0 * | dst, | |
const QASC_sampleV0 * | src | |||
) | [static] |
Adds the source sample, src, to the destination sample, dst.
dst | The destination sample | |
src | The source sample |
References _QASC_monitorV0::etotal, _QASC_monitorV0::frequency, _QASC_sampleV0::monitor, QSSP_spanV1Update(), _QASC_sampleV0::span, and _QASC_sampleV0::statistics.
Referenced by QASC_expand().
static int do_inflate | ( | const void * | src, | |
unsigned int | srcSize, | |||
void * | dst, | |||
unsigned int | dstSize | |||
) | [static] |
Decompress the source buffer to the destination buffer.
0 | Success | |
-1 | Failure |
src | The source buffer of compressed data | |
srcSize | The size, in bytes, of the source buffer of compressed data | |
dst | The destination buffer for decompressed data | |
dstSize | The available space, in bytes, of the destination buffer |
Referenced by expand_gzip0().
static QASC_STATUS expand_gzip0 | ( | QASC_sampleV0 * | qasc, | |
const ASC_ascBdy_Gzip0 * | asc, | |||
unsigned int | size | |||
) | [static] |
Expand the ASC data in the raw format to QASC format.
QASC_STATUS_SUCCESS,if | successful (0) | |
QASC_STATUS_CTB_BAD_LEN32,if | the contributor length is inconsistent with the data. | |
QASC_STATUS_CTB_INFLATE_FAIL,indicates | inflate failed |
qasc | The data access handle to be filled | |
asc | The source data | |
size | The size, in bytes, of the source data. |
References do_inflate(), _QASC_sampleV0::monitor, monitor_transfer(), _QSSP_spanV1::nused, QASC_STATUS_CTB_BAD_LEN32, QASC_STATUS_CTB_INFLATE_FAIL, QASC_STATUS_SUCCESS, _QASC_sampleV0::span, span_transfer(), and _QASC_sampleV0::statistics.
Referenced by QASC_expand().
static QASC_STATUS expand_raw0 | ( | QASC_sampleV0 * | qasc, | |
const ASC_ascBdy_Raw0 * | asc, | |||
unsigned int | size | |||
) | [static] |
Expand the ASC data in the raw format to QASC format.
QASC_STATUS_SUCCESS,if | successful (0) | |
QASC_STATUS_CTB_BAD_LEN32,if | the contributor length is inconsistent with the data. |
qasc | The data access handle to be filled | |
asc | The source data | |
size | The size, in bytes, of the source data. |
References _QASC_sampleV0::monitor, monitor_transfer(), _QASC_monitorV0::nsampled, QASC_STATUS_CTB_BAD_LEN32, QASC_STATUS_SUCCESS, _QASC_sampleV0::span, span_transfer(), and _QASC_sampleV0::statistics.
Referenced by QASC_expand().
static __inline int inflater | ( | const void * | src, | |
unsigned int | srcSize, | |||
void * | dst, | |||
unsigned int | dstSize | |||
) | [static] |
Decompress the source buffer to the destination buffe.
0 | Success | |
-1 | Failure |
src | The source buffer of compressed data | |
srcSize | The size, in bytes, of the source buffer of compressed data | |
dst | The destination buffer for decompressed data | |
dstSize | The available space, in bytes, of the destination buffer |
static __inline void monitor_transfer | ( | QASC_monitorV0 * | dst, | |
const ASC_stats * | src, | |||
unsigned int | nsampled | |||
) | [static] |
Transfers the contents of an ASC_stats structure plus the number of events sampled to a QASC_monitorV0 structure.
dst | The destination QASC_monitor structure | |
src | The source ASC_stats structure | |
nsampled | The number of events sampled |
References _QASC_monitorV0::nsampled.
Referenced by expand_gzip0(), and expand_raw0().
static __inline void pointV0_transfer | ( | QSSP_pointV0 * | dst, | |
const EMP_hdrEvt * | src | |||
) | [static] |
Transfer an EMP_hdrEvt structure to a QSSP_point structure.
dst | The destination QSSP_point structure | |
src | The source EMP_hdrEvt structure |
References _QSSP_pointV0::gemClock, QSSP_pointV0Complete(), _QSSP_pointV0::relative, _QSSP_pointV0::sequence, and _QSSP_pointV0::timetones.
Referenced by span_transfer().
QASC* QASC_alloc | ( | void * | must_be_null | ) |
Allocates and constructs a QASC handle.
must_be_null | Reserved for future use. |
References QASC_construct().
The constructor for a QASC control structure.
qasc | The control structure to be constructed. If NULL, a control structure will be allocated | |
must_be_null | Reserved for future use. |
References _QASC_ctx::com, _QASC::ctx, _QASC::cumulative, _QASC_ctx::cumulative, _QASC::free, _QASC_ctx::qasc, qasc_file_cache_get(), QASC_sizeof(), and QSSP_ctxConstruct().
Referenced by QASC_alloc().
Locates the statistics context (meta-data).
qasc | The statistics context |
References _QASC::ctx.
void QASC_destruct | ( | QASC * | qasc | ) |
The destructor for a QASC control structure.
qasc | The control structure to be destructed. |
References _QASC::free.
QASC_status QASC_expand | ( | QASC * | qasc, | |
const LSF_contribution * | ctb | |||
) |
Routine to check integrity and swap/uncompress input data into a 2nd buffer.
QASC_STATUS_SUCCESS,if | successful (0) | |
QASC_STATUS_CTB_BAD_LEN32,if | the contributor length is inconsistent with the data. | |
QASC_STATUS_CTB_UNKNOWN_VER,if | the encoding/data format version is unknown. | |
QASC_STATUS_CTB_INFLATE_FAIL,for | compressed formats, indicates the failure to inflate the data |
qasc | The data access handle to be filled | |
ctb | Input buffer |
This routine assumes the contributor has been byte-swapped.
References add_samples(), _QASC::ctx, _QASC::cumulative, _QASC_ctx::current, expand_gzip0(), expand_raw0(), QASC_STATUS_CTB_UNKNOWN_VER, _QASC::sample, and _QASC_sample::v0.
Referenced by QASC_updateAtContribution().
static __inline QFCP_cache * qasc_file_cache_get | ( | void | ) | [static] |
Returns a pointer to the file cache.
References RND_8.
Referenced by QASC_construct().
int QASC_idxAemGet | ( | int | board, | |
int | channel | |||
) |
Maps an ACD AEM board number and channel into a universal index.
>=0,The | universal index for the specifed ACD AEM board and channel | |
< | 0, Invalid board or channel number |
board | This is a value between 0 and 11 corresponding to the the 12 AEM FREE board/cable numbers
| |
channel | The channel, 0-18, within each FREE board/cable. |
int QASC_idxGemGet | ( | int | group, | |
int | channel | |||
) |
Maps an ACD GEM group and channel into a universal index.
>=0,The | universal index for the specifed ACD group and channel | |
< | 0, Invalid list or channel number |
group | This is a value between 0 and 3 corresponding to the 4 words in the GEM record -0 XZ plane -1 YZ plane -2 XY plane -3 RU plane | |
channel | The channel, 0-31, within each list. The bits are numbered from least significant bit to most significant bit |
int QASC_sizeof | ( | void * | must_be_null | ) |
Return the size, in bytes, of the buffer needed to handle a QASC datagram.
The | size, in bytes, of the buffer needed to handle a QASC datagram |
Referenced by QASC_construct().
int QASC_updateAtContribution | ( | QASC * | qasc, | |
const LSF_contribution * | ctb | |||
) |
Updates the context at datagram time.
If | have a statistics sample contribution, the number of records in the contribution. | |
>0,if | have a record contributor | |
=0,if | have the contribution context | |
-1,if | unrecognized |
qasc | The statistics context to update. | |
ctb | The statistics contribution |
References _QSSP_ctxKeys::cfg, _QSSP_ctxIds::cfg, _QASC_ctx::com, _QASC::ctx, _QSSP_ctx::dgm, _QASC::dgm_version, _QSSP_ctxIds::handler, _QSSP_ctx::id, _QSSP_ctx::key, _QSSP_ctxKeys::master, QASC_expand(), and _QSSP_ctxKeys::sbs.
const LSF_contribution* QASC_updateAtDatagram | ( | QASC * | qasc, | |
const LSF_datagram * | dgm | |||
) |
Updates the context at datagram time.
qasc | The statistics context to update. | |
dgm | The statistics datagram |
References _QASC_ctx::com, _QASC::ctx, _QASC::cumulative, _QSSP_ctx::dgm, _QASC::dgm_version, _QSSP_ctx::files, QSSP_ctxUpdateAtDatagram(), and _QASC_ctx::version.
int QASC_updateAtRecord | ( | QASC * | qasc, | |
const LSF_record * | rec | |||
) |
Updates the context at record time.
Non-negative | values indicate are one of the QASC_type's | |
Negative | values indicate an unsuccessful update |
qasc | The statistics context to update. | |
rec | The statistics record |
References _QASC::ctx, _QASC_ctx::current, _QASC_sampleV0::type, and _QASC_sample::v0.
static __inline void span_transfer | ( | QSSP_spanV1 * | dst, | |
const EMP_hdr * | src | |||
) | [static] |
Transfers the contents of an EMP_hdr structure to a QSSP_spanV1 structure.
dst | The destination QSSP_spanV1 structure | |
src | The source EMP_hdr structure |
References _QSSP_spanV1::nused, _QSSP_spanV1::points, pointV0_transfer(), and QSSP_spanV1Complete().
Referenced by expand_gzip0(), and expand_raw0().
void swap32bN | ( | unsigned int * | d32, | |
const unsigned int * | s32, | |||
int | n32 | |||
) | [static] |
Swaps the specified number of 32-bit integers, presumed to be in a big endian representation to the local endianness.. This is a NOOP on big endian machines.
d32 | The destinatin array of 32-bit swapped words | |
s32 | The source array of 32-bit words to swap | |
n32 | The number of words to word swap |