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.h File Reference

Public defs for Time Hack Services. More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Typedefs

typedef enum _THS_OPTION THS_OPTION
 Masks for option mask into THS_init.

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,
  THS_GEMPPS_HACK = 8
}

Functions

unsigned int THS_init (int optionMask)
 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).

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


Detailed Description

Public defs for Time Hack Services.

Author:
Ed Bacho -- ebacho@slac.stanford.edu
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 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:


Typedef Documentation

void(* THS_SendSlaveRtn)(void *arg, void *payload, int payloadLen)
 

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

Parameters:
arg - given arg to be included with call
payload - buffer with message to send
payloadLen - length of buffer
Returns:
none
This is routine used by THS to send messages between SIU and EPU. It must be passed down from module above that knows how to do this (most likly LSM using ITC calls)


Enumeration Type Documentation

enum _THS_OPTION
 

Enumeration values:
THS_GEM_HACK  enable time hack for gem clock (20 MHz)
THS_CPU_HACK  enable time hack for cpu clock (33/4 MHz)
THS_SIU_HACK  this cpu is the SIU
THS_GEMPPS_HACK  setup GEM to produce PPS (valid only on mv2304)


Function Documentation

unsigned int THS_cpuSetWarning unsigned int  expectedClkHz,
unsigned int  expectedDeltaClkHz
 

Set range for cpu clock warning messages.

Parameters:
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
Returns:
status

WCT_time THS_gemAbsTimeEvent int  gemStrobeIn,
int  gemClk
 

Calculate absolute time for event from strobe and clk provided with event (20MHz clk).

Parameters:
gemStrobeIn stobe counter from GEM from event data
gemClk clk counter from GEM from event data
Returns:
64b value of number of nanoSec since 1/1/2001
This routine takes the stobe and clk values from the GEM (part of event data) and converts it to an absolute time. Since this value is calulated through a table saved for the last N secs, it is only valid for the last N secs else will error and retun 0.

Here is the call graph for this function:

unsigned int THS_gemSetWarning unsigned int  expectedClkHz,
unsigned int  expectedDeltaClkHz
 

Set range for gem clock warning messages.

Parameters:
expectedClkHz - expected clock in Hz, <=0 uses default of 20MHz
expectedDeltaClkHz - expected delta clk in Hz, <0 uses default of 1% of clock
Returns:
status

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_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:13 2005 by doxygen 1.3.3