GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> THS / dev > ths4ddt / rad750


Interface   Data Structures   File List   Data Fields   Globals  

THS.h File Reference

Public defs for Time Hack Services. More...

#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)
 Dummy routine.
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 ()
 Dummy routine.
unsigned int THS_timetone (unsigned int absTimeSec, unsigned short saFlags)
 One-time set the wall clock time.
WCT_time THS_gemAbsTimeEvent (int gemStrobeIn, int gemClk)
 Dummy routine.
unsigned int THS_timetoneFromEvent (int gemStrobeIn, int *absTimeSecs, int *flag)
 One-time set the wall clock time.
unsigned int THS_prevTimetoneFromEvent (int gemStrobeIn, int *absTimeSecs, int *flags, int *absTimeSecsPrev, int *flagsPrev, int *gemStrobeInPrev)
 Dummy routine.
unsigned int THS_prevTimtoneFromEvent (int gemStrobeIn, int *absTimeSecs, int *flags, int *absTimeSecsPrev, int *flagsPrev, int *gemStrobeInPrev)
 Dummy routine.
unsigned int THS_cpuSetWarning (unsigned int expectedClkHz, unsigned int expectedDeltaClkHz)
 Dummy routine.
unsigned int THS_gemSetWarning (unsigned int expectedClkHz, unsigned int expectedDeltaClkHz)
 Dummy routine.
void THS_setPpsWarnEvery (unsigned int warnPpsEvery)
 Dummy routine.
void THS_setTimetoneWarnEvery (unsigned int _warnTimetoneEvery)
 Dummy routine.
void THS_setSlaveSend (THS_SendSlaveRtn rtn, void *arg, int lsmId)
 Dummy routine.
unsigned int THS_slaveProcessMsg (int func, void *payload, unsigned int len)
 Dummy routine.
void THS_setGemUpdateMsgs (int maxMsgs)
 Dummy routine.
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.


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

Enumerator:
THS_FSW_FLAG_TT_SIM  Timtone value is simulated
THS_FSW_FLAG_CPU_PPS_SIM  no PPS interrupt, PPS simulated, might not be accurate
THS_FSW_FLAG_GEM_PPS_SIM  GEM did not get PPS, need to calc new GEM stobe val
THS_FSW_FLAG_NO_HACK_TABLE  These values did not come from HackTable

Enumerator:
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


Function Documentation

unsigned int THS_cpuSetWarning ( unsigned int  expectedClkHz,
unsigned int  expectedDeltaClkHz 
)

Dummy routine.

Parameters:
expectedClkHz (none) Ignored
expectedDeltaClkHz (none) Ignored
Return values:
0 Always
For compatibility with the THS_cpuSetWarning() entry point in THS proper.

WCT_time THS_gemAbsTimeEvent ( int  gemStrobeIn,
int  gemClk 
)

Dummy routine.

Parameters:
gemStrobeIn (none) Ignored
gemClk (none) Ignored
Return values:
0LL Always
For compatibility with the THS_gemAbsTimeEvent() entry point in THS proper.

unsigned int THS_gemSetWarning ( unsigned int  expectedClkHz,
unsigned int  expectedDeltaClkHz 
)

Dummy routine.

Parameters:
expectedClkHz (none) Ignored
expectedDeltaClkHz (none) Ignored
Return values:
0 Always
For compatibility with the THS_gemSetWarning() entry point in THS proper.

unsigned int THS_init ( int  mask  ) 

Dummy routine.

Parameters:
mask (none) Ignored
Return values:
0 Always
For compatibility with the THS_init() entry point in THS proper.

void THS_lsfStatClear ( LSF_statsHdr *  statsHdr  ) 

Clear the LSF_statsHdr structure.

Parameters:
statsHdr pointer to LSF_statsHdr structure to fill in
Returns:
nothing

unsigned int THS_lsfStatFirstEvt ( LSF_statsHdr *  statsHdr,
unsigned long long  seq,
unsigned int  gemClock,
unsigned int  gemStrobe 
)

Sets first event parms within LSF_statsHdr.

Parameters:
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
Returns:
status This is convenient routine to fill in event info that is stored in a LSF_statsHdr structure within an LSF packet for eventual output as science data on the SSR.

References THS_prevTimtoneFromEvent().

void THS_lsfStatIncEvt ( LSF_statsHdr *  statsHdr,
int  increment 
)

Increment event counter in LSF_statsHdr structure.

Parameters:
statsHdr pointer to LSF_statsHdr structure to fill in
increment number of events to increase evt count by
Returns:
nothing This is convenient routine to increment the event counter within LSF_statsHdr structure. Note that this in the number of events seen by the callback, the raw events rather than the number of prescaled events.

