GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EFC / V4-5-5 > ifilter / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

filter.c File Reference

Driver program to test filtering code. More...

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <filter_rto.h>
#include <filter_sdi.h>
#include <GFC_resultDef.h>
#include <EFC/EFA.h>
#include <EFC/GFC_V3_status.h>
#include <EFC/EFC_samplerDef.h>
#include <EFC/EDM.h>
#include <EFC/EFC.h>
#include <EFC/EFC_edsFw.h>
#include <EFC/EFA_def.h>
#include <EFC/EFS.h>
#include <EFC/EFC_time.h>
#include <EFC/EFR_key.h>
#include <EDS/EDS_fw.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_pkt.h>
#include <EDS/EBF_cid.h>
#include <EDS/ECR_cal.h>
#include <EDS/TMR.h>
#include <EDS/LCBV.h>
#include <EDS/io/LCBP.h>
#include <EDS/io/EBF_stream.h>
#include <EDS/io/EBF_evts.h>
#include <EFC_DB/EFC_DB_schema.h>
#include <EFC_DB/EH_ids.h>
#include <GFC_DB/GFC_DB_V3_schema.h>
#include <GFC_DB/GAMMA_DB_instance.h>
#include <LSF/LSF_reason.h>
#include <EMP/EMP_hdrdefs.h>
#include <PBS/PBS.h>
#include <CDM/CDM_pubdefs.h>
#include <CAB/CAB_lookupPub.h>
#include <PBI/FFS.ih>
#include <string.h>
#include <LSE/CCSDS_ostream.h>
#include <LSE/LSE_time.h>
#include <LSF/LSF_ids.h>
#include <LSEP/LSEPW.h>
#include <ITC/ITC_pubdefs.h>
#include <IMM/FPM_pubdefs.h>
#include <IMM/RBM_pubdefs.h>
#include <MSG/MSG_pubdefs.h>
#include <EFC/GFC.h>
#include <EFC/GFC_resultsPrint.h>
#include <EFC/GFC_statsPrint.h>
#include <EFC/GFC_cfgPrint.h>
#include <EFC/GFC_stats.h>
#include <EFC/GFC_def.h>
#include <EDS/EBF_evt.h>
#include <EDS/EBF_mc.h>

Classes

struct  _FilterResultCtx
 The filter result context, will replace FilterResultCtl. More...
struct  _OutputHandler
 Binds an output routine with its parameter. More...
struct  _FilterCtx
 Structure to bind all the filtering parameters together into something suitable for passing to the LCB event call back handler. More...
struct  _RestartPkt
 Defines an EBF restart packet. More...

Defines

#define DATAGRAMS_SUPPORTED
#define CACHE_cleanData(_ptr, _nbytes)
 Macro to move the data from cache to memory and then invalidate the cache. This is a NOP all but VxWorks platforms.

Typedefs

typedef struct _FilterResultCtx FilterResultCtx
 Typedef for struct _FilterResultCtx.
typedef struct _OutputHandler OutputHandler
 Typedef for struct _OutputHandler.
typedef struct _FilterCtx FilterCtx
 Typedef for struct _FilterCtx.
typedef struct _RestartPkt RestartPkt
 Typedef for struct _RestartPkt.

Functions

static int doFilter (const FilterRto *rto)
 Common routine to do the filtering.
static void * allocate (int nbytes, const char *name)
 Allocates the number of bytes, prints an error message if unsuccessful.
static void free_em (void *ptr)
 Jacketing routine to the free function.
static int createOutput (OutputHandler *output, const char *name, OutputFileType_k type, int clevel, EDS_fw *eds_fw, unsigned int options)
 Creates an output file if name is not NULL.
static void start_run (FilterCtx *ctx, EDS_fw *edsFw, unsigned int handler_mask, unsigned int post_mask)
 Notifies the handlers and posters of the start run.
const
EDS_DB_HandlerConstructServices * 
gfc_constructServicesGet (FilterCtx *ctx)
static __inline__ void initialize (void)
static __inline__ void sdi_construct (FilterSdi *sdi, const char *filename)
static __inline__ void sdi_destruct (FilterSdi *sdi)
static __inline__ void time_initialize ()
int main (int argc, char **argv)
 Entry point for filter.
int GRBP_start (FILE *fp, int reason, unsigned int run_id, unsigned int startTime, unsigned int mode, unsigned int hw_key, unsigned int cfg_key)
void GRBP_write (FILE *fp, EDS_fwIxb *ixb)
int GRBP_notify (FILE *fp, unsigned int mode, unsigned int active, const unsigned char cfgs[32], const EDS_rsdTbl *rsdTbl)
int GRBP_flush (FILE *fp, int reason)
static void printOutput (OutputHandler *output, EDS_fwIxb *ixb)
 Prints a 1 line summary of the events that are output.
static int dummyStart (void *prm, unsigned int reason, unsigned int run_id, unsigned int startTime, unsigned int mode, unsigned int hw_key, unsigned int cfg_key)
 Dummy routine to intercept the output events when one does not have a real output routine.
static void dummyWrite (OutputHandler *output, EDS_fwIxb *ixb)
 Dummy routine to intercept the output events when one does not have a real output routine.
static int dummyNotify (void *prm, unsigned int mode, unsigned int active, const unsigned char cfgs[32], const EDS_rsdTbl *rsdTbl)
 Dummy routine to handle mode change notifications to the output stream.
static void dummyFlush (void *prm, int reason)
 Dummy routine to close an output stream.
