\hypertarget{THS_8h}{
\section{THS.h File Reference}
\label{THS_8h}\index{THS.h@{THS.h}}
}
Public defs for Time Hack Services. 

{\tt \#include \char`\"{}LSF/LSF\_\-stats\-Hdr.h\char`\"{}}\par


Include dependency graph for THS.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=119pt]{THS_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=95pt]{THS_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__THS__GemTableFlagsBf}{\_\-THS\_\-Gem\-Table\-Flags\-Bf}
\begin{CompactList}\small\item\em Structure to map out the bit fields time hack flags stored as 32 bits in gem\-Table. \item\end{CompactList}\item 
struct \hyperlink{union__THS__GemTableFlags}{\_\-THS\_\-Gem\-Table\-Flags}
\begin{CompactList}\small\item\em Union for different access of 32 bit flags in gem\-Table. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{THS_8h_a0}{
typedef enum \hyperlink{THS_8h_a32}{\_\-THS\_\-OPTION} \hyperlink{THS_8h_a0}{THS\_\-OPTION}}
\label{THS_8h_a0}

\begin{CompactList}\small\item\em Masks for option mask into THS\_\-init. \item\end{CompactList}\item 
\hypertarget{THS_8h_a1}{
typedef enum \hyperlink{THS_8h_a33}{\_\-THS\_\-FSW\_\-FLAGS} \hyperlink{THS_8h_a1}{THS\_\-THS\_\-FSW\_\-FLAGS}}
\label{THS_8h_a1}

\begin{CompactList}\small\item\em Masks for FSW flags in gem table. \item\end{CompactList}\item 
\hypertarget{THS_8h_a2}{
typedef \hyperlink{struct__THS__GemTableFlagsBf}{\_\-THS\_\-Gem\-Table\-Flags\-Bf} \hyperlink{THS_8h_a2}{THS\_\-Gem\-Table\-Flags\-Bf}}
\label{THS_8h_a2}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__THS__GemTableFlagsBf}{\_\-THS\_\-Gem\-Table\-Flags\-Bf}. \item\end{CompactList}\item 
\hypertarget{THS_8h_a3}{
typedef \hyperlink{union__THS__GemTableFlags}{\_\-THS\_\-Gem\-Table\-Flags} \hyperlink{THS_8h_a3}{THS\_\-Gem\-Table\-Flags}}
\label{THS_8h_a3}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{union__THS__GemTableFlags}{\_\-THS\_\-Gem\-Table\-Flags}. \item\end{CompactList}\item 
typedef unsigned int( \hyperlink{THS_8h_a4}{THS\_\-Send\-Slave\-Rtn} )(void $\ast$lsm\-Arg, short lsm\-ID, short ths\-Id, int nid, void $\ast$payload, int payload\-Len, void $\ast$payload\-Free\-Rtn, void $\ast$payload\-Free\-Rtn\-Arg)
\begin{CompactList}\small\item\em stash away routine (from LCM) to send msg to EPU \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{THS_8h_a32}{\_\-THS\_\-OPTION} \{ \par
\hyperlink{THS_8h_a32a5}{THS\_\-GEM\_\-HACK} =  1, 
\par
\hyperlink{THS_8h_a32a6}{THS\_\-CPU\_\-HACK} =  2, 
\par
\hyperlink{THS_8h_a32a7}{THS\_\-SIU\_\-HACK} =  4
 \}
