\hypertarget{tpg_8c}{
\section{tpg.c File Reference}
\label{tpg_8c}\index{tpg.c@{tpg.c}}
}
Trigger Pattern Generator command-line user interface.  


{\tt \#include \char`\"{}tpg\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}signal\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}GNAT/ginit.h\char`\"{}}\par
{\tt \#include \char`\"{}GNAT/gio.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-print\-Proc.h\char`\"{}}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$stddef.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__TPG}{TPG} $\ast$ \hyperlink{tpg_8c_a1}{TPGnew} (unsigned $\ast$comm\-Addr)
\begin{CompactList}\small\item\em Calls calloc to allocate memory for the struct and associated buffers then sets the buffer pointers to the correct offsets. \item\end{CompactList}\item 
void \hyperlink{tpg_8c_a2}{TPGclear} (\hyperlink{struct__TPG}{TPG} $\ast$this)
\begin{CompactList}\small\item\em Sets all the buffers to 0. \item\end{CompactList}\item 
void \hyperlink{tpg_8c_a3}{TPGclear\-Buf} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned buffer\-Id)
\begin{CompactList}\small\item\em Sets the buffer indicated by {\em buffer\-Id\/} to 0. \item\end{CompactList}\item 
unsigned \hyperlink{tpg_8c_a4}{TPGset\-TEM} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned tem\_\-id, \hyperlink{tpg_8h_a1}{tem\-Trg} trg, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a5}{TPGset\-VETO} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned free\_\-id, unsigned veto\_\-id, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a6}{TPGset\-CNO} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned free\_\-id, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a7}{TPGset\-TEMv} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned tem\_\-id, \hyperlink{tpg_8h_a1}{tem\-Trg} trg, unsigned start, unsigned $\ast$pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a8}{TPGset\-VETOv} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned free\_\-id, unsigned veto\_\-id, unsigned start, unsigned $\ast$pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a9}{TPGset\-CNOv} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned free\_\-id, unsigned start, unsigned $\ast$pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a10}{TPGstart} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned char $\ast$clk\-Delay)
\item 
unsigned \hyperlink{tpg_8c_a11}{TPGdump} (\hyperlink{struct__TPG}{TPG} $\ast$this, unsigned buffer\-Id)
\item 
unsigned \hyperlink{tpg_8c_a12}{\_\-check\-Bounds} (unsigned start, unsigned pat\_\-len, unsigned repetitions)
\item 
unsigned \hyperlink{tpg_8c_a13}{\_\-check\-TEM} (unsigned tem\_\-id, \hyperlink{tpg_8h_a1}{tem\-Trg} trg)
\item 
unsigned \hyperlink{tpg_8c_a14}{\_\-check\-FREE} (unsigned free\_\-id, unsigned veto\_\-id)
\item 
unsigned \hyperlink{tpg_8c_a15}{\_\-check\-CNO} (unsigned free\_\-id)
\item 
void \hyperlink{tpg_8c_a16}{\_\-set\-Bits} (unsigned $\ast$fifo, unsigned channel, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
void \hyperlink{tpg_8c_a17}{\_\-set\-Bitsv} (unsigned $\ast$fifo, unsigned channel, unsigned start, unsigned $\ast$pattern, unsigned pat\_\-len, unsigned repetitions)
\item 
int \hyperlink{tpg_8c_a18}{TPGmsg\-Init} (void)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
unsigned \hyperlink{tpg_8c_a0}{TPG\_\-LASTWORD} = TPG\_\-BUFFER\_\-DEPTH - sizeof(unsigned)
\end{CompactItemize}


\subsection{Detailed Description}
Trigger Pattern Generator command-line user interface. 

\begin{Desc}
\item[Author:]James Swain -- \href{mailto:jswain@slac.stanford.edu}{\tt jswain@slac.stanford.edu} \end{Desc}


\subsection{Function Documentation}
\hypertarget{tpg_8c_a12}{
\index{tpg.c@{tpg.c}!_checkBounds@{\_\-checkBounds}}
\index{_checkBounds@{\_\-checkBounds}!tpg.c@{tpg.c}}
\subsubsection[\_\-checkBounds]{\setlength{\rightskip}{0pt plus 5cm}unsigned \_\-check\-Bounds (unsigned {\em start}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a12}


unsigned \hyperlink{tpg__p_8h_a8}{\_\-check\-Bounds(unsigned start, unsigned pat\_\-len, unsigned repetitions)}; \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em start}]Bit that this pattern begins at \item[{\em pat\_\-len}]length of pattern \item[{\em repetitions}]Number of times to repeat the pattern in the buffer \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS when all is well  Checks that the requested addition to the buffer does not exceed the boundaries \end{Desc}
\hypertarget{tpg_8c_a15}{
\index{tpg.c@{tpg.c}!_checkCNO@{\_\-checkCNO}}
\index{_checkCNO@{\_\-checkCNO}!tpg.c@{tpg.c}}
\subsubsection[\_\-checkCNO]{\setlength{\rightskip}{0pt plus 5cm}unsigned \_\-check\-CNO (unsigned {\em free\_\-id})}}
\label{tpg_8c_a15}


unsigned \hyperlink{tpg__p_8h_a11}{\_\-check\-CNO(unsigned free\_\-id)}; \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em free\_\-id}]ID of the FREE board \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS when all is well  Checks that the {\em free\_\-id\/} is valid \end{Desc}
\hypertarget{tpg_8c_a14}{
\index{tpg.c@{tpg.c}!_checkFREE@{\_\-checkFREE}}
\index{_checkFREE@{\_\-checkFREE}!tpg.c@{tpg.c}}
\subsubsection[\_\-checkFREE]{\setlength{\rightskip}{0pt plus 5cm}unsigned \_\-check\-FREE (unsigned {\em free\_\-id}, unsigned {\em veto\_\-id})}}
\label{tpg_8c_a14}