static __inline unsigned int restart_construct (RestartPkt *restart, const EBF_evt *evt)
 Constructs a template of the packet restart header. This includes both the 8 word header and the 4 word restart cell.
static void streamWrite (OutputHandler *output, EDS_fwIxb *ixb)
 Routine to flush an output stream.
static void streamFlush (OutputHandler *output, int reason)
 Routine to flush an output stream.

Variables

static const EDS_fwPostServices GrbpServices


Detailed Description

Driver program to test filtering code.

Author:
JJRussell - russell@slac.stanford.edu

  CVS $Id: filter.c,v 1.31 2013/01/11 19:08:48 russell Exp $

Function Documentation

static void * allocate ( int  nbytes,
const char *  name 
) [static]

Allocates the number of bytes, prints an error message if unsuccessful.

Returns:
Pointer to the allocated memory or NULL if unsuccessful.
Parameters:
nbytes The number of bytes to allocate
name The name of the object being allocated

Referenced by doFilter().

static int createOutput ( OutputHandler output,
const char *  name,
OutputFileType_k  type,
int  clevel,
EDS_fw *  eds_fw,
unsigned int  options 
) [static]

Creates an output file if name is not NULL.

Returns:
Status
Parameters:
output The output handler to fill in
name The name of the output file to create
type The output file type to create.
clevel If creating a compressed packet/datagram, the compression level
eds_fw The Event delivery framework handle
options Other output options

References _FilterSdi::cbp, _OutputHandler::count, dummyFlush(), dummyNotify(), dummyStart(), dummyWrite(), filter_sdi_construct(), _OutputHandler::options, _OutputHandler::prm, _OutputHandler::sdi, _OutputHandler::services, _OutputHandler::stream, streamFlush(), and streamWrite().

Referenced by doFilter().

static int doFilter ( const FilterRto rto  )  [static]

void dummyFlush ( void *  prm,
int  reason 
) [static]

Dummy routine to close an output stream.

Parameters:
prm The user context parameter
reason The reason flush is being called

Referenced by createOutput().

int dummyNotify ( void *  prm,
unsigned int  mode,
unsigned int  active,
const unsigned char  cfgs[32],
const EDS_rsdTbl *  rsdTbl 
) [static]

Dummy routine to handle mode change notifications to the output stream.

Parameters:
prm The user context parameter
mode The current mode
active The list of active handlers
cfgs The array of handler configurations
rsdTbl The result summary data table

Referenced by createOutput().

static int dummyStart ( void *  prm,
unsigned int  reason,
unsigned int  run_id,
unsigned int  startTime,
unsigned int  mode,
unsigned int  hw_key,
unsigned int  cfg_key 
) [static]

Dummy routine to intercept the output events when one does not have a real output routine.

Parameters:
prm The user context parameter
reason The reason for starting
run_id The run identifier
startTime The start time (in seconds since the SA epoch)
mode The starting mode
hw_key The hardware configuration key
cfg_key The software configuration key

Referenced by createOutput().

void dummyWrite ( OutputHandler output,
EDS_fwIxb *  ixb 
) [static]

Dummy routine to intercept the output events when one does not have a real output routine.

Parameters:
output Output context handle
ixb The information exchange block, contains a reference to the event to write plus other event related information

References _OutputHandler::options, and printOutput().

Referenced by createOutput().

static void free_em ( void *  ptr  )  [static]

Jacketing routine to the free function.

Parameters:
ptr The pointer to free, if NULL, do nothing

Referenced by doFilter().

main ( int  argc,
char **  argv 
)

Entry point for filter.

Parameters:
argc Standard argument count.
argv Standard vector of command line parameter strings.
Return values:
0,if successful -1, if the file does not exist or some other internal error.
The usage of this routine is self-documenting. Simply type filter with no parameters for its usage.

References doFilter(), filter_rtoFill(), and filter_rtoUsageReport().

static void printOutput ( OutputHandler output,
EDS_fwIxb *  ixb 
) [static]

Prints a 1 line summary of the events that are output.

Parameters:
output The output context handle
ixb The information exchange block

References _OutputHandler::count, and GFC_V3_STAGE_M_ENERGY.

Referenced by dummyWrite(), and streamWrite().

static __inline unsigned int restart_construct ( RestartPkt restart,
const EBF_evt *  evt 
) [static]

Constructs a template of the packet restart header. This includes both the 8 word header and the 4 word restart cell.

Returns:
Template copy of the Event Builder Word
Parameters:
restart The target restart packet
evt The event to derive the information from

References _RestartPkt::cell, and _RestartPkt::hdr.

void streamFlush ( OutputHandler output,
int  reason 
) [static]

Routine to flush an output stream.

Parameters:
output The output context handle
reason The reason flush is being called

References _OutputHandler::stream.

Referenced by createOutput().

void streamWrite ( OutputHandler output,
EDS_fwIxb *  ixb 
) [static]

Routine to flush an output stream.

Parameters:
output The output context handle
ixb The information exchange block

References _OutputHandler::options, printOutput(), and _OutputHandler::stream.

Referenced by createOutput().


Variable Documentation

const EDS_fwPostServices GrbpServices [static]

Initial value:

{
    (EDS_fwPostStartRtn )GRBP_start,
    (EDS_fwPostWriteRtn )GRBP_write,
    (EDS_fwPostNotifyRtn)GRBP_notify,
    (EDS_fwPostFlushRtn )GRBP_flush
}


Generated on Wed Jan 16 13:57:45 2013 by  doxygen 1.5.8