\item 
enum \hyperlink{THS_8h_a33}{\_\-THS\_\-FSW\_\-FLAGS} \{ \par
\hyperlink{THS_8h_a33a8}{THS\_\-FSW\_\-FLAG\_\-TT\_\-SIM} =  1, 
\par
\hyperlink{THS_8h_a33a9}{THS\_\-FSW\_\-FLAG\_\-CPU\_\-PPS\_\-SIM} =  2, 
\par
\hyperlink{THS_8h_a33a10}{THS\_\-FSW\_\-FLAG\_\-GEM\_\-PPS\_\-SIM} =  4, 
\par
\hyperlink{THS_8h_a33a11}{THS\_\-FSW\_\-FLAG\_\-NO\_\-HACK\_\-TABLE} =  8
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int \hyperlink{THS_8h_a12}{THS\_\-init} (int option\-Mask)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a13}{THS\_\-simulated\-PPS} (void)
\begin{CompactList}\small\item\em Return the state of the pulse-per-second simulation. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a14}{THS\_\-simulated\-TT} (void)
\begin{CompactList}\small\item\em Return the state of the timetone simulation. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a15}{THS\_\-wait} ()
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a16}{THS\_\-timetone} (unsigned int abs\-Time\-Sec, unsigned short sa\-Flags)
\begin{CompactList}\small\item\em One-time set the wall clock time. \item\end{CompactList}\item 
WCT\_\-time \hyperlink{THS_8h_a17}{THS\_\-gem\-Abs\-Time\-Event} (int gem\-Strobe\-In, int gem\-Clk)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a18}{THS\_\-timetone\-From\-Event} (int gem\-Strobe\-In, int $\ast$abs\-Time\-Secs, int $\ast$flag)
\begin{CompactList}\small\item\em One-time set the wall clock time. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a19}{THS\_\-prev\-Timetone\-From\-Event} (int gem\-Strobe\-In, int $\ast$abs\-Time\-Secs, int $\ast$flags, int $\ast$abs\-Time\-Secs\-Prev, int $\ast$flags\-Prev, int $\ast$gem\-Strobe\-In\-Prev)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a20}{THS\_\-prev\-Timtone\-From\-Event} (int gem\-Strobe\-In, int $\ast$abs\-Time\-Secs, int $\ast$flags, int $\ast$abs\-Time\-Secs\-Prev, int $\ast$flags\-Prev, int $\ast$gem\-Strobe\-In\-Prev)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a21}{THS\_\-cpu\-Set\-Warning} (unsigned int expected\-Clk\-Hz, unsigned int expected\-Delta\-Clk\-Hz)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a22}{THS\_\-gem\-Set\-Warning} (unsigned int expected\-Clk\-Hz, unsigned int expected\-Delta\-Clk\-Hz)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
void \hyperlink{THS_8h_a23}{THS\_\-set\-Pps\-Warn\-Every} (unsigned int warn\-Pps\-Every)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
void \hyperlink{THS_8h_a24}{THS\_\-set\-Timetone\-Warn\-Every} (unsigned int \_\-warn\-Timetone\-Every)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
void \hyperlink{THS_8h_a25}{THS\_\-set\-Slave\-Send} (\hyperlink{THS_8h_a4}{THS\_\-Send\-Slave\-Rtn} rtn, void $\ast$arg, int lsm\-Id)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a26}{THS\_\-slave\-Process\-Msg} (int func, void $\ast$payload, unsigned int len)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
void \hyperlink{THS_8h_a27}{THS\_\-set\-Gem\-Update\-Msgs} (int max\-Msgs)
\begin{CompactList}\small\item\em Dummy routine. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a28}{THS\_\-lsf\-Stat\-First\-Evt} (LSF\_\-stats\-Hdr $\ast$stats\-Hdr, unsigned long long seq, unsigned int gem\-Clock, unsigned int gem\-Strobe)
\begin{CompactList}\small\item\em Sets first event parms within LSF\_\-stats\-Hdr. \item\end{CompactList}\item 
void \hyperlink{THS_8h_a29}{THS\_\-lsf\-Stat\-Inc\-Evt} (LSF\_\-stats\-Hdr $\ast$stats\-Hdr, int increment)
\begin{CompactList}\small\item\em Increment event counter in LSF\_\-stats\-Hdr structure. \item\end{CompactList}\item 
unsigned int \hyperlink{THS_8h_a30}{THS\_\-lsf\-Stat\-Last\-Evt} (LSF\_\-stats\-Hdr $\ast$stats\-Hdr, unsigned long long seq, unsigned int gem\-Clock, unsigned int gem\-Strobe)
\begin{CompactList}\small\item\em Sets last event parms within LSF\_\-stats\-Hdr. \item\end{CompactList}\item 
void \hyperlink{THS_8h_a31}{THS\_\-lsf\-Stat\-Clear} (LSF\_\-stats\-Hdr $\ast$stats\-Hdr)
\begin{CompactList}\small\item\em Clear the LSF\_\-stats\-Hdr structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Public defs for Time Hack Services. 

