\hypertarget{TDATA_8h}{
\section{TDATA.h File Reference}
\label{TDATA_8h}\index{TDATA.h@{TDATA.h}}
}
Module to create and check a self-describing test data packet.  


\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}{
typedef enum \hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7}{\_\-TDATA\_\-DTEST} \hyperlink{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}{TDATA\_\-DTEST}}
\label{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}

\begin{CompactList}\small\item\em Specifies data sequence for various test. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7}{\_\-TDATA\_\-DTEST} \{ \par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c71fca49a2fd48eb9f577243272fb94e78}{TDATA\_\-DTEST\_\-INCREMENT} =  0, 
\par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7b4688f0db23d8b089e98d6530a722714}{TDATA\_\-DTEST\_\-CONSTANT} =  1, 
\par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c79cf18075eca854560869cba9c941a8c0}{TDATA\_\-DTEST\_\-RANDOM} =  2, 
\par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7f884cce8b6417315997857be10ee8b92}{TDATA\_\-DTEST\_\-WALK1} =  3, 
\par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7926af513d6b82251dd4cff20a0f24a71}{TDATA\_\-DTEST\_\-TRANS01} =  4, 
\par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c77bf34c2db1815d837e246fd41b574fa1}{TDATA\_\-DTEST\_\-TRANS10} =  5, 
\par
\hyperlink{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7d6e6638299eda08209d7e3c8e284d30b}{TDATA\_\-DTEST\_\-TASKID} =  6
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{TDATA_8h_8204e7ffce7a5793dabd4dcc26628086}{TDATA\_\-create} (unsigned short $\ast$ptr, int lenIn16b, int ccsds, \hyperlink{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}{TDATA\_\-DTEST} testType, unsigned int testParm)
\begin{CompactList}\small\item\em Create a self describing test data buffer. \item\end{CompactList}\item 
int \hyperlink{TDATA_8h_2ae974be1ad65fba40d4e323970989eb}{TDATA\_\-compare} (unsigned short $\ast$ptr, int lenIn16b, int ccsds, int printErrs)
\begin{CompactList}\small\item\em Analyse a self describing test data buffer for errors. \item\end{CompactList}\item 
int \hyperlink{TDATA_8h_7f7494294b2d96510c82660974939391}{TDATA\_\-compareSeq} (unsigned short $\ast$ptr, int lenIn16b, int seq, int ccsds, int printErrs)
\begin{CompactList}\small\item\em Analyse a buffer segment of a self describing test data buffer for errors. \item\end{CompactList}\item 
void \hyperlink{TDATA_8h_bdfec9c6de2718bc02cba74ee22da2ca}{TDATA\_\-setCcsdsParms} (unsigned int appId)
\begin{CompactList}\small\item\em set prameters for all CCSDS packets \item\end{CompactList}\item 
unsigned int \hyperlink{TDATA_8h_3d22ccbedcd99c01f4e435ce51208af2}{TDATA\_\-getRandCtxForSeqVal} (unsigned int testParm)
\begin{CompactList}\small\item\em Create contex to use with \hyperlink{TDATA_8h_2e61fe73cdbd6b14e5bdbfa1f9867ec3}{TDATA\_\-getNextSeqVal()}. \item\end{CompactList}\item 
unsigned int \hyperlink{TDATA_8h_2e61fe73cdbd6b14e5bdbfa1f9867ec3}{TDATA\_\-getNextSeqVal} (\hyperlink{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}{TDATA\_\-DTEST} testType, unsigned int testParm, int idx, unsigned int $\ast$randCtx)
\begin{CompactList}\small\item\em Create a data sequence one word at a time. \item\end{CompactList}\item 
char $\ast$ \hyperlink{TDATA_8h_8652a4df7926bdcbecf9350c482cb368}{TDATA\_\-testStr} (\hyperlink{TDATA_8h_fafb1ba1ffdfa0f77e907069435b6f43}{TDATA\_\-DTEST} testType)
\begin{CompactList}\small\item\em convert test type enum to a string \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Module to create and check a self-describing test data packet. 

\begin{Desc}
\item[Author:]Ed Bacho - \href{mailto:ebacho@slac.stanford.edu}{\tt ebacho@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}



\end{verbatim}
\normalsize
 

