GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> THS / dev > ths / sun-gcc
#include <LSF/LSF_statsHdr.h>
#include <PBS/WCT.h>
#include <PBI/Endianness.h>
Classes | |
struct | _THS_GemTableFlagsBf |
Structure to map out the bit fields time hack flags stored as 32 bits in gemTable. More... | |
struct | _THS_GemTableFlags |
Union for different access of 32 bit flags in gemTable. More... | |
Typedefs | |
typedef enum _THS_OPTION | THS_OPTION |
Masks for option mask into THS_init. | |
typedef enum _THS_FSW_FLAGS | THS_THS_FSW_FLAGS |
Masks for FSW flags in gem table. | |
typedef struct _THS_GemTableFlagsBf | THS_GemTableFlagsBf |
Typedef for struct _THS_GemTableFlagsBf. | |
typedef union _THS_GemTableFlags | THS_GemTableFlags |
Typedef for struct _THS_GemTableFlags. | |
typedef unsigned int( | THS_SendSlaveRtn )(void *lsmArg, short lsmID, short thsId, int nid, void *payload, int payloadLen, void *payloadFreeRtn, void *payloadFreeRtnArg) |
stash away routine (from LCM) to send msg to EPU | |
Enumerations | |
enum | _THS_OPTION { THS_GEM_HACK = 1, THS_CPU_HACK = 2, THS_SIU_HACK = 4 } |
enum | _THS_FSW_FLAGS { THS_FSW_FLAG_TT_SIM = 1, THS_FSW_FLAG_CPU_PPS_SIM = 2, THS_FSW_FLAG_GEM_PPS_SIM = 4, THS_FSW_FLAG_NO_HACK_TABLE = 8 } |
Functions | |
unsigned int | THS_init (int optionMask) |
Inits the TimeHackService module. | |
unsigned int | THS_simulatedPPS (void) |
Return the state of the pulse-per-second simulation. | |
unsigned int | THS_simulatedTT (void) |
Return the state of the timetone simulation. | |
unsigned int | THS_wait () |
Wait for TimeHackService module to be fully operational. | |
unsigned int | THS_timetone (unsigned int absTimeSec, unsigned short saFlags) |
Provide absTime for next entry in table (on next PPS). | |
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 *flag) |
get timetone/flags from table for this event | |
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_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_cpuSetWarning (unsigned int expectedClkHz, unsigned int expectedDeltaClkHz) |
Set range for cpu clock warning messages. | |
unsigned int | THS_gemSetWarning (unsigned int expectedClkHz, unsigned int expectedDeltaClkHz) |
Set range for gem clock warning messages. | |
void | THS_setPpsWarnEvery (unsigned int warnPpsEvery) |
Set how often get warning when no PPS. | |
void | THS_setTimetoneWarnEvery (unsigned int _warnTimetoneEvery) |
Set how often get warning when no timetone. | |
void | THS_setSlaveSend (THS_SendSlaveRtn rtn, void *arg, int lsmId) |
stash away routine (from LCM) to send msg to EPU | |
unsigned int | THS_slaveProcessMsg (int func, void *payload, unsigned int len) |
routine called from ITC dispatch in LSM to process each message it receives (this routine is run on EPU when it receives message) | |
void | THS_setGemUpdateMsgs (int maxMsgs) |
set size of memory pool for gemUpdate msgs, must be called before THS_init | |
unsigned int | THS_lsfStatFirstEvt (LSF_statsHdr *statsHdr, unsigned long long seq, unsigned int gemClock, unsigned int gemStrobe) |
Sets first event parms within LSF_statsHdr. | |
void | THS_lsfStatIncEvt (LSF_statsHdr *statsHdr, int increment) |
Increment event counter in LSF_statsHdr structure. | |
unsigned int | THS_lsfStatLastEvt (LSF_statsHdr *statsHdr, unsigned long long seq, unsigned int gemClock, unsigned int gemStrobe) |
Sets last event parms within LSF_statsHdr. | |
void | THS_lsfStatClear (LSF_statsHdr *statsHdr) |
Clear the LSF_statsHdr structure. |
This file has routines for adjusting the time on the CPU clock by using the WCT_set/get routines, therefore one can only get the current time thru WCT_get(). THese are based on a sub-multiple of the CPU's 33 MHz PCI clock.
The determination of the absolute time from event and LCB times is handled in other time hack files.
This module only truely works on the Rad750 which has the PPS input thru the PID registers. The mv2304 version starts up a task to simulate the PPS but it should therefore show no drift (since its locked with the clock)
Inputs:
Output:
void(* THS_SendSlaveRtn)(void *arg, void *payload, int payloadLen) |
stash away routine (from LCM) to send msg to EPU
arg | - given arg to be included with call | |
payload | - buffer with message to send | |
payloadLen | - length of buffer |
enum _THS_FSW_FLAGS |
enum _THS_OPTION |
unsigned int THS_cpuSetWarning | ( | unsigned int | expectedClkHz, | |
unsigned int | expectedDeltaClkHz | |||
) |
Set range for cpu clock warning messages.
expectedClkHz | - expected clock in Hz, <=0 uses default, (16.6MHz on mv2304, 8.3MHz on Rad750) | |
expectedDeltaClkHz | - expected delta clk in Hz, <0 uses default of 2% of clock |
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_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_init | ( | int | mask | ) |
Inits the TimeHackService module.
mask | time hack options, 1=CPU time hack, 2=Gem Time Hack, 4=CpuIsSiu |
References THS_CPU_HACK, THS_cpuInit(), THS_GEM_HACK, THS_gemInit(), and THS_SIU_HACK.
void THS_lsfStatClear | ( | LSF_statsHdr * | statsHdr | ) |
Clear the LSF_statsHdr structure.
statsHdr | pointer to LSF_statsHdr structure to fill in |
unsigned int THS_lsfStatFirstEvt | ( | LSF_statsHdr * | statsHdr, | |
unsigned long long | seq, | |||
unsigned int | gemClock, | |||
unsigned int | gemStrobe | |||
) |
Sets first event parms within LSF_statsHdr.
statsHdr | pointer to LSF_statsHdr structure to fill in | |
seq | extended seqence number of the event | |
gemClock | evt clock register read from GEM contributor of event | |
gemStrobe | evt PPS cock register read from GEM contributor of event |
References THS_prevTimtoneFromEvent().
void THS_lsfStatIncEvt | ( | LSF_statsHdr * | statsHdr, | |
int | increment | |||
) |
Increment event counter in LSF_statsHdr structure.
statsHdr | pointer to LSF_statsHdr structure to fill in | |
increment | number of events to increase evt count by |
unsigned int THS_lsfStatLastEvt | ( | LSF_statsHdr * | statsHdr, | |
unsigned long long | seq, | |||
unsigned int | gemClock, | |||
unsigned int | gemStrobe | |||
) |
Sets last event parms within LSF_statsHdr.
statsHdr | pointer to LSF_statsHdr structure to fill in | |
seq | extended seqence number of the event | |
gemClock | evt clock register read from GEM contributor of event | |
gemStrobe | evt PPS cock register read from GEM contributor of event |
References THS_prevTimtoneFromEvent().
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().
void THS_setGemUpdateMsgs | ( | int | maxMsgs | ) |
set size of memory pool for gemUpdate msgs, must be called before THS_init
maxMsgs | number of gem table update messages in memory pool |
void THS_setPpsWarnEvery | ( | unsigned int | warnPpsEvery | ) |
Set how often get warning when no PPS.
warnPpsEvery | 0=warn once when no pps detect, n=warn every N sec |
void THS_setSlaveSend | ( | THS_SendSlaveRtn | rtn, | |
void * | arg, | |||
int | lsmID | |||
) |
stash away routine (from LCM) to send msg to EPU
rtn | - pointer to function to use to send off message to EPU | |
arg | - 1st arg passed into rtn | |
lsmID | - 2nd arg passed into rtn |
void THS_setTimetoneWarnEvery | ( | unsigned int | warnTimetoneEvery | ) |
Set how often get warning when no timetone.
warnTimetoneEvery | 0=warn once when no tt detect, n=warn every N sec |
unsigned int THS_simulatedPPS | ( | void | ) |
Return the state of the pulse-per-second simulation.
0 | Pulse-per-second is not being simulated | |
1 | Pulse-per-second is being simulated |
unsigned int THS_simulatedTT | ( | void | ) |
Return the state of the timetone simulation.
0 | Timetone is not being simulated | |
1 | Timetone is being simulated |
unsigned int THS_slaveProcessMsg | ( | int | func, | |
void * | payload, | |||
unsigned int | len | |||
) |
routine called from ITC dispatch in LSM to process each message it receives (this routine is run on EPU when it receives message)
func | func code for message | |
payload | - buffer with received message | |
len | - length of given buffer |
References THS_FSW_FLAG_CPU_PPS_SIM, THS_FSW_FLAG_TT_SIM, THS_gemSetTable(), and THS_timetone().
unsigned int THS_timetone | ( | unsigned int | absTimeSec, | |
unsigned short | saFlags | |||
) |
Provide absTime for next entry in table (on next PPS).
absTimeSec | - absolute time for next PPS pulse in secs since 1/1/2001 | |
saFlags | - flags from Spectrum Astro (i.e. in Magic 7 telecommand) |
Referenced by THS_slaveProcessMsg().
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.
unsigned int THS_wait | ( | ) |
Wait for TimeHackService module to be fully operational.
start up bunch of things including Sw to call THS_timeTone() every second as result of message from spacecraft Hw to cause PPS interrupt every second
THS_wait() (this routine waits till receives two THS_timeTone() followed by PPS interrupt)
References THS_CPU_HACK, THS_cpuWait(), THS_GEM_HACK, and THS_gemWait().