\begin{Desc}
\item[Author:]Ed Bacho -- \href{mailto:ebacho@slac.stanford.edu}{\tt ebacho@slac.stanford.edu}\end{Desc}
This module handles calculation of absolute time using the \char`\"{}time hack\char`\"{}. 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 (\char`\"{}at the tone the time will be\char`\"{}) that preceeds it. The time provided in the time tone message from the scapecraft is in micro\-Sec 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:\begin{itemize}
\item time tone message every sec (500-800 m\-Sec before pulse) giving next abs\-Time\item HW 1PPS pulse every sec from GASU (although originates from spacecraft)\end{itemize}


Output:\begin{itemize}
\item can obtain corrected absolute time thru WCT\_\-get()\end{itemize}


\subsection{Typedef Documentation}
\hypertarget{THS_8h_a4}{
\index{THS.h@{THS.h}!THS_SendSlaveRtn@{THS\_\-SendSlaveRtn}}
\index{THS_SendSlaveRtn@{THS\_\-SendSlaveRtn}!THS.h@{THS.h}}
\subsubsection[THS\_\-SendSlaveRtn]{\setlength{\rightskip}{0pt plus 5cm}void($\ast$ \hyperlink{THS_8h_a4}{THS\_\-Send\-Slave\-Rtn})(void $\ast$arg, void $\ast$payload, int payload\-Len)}}
\label{THS_8h_a4}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em arg}]- given arg to be included with call \item[{\em payload}]- buffer with message to send \item[{\em payload\-Len}]- length of buffer \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none\end{Desc}
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)

\subsection{Enumeration Type Documentation}
\hypertarget{THS_8h_a33}{
\index{THS.h@{THS.h}!_THS_FSW_FLAGS@{\_\-THS\_\-FSW\_\-FLAGS}}
\index{_THS_FSW_FLAGS@{\_\-THS\_\-FSW\_\-FLAGS}!THS.h@{THS.h}}
\subsubsection[\_\-THS\_\-FSW\_\-FLAGS]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{THS_8h_a33}{\_\-THS\_\-FSW\_\-FLAGS}}}
\label{THS_8h_a33}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{THS_FSW_FLAG_TT_SIM@{THS\_\-FSW\_\-FLAG\_\-TT\_\-SIM}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_FSW_FLAG_TT_SIM@{THS\_\-FSW\_\-FLAG\_\-TT\_\-SIM}}\item[{\em 
\hypertarget{THS_8h_a33a8}{
THS\_\-FSW\_\-FLAG\_\-TT\_\-SIM}
\label{THS_8h_a33a8}
}]Timtone value is simulated \index{THS_FSW_FLAG_CPU_PPS_SIM@{THS\_\-FSW\_\-FLAG\_\-CPU\_\-PPS\_\-SIM}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_FSW_FLAG_CPU_PPS_SIM@{THS\_\-FSW\_\-FLAG\_\-CPU\_\-PPS\_\-SIM}}\item[{\em 
\hypertarget{THS_8h_a33a9}{
THS\_\-FSW\_\-FLAG\_\-CPU\_\-PPS\_\-SIM}
\label{THS_8h_a33a9}
}]no PPS interrupt, PPS simulated, might not be accurate \index{THS_FSW_FLAG_GEM_PPS_SIM@{THS\_\-FSW\_\-FLAG\_\-GEM\_\-PPS\_\-SIM}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_FSW_FLAG_GEM_PPS_SIM@{THS\_\-FSW\_\-FLAG\_\-GEM\_\-PPS\_\-SIM}}\item[{\em 
\hypertarget{THS_8h_a33a10}{
THS\_\-FSW\_\-FLAG\_\-GEM\_\-PPS\_\-SIM}
\label{THS_8h_a33a10}
}]GEM did not get PPS, need to calc new GEM stobe val \index{THS_FSW_FLAG_NO_HACK_TABLE@{THS\_\-FSW\_\-FLAG\_\-NO\_\-HACK\_\-TABLE}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_FSW_FLAG_NO_HACK_TABLE@{THS\_\-FSW\_\-FLAG\_\-NO\_\-HACK\_\-TABLE}}\item[{\em 
\hypertarget{THS_8h_a33a11}{
THS\_\-FSW\_\-FLAG\_\-NO\_\-HACK\_\-TABLE}
\label{THS_8h_a33a11}
}]These values did not come from Hack\-Table \end{description}
\end{Desc}

