GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > QSSP / V0-0-0

Constituent: qssp     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

QSSP.c File Reference

Decodes the Science Statistics (Physics) for the handlers. More...

#include "QSSP_pvtdefs.h"
#include "QSSP_efsCtx.h"
#include "dprintf.h"
#include "QSP/QSP_names.h"
#include "QSP/QFCH_cache.h"
#include "QSD/QFC_cache.h"
#include "QSD/QFR_file.h"
#include "LSE/LSEW_ctxTim.h"
#include "EFC/EFS_ids.h"
#include "EFC/EFS_ctxCtb.h"
#include "EFC/EFA_def.h"
#include "EDS/EBF_gem.h"
#include "LSF/LSF.h"
#include "LSF/LSF_scan.h"
#include "LSF/LSF_reason.h"
#include "LDT/BFU.h"
#include <string.h>
#include <stdlib.h>

Include dependency graph for QSSP.c:


Defines

#define RND_8(_v)   ((_v + 7) & ~0x7)

Typedefs

typedef const unsigned int *(* DecodeSample )(QSSP *qssp, QSSP_sample *sample, const unsigned int *dat, unsigned char bridge)
 Signature to decode a statistics sample from the input data.
typedef void *(* UnpackCtx )(QSSP_ctx *qssp, const QSSP_efsCtxBdy *bdy)
 Callback signature to unpack the statistics context.

Functions

static __inline QSSP_fileCacheqssp_file_cache_get (void)
 Returns a pointer to the file cache.
static __inline void qssp_unpack_did (QSSP_ctxDid *did, const LSE_did *src)
 Unpacks the did context.
static __inline void qssp_unpack_ctx_v0 (QSSP_ctx *ctx, const QSSP_efsCtxBdyV0 *v0)
 Unpacks version 0 of the context.
static __inline void qssp_unpack_ctx_v1 (QSSP_ctx *ctx, const QSSP_efsCtxBdyV1 *v1)
 Unpacks version 1 of the context.
static __inline void qssp_unpack_ctx_v2 (QSSP_ctx *ctx, const QSSP_efsCtxBdyV2 *v2)
 Unpacks version 2 of the context.
static __inline unsigned long
int 
compute_dsequence (const QSSP_point *points)
 Computes the event sample size.
static __inline unsigned long
long int 
compute_dtime (const QSSP_point *points)
 Computes the event sample time span.
static unsigned long long int compute_time (const QSSP_point *point)
 Computes the time, in nanoseconds of the current time. If there is an error, -1 is returned;.
static __inline const unsigned
int * 
copy_point (QSSP_point *point, const unsigned int *dat)
 Copies one QSSP_point structure.
static const unsigned int * decode_points_two (QSSP *qssp, QSSP_point *points, const unsigned int *dat, unsigned char bridge)
 Decodes two headers that are just straight copies.
static const unsigned int * decode_points_one (QSSP *qssp, QSSP_point *points, const unsigned int *dat, unsigned char bridge)
 Decodes one header that is just a straight copy.
static const unsigned int * decode_timetone (QSD_timetone *timetone, const QSD_timetone *base, const unsigned int *dat, int flags)
 Decodes one timetone structure based on the differences.
static __inline const unsigned
int * 
decode_points_diff (QSSP *qssp, QSSP_point *points, const unsigned int *dat, unsigned char bridge)
 Decodes the sample point information when it is encoded as a difference from the previous point to the current point.
static const unsigned int * decode_stats_norm (QSSP *qssp, QSSP_statistics *stats, const unsigned int *dat, unsigned char bridge)
 Decodes a normal (not differenced) statistics record.
static const unsigned int * decode_stats_diff (QSSP *qssp, QSSP_statistics *stats, const unsigned int *dat, unsigned char bridge)
 Decodes the statistics in difference format.
static const unsigned int * decode_sample_0 (QSSP *qssp, QSSP_sample *sample, const unsigned int *dat, unsigned char bridge)
 Decodes a format 0 sample record.
static const unsigned int * decode_sample_1 (QSSP *qssp, QSSP_sample *sample, const unsigned int *dat, unsigned char bridge)
 Decodes a format 1 sample record.
static const unsigned int * decode_sample_2 (QSSP *qssp, QSSP_sample *sample, const unsigned int *dat, unsigned char bridge)
 Decodes a format 2 sample record.
static const LSF_contribution * qssp_update_at_datagram (QSSP *qssp, const LSF_contribution *ctb, unsigned int hid)
 Updates the context for the datagram's contributions.
QSSPQSSP_alloc (void *must_be_null)
 Allocates and constructs a QSSP handle.
QSSPQSSP_construct (QSSP *qssp, void *must_be_null)
 The constructor for a QSSP control structure.
