GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSSP / V1-1-1 > qstd_print / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

qstd_print.c File Reference

Program to dump the contents of a stream of physics statistics datagrams. More...

#include <QSSP/QSTD.h>
#include <QSSP/QSTD_ctx.h>
#include <QSSP/QSTD_sample.h>
#include <QSSP/QSTD_samplesPrint.h>
#include <QSSP/QSTD_labels.h>
#include <QSSP/QSSP_ctxPrint.h>
#include <QSD/CCSDS_istream.h>
#include <QSD/CCSDS_apidDsc.h>
#include <QSD/CCSDS_telemetry.h>
#include <dprintf.h>
#include <LSE/LSEW_ctxTim.h>
#include <LSF/LSF.h>
#include <LSF/LSF_ids.h>
#include <LSF/LSF_print.h>
#include <LSF/LSF_reason.h>
#include <EFC/EFS_ids.h>
#include <CDM/CDM_pubdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Classes

struct  _Ctl
 Run time print options/parameters. More...
struct  _ApidStats
 Apid statistics. More...
struct  _QstdPrintCtx
 The print context. More...
struct  _DgmStream
 The EFS print datagram context for one Datagram Id. More...
struct  _ApidStream
 The EFS print context for one APID. More...

Defines

#define RND_TO(_x, _r)   (((_x) + (_r) - 1) / (_r)) * (_r)
 Round _x up to the nearest boundary of _r.

Typedefs

typedef enum _PRT_M PRT_M
 Typedef for enum PRT_M.
typedef struct _Ctl Ctl
 Typedef for struct _Ctl.
typedef struct _ApidStats ApidStats
 Typedef for struct _ApidStats.
typedef struct _QstdPrintCtx QstdPrintCtx
 Typedef for struct _QstdPrintCtx.
typedef struct _ApidStream ApidStream
 Typedef for struct _ApidStream.
typedef struct _DgmStream DgmStream
 Typedef for struct _DgmStream.

Enumerations

enum  _PRT_M {
  PRT_M_HDR = 0x0001,
  PRT_M_RAW = 0x0002,
  PRT_M_STATS = 0x0004
}
 What to print. More...

Functions

static void report_usage (void)
 Brief explanation on qsep_print usage.
static int get_ctl (Ctl *ctl, int argc, char *const argv[])
 Examines the command line parameters and fills the print run time options control structure.
static int loadLib (const char *library_name, int verbose)
 Dynamically loads the specified configuration library.
static int size (const Ctl *ctl)
 Returns the size, in bytes, of the control handle.
static void construct_astreams (ApidStream *astreams, int astream_cnt, unsigned int which, Ctl *ctl)
 Constructs the individual APID streams.
static void destruct_astreams (ApidStream *astreams, int astream_cnt, unsigned int which)
 Constructs the individual APID streams.
static void construct (QstdPrintCtx *ptx, ApidStream *astream)
 Constructs/initializes the context for handling the statistics datagrams.
static void destruct (QstdPrintCtx *ptx)
 Destructor for the context for handling the statistics datagrams.
static __inline ApidStreamresolve (ApidStream *astreams, int astream_cnt, const CCSDS_telemetry *hdr)
 Given a CCSDS header containing the APID, the function resolves the Apid stream.
static LSF_scanContributionHandler screen_dgm (ApidStream *astream, const LSF_datagram *dgm)
 Screens out any datagrams that are not LSEP event datagrams.
static LSF_scanRecordHandler print_ctb (DgmStream *dstream, const LSF_contribution *ctb)
 Prints the contribution context information.
static unsigned int print_rec (DgmStream *dstream, const LSF_record *rec)
 Prints the record information.
static unsigned int print_rec_only (DgmStream *dstream, const LSF_record *rec)
 Prints the record information.
static void printRaw (const unsigned int *pdata, unsigned int cnt)
 Bare bones dump of the specified number of 32-bit words.
static void new_line (void)
 Prints a new line.
static int qstd_print (int argc, char *const argv[])
 Process a file of science statistics datagrams.
int main (int argc, char *const argv[])
 Process a file of physics events datagrams.


Detailed Description

Program to dump the contents of a stream of physics statistics datagrams.

Author:
JJRussell - russell@slac.stanford.edu

   Cvs $Id: qstd_print.c,v 1.4 2011/03/29 00:14:58 russell Exp $

Usage
   > qstd_print -d -n:<# of stats> -s<# to skip> <file_name>
  

For a complete explanation type qstd_print with no arguments

Define Documentation

#define RND_TO ( _x,
_r   )     (((_x) + (_r) - 1) / (_r)) * (_r)

Round _x up to the nearest boundary of _r.

Returns:
The rounded of value
Parameters:
_x The value to round
_r The rounding


Enumeration Type Documentation

enum _PRT_M

What to print.

Enumerator:
PRT_M_HDR  Print the headers
PRT_M_RAW  Print the raw packet
PRT_M_STATS  Print the stats


Function Documentation

static void construct ( QstdPrintCtx ptx,
ApidStream astream 
) [static]

Constructs/initializes the context for handling the statistics datagrams.

Parameters:
ptx The print context handle to construct
astream The application stream to associate with this print driver.

References _QstdPrintCtx::qstd.

Referenced by construct_astreams().