\subsection{Enumeration Type Documentation}
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7}{
\index{TDATA.h@{TDATA.h}!\_\-TDATA\_\-DTEST@{\_\-TDATA\_\-DTEST}}
\index{\_\-TDATA\_\-DTEST@{\_\-TDATA\_\-DTEST}!TDATA.h@{TDATA.h}}
\subsubsection[{\_\-TDATA\_\-DTEST}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \_\-TDATA\_\-DTEST}}}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{TDATA\_\-DTEST\_\-INCREMENT@{TDATA\_\-DTEST\_\-INCREMENT}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-INCREMENT@{TDATA\_\-DTEST\_\-INCREMENT}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c71fca49a2fd48eb9f577243272fb94e78}{
TDATA\_\-DTEST\_\-INCREMENT}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c71fca49a2fd48eb9f577243272fb94e78}
}]The data increments for each data unit, testParm is start value \index{TDATA\_\-DTEST\_\-CONSTANT@{TDATA\_\-DTEST\_\-CONSTANT}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-CONSTANT@{TDATA\_\-DTEST\_\-CONSTANT}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7b4688f0db23d8b089e98d6530a722714}{
TDATA\_\-DTEST\_\-CONSTANT}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7b4688f0db23d8b089e98d6530a722714}
}]The data is of constant value, testParm is value \index{TDATA\_\-DTEST\_\-RANDOM@{TDATA\_\-DTEST\_\-RANDOM}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-RANDOM@{TDATA\_\-DTEST\_\-RANDOM}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c79cf18075eca854560869cba9c941a8c0}{
TDATA\_\-DTEST\_\-RANDOM}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c79cf18075eca854560869cba9c941a8c0}
}]The data changes value randomly, testParm is seed \index{TDATA\_\-DTEST\_\-WALK1@{TDATA\_\-DTEST\_\-WALK1}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-WALK1@{TDATA\_\-DTEST\_\-WALK1}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7f884cce8b6417315997857be10ee8b92}{
TDATA\_\-DTEST\_\-WALK1}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7f884cce8b6417315997857be10ee8b92}
}]The data changes has walking 1's, testParm is number of 1's \index{TDATA\_\-DTEST\_\-TRANS01@{TDATA\_\-DTEST\_\-TRANS01}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-TRANS01@{TDATA\_\-DTEST\_\-TRANS01}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7926af513d6b82251dd4cff20a0f24a71}{
TDATA\_\-DTEST\_\-TRANS01}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7926af513d6b82251dd4cff20a0f24a71}
}]The data changes from all 0's to all 1's, testParm is number of 0's before 1's \index{TDATA\_\-DTEST\_\-TRANS10@{TDATA\_\-DTEST\_\-TRANS10}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-TRANS10@{TDATA\_\-DTEST\_\-TRANS10}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c77bf34c2db1815d837e246fd41b574fa1}{
TDATA\_\-DTEST\_\-TRANS10}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c77bf34c2db1815d837e246fd41b574fa1}
}]The data changes from all 1's to all 0's, testParm is number of 1's before 0's \index{TDATA\_\-DTEST\_\-TASKID@{TDATA\_\-DTEST\_\-TASKID}!TDATA.h@{TDATA.h}}\index{TDATA.h@{TDATA.h}!TDATA\_\-DTEST\_\-TASKID@{TDATA\_\-DTEST\_\-TASKID}}\item[{\em 
\hypertarget{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7d6e6638299eda08209d7e3c8e284d30b}{
TDATA\_\-DTEST\_\-TASKID}
\label{TDATA_8h_417efd915a54c80eaaaca4e1b126a3c7d6e6638299eda08209d7e3c8e284d30b}
}]The data is the creating 32b taskId t \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{TDATA_8h_2ae974be1ad65fba40d4e323970989eb}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-compare@{TDATA\_\-compare}}
\index{TDATA\_\-compare@{TDATA\_\-compare}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-compare}]{\setlength{\rightskip}{0pt plus 5cm}int TDATA\_\-compare (unsigned short $\ast$ {\em ptr}, \/  int {\em lenIn16b}, \/  int {\em ccsds}, \/  int {\em printErrs})}}
\label{TDATA_8h_2ae974be1ad65fba40d4e323970989eb}


Analyse a self describing test data buffer for errors. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]\item[{\em lenIn16b}]\item[{\em ccsds}]1=expect CCSDS header on data \item[{\em printErrs}]1=print errors as found \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]number of errors detected This checks a data buffer created with \hyperlink{TDATA_8h_8204e7ffce7a5793dabd4dcc26628086}{TDATA\_\-create()}. The buffer is assumd to be complete. Buffers broken into sequences should use TDATA\_\-compareSeq.\end{Desc}
WARNING: Because of the sequence handling, this routine is no longer thread safe. Itassumes a single thread is calling it and that sequences of buffer segments are received in order. 