void QSSP_destruct (QSSP *qssp)
 The destructor for a QSSP control structure.
const QSSP_ctxQSSP_ctxGet (const QSSP *qssp)
 Locates the statistics context (meta-data).
int QSSP_sizeof (void *must_be_null)
 Returns the size, in bytes, of a QSS control structure.
const LSF_contribution * QSSP_updateAtDatagram (QSSP *qssp, const LSF_datagram *dgm)
 Updates the context at datagram time.
int QSSP_updateAtContribution (QSSP *qssp, const LSF_contribution *ctb)
 Updates the context at datagram time.
static __inline void qssp_sample_add (QSSP_sample *dst, const QSSP_sample *src)
 Adds the source sample to the destination sample.
static __inline int qssp_sample_decode (QSSP *qssp, unsigned int type_id, unsigned char bridge, const unsigned int *dat)
 Decodes the statistics data.
int QSSP_updateAtRecord (QSSP *qssp, const LSF_record *rec)
 Updates the context at record time.
const QSSP_sampleQSSP_retrieve (const QSSP *qssp)
 Retrieves the most recent sample, global or incremental that was processed.

Detailed Description

Decodes the Science Statistics (Physics) for the handlers.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: QSSP.c,v 1.1.1.1 2008/04/02 01:19:25 russell Exp $

Typedef Documentation

const unsigned int *(* DecodeSample)(QSSP *qssp, QSSP_sample *sample, const unsigned int *dat, unsigned char bridge)
 

Signature to decode a statistics sample from the input data.

Returns:
The next decode location
Parameters:
qssp The QSSP context handle
sample The structure to receive the decoded data from
dat The input data
bridge The bridge word, contains decoding options

typedef void(* UnpackCtx)(QSSP_ctx *qssp, const QSSP_efsCtxBdy *bdy)
 

Callback signature to unpack the statistics context.

Parameters:
qssp The destination context block to receive the unpacked dat
bdy The source context block


Function Documentation

static __inline unsigned long int compute_dsequence const QSSP_point points  )  [static]
 

Computes the event sample size.

Parameters:
points The beginning and ending event sample points

static __inline unsigned long long int compute_dtime const QSSP_point points  )  [static]
 

Computes the event sample time span.

Parameters:
points The beginning and ending event sample points

static unsigned long long int compute_time const QSSP_point point  )  [static]
 

Computes the time, in nanoseconds of the current time. If there is an error, -1 is returned;.

Parameters:
point The sample point header to compute the time of

static __inline unsigned int * copy_point QSSP_point point,
const unsigned int *  dat
[static]
 

Copies one QSSP_point structure.

Returns:
Pointer to the next decode address
Parameters:
point The target sample point structure
dat The source data

static __inline const unsigned int * decode_points_diff QSSP qssp,
QSSP_point points,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes the sample point information when it is encoded as a difference from the previous point to the current point.

Returns:
The next location to continue the decoding
Parameters:
qssp The decoding context
points The structure to receive the sample points
dat The input data to decode from
bridge The record's bridge word

static const unsigned int decode_points_one QSSP qssp,
QSSP_point points,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes one header that is just a straight copy.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
points The structure to receive the sample points
dat The input data to decode from
bridge The record's bridge word

static const unsigned int decode_points_two QSSP qssp,
QSSP_point points,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes two headers that are just straight copies.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
points The structures to receive the decode sample points
dat The input data to decode from
bridge The record's bridge word

static const unsigned int * decode_sample_0 QSSP qssp,
QSSP_sample sample,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes a format 0 sample record.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
sample The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

static const unsigned int * decode_sample_1 QSSP qssp,
QSSP_sample sample,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes a format 1 sample record.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
sample The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

static const unsigned int * decode_sample_2 QSSP qssp,
QSSP_sample sample,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes a format 2 sample record.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
sample The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

static const unsigned int * decode_stats_diff QSSP qssp,
QSSP_statistics stats,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes the statistics in difference format.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
stats The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

static const unsigned int * decode_stats_norm QSSP qssp,
QSSP_statistics stats,
const unsigned int *  dat,
unsigned char  bridge
[static]
 

Decodes a normal (not differenced) statistics record.

Returns:
The next address to decode from
Parameters:
qssp The decoding context
stats The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

static const unsigned int * decode_timetone QSD_timetone *  timetone,
const QSD_timetone *  base,
const unsigned int *  dat,
int  flags
[static]
 

Decodes one timetone structure based on the differences.

Returns:
The next address to decode from
Parameters:
timetone The target timetone record
base The base timetone record. The decoded differences will be added to this structure
dat The data to be decoded
flags Flags used to interpret the data to be decoded
  • Bit 0 indicates the absolute Spectrum-Astro Epoch time in seconds is encoded in the the data
  • Bit 1 indicates the time actual timetone flags are stored in the data

