GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > GRBP / V0-4-2

Constituent: grbp_siu     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

grbp_siu.c File Reference

Program to test the SIU portion of the GRB algorithm. More...

#include "GRBP/io/GRB_stream.h"
#include "GRBP/io/ATT_stream.h"
#include "GRBP/io/ATT_dgm.h"
#include "GRBP/GRBP_client.h"
#include "GRBP_math.h"
#include "GRBP_msgdef.h"
#include "GRBP_pktdef.h"
#include "GRBP_DB/GRBP_DB_clientSchema.h"
#include "GRBP_DB/GRBP_DB_messageSchedule.h"
#include "GRBP_DB/GRBP_DB_window.h"
#include "GRBP_DB/GRBP_DB_print.h"
#include "GRBP_DB/GRBP_DB_locationSchedule.h"
#include "GRB/GRB_siu.h"
#include "ATT/ATT.h"
#include "CDM/CDM_pubdefs.h"
#include "CMX/CMX_lookupPub.h"
#include <stdio.h>
#include <stdlib.h>
#include "EDS/TMR.h"

Include dependency graph for grbp_siu.c:


Data Structures

struct  _Gbm
 Controls the contents and delivery of the GBM calculation message. More...
struct  _Ctl
 Captures the command line parameters. More...

Defines

#define RADIANS(_degrees)   ((_degrees) * (M_PI/180))
 Converts degrees to the equivalent number of radians.

Typedefs

typedef enum _OutStyle OutStyle
 Typedef for enum _OutStyle.
typedef _Gbm Gbm
 Typedef for struct _Gbm.
typedef _Ctl Ctl
 Typedef for struct _Ctl.

Enumerations

enum  _OutStyle {
  OUTSTYLE_K_NONE = 0,
  OUTSTYLE_K_ASCII = 1,
  OUTSTYLE_K_BINARY = 2
}
 The output styles. More...

Functions

int main (int argc, char *const argv[])
 Entry point to the client side (SIU) GRBP test program.
int doit (Ctl *ctl)
 Workhorse routine to feed the message and attitude files to the client-side GRBP code.
static int fill_gbm (Gbm *gbm, const char *string)
 Parses the gbm options string.
static void * mem_alloc (unsigned int nbytes)
 Wraps the 'real' allocator.
static void mem_free (void *ptr)
 Wraps the 'real' deallocator.
static const void * lookup (const char *symbol)
 Looksup the address of symbol using CMX_lookupSymbol and exits if not found.
static GRBP_DB_clientSchemaAll * getSchema (int verbose)
 Returns the GRBP DB schema.
static const GRB_latMsgServices * getMsgServices (OutStyle style, const char *name)
 Gets the message service vector based on the output style.
static void closeMsgServices (OutStyle style)
 Closes the message services based on the style.
static ATT_stream * read_att (const char *name, int flag)
 Opens and reads the specified ATT file.
static __inline ATT_Control * setup_att (int size)
 Sets up the ATT record history buffer.
static GRB_stream * read_grb (const char *name, int flag)
 Opens and reads the specified GRB message file.
static __inline unsigned long
long int 
get_base_time (const ATT_attitude *attitude)
 Gets the base time of the GRB.
static void __inline print_msg (const GRBP_msg *msg, int flag)
 Prints the specified GRB message.
static void __inline print_attitude (const ATT_attitude *attitude, int flag)
 Prints the attitude record.
static void __inline print_attitude_header (int flag)
 Prints the attitude header line.
static void reportUsage (void)
 Reports on the usage of grbp_siu.
static int fillCtl (Ctl *ctl, int argc, char *const argv[])
 Examines the command line parameters and fills the control structure.
static int loadLib (const char *library_name, int verbose)
 Dynamically loads the specified configuration library.
static void suspect_null (const GRB_latAlertMsg *alert)
 Dummy GRB LAT suspect alert message handler.
