GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > CAL_DB / V0-2-3
Constituent: cal_db_gains_create     Tag: sun-gcc
#include <stdio.h>
#include <stdlib.h>
#include "cal_import.h"
#include "cal_import_gains.h"
#include "calib_db_create.h"
Include dependency graph for cal_db_gains_create.c:
Data Structures | |
struct | _Ctl |
The CAL include file creation control structure. More... | |
Typedefs | |
typedef _Ctl | Ctl |
Typedef for struct _Ctl. | |
Functions | |
static void | reportUsage (void) |
Brief explanation of the test creation usage. | |
static int | idealized_prepare (unsigned int *export, const float gains[4][2]) |
Prepares the imported data for export. | |
static int | full_prepare (unsigned int *export, const float gains[16][8][12][4][2]) |
Prepares the imported data for export. | |
static int | writeFile (FILE *hfile, const char *hname, const char *package, const char *constituent, const char *version, CALIB_DB_STYLE_K style, const char *origin_name, const char *style_name, unsigned int key, unsigned int tag, const unsigned int *export) |
Files and writes the output include file. | |
static void | full_write (FILE *hfile, const unsigned int *export) |
Writes the FULL version of the gains. | |
static void | idealized_write (FILE *hfile, const unsigned int *export) |
Writes the IDEALIZED version of the gains. | |
static int | fillCtl (Ctl *ctl, int argc, char *const argv[]) |
Examines the command line parameters and fills the include file creation control structure. | |
static __inline unsigned int | compose (float mev_f) |
Composes the calibration values for one log end. | |
static void | fillGains (unsigned short int *gains, const unsigned int *exports) |
Fills one layers worth of gains. | |
static void | fillShifts (unsigned short int *shifts, const unsigned int *exports) |
Fills one layers worth of shifts. | |
static int | writeLayer (FILE *hfile, int lyr, const unsigned short int v[24]) |
Write one layers worth of constants. | |
int | CalDbGainsCreate (int argc, char *const argv[], const CalImportGains *import) |
Driver program to create CAL calibration include file. | |
static __inline int | FFS (unsigned int val) |
Finds the First Set bit. |
CVS $Id: cal_db_gains_create.c,v 1.4 2006/09/14 18:39:49 russell Exp $
This program accepts a cal_gains.h file and converts it to a representation that is used to transform ADC values to Mev. This portion handles only the gain part of the linear transformation. The pedestals are done imilarly, but by a different program.
The mechanism is fairly clunky, belonging to that ilk of programs whose mission is to write another program. In this case, the gain data is written out as data to a C data structure, called the schema. The resulting file is then compiled and built into a shareable image.
In addition to holding the data values, this schema also holds pointers to routines that are used to access the data. This tactic allows the interface to be stable, but effectively hides the internal representation of the data. Because the accessor routine's job is act as a go-between between the caller and the internal data, it must
It is this last point that drives the design to include the implementation of these routines at the same time the data is defined. That keeps the two in lock step.
|
Typedef for struct _Ctl. Contains all the parameters controlling the creation and content of the test include file. |
|
Driver program to create CAL calibration include file.
|
|
Composes the calibration values for one log end.
|
|
Finds the First Set bit.
|
|
Examines the command line parameters and fills the include file creation control structure.
|
|
Fills one layers worth of gains.
|
|
Fills one layers worth of shifts.
|
|
Prepares the imported data for export.
|
|
Writes the FULL version of the gains.
|
|
Prepares the imported data for export.
|
|
Writes the IDEALIZED version of the gains.
|
|
Files and writes the output include file.
|
|
Write one layers worth of constants.
|