GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > SIIS / dev

Constituent: siis2moc     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

siis2moc.c File Reference

Convert a SIIS archive file to MOC level 0 files. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "CCSDS/CCSDS_pkt.h"
#include "CCSDS/CCSDS_pri.h"
#include "MSG/MSG_pubdefs.h"
#include "MSG/MSG_printProc.h"
#include "PBS/TASK.h"
#include "SIIS/SIIS_file.h"
#include "SIIS/SIIS_moc.h"
#include "SIIS/SIIS_rec.h"
#include "SIIS/SIIS_vcdu.h"

Include dependency graph for siis2moc.c:


Data Structures

struct  _Apid_Info

Defines

#define GLAST_ID   251
#define DIM(a)   (sizeof (a) / sizeof (*a))

Typedefs

typedef _Apid_Info Apid_Info

Functions

static unsigned int find_apid_entry (Apid_Info **apid_info_p, const unsigned short apid, const unsigned short vcid)
static unsigned int add_apid_entry (Apid_Info **apid_info_p, const unsigned short apid, const unsigned short vcid)
static unsigned int parse_command_line (int argc, char *argv[])
 Interpret the command line parameters.
void print_message (MSG_OutputModes mode, void *prm, const MSG_Message *msg)
 Output processor callback routine to print messages.
static unsigned int start_message_system (void)
static unsigned int stop_message_system (void)
static unsigned int skip_file_data (FILE *in_file, const unsigned int num_bytes)
static unsigned int create_moc_file (Apid_Info *apid_info, const SIIS_Pdu_Hdr *pdu_hdr)
static unsigned int get_apid_info (Apid_Info **apid_info_p, const SIIS_Pdu_Hdr *pdu_hdr, const unsigned short apid)
static unsigned int close_moc_files (void)
static unsigned int gather_pdu_header (SIIS_Pdu_Hdr *pdu_hdr, const unsigned int vcdu_status, const unsigned int time_tag, const SIIS_Vcdu_Hdr *vcdu_hdr)
static unsigned int parse_ccsds_header (const unsigned char *data, const unsigned int data_bytes, unsigned short *type, unsigned short *apid, unsigned short *length)
static unsigned int write_ccsds_packet (SIIS_Pdu_Hdr *pdu_hdr, const unsigned char *data, const unsigned int data_bytes, const unsigned short apid, const unsigned short length)
static unsigned int extract_ccsds_packets (SIIS_Pdu_Hdr *pdu_hdr, const unsigned char *data, unsigned int data_bytes)
static unsigned int process_raw_telem (const unsigned char *body, const unsigned int body_bytes, const unsigned int time_tag)
unsigned int process_record (FILE *in_file)
int main (int argc, char *argv[])

Variables

static char * In_File_Name
 Pointer to the name of the input file.
static int Include_All
 Indicates whether we're including all APIDs.
static int Frame_Count = 0
 Number of VCDU frames processed.
static int Packet_Read_Count = 0
 Number of CCSDS packets read.
static int Packet_Write_Count = 0
 Number of CCSDS packets written.
static int Apid_Count = 0
 Number of different APIDs found.
static Apid_Info Apid_Vcid [32] = { { 0 } }
 Table of APID/VCIDs found in the archive file.

Detailed Description

Convert a SIIS archive file to MOC level 0 files.

  CVS $Id: siis2moc.c,v 1.3 2004/12/02 17:52:51 dmay Exp $
  

Extract CCSDS packets from a SIIS archive file and write them to level 0 MOC files.


Define Documentation

#define DIM  )     (sizeof (a) / sizeof (*a))
 

Calculate the number of items in an array.

#define GLAST_ID   251
 

Spacecraft ID for GLAST


Typedef Documentation

Apid_Info
 

The typedef for _Apid_Info


Function Documentation

unsigned int add_apid_entry Apid_Info **  apid_info_p,
const unsigned short  apid,
const unsigned short  vcid
[static]
 

Add a new entry in the APID/VCID table for a particular APID and VCID.

Parameters:
apid_info_p Pointer to location to store entry pointer.
apid APID for the packet.
vcid VCID for the packet.
Returns:
A SIIS MSG value.

unsigned int close_moc_files void   )  [static]
 

Close all level 0 MOC files that have been created.

Returns:
A SIIS MSG value.

unsigned int create_moc_file Apid_Info apid_info,
const SIIS_Pdu_Hdr pdu_hdr
[static]
 

Create a level 0 MOC file for a CCSDS packet.

Parameters:
apid_info Pointer to APID/VCID table entry.
pdu_hdr Pointer to packet annotation header information.
Returns:
A SIIS MSG value.

unsigned int extract_ccsds_packets SIIS_Pdu_Hdr pdu_hdr,
const unsigned char *  data,
unsigned int  data_bytes
[static]
 

Extract the CCSDS packets from within a VCDU frame and store them in MOC level 0 files.