static void confirm_null (int duration, double ra, double dec)
 Dummy a GRB LAT repoint request message handler.
static void update_null (const GRB_latAlertMsg *alert)
 Dummy GRB LAT update alert message handler.
static void closeout_null (const GRB_latAlertMsg *alert)
 Dummy GRB LAT closeout alert message handler.
static void alert_fprintf (FILE *fp, const char *name, const GRB_latAlertMsg *alert)
 Print the contents of a GRB LAT a alert message.
static void open_fprintf (const char *name)
 Opens an output file to print the alert messages to.
static void close_fprintf (void)
 Closes the output file.
static void suspect_fprintf (const GRB_latAlertMsg *alert)
 Print the contents of a GRB LAT suspect alert message.
static void confirm_fprintf (int duration, double ra, double dec)
 Print the parameters of the repoint request.
static void update_fprintf (const GRB_latAlertMsg *alert)
 Print the contents of a GRB LAT update alert message.
static void closeout_fprintf (const GRB_latAlertMsg *alert)
 Print the contents of a GRB LAT closeout alert message.

Variables

static FILE * AlertFp
 The file pointer to write to.

Detailed Description

Program to test the SIU portion of the GRB algorithm.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: grbp_siu.c,v 1.5 2007/08/10 20:47:54 russell Exp $

Define Documentation

#define RADIANS _degrees   )     ((_degrees) * (M_PI/180))
 

Converts degrees to the equivalent number of radians.

Returns:
The equivalent number of radians
Parameters:
_degrees The value, in degrees, to convert to radians


Enumeration Type Documentation

enum _OutStyle
 

The output styles.

Enumerator:
OUTSTYLE_K_NONE  No output file
OUTSTYLE_K_ASCII  ASCII output file
OUTSTYLE_K_BINARY  Binary output file


Function Documentation

static void alert_fprintf FILE *  fp,
const char *  type,
const GRB_latAlertMsg *  alert
[static]
 

Print the contents of a GRB LAT a alert message.

Parameters:
fp The target file pointer
type An ASCII string giving the type of message, ie. one of SUSPECT, CONFIRM, UPDATE. CLOSEOUT.
alert The alert message

static void closeMsgServices OutStyle  style  )  [static]
 

Closes the message services based on the style.

Parameters:
style The output style

static void closeout_fprintf const GRB_latAlertMsg *  alert  )  [static]
 

Print the contents of a GRB LAT closeout alert message.

Parameters:
alert The closeout alert message

static void closeout_null const GRB_latAlertMsg *  alert  )  [static]
 

Dummy GRB LAT closeout alert message handler.

Parameters:
alert The closeout alert message

static void confirm_fprintf int  duration,
double  ra,
double  dec
[static]
 

Print the parameters of the repoint request.

Parameters:
duration Duration, in seconds, of the alert
ra The right ascension, in degrees
dec The declination, in degrees

static void confirm_null int  duration,
double  ra,
double  dec
[static]
 

Dummy a GRB LAT repoint request message handler.

Parameters:
duration Duration, in seconds, of the alert
ra The right ascension, in degrees
dec The declination, in degrees

int doit Ctl ctl  ) 
 

Workhorse routine to feed the message and attitude files to the client-side GRBP code.

Parameters:
ctl The control parameters

static int fill_gbm Gbm gbm,
const char *  string
[static]
 

Parses the gbm options string.

Parameters:
gbm The Gbm structure to fill
string The Gbm options string

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

Examines the command line parameters and fills the 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 __inline unsigned long long int get_base_time const ATT_attitude attitude  )  [static]
 

Gets the base time of the GRB.

Returns:
The base time
Parameters:
attitude The first attitude record

static const GRB_latMsgServices * getMsgServices OutStyle  style,
const char *  name
[static]
 

Gets the message service vector based on the output style.

Parameters:
style The output style
name The name of the output file

static GRBP_DB_clientSchemaAll * getSchema int  verbose  )  [static]
 

