GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > EMP / V1-3-1

Constituent: asc_write     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

asc_write.c File Reference

Program to test ACD counting statistics accumulation and writing of the datagram within the EDS framework. More...

#include "EMP/ASC.h"
#include "EMP/ASC_dgmPrint.h"
#include "EMP/ASC_pubdefs.h"
#include "EMP/LSD_sdi.h"
#include "EDS/io/EBF_stream.h"
#include "EDS/io/LCBP.h"
#include "EDS/EDS_fw.h"
#include "EDS/LCBV.h"
#include "ITC/ITC_pubdefs.h"
#include "IMM/FPM_pubdefs.h"
#include "IMM/RBM_pubdefs.h"
#include "EMP_DB/ASC_DB_schema.h"
#include "LSE/CCSDS_ostream.h"
#include "LSF/LSF_reason.h"
#include "MSG/MSG_pubdefs.h"
#include "CDM/CDM_pubdefs.h"
#include "PBS/PBS.h"
#include "PBS/TMR.h"
#include "PBS/MBA.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

Include dependency graph for asc_write.c:


Data Structures

struct  _GetCtx
 Structure to hold the context for retrieving a pointer to the next input file. More...
struct  _OutputCtx
 Output context. More...
struct  _Ctl
 Collections all the control parameters together. These are essentially the interpretted command line options. More...

Typedefs

typedef _GetCtx GetCtx
 Typedef for struct _GetCtx.
typedef const char *(* Get_filename )(void *ctx)
 Typedef of the callback routine to retrieve the next input file name.
typedef _OutputCtx OutputCtx
 Typedef for struct _OutputCtx.
typedef _Ctl Ctl
 Typedef for struct _Ctl.

Functions

static void CheckClearTiming (void)
 quick timing test for clearing the histograms
static int asc_init (Ctl *ctl)
 One-time ASC initialization.
int asc_close (Ctl *ctl)
 Closes the asc context.
static void emp_setup (const ASC_DB_Schema *db, ASC_handlerConstructCfg *cfg, int *retEdsPriority, EDS_fw **retFw, ASC **retAsc)
 Install EMP/ASC into the EDS system.
static int do_it (Ctl *ctl)
 Simple driver program to setup, accumulate and print the statistics.
static unsigned int process (EBF_stream *stream, int nloops, int nskip, int nprocess, LCBV_pktCb rtn, void *prm)
 Convenience routine to formalize the processing.
static ASC_handlerConstructCfg * output_construct (const char *ofilename, unsigned int *options)
 Construct the output configuration structure.
static int output_write (OutputCtx *ctx, LSD_sdiPds *pds)
 Processes an output packet.
static int output_print (unsigned int *options, LSD_sdiPds *pds)
 Processes an output packet by just printing it.
static int file_write (FILE *file, void *buf, int nbytes)
 A CCSDS_ostream output callback routine used when writing the specified buffer to a file.
static int InstallServices (EDS_fw *fw, int edsPriority, ASC **asc, const ASC_DB_Schema *db, ASC_handlerConstructCfg *cfg)
 Install EMP/ASC services into the EDS system.
static const char * get_filename (GetCtx *ctx)
 User provide callback routine to retrieve the next input file.
static void reportUsage (void)
 Gives a terse explanation of this commands usage.
static int fill_ctl (Ctl *ctl, int argc, char *const argv[])
 Examines the command line parameters and fills the print control structure.
int main (int argc, char *const argv[])
 Usual entry point for the asc_write.
static unsigned int get_reporting_options (const char *s)
 Returns a bit mask of the reporting options.

Variables

const unsigned int EbfData []
 A small set of test data.

Detailed Description

Program to test ACD counting statistics accumulation and writing of the datagram within the EDS framework.

Author:
Ed Bacho - ebacho@slac.stanford.edu

JJRussell - russell@slac.stanford.edu

    $ asc_write -n <number_of_events> -o<output_file> <input_files>
      Do an asc_write with no arguments for a more complete explanation
      of the parameters.
   

    CVS $Id: asc_write.c,v 1.2 2006/11/14 20:33:39 russell Exp $
 
  

Typedef Documentation

const char *(* Get_filename)(void *ctx)
 