\hypertarget{THS_8h_a32}{
\index{THS.h@{THS.h}!_THS_OPTION@{\_\-THS\_\-OPTION}}
\index{_THS_OPTION@{\_\-THS\_\-OPTION}!THS.h@{THS.h}}
\subsubsection[\_\-THS\_\-OPTION]{\setlength{\rightskip}{0pt plus 5cm}enum \hyperlink{THS_8h_a32}{\_\-THS\_\-OPTION}}}
\label{THS_8h_a32}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{THS_GEM_HACK@{THS\_\-GEM\_\-HACK}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_GEM_HACK@{THS\_\-GEM\_\-HACK}}\item[{\em 
\hypertarget{THS_8h_a32a5}{
THS\_\-GEM\_\-HACK}
\label{THS_8h_a32a5}
}]enable time hack for gem clock (20 MHz) \index{THS_CPU_HACK@{THS\_\-CPU\_\-HACK}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_CPU_HACK@{THS\_\-CPU\_\-HACK}}\item[{\em 
\hypertarget{THS_8h_a32a6}{
THS\_\-CPU\_\-HACK}
\label{THS_8h_a32a6}
}]enable time hack for cpu clock (33/4 MHz) \index{THS_SIU_HACK@{THS\_\-SIU\_\-HACK}!THS.h@{THS.h}}\index{THS.h@{THS.h}!THS_SIU_HACK@{THS\_\-SIU\_\-HACK}}\item[{\em 
\hypertarget{THS_8h_a32a7}{
THS\_\-SIU\_\-HACK}
\label{THS_8h_a32a7}
}]this cpu is the SIU \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{THS_8h_a21}{
\index{THS.h@{THS.h}!THS_cpuSetWarning@{THS\_\-cpuSetWarning}}
\index{THS_cpuSetWarning@{THS\_\-cpuSetWarning}!THS.h@{THS.h}}
\subsubsection[THS\_\-cpuSetWarning]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-cpu\-Set\-Warning (unsigned int {\em expected\-Clk\-Hz}, unsigned int {\em expected\-Delta\-Clk\-Hz})}}
\label{THS_8h_a21}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em expected\-Clk\-Hz}](none) Ignored \item[{\em expected\-Delta\-Clk\-Hz}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a21}{THS\_\-cpu\-Set\-Warning()} entry point in THS proper.\hypertarget{THS_8h_a17}{
\index{THS.h@{THS.h}!THS_gemAbsTimeEvent@{THS\_\-gemAbsTimeEvent}}
\index{THS_gemAbsTimeEvent@{THS\_\-gemAbsTimeEvent}!THS.h@{THS.h}}
\subsubsection[THS\_\-gemAbsTimeEvent]{\setlength{\rightskip}{0pt plus 5cm}WCT\_\-time THS\_\-gem\-Abs\-Time\-Event (int {\em gem\-Strobe\-In}, int {\em gem\-Clk})}}
\label{THS_8h_a17}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gem\-Strobe\-In}](none) Ignored \item[{\em gem\-Clk}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0LL}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a17}{THS\_\-gem\-Abs\-Time\-Event()} entry point in THS proper.\hypertarget{THS_8h_a22}{
\index{THS.h@{THS.h}!THS_gemSetWarning@{THS\_\-gemSetWarning}}
\index{THS_gemSetWarning@{THS\_\-gemSetWarning}!THS.h@{THS.h}}
\subsubsection[THS\_\-gemSetWarning]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-gem\-Set\-Warning (unsigned int {\em expected\-Clk\-Hz}, unsigned int {\em expected\-Delta\-Clk\-Hz})}}
\label{THS_8h_a22}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em expected\-Clk\-Hz}](none) Ignored \item[{\em expected\-Delta\-Clk\-Hz}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a22}{THS\_\-gem\-Set\-Warning()} entry point in THS proper.\hypertarget{THS_8h_a12}{
\index{THS.h@{THS.h}!THS_init@{THS\_\-init}}
\index{THS_init@{THS\_\-init}!THS.h@{THS.h}}
\subsubsection[THS\_\-init]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-init (int {\em mask})}}
\label{THS_8h_a12}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mask}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a12}{THS\_\-init()} entry point in THS proper.\hypertarget{THS_8h_a31}{
\index{THS.h@{THS.h}!THS_lsfStatClear@{THS\_\-lsfStatClear}}
\index{THS_lsfStatClear@{THS\_\-lsfStatClear}!THS.h@{THS.h}}
\subsubsection[THS\_\-lsfStatClear]{\setlength{\rightskip}{0pt plus 5cm}void THS\_\-lsf\-Stat\-Clear (LSF\_\-stats\-Hdr $\ast$ {\em stats\-Hdr})}}
\label{THS_8h_a31}


