GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSEP / V3-4-1 > qsep_extract / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

qsep_extract.c File Reference

Program to extract the event data from LSD to EBF format. More...

#include <QSEP/QSEP.h>
#include <QSEP/QSEP_ctx.h>
#include <QSEP/QSEP_dgmDvr.h>
#include <qsep_not_dismissable.h>
#include <qsep_select.h>
#include <QSE/QSE_ebf.h>
#include <QSD/CCSDS_istream.h>
#include <QSD/CCSDS_apidDsc.h>
#include <QSD/CCSDS_telemetry.h>
#include <QSD/CCSDS_telemetryPrint.h>
#include <LSF/LSF.h>
#include <LSF/LSF_scan.h>
#include <EDS/ESS.h>
#include <EDS/io/EBF_stream.h>
#include <PBI/FFS.ih>
#include <PBI/PTR.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

Classes

struct  _Ctl
 Run time print options/parameters. More...
struct  _ApidStream
 The print context for one APID. More...

Defines

#define APID_STREAM_CNT   5
 The number of Apid Streams, this is really the number of LAT CPUs.

Typedefs

typedef struct _Ctl Ctl
 Typedef for struct _Ctl.
typedef struct _ApidStream ApidStream
 Typedef for struct _ApidStream.

Functions

static int qsep_extract (Ctl *ctl)
 Process a file of calibration events datagrams.
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 void report_usage (int verbose)
 Brief explanation on qsep_extract usage.
static int construct_astreams (ApidStream *astreams, int astream_cnt, unsigned int which, Ctl *ctl)
 Constructs the individual APID streams.
static int resolve (ApidStream *astreams, const CCSDS_telemetry *pkt, CCSDS_apidDsc **dsc)
 Given a CCSDS header containing the APID, the function resolves the Apid stream.
static unsigned int handle_rec (ApidStream *astream, const LSF_record *rec, QSEP *qsep)
 Extracts and writes the contents of the event.
static void rsd_add (QSE_ebfEvt *evt, const QSEP *qsep, unsigned int rsdmsk)
 Adds as much result summary information as can fit into the 8-word event header.
static void new_line (void)
 Prints a new line.
int main (int argc, char *const argv[])
 Process a file of calibration events datagrams.


Detailed Description

Program to extract the event data from LSD to EBF format.

Author:
russellslac.stanford.edu
Usage
   > qsep_extract -n:<# of events> -s<# to skip> -o<file_name> <file_name>
  

For a complete explanation type qsep_extract with no arguments

Function Documentation

static int 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 _Ctl::abort, _ApidStream::apid, APID_STREAM_CNT, _Ctl::cfg, _ApidStream::ctl, _Ctl::dmp_ccsds, _ApidStream::dsc, _ApidStream::dsc_buf, handle_rec(), _Ctl::maxcells, _Ctl::nprocess, _Ctl::nskip, _Ctl::ofile, _ApidStream::ostream, and _Ctl::resource_level.

Referenced by qsep_extract().

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::abort, _Ctl::cfg, _Ctl::cpus, _Ctl::cs_ignore, _Ctl::dmp_ccsds, _Ctl::ess, _Ctl::ifile, _Ctl::maxcells, _Ctl::nerr, _Ctl::nevent, _Ctl::nout, _Ctl::nprocess, _Ctl::nskip, _Ctl::nwrite, _Ctl::ofile, qsep_select_parse_size(), report_usage(), _Ctl::resource_level, _Ctl::rsdmsk, _Ctl::size_type, and _Ctl::verbose.

Referenced by main().

static unsigned int handle_rec ( ApidStream astream,
const LSF_record *  rec,
QSEP *  qsep 
) [static]

Extracts and writes the contents of the event.

Parameters:
astream The apid stream
rec The LSF record containing the event
qsep The QSEP context

References _Ctl::cs_ignore, _ApidStream::ctl, _Ctl::dir, _Ctl::ebf, _Ctl::ebf_siz, _Ctl::ess, _Ctl::nerr, _Ctl::nevent, _Ctl::nout, _Ctl::nwrite, _ApidStream::ostream, QSEP_DGMDVR_FATE_K_CONTINUE, QSEP_DGMDVR_FATE_K_STOP, qsep_not_dismissable(), rsd_add(), _Ctl::rsdmsk, and _Ctl::size_type.

Referenced by construct_astreams().

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

Process a file of calibration events datagrams.

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

References _Ctl::dir, _Ctl::ebf, _Ctl::ebf_siz, get_ctl(), and qsep_extract().

int qsep_extract ( Ctl ctl  )  [static]

Process a file of calibration events datagrams.

Returns:
Overall status
Parameters:
ctl The control structure

References APID_STREAM_CNT, construct_astreams(), _Ctl::cpus, _Ctl::ifile, _Ctl::nerr, _Ctl::nevent, new_line(), _Ctl::nout, resolve(), and _Ctl::verbose.

Referenced by main().

static void report_usage ( int  verbose  )  [static]

Brief explanation on qsep_extract usage.

Parameters:
verbose If true, full documentation

References qsep_select_usage().

Referenced by get_ctl().

static int resolve ( ApidStream astreams,
const CCSDS_telemetry *  pkt,
CCSDS_apidDsc **  dsc 
) [static]

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

Return values:
CCSDS_ISTREAM_RESOLVER_STATUS_K_SUCCESS,if the descriptor was found
CCSDS_ISTREAM_RESOLVER_STATUS_K_NOTFOUND,if the descriptor was not found.
Parameters:
astreams The array of APID streams
pkt The CCSDS telemetry packet
dsc Returned as the pointer to the found descriptor

References APID_STREAM_CNT, and _ApidStream::dsc.

Referenced by qsep_extract().

static void rsd_add ( QSE_ebfEvt *  evt,
const QSEP *  qsep,
unsigned int  rsdmsk 
) [static]

Adds as much result summary information as can fit into the 8-word event header.

Parameters:
evt The decoded event
qsep The context block
rsdmsk A big-endian style bit-mask giving the target list of handlers
Due to the finite size of the header block, only a total of 6 words will be copied from up to 4 event handlers. The first 32-bit word contains 4 bytes, with the low 3 bits giving the length (in 32-bit words and the upper 5 bits giving the ID.

References _QSEP_ctxRsd::dat_list, _QSEP_ctxRsd::dscs, _QSEP_rsdDsc::len, _QSEP_rsdDsc::ptr, and _QSEP_ctx::rsd.

Referenced by handle_rec().


Generated on Fri Sep 30 19:03:32 2011 by  doxygen 1.5.8