GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> THS / V1-6-3 > ths / rhel5-64
#include <PBS/PBS.h>
#include <PBS/WCT.h>
#include <PBS/TASK.h>
#include <PBS/TMR.h>
#include <PBS/LSU.h>
#include <PBS/MBA.h>
#include <PBS/FPA.h>
#include <PBS/BSWP.ih>
#include <LCBD/LCBD.h>
#include <MSG/MSG_pubdefs.h>
#include <THS/THS_msgs.h>
#include <THS_prvdefs.h>
#include <stdio.h>
Functions | |
| unsigned int | THS_init (int mask) |
| Inits the TimeHackService module. | |
| unsigned int | THS_simulatedPPS () |
| Return the state of the pulse-per-second simulation. | |
| unsigned int | THS_simulatedTT () |
| 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). | |
| unsigned int | THS_getLastPpsAbsTimeSec () |
| Get the absolute time value at last PPS. | |
| void | THS_stats () |
| Print some THS statistics. | |
| 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_setGemUpdateMsgs (int maxMsgs) |
| set size of memory pool for gemUpdate msgs, must be called before THS_init | |
| void | THS_setSlaveSend (THS_SendSlaveRtn rtn, void *arg, int lsmID) |
| stash away routine (from LCM) to send msg to EPU | |
| void | THS_sendSlaveGemSetTableMsg (unsigned int absTime, THS_GemTableFlags flags, unsigned int gemStrobe, LSU_factors Kgem) |
| send gmHack from SIU to EPU (this runs on SIU) | |
| 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) | |
This module handles calculation of absolute time using the "time hack". 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.
This module only truely works on the Rad750 which has the PPS input thru the PID registers. The mv2304 version can be sort-of simulated by setting up a task to provide PPS (see THS_test.c)
Inputs:
Output:
| unsigned int THS_getLastPpsAbsTimeSec | ( | ) |
Get the absolute time value at last PPS.
| 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_sendSlaveGemSetTableMsg | ( | unsigned int | absTime, | |
| THS_GemTableFlags | flags, | |||
| unsigned int | gemStrobe, | |||
| LSU_factors | Kgem | |||
| ) |
send gmHack from SIU to EPU (this runs on SIU)
| absTime | - time in sec since 1/1/2001 from tt message | |
| flags | - flags from tt message | |
| gemStrobe | - contents of gemStrobe reg with clk on last PPS and clk counter | |
| Kgem | - multiplcation constants for calcs |
| 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().
| void THS_stats | ( | ) |
Print some THS statistics.
References THS_CPU_HACK, THS_GEM_HACK, THS_gemCalcClkDiff(), THS_gemGetTableInfo(), and THS_prevTimtoneFromEvent().
| 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_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().
1.5.8