QSSP * QSSP_alloc void *  must_be_null  ) 
 

Allocates and constructs a QSSP handle.

Returns:
Pointer to the allocated handle
Parameters:
must_be_null Reserved for future use.

QSSP * QSSP_construct QSSP qssp,
void *  must_be_null
 

The constructor for a QSSP control structure.

Returns:
Pointer to the QSS control structure
Parameters:
qssp The control structure to be constructed. If NULL, a control structure will be allocated
must_be_null Reserved for future use.

const QSSP_ctx * QSSP_ctxGet const QSSP qssp  ) 
 

Locates the statistics context (meta-data).

Parameters:
qssp The statistics context

void QSSP_destruct QSSP qssp  ) 
 

The destructor for a QSSP control structure.

Returns:
Pointer to the QSS control structure
Parameters:
qssp The control structure to be destructed.

static __inline QSSP_fileCache * qssp_file_cache_get void   )  [static]
 

Returns a pointer to the file cache.

Returns:
The file cache
This routine return the handle, creating it if necessary. This not really the right architecture. This needs to be part of a QSS global environment. This can't be accomplished at this time because it would require a backwardly incompatiable change to QSSP_construct.

const QSSP_sample * QSSP_retrieve const QSSP qssp  ) 
 

Retrieves the most recent sample, global or incremental that was processed.

Returns:
Pointer to the sample
Parameters:
qssp The statistics context

static __inline void qssp_sample_add QSSP_sample dst,
const QSSP_sample src
[static]
 

Adds the source sample to the destination sample.

Parameters:
dst The destination sample
src The source sample

static __inline int qssp_sample_decode QSSP qssp,
unsigned int  type_id,
unsigned char  bridge,
const unsigned int *  dat
[static]
 

Decodes the statistics data.

Return values:
If not negative, then the sample type (QSSP_TYPE_K)
If negative
Parameters:
qssp The QSSP context handle
type_id 0 = just the set of values 1 = the difference between the current and last set
bridge bit 0 0 = normal record; 1 = global record
dat The statistics data

int QSSP_sizeof void *  must_be_null  ) 
 

Returns the size, in bytes, of a QSS control structure.

Returns:
The size, in bytes, of a QSS control structure
Parameters:
must_be_null Parameter reserved for future use

static __inline void qssp_unpack_ctx_v0 QSSP_ctx ctx,
const QSSP_efsCtxBdyV0 v0
[static]
 

Unpacks version 0 of the context.

Parameters:
ctx The destination context
v0 The source context

static __inline void qssp_unpack_ctx_v1 QSSP_ctx ctx,
const QSSP_efsCtxBdyV1 v1
[static]
 

Unpacks version 1 of the context.

Parameters:
ctx The destination context
v1 The source context

static __inline void qssp_unpack_ctx_v2 QSSP_ctx ctx,
const QSSP_efsCtxBdyV2 *  v2
[static]
 

Unpacks version 2 of the context.

Parameters:
ctx The destination context
v2 The source context

static __inline void qssp_unpack_did QSSP_ctxDid did,
const LSE_did *  src
[static]
 

Unpacks the did context.

Parameters:
did The destination did
src The source did

static const LSF_contribution * qssp_update_at_datagram QSSP qssp,
const LSF_contribution *  ctb,
unsigned int  hid
[static]
 

Updates the context for the datagram's contributions.

Returns:
Pointer to the next contribution after the datagram's contributions
Parameters:
qssp The QSSP context handle
ctb The datagram's contributions
hid The handler identity
This routine processes the contributions that rightfully belong to the datagram. In the QSEP datagrams, these are called the root contributions. For the QSSP datagrams, I rethought this issue and decided that while the root contribution is a good idea, I had implemented incorrectly. What QSSP does is let the update at datagram time consume those contributes it believes rightfully belong to it.
So that the user knows that these have been processed, this routine returns the next contribution after the datagram's contributions.

int QSSP_updateAtContribution QSSP qssp,
const LSF_contribution *  ctb
 

Updates the context at datagram time.

Return values:
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
Parameters:
qssp The statistics context to update.
ctb The statistics contribution

const LSF_contribution * QSSP_updateAtDatagram QSSP qssp,
const LSF_datagram *  dgm
 

Updates the context at datagram time.

Returns:
The contribution to resume processsing at
Parameters:
qssp The statistics context to update.
dgm The statistics datagram

int QSSP_updateAtRecord QSSP qssp,
const LSF_record *  rec
 

Updates the context at record time.

Return values:
Non-negative values indicate are one of the QSSP_type's
Negative values indicate an unsuccessful update
Parameters:
qssp The statistics context to update.
rec The statistics record


Generated on Wed Apr 2 01:35:52 2008 by  doxygen 1.4.4