GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > THS / V1-0-5

Constituent: ths     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

THS.c File Reference

Time Hack Services for CPU. More...

#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>

Include dependency graph for THS.c:

Include dependency graph

Functions

unsigned int THS_init (int mask)
 Inits the TimeHackService module.

unsigned int THS_wait ()
 Wait for TimeHackService module to be fully operational.

unsigned int THS_timetone (unsigned int absTimeSec, unsigned short flags)
 Provide absTime for next entry in table (on next PPS).

unsigned int THS_getLastPpsAbsTimeSec ()
 Get the absolute time value at last PPS.

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, 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)


Detailed Description

Time Hack Services for CPU.

Author:
Ed Bacho -- ebacho@slac.stanford.edu
This is the controlling module for the Time Hack Services. It does the following:

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:


Function Documentation

unsigned int THS_getLastPpsAbsTimeSec  ) 
 

Get the absolute time value at last PPS.

Returns:
absolute time value

unsigned int THS_init int  mask  ) 
 

Inits the TimeHackService module.

Parameters:
mask time hack options, 1=CPU time hack, 2=Gem Time Hack, 4=CpuIsSiu
Returns:
status
This routine does basic init for THS and requires a few modules to be init (PBS,MSG, ??). It setup the Pid TImers for the PPS interrupt and prepares to handle timeones. Howver, it takes several seconds for time hack to be operational and THS_start() can be used to determine if it is operational.

Here is the call graph for this function:

void THS_sendSlaveGemSetTableMsg unsigned int  absTime,
unsigned int  gemStrobe,
LSU_factors  Kgem
 

send gmHack from SIU to EPU (this runs on SIU)

Parameters:
absTime - time in sec since 1/1/2001
gemStrobe - contents of gemStrobe reg with clk on last PPS and clk counter
Kgem - multiplcation constants for calcs
Returns:
none

void THS_setSlaveSend THS_SendSlaveRtn  rtn,
void *  arg,
int  lsmID
 

stash away routine (from LCM) to send msg to EPU

Parameters:
rtn - pointer to function to use to send off message to EPU
arg - 1st arg passed into rtn
lsmID - 2nd arg passed into rtn
Returns:
none
Given routine should be called as: (rtn)(arg, lsmId, int nid, void *payload, int payloadLen, void* payloadFreeRtn, void *payloadFreeRtnArg);

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)

Parameters:
func func code for message
payload - buffer with received message
len - length of given buffer
Returns:
none

Here is the call graph for this function:

unsigned int THS_timetone unsigned int  absTimeSec,
unsigned short  flags
 

Provide absTime for next entry in table (on next PPS).

Parameters:
absTimeSec - absolute time for next PPS pulse in secs since 1/1/2001
flags 
Returns:
status
This routine provides the absolute time for next PPS. This should come from the spacecrasft once a sec approx 500-800 milliSec before PPS.

unsigned int THS_wait  ) 
 

Wait for TimeHackService module to be fully operational.

Returns:
status
Since time hack requires a number of subsystems to be operating. These includes LCB driver, 1553 driver, and time tone messages from the scapecraft. Since this module requires two timeTone message from the spacecraft it might take 2 seconds before it is operational. THe routine does a slow poll waiting for the THS to be operational.

The sequence is: THS_init();

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)

Here is the call graph for this function:


Generated on Thu Jun 23 21:55:05 2005 by doxygen 1.3.3