References TDATA\_\-compareSeq().\hypertarget{TDATA_8h_7f7494294b2d96510c82660974939391}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-compareSeq@{TDATA\_\-compareSeq}}
\index{TDATA\_\-compareSeq@{TDATA\_\-compareSeq}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-compareSeq}]{\setlength{\rightskip}{0pt plus 5cm}int TDATA\_\-compareSeq (unsigned short $\ast$ {\em ptr}, \/  int {\em lenIn16b}, \/  int {\em seq}, \/  int {\em ccsds}, \/  int {\em printErrs})}}
\label{TDATA_8h_7f7494294b2d96510c82660974939391}


Analyse a buffer segment of a self describing test data buffer for errors. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]The buffer segment to be compared \item[{\em lenIn16b}]length of this seqment \item[{\em seq}]sequence number of this buffer segment where seq=0 is the first \item[{\em ccsds}]1=expect CCSDS header on data \item[{\em printErrs}]1=print errors as found \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]number of errors detected This checks a data buffer created with \hyperlink{TDATA_8h_8204e7ffce7a5793dabd4dcc26628086}{TDATA\_\-create()}. However this routine will alloc one to check the buffer when it is broken into a number segments (as done by the EBM, Event Builder Module). The sequence number of the segment must be specified and seq=0 MUST be first. Info about the buffer is stored staticly on seq=0 and used when seq!=0.\end{Desc}
WARNING: Because of the sequence handling, this routine is no longer thread safe. It assumes a single thread is calling it and that sequences of buffer segments are received in order. 

References EPRINTF, TDATA\_\-DTEST\_\-CONSTANT, TDATA\_\-DTEST\_\-INCREMENT, TDATA\_\-DTEST\_\-RANDOM, TDATA\_\-DTEST\_\-TASKID, TDATA\_\-DTEST\_\-TRANS01, TDATA\_\-DTEST\_\-TRANS10, and TDATA\_\-DTEST\_\-WALK1.

Referenced by TDATA\_\-compare().\hypertarget{TDATA_8h_8204e7ffce7a5793dabd4dcc26628086}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-create@{TDATA\_\-create}}
\index{TDATA\_\-create@{TDATA\_\-create}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-create}]{\setlength{\rightskip}{0pt plus 5cm}void TDATA\_\-create (unsigned short $\ast$ {\em ptr}, \/  int {\em lenIn16b}, \/  int {\em ccsds}, \/  {\bf TDATA\_\-DTEST} {\em testType}, \/  unsigned int {\em testParm})}}
\label{TDATA_8h_8204e7ffce7a5793dabd4dcc26628086}


Create a self describing test data buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]\item[{\em lenIn16b}]- total length of buffer including 8 byte header, data, and optional 14 byte CCSDS \item[{\em ccsds}]1=put CCSDS header on data sent out as event \item[{\em testType}]Specifies the data sequence for test \item[{\em testParm}]Parm to use with testType \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none This creates a data buffer with an 8 byte header that describes the data so that \hyperlink{TDATA_8h_2ae974be1ad65fba40d4e323970989eb}{TDATA\_\-compare()} can compare and determine if the data has been corrupted.\end{Desc}
The testType and use of testParm is as follows:

testType = TDATA\_\-DTEST\_\-CONSTANT testParm = 16b constant value to be repeated as data

testType = TDATA\_\-DTEST\_\-INCREMENT testParm = 16b start value that is incremented on each 16b word

testType = TDATA\_\-DTEST\_\-RANDOM testParm = seed value for ranom generator, values are 16b but appear random in all dTypes

testType = TDATA\_\-DTEST\_\-WALK1 testParm = 8=walk on bytes, 16=walk on 16b words, 32=walk on 32b words

testType = TDATA\_\-DTEST\_\-TRANS01 testParm = number of bits of 0's before all 1's in each packet

testType = TDATA\_\-DTEST\_\-TRANS10 testParm = number of bits of 1's before all 0's in each packet 

