GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > QSE / V1-6-3

Constituent: qse_repacktest     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

qse_repacktest.c File Reference

Crude program to test the repacking routines. More...

#include "QSE/QSE_aemRepack.h"
#include "EDS/TMR.h"
#include "EDS/LCBV.h"
#include "EDS/io/EBF_evts.h"
#include "EDS/io/EBF_stream.h"
#include "EDS/io/LCBP.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "EDS/FFS.h"
#include "EDS/EBF_cid.h"
#include "EDS/EBF_ctb.h"
#include "EDS/EBF_evt.h"
#include "EDS/EBF_pkt.h"
#include "EDS/EBF_dir.h"
#include "EDS/EBF_siv.h"
#include "EDS/EBF_tem.h"
#include "EDS/EBF_tkr.h"
#include "EDS/EBF_edw.h"
#include "QSE/QSE_aem.h"
#include "QSE/QSE_aemUnpack.h"

Include dependency graph for qse_repacktest.c:


Data Structures

struct  _Ctl
 Collections all the control parameters together. These are essentially the interpretted command line options. More...
struct  _RepackRecord
 Information about the unpacking/repacking of one object. More...
struct  _RepackResult
 Information about the unpacking/repacking of one event. More...
struct  _RepackSummary
struct  _RepackCtl
 Demonstration/test of the basic repacking routines control block. More...

Defines

#define HW_ACCESS(_hwa)   *(unsigned short int *)(&(_hwa))
 Addresses the AEM half-word array in a way that is compatiable with big or little endian machines.

Typedefs

typedef _RepackCtl RepackCtl
 Typedef for struct _RepackCtl.
typedef enum _REPACK_OBJ_K REPACK_OBJ_K
 Typedef for enum _EDSD_REPACK_OBJ_K.
typedef enum _REPACK_OBJ_V REPACK_OBJ_V
 Typedef for enum _REPACK_OBJ_V.
typedef enum _REPACK_OBJ_M REPACK_OBJ_M
 Typedef for enum _REPACK_OBJ_M.
typedef _Ctl Ctl
 Typedef for struct _Ctl.
typedef _RepackRecord RepackRecord
 Typedef for struct _RepackRecord.
typedef _RepackResult RepackResult
 Typedef for struct _RepackResult.
typedef _RepackSummary RepackSummary

Enumerations

enum  _REPACK_OBJ_K {
  REPACK_OBJ_K_DIR = 0,
  REPACK_OBJ_K_AEM = 1,
  REPACK_OBJ_K_TKR = 2,
  REPACK_OBJ_K_CAL = 3,
  REPACK_OBJ_K_CNT = 4,
  REPACK_OBJ_K_EVT = 16,
  REPACK_OBJ_K_SUM = 17,
  REPACK_OBJ_K_DMP = 18
}
 Enumerates what to unpack/repack. More...
enum  _REPACK_OBJ_V {
  REPACK_OBJ_V_DIR = REPACK_OBJ_K_DIR,
  REPACK_OBJ_V_AEM = REPACK_OBJ_K_AEM,
  REPACK_OBJ_V_TKR = REPACK_OBJ_K_TKR,
  REPACK_OBJ_V_CAL = REPACK_OBJ_K_CAL,
  REPACK_OBJ_V_SUM = REPACK_OBJ_K_SUM,
  REPACK_OBJ_V_EVT = REPACK_OBJ_K_EVT,
  REPACK_OBJ_V_DMP = REPACK_OBJ_K_DMP
}
 Enumerates the bit positions of the unpack/repack objects. More...
enum  _REPACK_OBJ_M {
  REPACK_OBJ_M_DIR = (1 << REPACK_OBJ_V_DIR),
  REPACK_OBJ_M_AEM = (1 << REPACK_OBJ_V_AEM),
  REPACK_OBJ_M_TKR = (1 << REPACK_OBJ_V_TKR),
  REPACK_OBJ_M_CAL = (1 << REPACK_OBJ_V_CAL),
  REPACK_OBJ_M_ALL = (1 << REPACK_OBJ_K_CNT)-1,
  REPACK_OBJ_M_SUM = (1 << REPACK_OBJ_V_SUM),
  REPACK_OBJ_M_EVT = (1 << REPACK_OBJ_V_EVT),
  REPACK_OBJ_M_DMP = (1 << REPACK_OBJ_V_DMP)
}
 Enumerates the bit masks of the unpack/repack objects. More...

