\hypertarget{SSRSIM_8c}{
\section{SSRSIM.c File Reference}
\label{SSRSIM_8c}\index{SSRSIM.c@{SSRSIM.c}}
}
Module to simulated SSR data output from ISIS.  


{\tt \#include $<$PBS/PBS.h$>$}\par
{\tt \#include $<$PBS/FPA.h$>$}\par
{\tt \#include $<$PBS/MBA.h$>$}\par
{\tt \#include $<$PBS/WUT.h$>$}\par
{\tt \#include $<$PBS/TMR.h$>$}\par
{\tt \#include $<$PBS/QI.h$>$}\par
{\tt \#include $<$PBS/FORK.h$>$}\par
{\tt \#include $<$PBS/SPIN.h$>$}\par
{\tt \#include $<$PBS/TASK.h$>$}\par
{\tt \#include $<$MSG/MSG\_\-pubdefs.h$>$}\par
{\tt \#include $<$LCBT/SSRSIM\_\-msgs.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-drv.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-clk.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-evt.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-nut.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-rst.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-stats.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-cr.h$>$}\par
{\tt \#include $<$LCBD/LCBC.h$>$}\par
{\tt \#include $<$LCBD/LCBR.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-msgs.h$>$}\par
{\tt \#include $<$LCBD/LATP.h$>$}\par
{\tt \#include $<$LCBD/LCB.h$>$}\par
{\tt \#include $<$LCBD/LCB\_\-cr.h$>$}\par
{\tt \#include $<$LCBD/LCBD\_\-pci.h$>$}\par
{\tt \#include $<$LCBT/SSRSIM.h$>$}\par
{\tt \#include $<$RND.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{SSRSIM_8c_5e2ec1db3b161e0ac51d89e335456909}{SSRSIM\_\-init} (LCBD lcb, int sendTaskPri, int latpAddr, int appId)
\begin{CompactList}\small\item\em init the SSR simulate module \item\end{CompactList}\item 
void \hyperlink{SSRSIM_8c_aec1f6a56e1c11e7a738791dea02ac00}{SSRSIM\_\-release} ()
\begin{CompactList}\small\item\em shutdown the SSR simulate module \item\end{CompactList}\item 
int \hyperlink{SSRSIM_8c_4181901e6a37cb21bf98b8de5a39dafc}{SSRSIM\_\-setParm} (\hyperlink{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}{TDATA\_\-DTEST} dataType, int dataParm, int tDuration, int reqPacketSize32, int evtPeriod, int $\ast$actualPacketSize32)
\begin{CompactList}\small\item\em Setup and start data simulated SSR data from ISIS. \item\end{CompactList}\item 
void \hyperlink{SSRSIM_8c_b76c5ed829115d343c191e427849504f}{SSRSIM\_\-stop} ()
\begin{CompactList}\small\item\em stop SSR simulate data output \item\end{CompactList}\item 
void \hyperlink{SSRSIM_8c_e76bfd0299aa82a6fdd8eb598e5bcff9}{SSRSIM\_\-stats} ()
\begin{CompactList}\small\item\em print stats \item\end{CompactList}\item 
void \hyperlink{SSRSIM_8c_10bf7a85a61b42f7558529d32632a9e4}{SSRSIM\_\-statsReset} ()
\begin{CompactList}\small\item\em reset stats for printing \item\end{CompactList}\item 
void \hyperlink{SSRSIM_8c_84ab4ce83207289ffd847ec8fdb8fc3d}{SSRSIM\_\-statsGetErrors} (int $\ast$timerMiss, int $\ast$dmaErrs, int $\ast$itemErrs, int $\ast$backPresErrs)
\begin{CompactList}\small\item\em get error stats \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Module to simulated SSR data output from ISIS. 

\begin{Desc}
\item[Author:]Ed Bacho -- \href{mailto:ebacho@slac.stanford.edu}{\tt ebacho@slac.stanford.edu} Basic algorithm:\end{Desc}
To start: Pulls all buffs from Freelist (FPA), sends buff to fork task Forktask load up buffs with data and put in ReadyList QUE Enable timer, if $<$ 1 KHz datarate timer determined by datarate, one event per dma if $>$ 1 KHz datarate time is 1 mSec, each DMA has N events To Stop: Disable timer Pull all buffers from the ReadyList QUE and puts back in Freelist (FPA)

Normal Operation Timer - runs every N milliSec, pulls buff from ReadyList and sends to LCB LcbRstCallback - when LCB finishes, buffer is send to fork task ForkTask - fills buffer with new data and puts it in ReadyList 

\subsection{Function Documentation}
\hypertarget{SSRSIM_8c_5e2ec1db3b161e0ac51d89e335456909}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-init@{SSRSIM\_\-init}}
\index{SSRSIM\_\-init@{SSRSIM\_\-init}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}SSRSIM\_\-init (LCBD {\em lcb}, \/  int {\em sendTaskPri}, \/  int {\em latpAddr}, \/  int {\em appId})}}
\label{SSRSIM_8c_5e2ec1db3b161e0ac51d89e335456909}


init the SSR simulate module 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lcb}]LCB handle \item[{\em sendTaskPri}]priority of task created to send data to LCB, 0=default of 60 \item[{\em latpAddr}]address of unit to send data to \item[{\em appId}]appId to be used within the CCSDS header \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none \end{Desc}


References RND\_\-lc0\_\-init(), SSRSIM\_\-statsReset(), and TDATA\_\-setCcsdsParms().\hypertarget{SSRSIM_8c_aec1f6a56e1c11e7a738791dea02ac00}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-release@{SSRSIM\_\-release}}
\index{SSRSIM\_\-release@{SSRSIM\_\-release}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-release}]{\setlength{\rightskip}{0pt plus 5cm}SSRSIM\_\-release ()}}
\label{SSRSIM_8c_aec1f6a56e1c11e7a738791dea02ac00}


shutdown the SSR simulate module 

\begin{Desc}
\item[Returns:]none \end{Desc}


References SSRSIM\_\-stop().\hypertarget{SSRSIM_8c_4181901e6a37cb21bf98b8de5a39dafc}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-setParm@{SSRSIM\_\-setParm}}
\index{SSRSIM\_\-setParm@{SSRSIM\_\-setParm}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-setParm}]{\setlength{\rightskip}{0pt plus 5cm}int SSRSIM\_\-setParm ({\bf TDATA\_\-DTEST} {\em dataType}, \/  int {\em dataParm}, \/  int {\em tDuration}, \/  int {\em reqPacketSize32}, \/  int {\em evtPeriod}, \/  int $\ast$ {\em actualPacketSize32})}}
\label{SSRSIM_8c_4181901e6a37cb21bf98b8de5a39dafc}


Setup and start data simulated SSR data from ISIS. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dataType}]data pattern to load into buffer \item[{\em dataParm}]parameter associated with given dataType \item[{\em tDuration}]time in secs to output data, -1=forever \item[{\em reqPacketSize32}]desired packet size, 8 to 1020, 0=random size \item[{\em evtPeriod}]time in microSec between events, 100 (10KHz) to 30000000 (1/30 Hz) \item[{\em actualPacketSize32}]returned packet size adjusted down if needed to achieve given evtPeriod within LCB bandwidth constraints, max size is returned if reqPacketSIze=0 for random \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]status 0=sucess \end{Desc}


References SSRSIM\_\-stop(), and TDATA\_\-DTEST\_\-RANDOM.\hypertarget{SSRSIM_8c_e76bfd0299aa82a6fdd8eb598e5bcff9}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-stats@{SSRSIM\_\-stats}}
\index{SSRSIM\_\-stats@{SSRSIM\_\-stats}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-stats}]{\setlength{\rightskip}{0pt plus 5cm}SSRSIM\_\-stats ()}}
\label{SSRSIM_8c_e76bfd0299aa82a6fdd8eb598e5bcff9}


print stats 

\begin{Desc}
\item[Returns:]none \end{Desc}


References PRINTF.\hypertarget{SSRSIM_8c_84ab4ce83207289ffd847ec8fdb8fc3d}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-statsGetErrors@{SSRSIM\_\-statsGetErrors}}
\index{SSRSIM\_\-statsGetErrors@{SSRSIM\_\-statsGetErrors}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-statsGetErrors}]{\setlength{\rightskip}{0pt plus 5cm}void SSRSIM\_\-statsGetErrors (int $\ast$ {\em timerMiss}, \/  int $\ast$ {\em dmaErrs}, \/  int $\ast$ {\em itemErrs}, \/  int $\ast$ {\em backPresErrs})}}
\label{SSRSIM_8c_84ab4ce83207289ffd847ec8fdb8fc3d}


