GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> THS / dev > ths / rhel5-64
#include <THS/THS_msgs.h>
#include <THS_prvdefs.h>
#include <LCBD/LCBD.h>
#include <LCBD/LCBD_pci.h>
#include <LEM/defs.h>
#include <LEM/decode.h>
#include <LEM/encode.h>
#include <LEM/encode_structs.h>
#include <LEM/cli.h>
#include <PBS/PBS.h>
#include <PBS/TASK.h>
#include <PBS/TMR.h>
#include <MSG/MSG_pubdefs.h>
#include <PBI/Endianness.h>
#include <stdio.h>
#include <string.h>
Functions | |
WCT_time | THS_gemAbsTimeEvent (int gemStrobeIn, int gemClk) |
Calculate absolute time for event from strobe and clk provided with event (20MHz clk). | |
unsigned int | THS_timetoneFromEvent (int gemStrobeIn, int *absTimeSecs, int *flags) |
get timetone/flags from table for this event | |
unsigned int | THS_prevTimtoneFromEvent (int gemStrobeIn, int *absTimeSecs, int *flags, int *absTimeSecsPrev, int *flagsPrev, int *gemStrobeInPrev) |
THIS IS MIS-SPELLING, it just calls THS_prevTimetoneFromEvent. | |
unsigned int | THS_prevTimetoneFromEvent (int gemStrobeIn, int *absTimeSecs, int *flags, int *absTimeSecsPrev, int *flagsPrev, int *gemStrobeInPrev) |
get timetone/flags from table for this event and for prev entry in table | |
unsigned int | THS_gemInit (int siu) |
Inits the TimeHackService module. | |
unsigned int | THS_gemWait () |
Start the TimeHackService module. | |
unsigned int | THS_gemGetTableInfo (int count, unsigned int *gemStrobe, LSU_factors *Kgem, unsigned int *flags) |
get info from hack table | |
unsigned int | THS_gemCalcClkDiff (unsigned int clk, unsigned int prevClk) |
calculate diff between clks assuming 25 bit clock | |
void | THS_gemIsr (unsigned int absTimeSec, THS_GemTableFlags flags) |
interrupt routine for gem specfic time hack | |
unsigned int | THS_gemSetWarning (unsigned int expectedClkHz, unsigned int expectedDeltaClkHz) |
Set range for gem clock warning messages. | |
void | THS_gemSetTable (unsigned int absTimeSec, THS_GemTableFlags flags, unsigned int gemStrobeIn, LSU_factors Kgem) |
Set a single entry in the gem hack table. |
This module handles calculation of absolute time using the "time hack" for the clk in the GEM (GASU).
The absolute (or true) time is provided once a second through a combination of a 1PPS (1 pulse per sec) hardware pulse and a time tone message ("at the tone the time will be") that preceeds it. The time provided in the time tone message from the scapecraft is in microSec since 1/1/2001. Hence the clock value is adjusted each second to account for clock counter drift from GEM clock.
The basic functions provided to application programs are:
Inputs:
Outputs:
WCT_time THS_gemAbsTimeEvent | ( | int | gemStrobeIn, | |
int | gemClk | |||
) |
Calculate absolute time for event from strobe and clk provided with event (20MHz clk).
gemStrobeIn | stobe counter from GEM from event data | |
gemClk | clk counter from GEM from event data |
References THS_FSW_FLAG_NO_HACK_TABLE, and THS_gemCalcClkDiff().
unsigned int THS_gemCalcClkDiff | ( | unsigned int | clk, | |
unsigned int | prevClk | |||
) |
calculate diff between clks assuming 25 bit clock
clk | latest gem clk value | |
prevClk | previous gem clock value |
Referenced by THS_gemAbsTimeEvent(), and THS_stats().
unsigned int THS_gemGetTableInfo | ( | int | count, | |
unsigned int * | gemStrobe, | |||
LSU_factors * | Kgem, | |||
unsigned int * | flags | |||
) |
get info from hack table
count | count value from gemStrobe, this is a 7 bit index into table | |
gemStrobe | gemStrobe register value for this | |
Kgem | ptr to extrapolation constants struct to fill | |
flags | return flags from tt message for this entry |
Referenced by THS_stats().
unsigned int THS_gemInit | ( | int | siu | ) |
Inits the TimeHackService module.
siu | 1=SIU(=commander on cmd/response), 0=EPU |
Referenced by THS_init().
void THS_gemIsr | ( | unsigned int | absTimeSec, | |
THS_GemTableFlags | flags | |||
) |
interrupt routine for gem specfic time hack
absTimeSec | absolute time at PPS from tt message | |
flags | Spectrum Astro and FSW flags |
void THS_gemSetTable | ( | unsigned int | absTimeSec, | |
THS_GemTableFlags | flags, | |||
unsigned int | gemStrobeIn, | |||
LSU_factors | Kgem | |||
) |
Set a single entry in the gem hack table.
absTimeSec | ||
flags | combined SA and FSW flags | |
gemStrobeIn | register read from GEM | |
Kgem | coeffients to calc absolute time |
References _THS_GemTableFlags::ui.
Referenced by THS_slaveProcessMsg().
unsigned int THS_gemSetWarning | ( | unsigned int | expectedClkHz, | |
unsigned int | expectedDeltaClkHz | |||
) |
Set range for gem clock warning messages.
expectedClkHz | - expected clock in Hz, <=0 uses default of 20MHz | |
expectedDeltaClkHz | - expected delta clk in Hz, <0 uses default of 1% of clock |
unsigned int THS_gemWait | ( | ) |
Start the TimeHackService module.
start up bunch of things including LCB driver Sw to call THS_timeTone() every second as result of message from spacecraft Hw to cause PPS interrupt every second
THS_gemWait() (this routine waits till received first THS_gemTimeTone() followed by PPS interrupt)
Referenced by THS_wait().
unsigned int THS_prevTimetoneFromEvent | ( | int | gemStrobeIn, | |
int * | absTimeSecs, | |||
int * | flags, | |||
int * | absTimeSecsPrev, | |||
int * | flagsPrev, | |||
int * | gemStrobeInPrev | |||
) |
get timetone/flags from table for this event and for prev entry in table
gemStrobeIn | stobe counter from GEM from event data | |
absTimeSecs | returns time from timetone message in secs for this event | |
flags | returns flags from timetone message for this event, bits defines as THS_GemTableFlags | |
absTimeSecsPrev | returns time from prev entry in table | |
flagsPrev | returns flags from prev entry in table, bits defines as THS_GemTableFlags | |
gemStrobeInPrev | returne gemStrobe register value from prev entry in table |
References THS_FSW_FLAG_NO_HACK_TABLE.
Referenced by THS_prevTimtoneFromEvent().
unsigned int THS_timetoneFromEvent | ( | int | gemStrobeIn, | |
int * | absTimeSecs, | |||
int * | flags | |||
) |
get timetone/flags from table for this event
gemStrobeIn | stobe counter from GEM from event data | |
absTimeSecs | returns time from timetone message in secs for this event | |
flags | returns flags from timetone message for this event, bits defines as THS_GemTableFlags |
References THS_FSW_FLAG_NO_HACK_TABLE.