\hypertarget{gtrg_8c}{
\section{gtrg.c File Reference}
\label{gtrg_8c}\index{gtrg.c@{gtrg.c}}
}
Expose mini-GLT registers.  


{\tt \#include \char`\"{}GNAT/log.h\char`\"{}}\par
{\tt \#include \char`\"{}gnat\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}GNAT/gtrg.h\char`\"{}}\par
{\tt \#include \char`\"{}GNAT/gio.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{gtrg_8c_a0}{g\-Get\-Trg\-Mask\-Cfg\-Reg} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int $\ast$val)
\begin{CompactList}\small\item\em returns the contents of the trigger mask / config register \item\end{CompactList}\item 
int \hyperlink{gtrg_8c_a1}{g\-Set\-Trg\-Mask\-Cfg\-Reg} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int val)
\begin{CompactList}\small\item\em sets the contents of the trigger mask / config register \item\end{CompactList}\item 
int \hyperlink{gtrg_8c_a2}{g\-Get\-Trg\-Opt\-Reg} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int $\ast$val)
\begin{CompactList}\small\item\em returns the contents of the trigger options register \item\end{CompactList}\item 
int \hyperlink{gtrg_8c_a3}{g\-Set\-Trg\-Opt\-Reg} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int val)
\begin{CompactList}\small\item\em sets the contents of the trigger options register \item\end{CompactList}\item 
int \hyperlink{gtrg_8c_a4}{g\-Set\-Trg\-Self\-Trg} (\hyperlink{struct__gnat}{gnat\-Handle} gh)
\begin{CompactList}\small\item\em Creates a self trigger signal. \item\end{CompactList}\item 
int \hyperlink{gtrg_8c_a5}{g\-Read\-Trg\-Msg} (\hyperlink{struct__gnat}{gnat\-Handle} gh, \hyperlink{struct__gResponse}{g\-Response} $\ast$rsp)
\begin{CompactList}\small\item\em Attempts to read a trigger message from record FIFO. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Expose mini-GLT registers. 

\begin{Desc}
\item[Author:]Curt Brune -- \href{mailto:curt@slac.stanford.edu}{\tt curt@slac.stanford.edu} \end{Desc}


\subsection{Function Documentation}
\hypertarget{gtrg_8c_a0}{
\index{gtrg.c@{gtrg.c}!gGetTrgMaskCfgReg@{gGetTrgMaskCfgReg}}
\index{gGetTrgMaskCfgReg@{gGetTrgMaskCfgReg}!gtrg.c@{gtrg.c}}
\subsubsection[gGetTrgMaskCfgReg]{\setlength{\rightskip}{0pt plus 5cm}int g\-Get\-Trg\-Mask\-Cfg\-Reg (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int $\ast$ {\em val})}}
\label{gtrg_8c_a0}


returns the contents of the trigger mask / config register 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \item[{\em val}]pointer to storage to hold register on return \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK on success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{gtrg_8c_a1}{g\-Set\-Trg\-Mask\-Cfg\-Reg()} \end{Desc}
\hypertarget{gtrg_8c_a2}{
\index{gtrg.c@{gtrg.c}!gGetTrgOptReg@{gGetTrgOptReg}}
\index{gGetTrgOptReg@{gGetTrgOptReg}!gtrg.c@{gtrg.c}}
\subsubsection[gGetTrgOptReg]{\setlength{\rightskip}{0pt plus 5cm}int g\-Get\-Trg\-Opt\-Reg (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int $\ast$ {\em val})}}
\label{gtrg_8c_a2}


returns the contents of the trigger options register 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \item[{\em val}]pointer to storage to hold register on return \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK on success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{gtrg_8c_a3}{g\-Set\-Trg\-Opt\-Reg()} \end{Desc}
\hypertarget{gtrg_8c_a5}{
\index{gtrg.c@{gtrg.c}!gReadTrgMsg@{gReadTrgMsg}}
\index{gReadTrgMsg@{gReadTrgMsg}!gtrg.c@{gtrg.c}}
\subsubsection[gReadTrgMsg]{\setlength{\rightskip}{0pt plus 5cm}int g\-Read\-Trg\-Msg (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, \hyperlink{struct__gResponse}{g\-Response} $\ast$ {\em rsp})}}
\label{gtrg_8c_a5}


Attempts to read a trigger message from record FIFO. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \item[{\em rsp}]pointer to response structure to hold the result \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK on success\end{Desc}


The trigger message is 32 bits long and looks like this in the record FIFO (18 bits wide).

\small\begin{alltt}
        -----------------------------------
        1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
        7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
        -----------------------------------
Word 1  1 M M M M M M M M M M M M M M M M M
Word 2  D D M M M M M M M M M M M M M M Z Z
Word 3  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 4  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 5  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 6  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 7  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 8  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 9  D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z
Word 10 D D Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z\end{alltt}\normalsize 


\small\begin{alltt}  Legend:\end{alltt}\normalsize 


\small\begin{alltt}      1  --  Start Bit, first bit of trigger message
      M  --  Message bit, 31 in all
      D  --  Do not care, ignored
      Z  --  Zero
  \end{alltt}\normalsize 


I want to return the start bit plus the 31 message bits. \hypertarget{gtrg_8c_a1}{
\index{gtrg.c@{gtrg.c}!gSetTrgMaskCfgReg@{gSetTrgMaskCfgReg}}
\index{gSetTrgMaskCfgReg@{gSetTrgMaskCfgReg}!gtrg.c@{gtrg.c}}
\subsubsection[gSetTrgMaskCfgReg]{\setlength{\rightskip}{0pt plus 5cm}int g\-Set\-Trg\-Mask\-Cfg\-Reg (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int {\em val})}}
\label{gtrg_8c_a1}


sets the contents of the trigger mask / config register 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \item[{\em val}]value to put in register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK on success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{gtrg_8c_a0}{g\-Get\-Trg\-Mask\-Cfg\-Reg()} \end{Desc}
\hypertarget{gtrg_8c_a3}{
\index{gtrg.c@{gtrg.c}!gSetTrgOptReg@{gSetTrgOptReg}}
\index{gSetTrgOptReg@{gSetTrgOptReg}!gtrg.c@{gtrg.c}}
\subsubsection[gSetTrgOptReg]{\setlength{\rightskip}{0pt plus 5cm}int g\-Set\-Trg\-Opt\-Reg (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int {\em val})}}
\label{gtrg_8c_a3}


sets the contents of the trigger options register 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \item[{\em val}]value to put in register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK on success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{gtrg_8c_a2}{g\-Get\-Trg\-Opt\-Reg()} \end{Desc}
\hypertarget{gtrg_8c_a4}{
\index{gtrg.c@{gtrg.c}!gSetTrgSelfTrg@{gSetTrgSelfTrg}}
\index{gSetTrgSelfTrg@{gSetTrgSelfTrg}!gtrg.c@{gtrg.c}}
\subsubsection[gSetTrgSelfTrg]{\setlength{\rightskip}{0pt plus 5cm}int g\-Set\-Trg\-Self\-Trg (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh})}}
\label{gtrg_8c_a4}


Creates a self trigger signal. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK on success\end{Desc}


Raises the self trigger signal -- the COMM board may ignore this signal if the internal trigger is disable (see g\-Set\-Trg\-Mask() ). 