Parameters:
pdu_hdr Pointer to packet annotation header info.
data Pointer to start of the VCDU frame data unit zone.
data_bytes Number of bytes of data within the data unit zone.
Returns:
A SIIS MSG value.

unsigned int find_apid_entry Apid_Info **  apid_info_p,
const unsigned short  apid,
const unsigned short  vcid
[static]
 

Find an entry in the APID/VCID table for a particular APID and VCID.

Parameters:
apid_info_p Pointer to location to store entry pointer.
apid APID for the packet.
vcid VCID for the packet.
Returns:
A SIIS MSG value.

unsigned int gather_pdu_header SIIS_Pdu_Hdr pdu_hdr,
const unsigned int  vcdu_status,
const unsigned int  time_tag,
const SIIS_Vcdu_Hdr vcdu_hdr
[static]
 

Gather information that will be stored in a packet annotation header.

Parameters:
pdu_hdr Pointer to location to store annotation header info.
vcdu_status Status from SIIS_vcduGetHdr.
time_tag Time at which record was written to archive file.
vcdu_hdr Pointer to VCDU header info for this frame.
Returns:
A SIIS MSG value.

unsigned int get_apid_info Apid_Info **  apid_info_p,
const SIIS_Pdu_Hdr pdu_hdr,
const unsigned short  apid
[static]
 

Find the entry in the APID/VCID table for a particular APID and VCID. If there is no entry, then create a new entry and a new level 0 MOC file.

Parameters:
apid_info_p Pointer to location to store entry pointer.
pdu_hdr Pointer to packet annotation header information.
apid APID for the packet.
Returns:
A SIIS MSG value.

int main int  argc,
char *  argv[]
 

The application entry point.

Parameters:
argc The number of command line args.
argv The list of command line args.
Return values:
0 Success.
-1 Failure.

unsigned int parse_ccsds_header const unsigned char *  data,
const unsigned int  data_bytes,
unsigned short *  type,
unsigned short *  apid,
unsigned short *  length
[static]
 

Extract information from the header of a CCSDS packet. Note that the 'length' value includes the length of the packet header.

Parameters:
data Pointer to start of the packet buffer.
data_bytes Number of bytes of data in the packet buffer.
type Pointer to location to return packet type.
apid Pointer to location to return packet APID.
length Pointer to location to return packet length.
Returns:
A SIIS MSG value.

unsigned int parse_command_line int  argc,
char *  argv[]
[static]
 

Interpret the command line parameters.

Parameters:
argc The number of command line args.
argv The list of command line args.
Returns:
A SIIS MSG value.

void print_message MSG_OutputModes  mode,
void *  prm,
const MSG_Message *  msg
 

Output processor callback routine to print messages.

Parameters:
mode (in) Output processor calling mode
prm (in) User parameter
msg (in) Message structure
Prints a message using printf.

unsigned int process_raw_telem const unsigned char *  body,
const unsigned int  body_bytes,
const unsigned int  time_tag
[static]
 

Process a raw telemetry record from the SIIS archive file. For each CCSDS packet within the record, add a packet annotation header to it and store it into a level 0 MOC file.

Parameters:
body Pointer to body of the record.
body_bytes Number of bytes of data within the record body.
time_tag Time at which record was written to archive file.
Returns:
A SIIS MSG value.

unsigned int process_record FILE *  in_file  ) 
 

Process a record from the SIIS archive file. Do nothing with the record unless it is a raw telemetry record. For raw telemetry records, extract the CCSDS packets and store them in MOC level 0 files.

When finished, the file position indicator for in_file will point to the start of the next record within the archive file.

Parameters:
in_file Archive file handle.
Returns:
A SIIS MSG value.

unsigned int skip_file_data FILE *  in_file,
const unsigned int  num_bytes
[static]
 

Read and discard data from a file.

Parameters:
in_file File handle.
num_bytes Number of bytes to read and discard.
Returns:
A SIIS MSG value.

unsigned int start_message_system void   )  [static]
 

Start the messaging system.

Returns:
A SIIS MSG value.

unsigned int stop_message_system void   )  [static]
 

Stop the messaging system.

Returns:
A SIIS MSG value.

unsigned int write_ccsds_packet SIIS_Pdu_Hdr pdu_hdr,
const unsigned char *  data,
const unsigned int  data_bytes,
const unsigned short  apid,
const unsigned short  length
[static]
 

Write a CCSDS packet and packet annotation header to a level 0 MOC file. There is a separate file for each APID/VCID. The file is created if this is the first packet for a given file.

Parameters:
pdu_hdr Pointer to packet annotation header information.
data Pointer to start of the packet buffer.
data_bytes Number of bytes of data in the packet buffer.
apid APID for the packet.
length Length of the packet, in bytes, as reported in its header.
Returns:
A SIIS MSG value.


Generated on Tue Dec 4 12:22:58 2007 by  doxygen 1.4.4