GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSEC / dev > qsec_print / sun-gcc
#include <QSEC/QSEC.h>
#include <QSD/CCSDS_istream.h>
#include <QSD/CCSDS_apidDsc.h>
#include <QSD/CCSDS_telemetry.h>
#include <QSE/QSE_printDvr.h>
#include <QSE/QSE_update.h>
#include <QSE/QSE_ctx.h>
#include <QSE/QSE_ctxPrint.h>
#include <QSE/QSE_dirPrint.h>
#include <QSE/QSE_aem.h>
#include <QSE/QSE_aemPrint.h>
#include <QSE/QSE_aemUnpack.h>
#include <QSE/QSE_acd.h>
#include <QSE/QSE_acdPrint.h>
#include <QSE/QSE_acdUnpack.h>
#include <QSE/QSE_tkr.h>
#include <QSE/QSE_tkrPrint.h>
#include <QSE/QSE_tkrUnpack.h>
#include <QSE/QSE_cal.h>
#include <QSE/QSE_calPrint.h>
#include <QSE/QSE_calUnpack.h>
#include <QSE/QSE_gemPrint.h>
#include <LSE/LSE_ids.h>
#include <LSF/LSF.h>
#include <LSF/LSF_print.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_match.h>
#include <EDS/EBF_gem.h>
#include <PBI/PTR.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Classes | |
struct | _Ctl |
struct | _ApidStream |
Defines | |
#define | RND_TO(_x, _r) (((_x) + (_r) - 1) / (_r)) * (_r) |
#define | CLK_FREQ 20000000 |
#define | CLK_BITS 25 |
#define | CLK_MASK ((1 << CLK_BITS) - 1) |
#define | SECS_MASK ((1 << (32 - CLK_BITS)) - 1) |
Typedefs | |
typedef enum _PRT_M | PRT_M |
typedef struct _Ctl | Ctl |
typedef struct _ApidStream | ApidStream |
Enumerations | |
enum | { QSEC_APID_BASE = 0x3c5, QSEC_MAX_APIDS = 4 } |
Miscellaneous constants. More... | |
enum | _PRT_M { PRT_M_ACD = 0x1, PRT_M_AEM = 0x2, PRT_M_TKR = 0x4, PRT_M_CAL = 0x8, PRT_M_GEM = 0x10, PRT_M_RAW = 0x20, PRT_M_CMP = 0x40, PRT_M_DIR = 0x80, PRT_M_ECTRS = 0x100, PRT_M_ETIME = 0x200 } |
Functions | |
static void | report_usage (void) |
static int | get_ctl (Ctl *ctl, int argc, char *const argv[]) |
static int | size (const Ctl *ctl) |
static void | construct_astreams (ApidStream *astreams, int astream_cnt, unsigned int which, Ctl *ctl) |
static void | construct (QSE_printDvr *printDvr, unsigned int resource_level, void *printDvrPrm, ApidStream *astream) |
static int | resolve (void *parm, const CCSDS_telemetry *pkt, CCSDS_apidDsc **dsc) |
static int | check_packet (void *parm, void *stream, const CCSDS_telemetry *pkt, CCSDS_apidDsc *dsc) |
static int | process_dgm (void *parm, const void *dgm, int dglen) |
LSF_scanContributionHandler | screen_dgm (void *dvr, const LSF_datagram *dgm) |
static unsigned | print_dgm (void *astream, const LSF_datagram *dgm, void *qsec) |
static unsigned | print_ctb (void *astream, const LSF_contribution *ctb, void *qsec) |
static unsigned | print_rec (void *astream, const LSF_record *rec, void *qsec) |
static LSF_scanContributionHandler | dgm_count (void *count, const LSF_datagram *dgm) |
static LSF_scanRecordHandler | ctb_count (void *count, const LSF_contribution *ctb) |
static void | updateEtime (const EBF_gem *gem, Ctl *ctl) |
static void | printEtime (const Ctl *ctl) |
static void | printEvt (const QSE_ebfEvt *evt, int nbytes) |
static void | printRec (const LSF_record *rec) |
static void | printDmp (const unsigned int *dat, int cnt) |
static void | printError (int status) |
static void | new_line (void) |
int | QSEC_print (int argc, char *const argv[]) |
int | main (int argc, char *const argv[]) |
> qsec_print -d -n:<# of events> -s<# to skip> <file_name>
#define RND_TO | ( | _x, | |||
_r | ) | (((_x) + (_r) - 1) / (_r)) * (_r) |
Round _x up to the nearest boundary of _r
_x | The value to round | |
_r | The rounding |
Referenced by construct(), and size().
typedef struct _ApidStream ApidStream |
APID stream structure
anonymous enum |
enum _PRT_M |
What to print
int check_packet | ( | void * | parm, | |
void * | stream, | |||
const CCSDS_telemetry * | pkt, | |||
CCSDS_apidDsc * | dsc | |||
) | [static] |
Check a packet for validity
This routine is the packet checker callback routine for an APID stream. It simply calls the standard routine.
parm | The processing parameters. | |
stream | The data stream. | |
pkt | The address of the packet. | |
dsc | The address of the APID descriptor. |
Referenced by construct_astreams().
void construct | ( | QSE_printDvr * | printDvr, | |
unsigned int | resource_level, | |||
void * | printDvrPrm, | |||
ApidStream * | astream | |||
) | [static] |
Construct/initialize the print driver handle used in formatting the events
printDvr | The print driver handle to initialize | |
resource_level | The maximum resource level that needs supporting | |
printDvrPrm | Options parameter passed to the print driver construction routine | |
astream | The application stream to associate with this print driver. |
References print_ctb(), print_dgm(), print_rec(), and RND_TO.
Referenced by construct_astreams().
void construct_astreams | ( | ApidStream * | astreams, | |
int | astream_cnt, | |||
unsigned int | which, | |||
Ctl * | ctl | |||
) | [static] |
Construct the individual APID streams
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, check_packet(), construct(), _ApidStream::ctl, _ApidStream::dsc, _ApidStream::dsc_buf, _ApidStream::printDvr, process_dgm(), QSEC_APID_BASE, _Ctl::resource_level, size(), and _ApidStream::stats.
Referenced by QSEC_print().
LSF_scanRecordHandler ctb_count | ( | void * | count, | |
const LSF_contribution * | ctb | |||
) | [static] |
Count the number of events in this contribution
count | Returned with the number of events in this datagram | |
ctb | The contribution |
Referenced by dgm_count().
LSF_scanContributionHandler dgm_count | ( | void * | count, | |
const LSF_datagram * | dgm | |||
) | [static] |
Count the number of events in this datagram
count | Returned with the number of events in this datagram | |
dgm | The datagram |
References ctb_count().
Referenced by print_dgm().
int get_ctl | ( | Ctl * | ctl, | |
int | argc, | |||
char *const | argv[] | |||
) | [static] |
Examine the command line parameters and fill the print run time options control structure
ctl | The parameter run time options block. | |
argc | The number of command line parameters. | |
argv | The array of pointers to the command line parameters. |
0,Everything | is okay. | |
-1,Incorrect | command usage. Usually this means that the input file name was absent. |
References _Ctl::cids, _Ctl::cpus, _Ctl::dgm_options, _Ctl::dgn_ids, _Ctl::dmp_ccsds, _Ctl::file, _Ctl::nevent, _Ctl::node, _Ctl::nprint, _Ctl::nskip, _Ctl::options, _Ctl::ppstime, PRT_M_ACD, PRT_M_AEM, PRT_M_CAL, PRT_M_CMP, PRT_M_DIR, PRT_M_ECTRS, PRT_M_ETIME, PRT_M_GEM, PRT_M_RAW, PRT_M_TKR, report_usage(), _Ctl::secs, _Ctl::ticks, and _Ctl::trgtime.
Referenced by QSEC_print().
int main | ( | int | argc, | |
char *const | argv[] | |||
) |
Main program to process a file of calibration event datagrams
argc | The argument count | |
argv | The vector of command line strings |
References QSEC_print().
void new_line | ( | void | ) | [static] |
Print a new line
Referenced by print_ctb(), print_dgm(), and print_rec().
unsigned int print_ctb | ( | void * | astream, | |
const LSF_contribution * | ctb, | |||
void * | qsec | |||
) | [static] |
Print the event context information
astream | The apid stream | |
ctb | The datagram contribution | |
qsec | The QSEC event context structure |
References _ApidStream::ctl, _Ctl::nevent, new_line(), _Ctl::nskip, and _ApidStream::stats.
Referenced by construct().
unsigned int print_dgm | ( | void * | astream, | |
const LSF_datagram * | dgm, | |||
void * | qsec | |||
) | [static] |
Print the event context information
astream | The apid stream | |
dgm | The datagram | |
qsec | The QSEC event context structure |
References _ApidStream::ctl, dgm_count(), _Ctl::dgm_options, _Ctl::nevent, new_line(), _Ctl::nskip, and _ApidStream::stats.
Referenced by construct().
unsigned int print_rec | ( | void * | astream, | |
const LSF_record * | rec, | |||
void * | qsec | |||
) | [static] |
Expand and print the contents of the event
astream | The apid stream | |
rec | The LSF record containing the event | |
qsec | The QSEC event context structure |
References _Ctl::acd, _Ctl::aem, _Ctl::cal, _ApidStream::ctl, _Ctl::dir, _Ctl::ebf, _Ctl::ebf_siz, _Ctl::nevent, new_line(), _Ctl::nprint, _Ctl::options, printError(), printEtime(), printEvt(), printRec(), PRT_M_ACD, PRT_M_AEM, PRT_M_CAL, PRT_M_CMP, PRT_M_DIR, PRT_M_ECTRS, PRT_M_ETIME, PRT_M_GEM, PRT_M_RAW, PRT_M_TKR, _ApidStream::stats, _Ctl::tkr, and updateEtime().
Referenced by construct().
void printDmp | ( | const unsigned int * | dat, | |
int | cnt | |||
) | [static] |
Print a formatted hex dump of the specified block of integers
dat | Pointer to the 32-bit integer data to print | |
cnt | The count of the number of 32-bit integers to dump |
Referenced by printEvt(), and printRec().
void printError | ( | int | status | ) | [static] |
Print an error line
status | The error status to report. |
References QSEC_STATUS_K_DECODE, QSEC_STATUS_K_ERR, QSEC_STATUS_K_INCLEN, QSEC_STATUS_K_NOGEM, QSEC_STATUS_K_OVRRUN, QSEC_STATUS_K_TOO_SMALL, and QSEC_STATUS_K_UNDRUN.
Referenced by print_rec().
void printEtime | ( | const Ctl * | ctl | ) | [static] |
Print the time of the event.
ctl | Pointer to the control structure |
References _Ctl::ppstime, _Ctl::secs, _Ctl::ticks, and _Ctl::trgtime.
Referenced by print_rec().
void printEvt | ( | const QSE_ebfEvt * | evt, | |
int | nbytes | |||
) | [static] |
Print a very crude hex dump of the EBF event record to stdout.
evt | Pointer to the EBF event record to print | |
nbytes | Number of bytes to print |
References printDmp().
Referenced by print_rec().
void printRec | ( | const LSF_record * | rec | ) | [static] |
Print a very crude hex dump of the event record to stdout.
rec | Pointer to the event record to print |
References printDmp().
Referenced by print_rec().
int process_dgm | ( | void * | parm, | |
const void * | dgm, | |||
int | dglen | |||
) | [static] |
Process a datagram
This routine is the datagram processor callback routine for an APID stream. It calls the LSF processor.
parm | The processing parameters (address of print driver). | |
dgm | The address of the datagram. | |
dglen | The length of the datagram. |
zero | Continue processing | |
non-zero | Stop processing |
References screen_dgm().
Referenced by construct_astreams().
int QSEC_print | ( | int | argc, | |
char *const | argv[] | |||
) |
Process a file of calibration event datagrams
argc | The argument count | |
argv | The vector of command line strings |
References _Ctl::acd, _Ctl::aem, _Ctl::cal, _Ctl::cids, construct_astreams(), _Ctl::cpus, _Ctl::dgn_ids, _Ctl::dir, _Ctl::ebf, _Ctl::ebf_siz, _Ctl::file, get_ctl(), _Ctl::node, QSEC_MAX_APIDS, resolve(), and _Ctl::tkr.
Referenced by main().
void report_usage | ( | void | ) | [static] |
Brief explanation on qsec_print usage
Referenced by get_ctl().
int resolve | ( | void * | parm, | |
const CCSDS_telemetry * | pkt, | |||
CCSDS_apidDsc ** | dsc | |||
) | [static] |
Resolve a packet into its APID stream
This routine is the resolve callback routine for the entire data stream. It determines which APID stream (if any) the packet belongs to.
parm | The array of APID streams. | |
pkt | The address of the CCSDS packet. | |
dsc | The address of a pointer to receive the address of the matching APID descriptor. |
CCSDS_ISTREAM_RESOLVER_STATUS_K_SUCCESS | Stream found | |
CCSDS_ISTREAM_RESOLVER_STATUS_K_NOTFOUND | Stream not found |
References _ApidStream::ctl, _Ctl::dmp_ccsds, _ApidStream::dsc, QSEC_APID_BASE, and QSEC_MAX_APIDS.
Referenced by QSEC_print().
LSF_scanContributionHandler screen_dgm | ( | void * | dvr, | |
const LSF_datagram * | dgm | |||
) |
Screen out any datagrams that are not LSEC event datagrams
dvr | The print driver's contribution handle | |
dgm | The datagram |
Referenced by process_dgm().
int size | ( | const Ctl * | ctl | ) | [static] |
Return the size, in bytes, of the control handle.
The amount of memory returned by this routien should be allocated by caller and passed, along with prm, to construction routine
ctl | The control block |
References RND_TO.
Referenced by construct_astreams().
void updateEtime | ( | const EBF_gem * | gem, | |
Ctl * | ctl | |||
) | [static] |
Update the time of the event.
gem | Pointer to the GEM data | |
ctl | Pointer to the control structure |
References _Ctl::ppstime, _Ctl::secs, _Ctl::ticks, and _Ctl::trgtime.
Referenced by print_rec().