static void construct_astreams ( ApidStream astreams,
int  astream_cnt,
unsigned int  which,
Ctl ctl 
) [static]

Constructs the individual APID streams.

Parameters:
astreams The array of APID streams to construct
astream_cnt The count of APID streams to construct
which Bit mask of which CPUs to process
ctl The control structure

References _ApidStream::apid, construct(), _ApidStream::ctl, _ApidStream::dsc, _ApidStream::dsc_buf, _ApidStream::ptx, size(), and _ApidStream::stats.

Referenced by qstd_print().

static void destruct ( QstdPrintCtx ptx  )  [static]

Destructor for the context for handling the statistics datagrams.

Parameters:
ptx The print context handle to destruct

References _QstdPrintCtx::qstd.

Referenced by destruct_astreams().

static void destruct_astreams ( ApidStream astreams,
int  astream_cnt,
unsigned int  which 
) [static]

Constructs the individual APID streams.

Parameters:
astreams The array of APID streams to destruct
astream_cnt The count of APID streams to destruct
which Bit mask of which CPUs to process

References destruct(), and _ApidStream::ptx.

Referenced by qstd_print().

static int get_ctl ( Ctl ctl,
int  argc,
char *const   argv[] 
) [static]

Examines the command line parameters and fills the print run time options control structure.

Parameters:
ctl The parameter run time options block.
argc The number of command line parameters.
argv The array of pointers to the command line parameters.
Return values:
0,Everything is okay.
-1,Incorrect command usage. Usually this means that the input file name was absent.

References _Ctl::cpus, _Ctl::dmp_ccsds, _Ctl::file, loadLib(), _Ctl::nprint, _Ctl::nskip, _Ctl::options, PRT_M_HDR, PRT_M_RAW, PRT_M_STATS, and report_usage().

Referenced by qstd_print().

static int loadLib ( const char *  library_name,
int  verbose 
) [static]

Dynamically loads the specified configuration library.

Return values:
0,success 
-1,failure 
Parameters:
library_name The name of the library to load
verbose The verbosity level

Referenced by get_ctl().

int main ( int  argc,
char *const   argv[] 
)

Process a file of physics events datagrams.

Returns:
Overall status
Parameters:
argc The argument count
argv The vector of command line strings

References qstd_print().

static LSF_scanRecordHandler print_ctb ( DgmStream dstream,
const LSF_contribution *  ctb 
) [static]

static unsigned int print_rec ( DgmStream dstream,
const LSF_record *  rec 
) [static]

static unsigned int print_rec_only ( DgmStream dstream,
const LSF_record *  rec 
) [static]

Prints the record information.

Parameters:
dstream The datagram stream handle
rec The record

References _DgmStream::astream, _ApidStream::ctl, new_line(), _ApidStats::nrecs, _Ctl::options, printRaw(), PRT_M_HDR, PRT_M_RAW, and _ApidStream::stats.

Referenced by print_ctb(), and print_rec().

static void printRaw ( const unsigned int *  pdata,
unsigned int  cnt 
) [static]

Bare bones dump of the specified number of 32-bit words.

Parameters:
pdata Pointer to the data to print
cnt The number of 32-bit words to dump

Referenced by print_ctb(), and print_rec_only().

static int qstd_print ( int  argc,
char *const   argv[] 
) [static]

Process a file of science statistics datagrams.

Returns:
Overall status
Parameters:
argc The argument count
argv The vector of command line strings

References construct_astreams(), _Ctl::cpus, destruct_astreams(), _Ctl::dmp_ccsds, _ApidStream::dsc, _Ctl::file, get_ctl(), resolve(), and screen_dgm().

Referenced by main().

static __inline ApidStream * resolve ( ApidStream astreams,
int  astream_cnt,
const CCSDS_telemetry *  pkt 
) [static]

Given a CCSDS header containing the APID, the function resolves the Apid stream.

Returns:
IF the APID is one of the known streams, then resolves returns a pointer to the associated stream. If not, then NULL
Parameters:
astreams The array of APID streams
astream_cnt The number of APID streams
pkt The CCSDS packet

Referenced by qstd_print().

static LSF_scanContributionHandler screen_dgm ( ApidStream astream,
const LSF_datagram *  dgm 
) [static]

Screens out any datagrams that are not LSEP event datagrams.

Returns:
Either a stop scan signal or the contribution handler
Parameters:
astream The APID stream handle
dgm The datagram

References _DgmStream::astream, _QSTD_ctx::com, _ApidStream::ctl, _ApidStream::dstream, _QSTD_ctx::labels, _QSTD_ctxVersions::master, _ApidStats::nctbs, _ApidStats::ndgms, new_line(), _Ctl::options, print_ctb(), PRT_M_HDR, PRT_M_STATS, _ApidStream::ptx, _QstdPrintCtx::qstd, _ApidStream::stats, and _QSTD_ctx::version.

Referenced by qstd_print().

static int size ( const Ctl ctl  )  [static]

Returns the size, in bytes, of the control handle.

Returns:
The size, in bytes, of the control handle.
Parameters:
ctl The control block
The amount of memory returned by this routine should be allocated by caller and passed, along with prm, to construction routine

Referenced by construct_astreams().


Generated on Fri Sep 30 19:02:33 2011 by  doxygen 1.5.8