\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.  




This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=85pt]{TDATA_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{TDATA_8h_a0}{
typedef enum \hyperlink{TDATA_8h_a12}{\_\-TDATA\_\-DTEST} \hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST}}
\label{TDATA_8h_a0}

\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_a12}{\_\-TDATA\_\-DTEST} \{ \par
\hyperlink{TDATA_8h_a12a1}{TDATA\_\-DTEST\_\-INCREMENT} =  0, 
\par
\hyperlink{TDATA_8h_a12a2}{TDATA\_\-DTEST\_\-CONSTANT} =  1, 
\par
\hyperlink{TDATA_8h_a12a3}{TDATA\_\-DTEST\_\-RANDOM} =  2, 
\par
\hyperlink{TDATA_8h_a12a4}{TDATA\_\-DTEST\_\-WALK1} =  3, 
\par
\hyperlink{TDATA_8h_a12a5}{TDATA\_\-DTEST\_\-TRANS01} =  4, 
\par
\hyperlink{TDATA_8h_a12a6}{TDATA\_\-DTEST\_\-TRANS10} =  5
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{TDATA_8h_a7}{TDATA\_\-create} (unsigned short $\ast$ptr, int len\-In16b, int ccsds, \hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST} test\-Type, unsigned int test\-Parm)
\begin{CompactList}\small\item\em Create a self describing test data buffer. \item\end{CompactList}\item 
int \hyperlink{TDATA_8h_a8}{TDATA\_\-compare} (unsigned short $\ast$ptr, int len\-In16b, int ccsds, int print\-Errs)
\begin{CompactList}\small\item\em Analyse a self describing test data buffer for errors. \item\end{CompactList}\item 
unsigned int \hyperlink{TDATA_8h_a9}{TDATA\_\-get\-Rand\-Ctx\-For\-Seq\-Val} (unsigned int test\-Parm)
\begin{CompactList}\small\item\em Create contex to use with \hyperlink{TDATA_8h_a10}{TDATA\_\-get\-Next\-Seq\-Val()}. \item\end{CompactList}\item 
unsigned int \hyperlink{TDATA_8h_a10}{TDATA\_\-get\-Next\-Seq\-Val} (\hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST} test\-Type, unsigned int test\-Parm, int idx, unsigned int $\ast$rand\-Ctx)
\begin{CompactList}\small\item\em Create a data sequence one word at a time. \item\end{CompactList}\item 
char $\ast$ \hyperlink{TDATA_8h_a11}{TDATA\_\-test\-Str} (\hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST} test\-Type)
\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_a12}{
\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 \hyperlink{TDATA_8h_a12}{\_\-TDATA\_\-DTEST}}}
\label{TDATA_8h_a12}


\begin{Desc}
\item[Enumeration values: ]\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_a12a1}{
{\em TDATA\_\-DTEST\_\-INCREMENT}}
\label{TDATA_8h_a12a1}
}]The data increments for each data unit, test\-Parm 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_a12a2}{
{\em TDATA\_\-DTEST\_\-CONSTANT}}
\label{TDATA_8h_a12a2}
}]The data is of constant value, test\-Parm 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_a12a3}{
{\em TDATA\_\-DTEST\_\-RANDOM}}
\label{TDATA_8h_a12a3}
}]The data changes value randomly, test\-Parm 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_a12a4}{
{\em TDATA\_\-DTEST\_\-WALK1}}
\label{TDATA_8h_a12a4}
}]The data changes has walking 1's, test\-Parm 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_a12a5}{
{\em TDATA\_\-DTEST\_\-TRANS01}}
\label{TDATA_8h_a12a5}
}]The data changes from all 0's to all 1's, test\-Parm 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_a12a6}{
{\em TDATA\_\-DTEST\_\-TRANS10}}
\label{TDATA_8h_a12a6}
}]The data changes from all 1's to all 0's, test\-Parm is number of 1's before 0's \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{TDATA_8h_a8}{
\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 len\-In16b}, int {\em ccsds}, int {\em print\-Errs})}}
\label{TDATA_8h_a8}


Analyse a self describing test data buffer for errors. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]\item[{\em len\-In16b}]\item[{\em ccsds}]1=expect CCSDS header on data \item[{\em print\-Errs}]1=print errors as found \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]number of errors detected \end{Desc}
This checks a data buffer created with \hyperlink{TDATA_8h_a7}{TDATA\_\-create()}. \hypertarget{TDATA_8h_a7}{
\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 len\-In16b}, int {\em ccsds}, \hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST} {\em test\-Type}, unsigned int {\em test\-Parm})}}
\label{TDATA_8h_a7}


Create a self describing test data buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]\item[{\em len\-In16b}]\item[{\em ccsds}]1=put CCSDS header on data sent out as event \item[{\em test\-Type}]Specifies the data sequence for test \item[{\em test\-Parm}]Parm to use with test\-Type \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none \end{Desc}
This creates a data buffer with an 8 byte header that describes the data so that \hyperlink{TDATA_8h_a8}{TDATA\_\-compare()} can compare and determine if the data has been corrupted.

The test\-Type and use of test\-Parm is as follows:

test\-Type = TDATA\_\-DTEST\_\-CONSTANT test\-Parm = 16b constant value to be repeated as data

test\-Type = TDATA\_\-DTEST\_\-INCREMENT test\-Parm = 16b start value that is incremented on each 16b word

test\-Type = TDATA\_\-DTEST\_\-RANDOM test\-Parm = seed value for ranom generator, values are 16b but appear random in all d\-Types

test\-Type = TDATA\_\-DTEST\_\-WALK1 test\-Parm = 8=walk on bytes, 16=walk on 16b words, 32=walk on 32b words

test\-Type = TDATA\_\-DTEST\_\-TRANS01 test\-Parm = number of bits of 0's before all 1's in each packet

test\-Type = TDATA\_\-DTEST\_\-TRANS10 test\-Parm = number of bits of 1's before all 0's in each packet \hypertarget{TDATA_8h_a10}{
\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\_\-get\-Next\-Seq\-Val (\hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST} {\em test\-Type}, unsigned int {\em test\-Parm}, int {\em idx}, unsigned int $\ast$ {\em rand\-Ctx})}}
\label{TDATA_8h_a10}


Create a data sequence one word at a time. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em test\-Type}]type of data sequence \item[{\em test\-Parm}]parm for data sequence \item[{\em idx}]index into sequence \item[{\em rand\-Ctx}]if test\-Type==TDATA\_\-DTEST\_\-RANDOM, supply pointer to int returned from \hyperlink{TDATA_8h_a9}{TDATA\_\-get\-Rand\-Ctx\-For\-Seq\-Val()} \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]data value in sequence \end{Desc}
Create a data sequence one word at a time. TDATA\_\-init\-Seq() needs to be called first. \hypertarget{TDATA_8h_a9}{
\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\_\-get\-Rand\-Ctx\-For\-Seq\-Val (unsigned int {\em seed})}}
\label{TDATA_8h_a9}


Create contex to use with \hyperlink{TDATA_8h_a10}{TDATA\_\-get\-Next\-Seq\-Val()}. 

\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_a11}{
\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\_\-test\-Str (\hyperlink{TDATA_8h_a0}{TDATA\_\-DTEST} {\em test\-Type})}}
\label{TDATA_8h_a11}


convert test type enum to a string 

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