unsigned int THS_lsfStatLastEvt ( LSF_statsHdr *  statsHdr,
unsigned long long  seq,
unsigned int  gemClock,
unsigned int  gemStrobe 
)

Sets last event parms within LSF_statsHdr.

Parameters:
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
Returns:
status This is convenient routine to fill in event info that is stored in a LSF_statsHdr structure within an LSF packet for eventual output as science data on the SSR.

References THS_prevTimtoneFromEvent().

unsigned int THS_prevTimetoneFromEvent ( int  gemStrobeIn,
int *  absTimeSecs,
int *  flags,
int *  absTimeSecsPrev,
int *  flagsPrev,
int *  gemStrobeInPrev 
)

Dummy routine.

Parameters:
gemStrobeIn (none) Ignored
absTimeSecs (none) Ignored
flags (none) Ignored
absTimeSecsPrev (none) Ignored
flagsPrev (none) Ignored
gemStrobeInPrev (none) Ignored
Return values:
THS_NOINIT Always
For compatibility with the THS_prevTimetoneFromEvent() entry point in THS proper.

unsigned int THS_prevTimtoneFromEvent ( int  gemStrobeIn,
int *  absTimeSecs,
int *  flags,
int *  absTimeSecsPrev,
int *  flagsPrev,
int *  gemStrobeInPrev 
)

Dummy routine.

Parameters:
gemStrobeIn (none) Ignored
absTimeSecs (none) Ignored
flags (none) Ignored
absTimeSecsPrev (none) Ignored
flagsPrev (none) Ignored
gemStrobeInPrev (none) Ignored
Return values:
THS_NOINIT Always
For compatibility with the THS_prevTimtoneFromEvent() entry point in THS proper.

Referenced by THS_lsfStatFirstEvt(), and THS_lsfStatLastEvt().

void THS_setGemUpdateMsgs ( int  maxMsgs  ) 

Dummy routine.

Parameters:
maxMsgs (none) Ignored
For compatibility with the THS_setGemUpdateMsgs() entry point in THS proper.

void THS_setPpsWarnEvery ( unsigned int  warnPpsEvery  ) 

Dummy routine.

Parameters:
warnPpsEvery (none) Ignored
For compatibility with the THS_setPpsWarnEvery() entry point in THS proper.

void THS_setSlaveSend ( THS_SendSlaveRtn  rtn,
void *  arg,
int  lsmID 
)

Dummy routine.

Parameters:
rtn (none) Ignored
arg (none) Ignored
lsmID (none) Ignored
For compatibility with the THS_setSlaveSend() entry point in THS proper.

void THS_setTimetoneWarnEvery ( unsigned int  warnTimetoneEvery  ) 

Dummy routine.

Parameters:
warnTimetoneEvery (none) Ignored
For compatibility with the THS_setTimetoneWarnEvery() entry point in THS proper.

unsigned int THS_simulatedPPS ( void   ) 

Return the state of the pulse-per-second simulation.

Return values:
1 Pulse-per-second is being simulated
For compatibility with the THS_simulatedPPS() entry point in THS proper.

unsigned int THS_simulatedTT ( void   ) 

Return the state of the timetone simulation.

Return values:
1 Timetone is being simulated
For compatibility with the THS_simulatedPPS() entry point in THS proper.

unsigned int THS_slaveProcessMsg ( int  func,
void *  payload,
unsigned int  len 
)

Dummy routine.

Parameters:
func (none) Ignored
payload (none) Ignored
len (none) Ignored
Return values:
0 Always
For compatibility with the THS_slaveProcessMsg() entry point in THS proper.

unsigned int THS_timetone ( unsigned int  absTimeSec,
unsigned short  saFlags 
)

One-time set the wall clock time.

Parameters:
absTimeSec (none) Ignored
saFlags (none) Ignored
Return values:
0 Always
The only routine in THS/DDT that actually does any work. The first time this routine sees a timetone message, it will attempt to set wall-clock time (none too accurately, probably good to about 1/10 second), and call WUT_sys_adjust() to get all extant timeouts adjusted. After that, wall clock time simply free- wheels based on the CPU clock (which DDT will likely adjust).

unsigned int THS_timetoneFromEvent ( int  gemStrobeIn,
int *  absTimeSec,
int *  flags 
)

One-time set the wall clock time.

Parameters:
gemStrobeIn (none) Ignored
absTimeSec (none) Ignored
flags (none) Ignored
Return values:
THS_NOINIT Always
For compatibility with the THS_timetoneFromEvent() entry point in THS proper.

unsigned int THS_wait (  ) 

Dummy routine.

For compatibility with the THS_wait() entry point in THS proper.


Generated on Thu Mar 31 12:56:20 2011 by  doxygen 1.5.8