Typedef of the callback routine to retrieve the next input file name.

Returns:
A pointer to the name of the next file to process
Parameters:
ctx The context block, holds the list of files to process and a pointer to the file to process


Function Documentation

int asc_close Ctl ctl  ) 
 

Closes the asc context.

Parameters:
ctl The control context

static int asc_init Ctl ctl  )  [static]
 

One-time ASC initialization.

Parameters:
ctl The control information

static int do_it Ctl ctl  )  [static]
 

Simple driver program to setup, accumulate and print the statistics.

Parameters:
ctl The control statistics, containing such things as the list of files to accumulate over, the number of events to process etc

static void emp_setup const ASC_DB_Schema *  db,
ASC_handlerConstructCfg *  cfg,
int *  retEdsPriority,
EDS_fw **  retFw,
ASC **  retAsc
[static]
 

Install EMP/ASC into the EDS system.

Parameters:
db The configuration database
cfg The user configuration to pass to the handler construction routine.
retEdsPriority if not NULL return eds priority used
retFw if not NULL fw pointer for EDS
retAsc if not NULL return ctl pointer for EDS

static int file_write FILE *  file,
void *  buf,
int  len
[static]
 

A CCSDS_ostream output callback routine used when writing the specified buffer to a file.

Return values:
0,to satisfy the interface requriements of CCSDS_ostream
Parameters:
file The output file handle
buf The buffer to write
len The number of bytes in buffer to write

static int fill_ctl Ctl ctl,
int  argc,
char *const   argv[]
[static]
 

Examines the command line parameters and fills the print control structure.

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

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

const char * get_filename GetCtx ctx  )  [static]
 

User provide callback routine to retrieve the next input file.

Returns:
A pointer to the next file or NULL if no more
Parameters:
ctx The input file context handle

static unsigned int get_reporting_options const char *  s  )  [static]
 

Returns a bit mask of the reporting options.

Returns:
A bit mask of the reporting options
Parameters:
s The option string to parse

static int InstallServices EDS_fw *  fw,
int  edsPriority,
ASC **  retAsc,
const ASC_DB_Schema *  db,
ASC_handlerConstructCfg *  cfg
[static]
 

Install EMP/ASC services into the EDS system.

Returns:
Status
Parameters:
fw Framework ptr init'ed by EDS_fwConstruct
edsPriority Index of eds func pointer, 0 is first habndler
retAsc Returned as ASC handle created by constructore
db The ASC_DB configuration database
cfg The user configuration to pass to the handler construction routine.
This routine installs EMP services into EDS. This would normally be done by LPA based on availible XXX_DB lib setup as services. Here we provide a local ASC_DB and go thru the construction of an EMP service and its installation into EDS.

Note:
This routine is meant for TESTING only.

int main int  argc,
char *const   argv[]
 

Usual entry point for the asc_write.

Parameters:
argc The number of arguments
argv The vector of arguments.
    $ asc_write -omyAsc.lsd myEventFile.ebf

      Accumulates the statistics for events in given EBF file

   

static ASC_handlerConstructCfg * output_construct const char *  ofilename,
unsigned int *  options
[static]
 

Construct the output configuration structure.

Returns:
Pointer to the construct configuration, or NULL on failure
Parameters:
ofilename The name of the output file, may be HULL in which case no output file is written
options Pointer to the output display options.

static int output_print unsigned int *  options,
LSD_sdiPds *  pds
[static]
 

Processes an output packet by just printing it.

Parameters:
options The printing options
pds The packet descriptor structure for the packet to be output

static int output_write OutputCtx ctx,
LSD_sdiPds *  pds
[static]
 

Processes an output packet.

Parameters:
ctx The output processing context
pds The packet descriptor structure for the packet to be output

static unsigned int process EBF_stream *  stream,
int  nloops,
int  nskip,
int  nprocess,
LCBV_pktCb  rtn,
void *  prm
[static]
 

Convenience routine to formalize the processing.

Returns:
Status
Parameters:
stream The stream to process
nloops The number of times to process the same stream
nskip The number of events to skip
nprocess The number of events to process
rtn The event processing routine
prm The event processing routine's parameter


Generated on Sat Jan 6 02:40:52 2007 by  doxygen 1.4.4