Functions

static int repackSizeof (void)
 Returns the size, in bytes, of the control structure.
static int repackConstruct (RepackCtl *ctl, int nevts, unsigned int objects, LCBV_pktsRngFreeCb freeRtn, void *freePrm)
 Allocates and initializes the repacking buffers and control structures.
static unsigned int repackProcess (RepackCtl *ctl, unsigned int edw, EBF_pkt *pkt)
 Loops through the events, printing the contents to stdout.
static void repackReport (const RepackCtl *ctl)
 The reporting function.
static int repackDestruct (RepackCtl *ctl)
 DeAllocates and the unpacking/repacking buffers.
static void reportUsage (void)
 Brief explanation on readtest usage.
static unsigned int repack (Ctl *ctl)
 Finishes the platform common setup and initalization, starts the packet flow.
static unsigned int get_report_opts (const char *optarg)
 Returns a bit mask of the reporting options.
static int fillCtl (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 readtest.
static void * alloc (const char *what, int nbytes)
 Attempts to allocate the specified number of bytes and issues an error message if it cannot.
static void dump (const void *dat, int nbytes)
 Produce a semi-formatted dump of the AEM data.
static void calc_summary (RepackSummary *summary, const RepackResult *results, int nresults, unsigned int objects)
 Calculates the summary statistics from the result records.
static void report_evt_results (const RepackResult *results, int nresults, unsigned int objects)
 Prints the event-by-event results.
static void report_summary (RepackSummary *summary, unsigned int objects)
 Reports the repacking summary statistics.
static void print_title (const char *caption, unsigned int objects)
 Prints the title bars for the report summary.
static void print_separator (int cnt)
 Prints the separator line of the title bar.
static void new_line (void)
 Print a new line character.
static int compare (const void *s1, const void *s2, int nbytes)
 Compares the 32-bit bswapped arrays.

Detailed Description

Crude program to test the repacking routines.

    $ qse_repacktest -A <file.ebf>

      where
        A: Repack AEM
   

    CVS $Id: qse_repacktest.c,v 1.2 2006/02/22 01:24:42 russell Exp $
   
Author:
JJRussell - russell@slac.stanford.edu

Define Documentation

#define HW_ACCESS _hwa   )     *(unsigned short int *)(&(_hwa))
 

Addresses the AEM half-word array in a way that is compatiable with big or little endian machines.

Returns:
Value at the halfword index
Parameters:
_hwa The halfword lvalue to accessed


Typedef Documentation

RepackResult
 

Typedef for struct _RepackResult.

This contains two values, 0 is the unpack record, 1 is the repack record.


Enumeration Type Documentation

enum _REPACK_OBJ_K
 

Enumerates what to unpack/repack.

Enumerator:
REPACK_OBJ_K_DIR  ID for the DIR
REPACK_OBJ_K_AEM  ID for the AEM
REPACK_OBJ_K_TKR  ID for the TKR
REPACK_OBJ_K_CAL  ID for the CAL
REPACK_OBJ_K_CNT  Number of objects to time
REPACK_OBJ_K_EVT  Report event-by-event statistics
REPACK_OBJ_K_SUM  Report summary statistics
REPACK_OBJ_K_DMP  Dump data and repacked data

enum _REPACK_OBJ_M
 

Enumerates the bit masks of the unpack/repack objects.

Enumerator:
REPACK_OBJ_M_DIR  Bit mask, DIR
REPACK_OBJ_M_AEM  Bit mask, AEM
REPACK_OBJ_M_TKR  Bit mask, TKR
REPACK_OBJ_M_CAL  Bit mask, CAL
REPACK_OBJ_M_ALL  Bit mask, ALL
REPACK_OBJ_M_SUM  Bit mask, SUM
REPACK_OBJ_M_EVT  Bit mask, EVT
REPACK_OBJ_M_DMP  Bit mask, DMP

enum _REPACK_OBJ_V
 

Enumerates the bit positions of the unpack/repack objects.

Enumerator:
REPACK_OBJ_V_DIR  Bit offset, DIR
REPACK_OBJ_V_AEM  Bit offset, AEM
REPACK_OBJ_V_TKR  Bit offset, TKR
REPACK_OBJ_V_CAL  Bit offset, CAL
REPACK_OBJ_V_SUM  Bit offset, SUM
REPACK_OBJ_V_EVT  Bit offset, EVT
REPACK_OBJ_V_DMP  Bit offset, DMP


Function Documentation

static void * alloc const char *  what,
int  nbytes
[static]
 

Attempts to allocate the specified number of bytes and issues an error message if it cannot.

Parameters:
what A string indentifying the customer
nbytes The number of bytes to allocate

static void calc_summary RepackSummary *  summary,
const RepackResult results,
int  nresults,
unsigned int  objects
[static]
 

Calculates the summary statistics from the result records.

Parameters:
summary The summary statistics to be completed
results The result records
nresults The number of result result records
objects The bit mask of valid objects

static int compare const void *  s1,
const void *  s2,
int  nbytes
[static]
 

Compares the 32-bit bswapped arrays.

Returns:
0 if the same, else the index + 1 of the miscompare
Parameters:
s1 Pointer to the first array to be compared
s2 Pointer to the second array to be compared
nbytes The number of bytes to compare. Note that since these arrays are 32-bit swapped, the data can actually extend past the s1 + nbytes or s2 + nbytes boundary when nbytes is not a multiple of 4 bytes.

static void dump const void *  dat,
int  nbytes
[static]
 

Produce a semi-formatted dump of the AEM data.

Parameters:
dat Pointer to the data
nbytes The number of bytes in the data

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

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

Parameters:
ctl The parameter control 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.

static unsigned int get_report_opts const char *  optarg  )  [static]
 