Clear the LSF\_\-stats\-Hdr structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stats\-Hdr}]pointer to LSF\_\-stats\-Hdr structure to fill in \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]nothing\end{Desc}
\hypertarget{THS_8h_a28}{
\index{THS.h@{THS.h}!THS_lsfStatFirstEvt@{THS\_\-lsfStatFirstEvt}}
\index{THS_lsfStatFirstEvt@{THS\_\-lsfStatFirstEvt}!THS.h@{THS.h}}
\subsubsection[THS\_\-lsfStatFirstEvt]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-lsf\-Stat\-First\-Evt (LSF\_\-stats\-Hdr $\ast$ {\em stats\-Hdr}, unsigned long long {\em seq}, unsigned int {\em gem\-Clock}, unsigned int {\em gem\-Strobe})}}
\label{THS_8h_a28}


Sets first event parms within LSF\_\-stats\-Hdr. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stats\-Hdr}]pointer to LSF\_\-stats\-Hdr structure to fill in \item[{\em seq}]extended seqence number of the event \item[{\em gem\-Clock}]evt clock register read from GEM contributor of event \item[{\em gem\-Strobe}]evt PPS cock register read from GEM contributor of event \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]status\end{Desc}
This is convenient routine to fill in event info that is stored in a LSF\_\-stats\-Hdr structure within an LSF packet for eventual output as science data on the SSR.\hypertarget{THS_8h_a29}{
\index{THS.h@{THS.h}!THS_lsfStatIncEvt@{THS\_\-lsfStatIncEvt}}
\index{THS_lsfStatIncEvt@{THS\_\-lsfStatIncEvt}!THS.h@{THS.h}}
\subsubsection[THS\_\-lsfStatIncEvt]{\setlength{\rightskip}{0pt plus 5cm}void THS\_\-lsf\-Stat\-Inc\-Evt (LSF\_\-stats\-Hdr $\ast$ {\em stats\-Hdr}, int {\em increment})}}
\label{THS_8h_a29}


Increment event counter in LSF\_\-stats\-Hdr structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stats\-Hdr}]pointer to LSF\_\-stats\-Hdr structure to fill in \item[{\em increment}]number of events to increase evt count by \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]nothing\end{Desc}
This is convenient routine to increment the event counter within LSF\_\-stats\-Hdr structure. Note that this in the number of events seen by the callback, the raw events rather than the number of prescaled events.\hypertarget{THS_8h_a30}{
\index{THS.h@{THS.h}!THS_lsfStatLastEvt@{THS\_\-lsfStatLastEvt}}
\index{THS_lsfStatLastEvt@{THS\_\-lsfStatLastEvt}!THS.h@{THS.h}}
\subsubsection[THS\_\-lsfStatLastEvt]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-lsf\-Stat\-Last\-Evt (LSF\_\-stats\-Hdr $\ast$ {\em stats\-Hdr}, unsigned long long {\em seq}, unsigned int {\em gem\-Clock}, unsigned int {\em gem\-Strobe})}}
\label{THS_8h_a30}