References TDATA\_\-DTEST\_\-CONSTANT, TDATA\_\-DTEST\_\-INCREMENT, TDATA\_\-DTEST\_\-RANDOM, TDATA\_\-DTEST\_\-TASKID, TDATA\_\-DTEST\_\-TRANS01, TDATA\_\-DTEST\_\-TRANS10, and TDATA\_\-DTEST\_\-WALK1.\hypertarget{TDATA_8h_2e61fe73cdbd6b14e5bdbfa1f9867ec3}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-getNextSeqVal@{TDATA\_\-getNextSeqVal}}
\index{TDATA\_\-getNextSeqVal@{TDATA\_\-getNextSeqVal}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-getNextSeqVal}]{\setlength{\rightskip}{0pt plus 5cm}TDATA\_\-getNextSeqVal ({\bf TDATA\_\-DTEST} {\em testType}, \/  unsigned int {\em testParm}, \/  int {\em idx}, \/  unsigned int $\ast$ {\em randCtx})}}
\label{TDATA_8h_2e61fe73cdbd6b14e5bdbfa1f9867ec3}


Create a data sequence one word at a time. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em testType}]type of data sequence \item[{\em testParm}]parm for data sequence \item[{\em idx}]index into sequence \item[{\em randCtx}]if testType==TDATA\_\-DTEST\_\-RANDOM, supply pointer to int returned from \hyperlink{TDATA_8h_3d22ccbedcd99c01f4e435ce51208af2}{TDATA\_\-getRandCtxForSeqVal()} \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]data value in sequence Create a data sequence one word at a time. TDATA\_\-initSeq() needs to be called first. \end{Desc}


References TDATA\_\-DTEST\_\-CONSTANT, TDATA\_\-DTEST\_\-INCREMENT, TDATA\_\-DTEST\_\-RANDOM, TDATA\_\-DTEST\_\-TASKID, TDATA\_\-DTEST\_\-TRANS01, TDATA\_\-DTEST\_\-TRANS10, and TDATA\_\-DTEST\_\-WALK1.\hypertarget{TDATA_8h_3d22ccbedcd99c01f4e435ce51208af2}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-getRandCtxForSeqVal@{TDATA\_\-getRandCtxForSeqVal}}
\index{TDATA\_\-getRandCtxForSeqVal@{TDATA\_\-getRandCtxForSeqVal}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-getRandCtxForSeqVal}]{\setlength{\rightskip}{0pt plus 5cm}TDATA\_\-getRandCtxForSeqVal (unsigned int {\em seed})}}
\label{TDATA_8h_3d22ccbedcd99c01f4e435ce51208af2}


Create contex to use with \hyperlink{TDATA_8h_2e61fe73cdbd6b14e5bdbfa1f9867ec3}{TDATA\_\-getNextSeqVal()}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em seed}]seed value for random number generator \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]contex to be used for random number generator \end{Desc}
\hypertarget{TDATA_8h_bdfec9c6de2718bc02cba74ee22da2ca}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-setCcsdsParms@{TDATA\_\-setCcsdsParms}}
\index{TDATA\_\-setCcsdsParms@{TDATA\_\-setCcsdsParms}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-setCcsdsParms}]{\setlength{\rightskip}{0pt plus 5cm}void TDATA\_\-setCcsdsParms (unsigned int {\em appId})}}
\label{TDATA_8h_bdfec9c6de2718bc02cba74ee22da2ca}


set prameters for all CCSDS packets 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em appId}]set the AppId fiels within CCSDS header \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none \end{Desc}


Referenced by SSRSIM\_\-init().\hypertarget{TDATA_8h_8652a4df7926bdcbecf9350c482cb368}{
\index{TDATA.h@{TDATA.h}!TDATA\_\-testStr@{TDATA\_\-testStr}}
\index{TDATA\_\-testStr@{TDATA\_\-testStr}!TDATA.h@{TDATA.h}}
\subsubsection[{TDATA\_\-testStr}]{\setlength{\rightskip}{0pt plus 5cm}const char $\ast$ TDATA\_\-testStr ({\bf TDATA\_\-DTEST} {\em testType})}}
\label{TDATA_8h_8652a4df7926bdcbecf9350c482cb368}


convert test type enum to a string 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em testType}]enum to turn to string \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]string of given enum \end{Desc}


References TDATA\_\-DTEST\_\-CONSTANT, TDATA\_\-DTEST\_\-INCREMENT, TDATA\_\-DTEST\_\-RANDOM, TDATA\_\-DTEST\_\-TASKID, TDATA\_\-DTEST\_\-TRANS01, TDATA\_\-DTEST\_\-TRANS10, and TDATA\_\-DTEST\_\-WALK1.