GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> THS / dev > ths / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

THS_prvdefs.h File Reference

Private defs for Time Hack Services. More...

#include <PBS/LSU.h>
#include <PBS/WCT.h>
#include <THS/THS.h>

Functions

unsigned int THS_getLastPpsAbsTimeSec ()
 Get the absolute time value at last PPS.
unsigned int THS_cpuInit ()
 Inits the TimeHackService module.
unsigned int THS_cpuWait ()
 Start the TimeHackService module.
unsigned int THS_getLastPpsClock ()
 Get the CPU clk value at last PPS.
void THS_setLastPpsClock (unsigned int snapshot)
 Set the CPU clk value at last PPS.
void THS_cpuIsr (unsigned int absTimeSec, int newTimetone, unsigned int snapshot)
 interrupt routine for CPU specfic time hack
unsigned int THS_gemInit (int siu)
 Inits the TimeHackService module.
unsigned int THS_gemWait ()
 Start the TimeHackService module.
unsigned int THS_gemGetTableInfo (int count, unsigned int *gemStrobe, LSU_factors *Kgem, unsigned int *flags)
 get info from hack table
unsigned int THS_gemCalcClkDiff (unsigned int clk, unsigned int prevClk)
 calculate diff between clks assuming 25 bit clock
void THS_gemIsr (unsigned int absTimeSec, THS_GemTableFlags flags)
 interrupt routine for gem specfic time hack
void THS_gemSetTable (unsigned int absTimeSec, THS_GemTableFlags flags, unsigned int gemStrobeIn, LSU_factors Kgem)
 Set a single entry in the gem hack table.
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)


Detailed Description

Private defs for Time Hack Services.

Author:
Ed Bacho -- ebacho@slac.stanford.edu This module contains definitions shared between files in the THS module but not availible outside THS.

Function Documentation

unsigned int THS_cpuInit (  ) 

Inits the TimeHackService module.

Returns:
status This routine does basic init for THS cpu time hack and requires a few modules to be init (PBS,MSG, ??). Howver, actually operation will not happen till THS_cpuStart() is run.

Referenced by THS_init().

void THS_cpuIsr ( unsigned int  absTimeSec,
int  realPps,
unsigned int  snapshot 
)

interrupt routine for CPU specfic time hack

Parameters:
absTimeSec absolute time at PPS
realPps 1=indicates snapshot is real, 0=indicates snapshot is estimated
snapshot snapshot clk value at PPS
Returns:
nothing CPU Hack interrupt routine called from the ThsIsr() which is connected to the 1PPS interrutp. This adjusts the WCT clock with WCT_set().
CAUTION: THis routine adjusts the WUT timer module and it is very easy to kill the OS when modifying calls to WUT.

unsigned int THS_cpuWait (  ) 

Start the TimeHackService module.

Returns:
status Wait for the CPU TimeHackServices to start up. This routines requires that most of the software is operational. This includes LCB driver, 1553 driver, and time tone messages from the scapecraft enabled. Since this module requires a timeTone message from the spacecraft it can take up to 2 sec to return.
THe module is called within THS.c.

The sequence is: THS_cpuInit();

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_cpuWait() (this routine waits till received first THS_cpuTimeTone() followed by PPS interrupt)

Referenced by THS_wait().

unsigned int THS_gemCalcClkDiff ( unsigned int  clk,
unsigned int  prevClk 
)

calculate diff between clks assuming 25 bit clock

Parameters:
clk latest gem clk value
prevClk previous gem clock value
Returns:
difference between clk values

Referenced by THS_gemAbsTimeEvent(), and THS_stats().

unsigned int THS_gemGetTableInfo ( int  count,
unsigned int *  gemStrobe,
LSU_factors *  Kgem,
unsigned int *  flags 
)

get info from hack table

Parameters:
count count value from gemStrobe, this is a 7 bit index into table
gemStrobe gemStrobe register value for this
Kgem ptr to extrapolation constants struct to fill
flags return flags from tt message for this entry
Returns:
absolute time value at PPS in sec

Referenced by THS_stats().

unsigned int THS_gemInit ( int  siu  ) 

Inits the TimeHackService module.

Parameters:
siu 1=SIU(=commander on cmd/response), 0=EPU
Returns:
status This routine does basic init for gem specific THS and requires only a few modules to be init (PBS,MSG, ??). It is called from THS.c. Howver, it will not be fully operation till is has received timetone and PPS interrupt. THS_gemWait() can be used to wait for this state.

Referenced by THS_init().

THS_gemIsr ( unsigned int  absTimeSec,
THS_GemTableFlags  flags 
)

interrupt routine for gem specfic time hack

Parameters:
absTimeSec absolute time at PPS from tt message
flags Spectrum Astro and FSW flags
Returns:
nothing Interrupt routine connected to 1PPS input. This should be called from ThsIsr(). This is first half of processing to put a new entry into the time table. Other half is callback form LCB routine to read gem register.

void THS_gemSetTable ( unsigned int  absTimeSec,
THS_GemTableFlags  flags,
unsigned int  gemStrobeIn,
LSU_factors  Kgem 
)

Set a single entry in the gem hack table.

Parameters:
absTimeSec 
flags combined SA and FSW flags
gemStrobeIn register read from GEM
Kgem coeffients to calc absolute time
Returns:
none On SIU, this will be called within callback from the GEM read started by the PPS interrupt. The callback will also send this info on to the EPu's
On EPUs, this will be called as the results of a message from the SIU with this information.

References _THS_GemTableFlags::ui.

Referenced by THS_slaveProcessMsg().

unsigned int THS_gemWait (  ) 

Start the TimeHackService module.

Returns:
status Wait for THS to become full operational after THS_init(). This routines requires that most of the software is operational. This includes LCB driver, 1553 driver, and time tone messages from the scapecraft enabled. Since this module requires a timeTOne message from the spacecraft it can take up to 2 sec to return.
The sequence is: THS_gemInit();

start up bunch of things including LCB driver Sw to call THS_timeTone() every second as result of message from spacecraft Hw to cause PPS interrupt every second

THS_gemWait() (this routine waits till received first THS_gemTimeTone() followed by PPS interrupt)

Referenced by THS_wait().

unsigned int THS_getLastPpsAbsTimeSec (  ) 

Get the absolute time value at last PPS.

Returns:
absolute time value

unsigned int THS_getLastPpsClock (  ) 

Get the CPU clk value at last PPS.

Returns:
clock value

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)

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

void THS_setLastPpsClock ( unsigned int  snapshot  ) 

Set the CPU clk value at last PPS.

Parameters:
snapshot snapshow value from Rad750 HW


Generated on Thu Mar 31 12:53:03 2011 by  doxygen 1.5.8