Sets last event parms within LSF\_\-stats\-Hdr. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stats\-Hdr}]pointer to LSF\_\-stats\-Hdr structure to fill in \item[{\em seq}]extended seqence number of the event \item[{\em gem\-Clock}]evt clock register read from GEM contributor of event \item[{\em gem\-Strobe}]evt PPS cock register read from GEM contributor of event \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]status\end{Desc}
This is convenient routine to fill in event info that is stored in a LSF\_\-stats\-Hdr structure within an LSF packet for eventual output as science data on the SSR.\hypertarget{THS_8h_a19}{
\index{THS.h@{THS.h}!THS_prevTimetoneFromEvent@{THS\_\-prevTimetoneFromEvent}}
\index{THS_prevTimetoneFromEvent@{THS\_\-prevTimetoneFromEvent}!THS.h@{THS.h}}
\subsubsection[THS\_\-prevTimetoneFromEvent]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-prev\-Timetone\-From\-Event (int {\em gem\-Strobe\-In}, int $\ast$ {\em abs\-Time\-Secs}, int $\ast$ {\em flags}, int $\ast$ {\em abs\-Time\-Secs\-Prev}, int $\ast$ {\em flags\-Prev}, int $\ast$ {\em gem\-Strobe\-In\-Prev})}}
\label{THS_8h_a19}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gem\-Strobe\-In}](none) Ignored \item[{\em abs\-Time\-Secs}](none) Ignored \item[{\em flags}](none) Ignored \item[{\em abs\-Time\-Secs\-Prev}](none) Ignored \item[{\em flags\-Prev}](none) Ignored \item[{\em gem\-Strobe\-In\-Prev}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em THS\_\-NOINIT}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a19}{THS\_\-prev\-Timetone\-From\-Event()} entry point in THS proper.\hypertarget{THS_8h_a20}{
\index{THS.h@{THS.h}!THS_prevTimtoneFromEvent@{THS\_\-prevTimtoneFromEvent}}
\index{THS_prevTimtoneFromEvent@{THS\_\-prevTimtoneFromEvent}!THS.h@{THS.h}}
\subsubsection[THS\_\-prevTimtoneFromEvent]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-prev\-Timtone\-From\-Event (int {\em gem\-Strobe\-In}, int $\ast$ {\em abs\-Time\-Secs}, int $\ast$ {\em flags}, int $\ast$ {\em abs\-Time\-Secs\-Prev}, int $\ast$ {\em flags\-Prev}, int $\ast$ {\em gem\-Strobe\-In\-Prev})}}
\label{THS_8h_a20}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gem\-Strobe\-In}](none) Ignored \item[{\em abs\-Time\-Secs}](none) Ignored \item[{\em flags}](none) Ignored \item[{\em abs\-Time\-Secs\-Prev}](none) Ignored \item[{\em flags\-Prev}](none) Ignored \item[{\em gem\-Strobe\-In\-Prev}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em THS\_\-NOINIT}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a20}{THS\_\-prev\-Timtone\-From\-Event()} entry point in THS proper.\hypertarget{THS_8h_a27}{
\index{THS.h@{THS.h}!THS_setGemUpdateMsgs@{THS\_\-setGemUpdateMsgs}}
\index{THS_setGemUpdateMsgs@{THS\_\-setGemUpdateMsgs}!THS.h@{THS.h}}
\subsubsection[THS\_\-setGemUpdateMsgs]{\setlength{\rightskip}{0pt plus 5cm}void THS\_\-set\-Gem\-Update\-Msgs (int {\em max\-Msgs})}}
\label{THS_8h_a27}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em max\-Msgs}](none) Ignored\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a27}{THS\_\-set\-Gem\-Update\-Msgs()} entry point in THS proper.\hypertarget{THS_8h_a23}{
\index{THS.h@{THS.h}!THS_setPpsWarnEvery@{THS\_\-setPpsWarnEvery}}
\index{THS_setPpsWarnEvery@{THS\_\-setPpsWarnEvery}!THS.h@{THS.h}}
\subsubsection[THS\_\-setPpsWarnEvery]{\setlength{\rightskip}{0pt plus 5cm}void THS\_\-set\-Pps\-Warn\-Every (unsigned int {\em warn\-Pps\-Every})}}
\label{THS_8h_a23}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em warn\-Pps\-Every}](none) Ignored\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a23}{THS\_\-set\-Pps\-Warn\-Every()} entry point in THS proper.\hypertarget{THS_8h_a25}{
\index{THS.h@{THS.h}!THS_setSlaveSend@{THS\_\-setSlaveSend}}
\index{THS_setSlaveSend@{THS\_\-setSlaveSend}!THS.h@{THS.h}}
\subsubsection[THS\_\-setSlaveSend]{\setlength{\rightskip}{0pt plus 5cm}void THS\_\-set\-Slave\-Send (\hyperlink{THS_8h_a4}{THS\_\-Send\-Slave\-Rtn} {\em rtn}, void $\ast$ {\em arg}, int {\em lsm\-ID})}}
\label{THS_8h_a25}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rtn}](none) Ignored \item[{\em arg}](none) Ignored \item[{\em lsm\-ID}](none) Ignored\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a25}{THS\_\-set\-Slave\-Send()} entry point in THS proper.\hypertarget{THS_8h_a24}{
\index{THS.h@{THS.h}!THS_setTimetoneWarnEvery@{THS\_\-setTimetoneWarnEvery}}
\index{THS_setTimetoneWarnEvery@{THS\_\-setTimetoneWarnEvery}!THS.h@{THS.h}}
\subsubsection[THS\_\-setTimetoneWarnEvery]{\setlength{\rightskip}{0pt plus 5cm}void THS\_\-set\-Timetone\-Warn\-Every (unsigned int {\em warn\-Timetone\-Every})}}
\label{THS_8h_a24}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em warn\-Timetone\-Every}](none) Ignored\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a24}{THS\_\-set\-Timetone\-Warn\-Every()} entry point in THS proper.\hypertarget{THS_8h_a13}{
\index{THS.h@{THS.h}!THS_simulatedPPS@{THS\_\-simulatedPPS}}
\index{THS_simulatedPPS@{THS\_\-simulatedPPS}!THS.h@{THS.h}}
\subsubsection[THS\_\-simulatedPPS]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-simulated\-PPS (void)}}
\label{THS_8h_a13}


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

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 1}]Pulse-per-second is being simulated\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a13}{THS\_\-simulated\-PPS()} entry point in THS proper.\hypertarget{THS_8h_a14}{
\index{THS.h@{THS.h}!THS_simulatedTT@{THS\_\-simulatedTT}}
\index{THS_simulatedTT@{THS\_\-simulatedTT}!THS.h@{THS.h}}
\subsubsection[THS\_\-simulatedTT]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-simulated\-TT (void)}}
\label{THS_8h_a14}


