GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSE / dev > qse_repacktest / rhel6-64
#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 <QSE/QSE_aem.h>
#include <QSE/QSE_aemUnpack.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 <PBI/PTR.h>
Classes | |
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 struct _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 struct _Ctl | Ctl |
Typedef for struct _Ctl. | |
typedef struct _RepackRecord | RepackRecord |
Typedef for struct _RepackRecord. | |
typedef struct _RepackResult | RepackResult |
Typedef for struct _RepackResult. | |
typedef struct _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. |
$ qse_repacktest -A <file.ebf> where A: Repack AEM
CVS $Id: qse_repacktest.c,v 1.4 2011/08/05 17:11:20 russell Exp $
#define HW_ACCESS | ( | _hwa | ) | *(unsigned short int *)(&(_hwa)) |
Typedef for struct _RepackResult.
This contains two values, 0 is the unpack record, 1 is the repack record.
enum _REPACK_OBJ_K |
Enumerates what to unpack/repack.
enum _REPACK_OBJ_M |
Enumerates the bit masks of the unpack/repack objects.
enum _REPACK_OBJ_V |
Enumerates the bit positions of the unpack/repack objects.
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.
what | A string indentifying the customer | |
nbytes | The number of bytes to allocate |
Referenced by repackConstruct().
static void calc_summary | ( | RepackSummary * | summary, | |
const RepackResult * | results, | |||
int | nresults, | |||
unsigned int | objects | |||
) | [static] |
Calculates the summary statistics from the result records.
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 |
References _RepackResult::recs, REPACK_OBJ_K_CNT, _RepackCtl::result, _RepackRecord::size, _RepackCtl::size, _RepackRecord::status, and _RepackRecord::time.
Referenced by repackReport().
static int compare | ( | const void * | s1, | |
const void * | s2, | |||
int | nbytes | |||
) | [static] |
Compares the 32-bit bswapped arrays.
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. |
References HW_ACCESS.
Referenced by repackProcess().
static void dump | ( | const void * | dat, | |
int | nbytes | |||
) | [static] |
Produce a semi-formatted dump of the AEM data.
dat | Pointer to the data | |
nbytes | The number of bytes in the data |
References HW_ACCESS, and new_line().
Referenced by repackProcess().
static int fillCtl | ( | Ctl * | ctl, | |
int | argc, | |||
char *const | argv[] | |||
) | [static] |
Examines the command line parameters and fills the print control structure.
ctl | The parameter control 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 get_report_opts(), _Ctl::name, _Ctl::objects, REPACK_OBJ_M_AEM, REPACK_OBJ_M_ALL, REPACK_OBJ_M_DIR, REPACK_OBJ_M_DMP, reportUsage(), _Ctl::to_process, _Ctl::to_skip, and _Ctl::type.
Referenced by main().
static unsigned int get_report_opts | ( | const char * | optarg | ) | [static] |
Returns a bit mask of the reporting options.
optarg | Character string of the options |
References REPACK_OBJ_M_EVT, and REPACK_OBJ_M_SUM.
Referenced by fillCtl().
int main | ( | int | argc, | |
char *const | argv[] | |||
) |
Usual entry point for the readtest.
argc | The number of arguments | |
argv | The vector of arguments. |
$ 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.
cnt | The number columns to print |
References new_line().
Referenced by print_title(), and repackReport().
static void print_title | ( | const char * | caption, | |
unsigned int | objects | |||
) | [static] |
Prints the title bars for the report summary.
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 |
References new_line(), print_separator(), and REPACK_OBJ_K_CNT.
Referenced by repackReport().
static unsigned int repack | ( | Ctl * | ctl | ) | [static] |
Finishes the platform common setup and initalization, starts the packet flow.
ctl | The control structure |
References _Ctl::name, _Ctl::objects, _Ctl::repack, repackConstruct(), repackDestruct(), repackProcess(), repackReport(), repackSizeof(), _Ctl::to_process, _Ctl::to_skip, and _Ctl::type.
Referenced by main().
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.
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 |
References _RepackCtl::aem, alloc(), _RepackCtl::dir, _RepackCtl::ebf, _RepackCtl::ebfSize, _RepackCtl::freePrm, _RepackCtl::freeRtn, _RepackCtl::ievts, _RepackCtl::nevts, _RepackCtl::nobjects, _RepackCtl::objects, REPACK_OBJ_M_AEM, _RepackCtl::result, _RepackCtl::results, and _RepackCtl::siv.
Referenced by repack().
static int repackDestruct | ( | RepackCtl * | ctl | ) | [static] |
DeAllocates and the unpacking/repacking buffers.
ctl | Pointer to the control buffer |
References _RepackCtl::aem, _RepackCtl::dir, _RepackCtl::objects, REPACK_OBJ_M_AEM, REPACK_OBJ_M_DIR, and _RepackCtl::results.
Referenced by repack().
static unsigned int repackProcess | ( | RepackCtl * | ctl, | |
unsigned int | edw, | |||
EBF_pkt * | pkt | |||
) | [static] |
Loops through the events, printing the contents to stdout.
ctl | Control structure dictating how many and what to repack | |
edw | The event descriptor word | |
pkt | The packet to process |
References _RepackCtl::aem, compare(), _RepackCtl::dir, _RepackCtl::dirtime, dump(), _RepackCtl::ebf, _RepackCtl::ebfSize, _RepackCtl::freePrm, _RepackCtl::freeRtn, _RepackCtl::ievts, _RepackCtl::nevts, _RepackCtl::objects, _RepackCtl::pkt, _RepackResult::recs, REPACK_OBJ_K_AEM, REPACK_OBJ_K_DIR, REPACK_OBJ_M_AEM, REPACK_OBJ_M_DMP, _RepackCtl::result, _RepackCtl::siv, _RepackRecord::size, _RepackCtl::size, _RepackRecord::status, and _RepackRecord::time.
Referenced by repack().
static void repackReport | ( | const RepackCtl * | ctl | ) | [static] |
The reporting function.
ctl | The control parameters |
References calc_summary(), _RepackCtl::nobjects, _RepackCtl::objects, print_separator(), print_title(), REPACK_OBJ_M_EVT, REPACK_OBJ_M_SUM, report_evt_results(), report_summary(), _RepackCtl::result, and _RepackCtl::results.
Referenced by repack().
static int repackSizeof | ( | void | ) | [static] |
Returns the size, in bytes, of the control structure.
Referenced by repack().
static void report_evt_results | ( | const RepackResult * | results, | |
int | nresults, | |||
unsigned int | objects | |||
) | [static] |
Prints the event-by-event results.
results | The results array | |
nresults | The number of elements in the result array | |
objects | The bit mask of valid objects |
References new_line(), _RepackResult::recs, REPACK_OBJ_K_CNT, _RepackCtl::result, _RepackRecord::size, _RepackCtl::size, _RepackRecord::status, and _RepackRecord::time.
Referenced by repackReport().
static void report_summary | ( | RepackSummary * | summary, | |
unsigned int | objects | |||
) | [static] |
Reports the repacking summary statistics.
summary | The summary statistics | |
objects | The bit mask of valid objects |
References new_line(), REPACK_OBJ_K_CNT, and _RepackCtl::size.
Referenced by repackReport().