Returns the GRBP DB schema.

Returns:
The GRBP DB schema
Parameters:
verbose Flag indicating to print message about the origin either dynamically loaded CDM or default parameters

static int loadLib const char *  library_name,
int  verbose
[static]
 

Dynamically loads the specified configuration library.

Return values:
0,success 
-1,failure 
Parameters:
library_name The name of the library to load
verbose The verbosity level

static const void * lookup const char *  symbol  )  [static]
 

Looksup the address of symbol using CMX_lookupSymbol and exits if not found.

Returns:
The address of the symbol.
Parameters:
symbol The symbol to lookup
This is just a cover for CMX_lookupSymbol, exiting if the symbol is not found.

static void * mem_alloc unsigned int  nbytes  )  [static]
 

Wraps the 'real' allocator.

Returns:
Pointer to the allocated memory or NULL if not available
Parameters:
nbytes The number of bytes
On the embedded systems, the memory pool available to malloc is too small for the larger .ebf files. Typically in this environment one should use MBA_alloc/MBA_free, However, because the EDS package is supposed to be independent of other packages (including PBS) one can not link against in the traditional manner.
The solution is two fold
  • Do the usual thing and define wrapper functions that are different for the host and embedded systems.
  • Go one step further and define MBA_alloc/MBA_free as weak symbols.
This second point effectively transfers the burden of determining when the MBA_alloc/MBA_free symbols need to be satistied. Instead of at the static link or dynamic load stage, this is deferred till runtime.
Note:
There is likely an even trickier way to do this. Currently the code checks if MBA_alloc/MBA_free are non-NULL and if so uses them, else it reverts to malloc/free. Ideally the dynamic loader should do this, thus eliminating the need for any run-time code.

static void mem_free void *  ptr  )  [static]
 

Wraps the 'real' deallocator.

See also:
mem_alloc
Parameters:
ptr Pointer to the memory to free
Note:
See mem_alloc for a discussion on why mem_alloc and mem_free exist and for the implementation details

static void open_fprintf const char *  name  )  [static]
 

Opens an output file to print the alert messages to.

Parameters:
name The name of the output file

static void __inline print_attitude const ATT_attitude attitude,
int  flag
[static]
 

Prints the attitude record.

Parameters:
attitude The attitude record to parse
flag Flag indicating whether to print or not

static void __inline print_attitude_header int  flag  )  [static]
 

Prints the attitude header line.

Parameters:
flag Flag indicating whether to print or not

static __inline void print_msg const GRBP_msg msg,
int  flag
[static]
 

Prints the specified GRB message.

Parameters:
msg The message to print
flag The print flags

static ATT_stream * read_att const char *  name,
int  flag
[static]
 

Opens and reads the specified ATT file.

Parameters:
name The name of the file to open
flag Print flag

static GRB_stream * read_grb const char *  name,
int  flag
[static]
 

Opens and reads the specified GRB message file.

Parameters:
name The name of the file to open
flag Print flag

static __inline ATT_Control * setup_att int  size  )  [static]
 

Sets up the ATT record history buffer.

Returns:
A pointer to the history buffer
Parameters:
size The size of the history buffer

static void suspect_fprintf const GRB_latAlertMsg *  alert  )  [static]
 

Print the contents of a GRB LAT suspect alert message.

Parameters:
alert The suspect alert message

static void suspect_null const GRB_latAlertMsg *  alert  )  [static]
 

Dummy GRB LAT suspect alert message handler.

Parameters:
alert The suspect alert message

static void update_fprintf const GRB_latAlertMsg *  alert  )  [static]
 

Print the contents of a GRB LAT update alert message.

Parameters:
alert The update alert message

static void update_null const GRB_latAlertMsg *  alert  )  [static]
 

Dummy GRB LAT update alert message handler.

Parameters:
alert The update alert message


Generated on Wed Dec 5 06:57:48 2007 by  doxygen 1.4.4