Return the state of the timetone simulation. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 1}]Timetone is being simulated\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a13}{THS\_\-simulated\-PPS()} entry point in THS proper.\hypertarget{THS_8h_a26}{
\index{THS.h@{THS.h}!THS_slaveProcessMsg@{THS\_\-slaveProcessMsg}}
\index{THS_slaveProcessMsg@{THS\_\-slaveProcessMsg}!THS.h@{THS.h}}
\subsubsection[THS\_\-slaveProcessMsg]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-slave\-Process\-Msg (int {\em func}, void $\ast$ {\em payload}, unsigned int {\em len})}}
\label{THS_8h_a26}


Dummy routine. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em func}](none) Ignored \item[{\em payload}](none) Ignored \item[{\em len}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a26}{THS\_\-slave\-Process\-Msg()} entry point in THS proper.\hypertarget{THS_8h_a16}{
\index{THS.h@{THS.h}!THS_timetone@{THS\_\-timetone}}
\index{THS_timetone@{THS\_\-timetone}!THS.h@{THS.h}}
\subsubsection[THS\_\-timetone]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-timetone (unsigned int {\em abs\-Time\-Sec}, unsigned short {\em sa\-Flags})}}
\label{THS_8h_a16}


One-time set the wall clock time. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em abs\-Time\-Sec}](none) Ignored \item[{\em sa\-Flags}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Always\end{description}
\end{Desc}
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).\hypertarget{THS_8h_a18}{
\index{THS.h@{THS.h}!THS_timetoneFromEvent@{THS\_\-timetoneFromEvent}}
\index{THS_timetoneFromEvent@{THS\_\-timetoneFromEvent}!THS.h@{THS.h}}
\subsubsection[THS\_\-timetoneFromEvent]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-timetone\-From\-Event (int {\em gem\-Strobe\-In}, int $\ast$ {\em abs\-Time\-Sec}, int $\ast$ {\em flags})}}
\label{THS_8h_a18}


One-time set the wall clock time. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gem\-Strobe\-In}](none) Ignored \item[{\em abs\-Time\-Sec}](none) Ignored \item[{\em flags}](none) Ignored\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em THS\_\-NOINIT}]Always\end{description}
\end{Desc}
For compatibility with the \hyperlink{THS_8h_a18}{THS\_\-timetone\-From\-Event()} entry point in THS proper.\hypertarget{THS_8h_a15}{
\index{THS.h@{THS.h}!THS_wait@{THS\_\-wait}}
\index{THS_wait@{THS\_\-wait}!THS.h@{THS.h}}
\subsubsection[THS\_\-wait]{\setlength{\rightskip}{0pt plus 5cm}unsigned int THS\_\-wait ()}}
\label{THS_8h_a15}


Dummy routine. 

For compatibility with the \hyperlink{THS_8h_a15}{THS\_\-wait()} entry point in THS proper.