get error stats 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em timerMiss}]if not NULL, return timer misses which indicates no buffer to send to LCB \item[{\em dmaErrs}]if not NULL, return dma errs which indicate LCB did not process a list so list is probably incorrect or LCB problems \item[{\em itemErrs}]if not NULL, return item error which are errors on one item in list, probably indicate cannot talk to destination of item \item[{\em backPresErrs}]if not NULL, return backpressure errors which indicate timeout due to pause line from EBM being set \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none \end{Desc}
\hypertarget{SSRSIM_8c_10bf7a85a61b42f7558529d32632a9e4}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-statsReset@{SSRSIM\_\-statsReset}}
\index{SSRSIM\_\-statsReset@{SSRSIM\_\-statsReset}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-statsReset}]{\setlength{\rightskip}{0pt plus 5cm}SSRSIM\_\-statsReset ()}}
\label{SSRSIM_8c_10bf7a85a61b42f7558529d32632a9e4}


reset stats for printing 

\begin{Desc}
\item[Returns:]none \end{Desc}


Referenced by SSRSIM\_\-init().\hypertarget{SSRSIM_8c_b76c5ed829115d343c191e427849504f}{
\index{SSRSIM.c@{SSRSIM.c}!SSRSIM\_\-stop@{SSRSIM\_\-stop}}
\index{SSRSIM\_\-stop@{SSRSIM\_\-stop}!SSRSIM.c@{SSRSIM.c}}
\subsubsection[{SSRSIM\_\-stop}]{\setlength{\rightskip}{0pt plus 5cm}void SSRSIM\_\-stop ()}}
\label{SSRSIM_8c_b76c5ed829115d343c191e427849504f}


stop SSR simulate data output 

\begin{Desc}
\item[Returns:]none \end{Desc}


Referenced by SSRSIM\_\-release(), and SSRSIM\_\-setParm().