Returns a bit mask of the reporting options.

Returns:
A bit mask of the reporting options
Parameters:
optarg Character string of the options

int main int  argc,
char *const   argv[]
 

Usual entry point for the readtest.

Parameters:
argc The number of arguments
argv The vector of arguments.
qse_repacktest, example
    $ qse_repacktest  -s<nskip> -n<nevts> -A <file.ebf>

      where:
         -s: Indicates the number of events to skip before processing
             begins
         -n: Indicates the number of events to process
         -A: Test the AEm repacking

   

static void print_separator int  cnt  )  [static]
 

Prints the separator line of the title bar.

Parameters:
cnt The number columns to print

static void print_title const char *  caption,
unsigned int  objects
[static]
 

Prints the title bars for the report summary.

Returns:
The count of the number of objects in the object list
Parameters:
caption Character string to be used as the caption of the first column (5 or less characters).
objects Bit list of the objects to print

static unsigned int repack Ctl ctl  )  [static]
 

Finishes the platform common setup and initalization, starts the packet flow.

Parameters:
ctl The control structure

static int repackConstruct RepackCtl ctl,
int  nevts,
unsigned int  objects,
LCBV_pktsRngFreeCb  freeRtn,
void *  freePrm
[static]
 

Allocates and initializes the repacking buffers and control structures.

Returns:
Status
Parameters:
ctl Pointer to the control buffer
nevts The number of events to process
objects Which objects to unpack/repack
freeRtn Virtual packet free routine
freePrm Parameter passed to the free routine, likely the LCB device handle

static int repackDestruct RepackCtl ctl  )  [static]
 

DeAllocates and the unpacking/repacking buffers.

Returns:
Status
Parameters:
ctl Pointer to the control buffer

static unsigned int repackProcess RepackCtl ctl,
unsigned int  edw,
EBF_pkt *  pkt
[static]
 

Loops through the events, printing the contents to stdout.

Parameters:
ctl Control structure dictating how many and what to repack
edw The event descriptor word
pkt The packet to process

static void repackReport const RepackCtl ctl  )  [static]
 

The reporting function.

Parameters:
ctl The control parameters

static int repackSizeof void   )  [static]
 

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

Returns:
The size, in bytes, of the control structure

static void report_evt_results const RepackResult results,
int  nresults,
unsigned int  objects
[static]
 

Prints the event-by-event results.

Parameters:
results The results array
nresults The number of elements in the result array
objects The bit mask of valid objects

static void report_summary RepackSummary *  summary,
unsigned int  objects
[static]
 

Reports the repacking summary statistics.

Parameters:
summary The summary statistics
objects The bit mask of valid objects


Generated on Thu Jul 12 01:57:23 2007 by  doxygen 1.4.4