unsigned \hyperlink{tpg__p_8h_a10}{\_\-check\-FREE(unsigned free\_\-id, unsigned veto\_\-id)}; \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em free\_\-id}]ID of the FREE board \item[{\em veto\_\-id}]ID of the VETO line \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS when all is well  Checks that the {\em free\_\-id\/} and {\em veto\_\-id\/} are valid \end{Desc}
\hypertarget{tpg_8c_a13}{
\index{tpg.c@{tpg.c}!_checkTEM@{\_\-checkTEM}}
\index{_checkTEM@{\_\-checkTEM}!tpg.c@{tpg.c}}
\subsubsection[\_\-checkTEM]{\setlength{\rightskip}{0pt plus 5cm}unsigned \_\-check\-TEM (unsigned {\em tem\_\-id}, \hyperlink{tpg_8h_a1}{tem\-Trg} {\em trg})}}
\label{tpg_8c_a13}


unsigned \hyperlink{tpg__p_8h_a9}{\_\-check\-TEM(unsigned tem\_\-id, tem\-Trg trg)}; \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em tem\_\-id}]ID of the TEM \item[{\em trg}]Trg of the TEM \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS when all is well  Checks that the {\em tem\_\-id\/} and {\em trg\/} are valid \end{Desc}
\hypertarget{tpg_8c_a16}{
\index{tpg.c@{tpg.c}!_setBits@{\_\-setBits}}
\index{_setBits@{\_\-setBits}!tpg.c@{tpg.c}}
\subsubsection[\_\-setBits]{\setlength{\rightskip}{0pt plus 5cm}void \_\-set\-Bits (unsigned $\ast$ {\em fifo}, unsigned {\em channel}, unsigned {\em start}, unsigned {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a16}


void \_\-set\-Bits (unsigned$\ast$ fifo, unsigned channel, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fifo}]Array of unsigned representing the Playback FIFO of one COMM I/O board \item[{\em channel}]Channel this pattern is destined for \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... 32 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into {\em channel\/} and in buffer indicated by {\em board\/} \end{description}
\end{Desc}
\hypertarget{tpg_8c_a17}{
\index{tpg.c@{tpg.c}!_setBitsv@{\_\-setBitsv}}
\index{_setBitsv@{\_\-setBitsv}!tpg.c@{tpg.c}}
\subsubsection[\_\-setBitsv]{\setlength{\rightskip}{0pt plus 5cm}void \_\-set\-Bitsv (unsigned $\ast$ {\em fifo}, unsigned {\em channel}, unsigned {\em start}, unsigned $\ast$ {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a17}


void \hyperlink{tpg__p_8h_a13}{\_\-set\-Bitsv(unsigned$\ast$ fifo, unsigned channel, unsigned start, unsigned$\ast$ pattern, unsigned pat\_\-len, unsigned repetitions)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fifo}]Array of unsigned representing the Playback FIFO of one COMM I/O board \item[{\em channel}]Channel this pattern is destined for \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... (32$\ast$1024)-1 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into {\em channel\/} and in buffer indicated by {\em board\/} \end{description}
\end{Desc}
\hypertarget{tpg_8c_a2}{
\index{tpg.c@{tpg.c}!TPGclear@{TPGclear}}
\index{TPGclear@{TPGclear}!tpg.c@{tpg.c}}
\subsubsection[TPGclear]{\setlength{\rightskip}{0pt plus 5cm}void TPGclear (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this})}}
\label{tpg_8c_a2}


Sets all the buffers to 0. 

void \hyperlink{tpg_8c_a2}{TPGclear(TPG$\ast$ this)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure to clear \end{description}
\end{Desc}
\hypertarget{tpg_8c_a3}{
\index{tpg.c@{tpg.c}!TPGclearBuf@{TPGclearBuf}}
\index{TPGclearBuf@{TPGclearBuf}!tpg.c@{tpg.c}}
\subsubsection[TPGclearBuf]{\setlength{\rightskip}{0pt plus 5cm}void TPGclear\-Buf (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em buffer\-Id})}}
\label{tpg_8c_a3}


Sets the buffer indicated by {\em buffer\-Id\/} to 0. 

void \hyperlink{tpg_8c_a3}{TPGclear\-Buf(TPG$\ast$ this, unsigned buffer\-Id)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure containing buffer to clear \item[{\em buffer\-Id}]ID of the buffer to clear \end{description}
\end{Desc}
\hypertarget{tpg_8c_a11}{
\index{tpg.c@{tpg.c}!TPGdump@{TPGdump}}
\index{TPGdump@{TPGdump}!tpg.c@{tpg.c}}
\subsubsection[TPGdump]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGdump (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em buffer\-Id})}}
\label{tpg_8c_a11}


unsigned \hyperlink{tpg_8c_a11}{TPGdump(TPG$\ast$ this, unsigned buffer\-Id)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG struct to use to configure COMM I/O boards \item[{\em buffer\-Id}]Buffer to dump, 0 ... TPG\_\-N\_\-BOARDS \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Print out the bit patterns in the buffer \end{Desc}
\hypertarget{tpg_8c_a18}{
\index{tpg.c@{tpg.c}!TPGmsgInit@{TPGmsgInit}}
\index{TPGmsgInit@{TPGmsgInit}!tpg.c@{tpg.c}}
\subsubsection[TPGmsgInit]{\setlength{\rightskip}{0pt plus 5cm}int TPGmsg\-Init (void)}}
\label{tpg_8c_a18}


int \hyperlink{tpg_8c_a18}{TPGmsg\-Init(void)} \begin{Desc}
\item[Returns:]0 on success, -1 on failure  Starts a simple printf MSG processor \end{Desc}
\hypertarget{tpg_8c_a1}{
\index{tpg.c@{tpg.c}!TPGnew@{TPGnew}}
\index{TPGnew@{TPGnew}!tpg.c@{tpg.c}}
\subsubsection[TPGnew]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__TPG}{TPG}$\ast$ TPGnew (unsigned $\ast$ {\em comm\-Addr})}}
\label{tpg_8c_a1}


Calls calloc to allocate memory for the struct and associated buffers then sets the buffer pointers to the correct offsets. 

TPG$\ast$ \hyperlink{tpg_8c_a1}{TPGnew(unsigned$\ast$ comm\-Addr)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em comm\-Addr}]Array of addresses (TPG\_\-N\_\-BOARDS long) of the COMM I/O boards \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Ptr to a new TPG structure containing ptrs to buffers and gnat\-Handles \end{Desc}
\hypertarget{tpg_8c_a6}{
\index{tpg.c@{tpg.c}!TPGsetCNO@{TPGsetCNO}}
\index{TPGsetCNO@{TPGsetCNO}!tpg.c@{tpg.c}}
\subsubsection[TPGsetCNO]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGset\-CNO (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em free\_\-id}, unsigned {\em start}, unsigned {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a6}


unsigned \hyperlink{tpg_8c_a6}{TPGset\-CNO(TPG$\ast$ this, unsigned free\_\-id, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure being modified \item[{\em free\_\-id}]FREE being targeted (gives tgt board), 0 ... 3 \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... 32 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into the channel and buffer indicated by {\em free\_\-id\/} and {\em veto\_\-id\/} \end{Desc}
\hypertarget{tpg_8c_a9}{
\index{tpg.c@{tpg.c}!TPGsetCNOv@{TPGsetCNOv}}
\index{TPGsetCNOv@{TPGsetCNOv}!tpg.c@{tpg.c}}
\subsubsection[TPGsetCNOv]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGset\-CNOv (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em free\_\-id}, unsigned {\em start}, unsigned $\ast$ {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a9}


unsigned TPGset\-CNOv(TPG$\ast$ this, unsigned free\_\-id, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure being modified \item[{\em free\_\-id}]FREE being targeted (gives tgt board), 0 ... 3 \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... (32$\ast$1024) - 1 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into the channel and buffer indicated by {\em free\_\-id\/} and {\em veto\_\-id\/} \end{Desc}
\hypertarget{tpg_8c_a4}{
\index{tpg.c@{tpg.c}!TPGsetTEM@{TPGsetTEM}}
\index{TPGsetTEM@{TPGsetTEM}!tpg.c@{tpg.c}}
\subsubsection[TPGsetTEM]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGset\-TEM (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em tem\_\-id}, \hyperlink{tpg_8h_a1}{tem\-Trg} {\em trg}, unsigned {\em start}, unsigned {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a4}


unsigned \hyperlink{tpg_8c_a4}{TPGset\-TEM(TPG$\ast$ this, unsigned tem\_\-id, tem\-Trg   trg, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure being modified \item[{\em tem\_\-id}]TEM being targeted (gives channel range), 0 ... 3 \item[{\em trg}]TEM trg being targeted, (gives channel number), 0 ... 3, use tem\-Trg \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... 32 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into the channel and buffer indicated by {\em tem\_\-id\/} and {\em trg\/} \end{Desc}
\hypertarget{tpg_8c_a7}{
\index{tpg.c@{tpg.c}!TPGsetTEMv@{TPGsetTEMv}}
\index{TPGsetTEMv@{TPGsetTEMv}!tpg.c@{tpg.c}}
\subsubsection[TPGsetTEMv]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGset\-TEMv (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em tem\_\-id}, \hyperlink{tpg_8h_a1}{tem\-Trg} {\em trg}, unsigned {\em start}, unsigned $\ast$ {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a7}


unsigned \hyperlink{tpg_8c_a7}{TPGset\-TEMv(TPG$\ast$ this, unsigned tem\_\-id, tem\-Trg   trg, unsigned start, unsigned$\ast$ pattern, unsigned pat\_\-len, unsigned repetitions)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure being modified \item[{\em tem\_\-id}]TEM being targeted (gives channel range), 0 ... 3 \item[{\em trg}]TEM trg being targeted, (gives channel number), 0 ... 3, use tem\-Trg \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... (32$\ast$1024) - 1 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into the channel and buffer indicated by {\em tem\_\-id\/} and {\em trg\/} \end{Desc}
\hypertarget{tpg_8c_a5}{
\index{tpg.c@{tpg.c}!TPGsetVETO@{TPGsetVETO}}
\index{TPGsetVETO@{TPGsetVETO}!tpg.c@{tpg.c}}
\subsubsection[TPGsetVETO]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGset\-VETO (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em free\_\-id}, unsigned {\em veto\_\-id}, unsigned {\em start}, unsigned {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a5}


unsigned \hyperlink{tpg_8c_a5}{TPGset\-VETO(TPG$\ast$ this, unsigned free\_\-id, unsigned veto\_\-id, unsigned start, unsigned pattern, unsigned pat\_\-len, unsigned repetitions)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure being modified \item[{\em free\_\-id}]FREE being targeted (gives tgt board), 0 ... 3 \item[{\em veto\_\-id}]VETO bit being targeted, (gives channel number), 0 ... 17 \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... 32 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into the channel and buffer indicated by {\em free\_\-id\/} and {\em veto\_\-id\/} \end{Desc}
\hypertarget{tpg_8c_a8}{
\index{tpg.c@{tpg.c}!TPGsetVETOv@{TPGsetVETOv}}
\index{TPGsetVETOv@{TPGsetVETOv}!tpg.c@{tpg.c}}
\subsubsection[TPGsetVETOv]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGset\-VETOv (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned {\em free\_\-id}, unsigned {\em veto\_\-id}, unsigned {\em start}, unsigned $\ast$ {\em pattern}, unsigned {\em pat\_\-len}, unsigned {\em repetitions})}}
\label{tpg_8c_a8}


unsigned \hyperlink{tpg_8c_a8}{TPGset\-VETOv(TPG$\ast$ this, unsigned free\_\-id, unsigned veto\_\-id, unsigned start, unsigned$\ast$ pattern, unsigned pat\_\-len, unsigned repetitions)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG structure being modified \item[{\em free\_\-id}]FREE being targeted (gives tgt board), 0 ... 3 \item[{\em veto\_\-id}]VETO bit being targeted, (gives channel number), 0 ... 17 \item[{\em start}]Start bit for the pattern, 0 ... (32$\ast$1024)-1 \item[{\em pattern}]Up to 32 bit pattern to use (LSB first) \item[{\em pat\_\-len}]Pattern length 1 ... (32$\ast$1024) - 1 \item[{\em repetitions}]Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Places the {\em pat\_\-len\/} LSBs of {\em pattern\/} into the channel and buffer indicated by {\em free\_\-id\/} and {\em veto\_\-id\/} \end{Desc}
\hypertarget{tpg_8c_a10}{
\index{tpg.c@{tpg.c}!TPGstart@{TPGstart}}
\index{TPGstart@{TPGstart}!tpg.c@{tpg.c}}
\subsubsection[TPGstart]{\setlength{\rightskip}{0pt plus 5cm}unsigned TPGstart (\hyperlink{struct__TPG}{TPG} $\ast$ {\em this}, unsigned char $\ast$ {\em clk\-Delay})}}
\label{tpg_8c_a10}


unsigned \hyperlink{tpg_8c_a10}{TPGstart(TPG$\ast$ this, unsigned char$\ast$ clk\-Delay)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em this}]TPG struct to use to configure COMM I/O boards \item[{\em clk\-Delay}]Array of (6 bit) clock delays (TPG\_\-N\_\-BOARDS long) for the COMM I/O boards, to remove clock skew. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]One of TPG\_\-msgs, TPG\_\-SUCCESS if all goes well.  Use Programmed I/O to fill the COMM board FIFOs, then start the sequence \end{Desc}


\subsection{Variable Documentation}
\hypertarget{tpg_8c_a0}{
\index{tpg.c@{tpg.c}!TPG_LASTWORD@{TPG\_\-LASTWORD}}
\index{TPG_LASTWORD@{TPG\_\-LASTWORD}!tpg.c@{tpg.c}}
\subsubsection[TPG\_\-LASTWORD]{\setlength{\rightskip}{0pt plus 5cm}unsigned \hyperlink{tpg_8c_a0}{TPG\_\-LASTWORD} = TPG\_\-BUFFER\_\-DEPTH - sizeof(unsigned)}}
\label{tpg_8c_a0}


first bit of last word of a pattern 