\hypertarget{GTB_8h}{
\section{GTB.h File Reference}
\label{GTB_8h}\index{GTB.h@{GTB.h}}
}
Defines the input/output methods for the Gem Test Board driver The Gem Test Board is a modified COMM board, so this.  


\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__BFregControl}{\_\-BFreg\-Control}
\begin{CompactList}\small\item\em map of the comm i/o board 32-bit control register \item\end{CompactList}\item 
struct \hyperlink{struct__BFregInt}{\_\-BFreg\-Int}
\begin{CompactList}\small\item\em map of the comm i/o board 32-bit interrupt config register \item\end{CompactList}\item 
struct \hyperlink{struct__BFregPF}{\_\-BFreg\-PF}
\begin{CompactList}\small\item\em map of the comm i/o board 32-bit playback FIFO register \item\end{CompactList}\item 
struct \hyperlink{struct__BFregRF}{\_\-BFreg\-RF}
\begin{CompactList}\small\item\em map of the comm i/o board 32-bit record FIFO register \item\end{CompactList}\item 
struct \hyperlink{struct__BFregStatus}{\_\-BFreg\-Status}
\begin{CompactList}\small\item\em map of the comm i/o board 32-bit status register \item\end{CompactList}\item 
struct {\bf \_\-GTB\_\-T\_\-}
\item 
struct {\bf \_\-GTBreg\-Block}
\item 
union \hyperlink{union__regControl}{\_\-reg\-Control}
\begin{CompactList}\small\item\em union for 32-bit control register \item\end{CompactList}\item 
union \hyperlink{union__regInt}{\_\-reg\-Int}
\begin{CompactList}\small\item\em union for 32-bit interrupt register \item\end{CompactList}\item 
union \hyperlink{union__regPF}{\_\-reg\-PF}
\begin{CompactList}\small\item\em union for 32-bit play back FIFO register \item\end{CompactList}\item 
union \hyperlink{union__regRF}{\_\-reg\-RF}
\begin{CompactList}\small\item\em union for 32-bit record FIFO register \item\end{CompactList}\item 
union \hyperlink{union__regStatus}{\_\-reg\-Status}
\begin{CompactList}\small\item\em union for 32-bit status register \item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{GTB_8h_a0}{
\#define \hyperlink{GTB_8h_a0}{G\_\-OK}\ (0)}
\label{GTB_8h_a0}

\begin{CompactList}\small\item\em generic success return code \item\end{CompactList}\item 
\hypertarget{GTB_8h_a1}{
\#define \hyperlink{GTB_8h_a1}{GERR}\ (-1)}
\label{GTB_8h_a1}

\begin{CompactList}\small\item\em generic failure return code \item\end{CompactList}\item 
\hypertarget{GTB_8h_a2}{
\#define \hyperlink{GTB_8h_a2}{GERR\_\-BRD\_\-DETECT}\ (-103)}
\label{GTB_8h_a2}

\begin{CompactList}\small\item\em unable to detect/probe board error return code \item\end{CompactList}\item 
\hypertarget{GTB_8h_a3}{
\#define \hyperlink{GTB_8h_a3}{GERR\_\-BAD\_\-HANDLE}\ (-104)}
\label{GTB_8h_a3}

\begin{CompactList}\small\item\em bad handle error return code \item\end{CompactList}\item 
\hypertarget{GTB_8h_a4}{
\#define \hyperlink{GTB_8h_a4}{GERR\_\-BAD\_\-PARAM}\ (-105)}
\label{GTB_8h_a4}

\begin{CompactList}\small\item\em bad parameter passed to function error return code \item\end{CompactList}\item 
\hypertarget{GTB_8h_a5}{
\#define \hyperlink{GTB_8h_a5}{GERR\_\-READY\_\-TIMEOUT}\ (-110)}
\label{GTB_8h_a5}

\begin{CompactList}\small\item\em timeout error while waiting for COMM ready \item\end{CompactList}\item 
\hypertarget{GTB_8h_a6}{
\#define {\bf GTB\_\-OK}\ (G\_\-OK)}
\label{GTB_8h_a6}

\item 
\hypertarget{GTB_8h_a7}{
\#define {\bf GTB\_\-ERR}\ (GERR)}
\label{GTB_8h_a7}

\item 
\hypertarget{GTB_8h_a8}{
\#define {\bf GTB\_\-ERR\_\-BRD\_\-DETECT}\ GERR\_\-BRD\_\-DETECT}
\label{GTB_8h_a8}

\item 
\hypertarget{GTB_8h_a9}{
\#define {\bf GTB\_\-ERR\_\-BAD\_\-HANDLE}\ GERR\_\-BAD\_\-HANDLE}
\label{GTB_8h_a9}

\item 
\hypertarget{GTB_8h_a10}{
\#define {\bf GTB\_\-ERR\_\-BAD\_\-PARAM}\ GERR\_\-BAD\_\-PARAM}
\label{GTB_8h_a10}

\item 
\hypertarget{GTB_8h_a11}{
\#define {\bf GTB\_\-ERR\_\-READY\_\-TIMEOUT}\ GERR\_\-READY\_\-TIMEOUT}
\label{GTB_8h_a11}

\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{GTB_8h_a12}{
typedef \hyperlink{union__regControl}{\_\-reg\-Control} \hyperlink{GTB_8h_a12}{reg\-Control}}
\label{GTB_8h_a12}

\begin{CompactList}\small\item\em typedef for union \hyperlink{union__regControl}{\_\-reg\-Control} \item\end{CompactList}\item 
\hypertarget{GTB_8h_a13}{
typedef \hyperlink{union__regStatus}{\_\-reg\-Status} \hyperlink{GTB_8h_a13}{reg\-Status}}
\label{GTB_8h_a13}

\begin{CompactList}\small\item\em typedef for union \hyperlink{union__regStatus}{\_\-reg\-Status} \item\end{CompactList}\item 
\hypertarget{GTB_8h_a14}{
typedef \hyperlink{union__regPF}{\_\-reg\-PF} \hyperlink{GTB_8h_a14}{reg\-PF}}
\label{GTB_8h_a14}

\begin{CompactList}\small\item\em typedef for union \hyperlink{union__regPF}{\_\-reg\-PF} \item\end{CompactList}\item 
\hypertarget{GTB_8h_a15}{
typedef \hyperlink{union__regRF}{\_\-reg\-RF} \hyperlink{GTB_8h_a15}{reg\-RF}}
\label{GTB_8h_a15}

\begin{CompactList}\small\item\em typedef for union \hyperlink{union__regRF}{\_\-reg\-RF} \item\end{CompactList}\item 
\hypertarget{GTB_8h_a16}{
typedef \hyperlink{union__regInt}{\_\-reg\-Int} \hyperlink{GTB_8h_a16}{reg\-Int}}
\label{GTB_8h_a16}

\begin{CompactList}\small\item\em typedef for union \hyperlink{union__regInt}{\_\-reg\-Int} \item\end{CompactList}\item 
\hypertarget{GTB_8h_a17}{
typedef \_\-GTBreg\-Block {\bf GTBreg\_\-t}}
\label{GTB_8h_a17}

\item 
\hypertarget{GTB_8h_a18}{
typedef \_\-GTB\_\-T\_\- {\bf GTB\_\-t}}
\label{GTB_8h_a18}

\item 
\hypertarget{GTB_8h_a19}{
typedef GTB\_\-t $\ast$ {\bf gtb\-Hndl}}
\label{GTB_8h_a19}

\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
gtb\-Hndl \hyperlink{GTB_8h_a20}{gtb\-Open} (unsigned int phys\-Addr)
\begin{CompactList}\small\item\em maps the physical address to an instance of the driver object \item\end{CompactList}\item 
\hypertarget{GTB_8h_a21}{
int {\bf gtb\-Close} (gtb\-Hndl h)}
\label{GTB_8h_a21}

\item 
\hypertarget{GTB_8h_a22}{
int {\bf gtb\-Reset} (gtb\-Hndl h)}
\label{GTB_8h_a22}

\item 
\hypertarget{GTB_8h_a23}{
int {\bf gtb\-Flush\-All\-F} (gtb\-Hndl h)}
\label{GTB_8h_a23}

\item 
\hypertarget{GTB_8h_a24}{
int {\bf gtb\-Flush\-F} (gtb\-Hndl h, int fifo\-Id)}
\label{GTB_8h_a24}

\item 
\hypertarget{GTB_8h_a25}{
int {\bf gtb\-Flush\-RF} (gtb\-Hndl h)}
\label{GTB_8h_a25}

\item 
\hypertarget{GTB_8h_a26}{
int {\bf gtb\-Flush\-PF} (gtb\-Hndl h)}
\label{GTB_8h_a26}

\item 
\hypertarget{GTB_8h_a27}{
int {\bf gtb\-Probe} (gtb\-Hndl h)}
\label{GTB_8h_a27}

\item 
\hypertarget{GTB_8h_a28}{
int {\bf gtb\-HWver} (gtb\-Hndl h, unsigned short $\ast$ver, unsigned short $\ast$rev)}
\label{GTB_8h_a28}

\item 
\hypertarget{GTB_8h_a29}{
int {\bf gtb\-SWver} (gtb\-Hndl h, unsigned short $\ast$ver, unsigned short $\ast$rev)}
\label{GTB_8h_a29}

\item 
\hypertarget{GTB_8h_a30}{
int {\bf gtb\-Write\-F16} (gtb\-Hndl h, unsigned short val, int fifo\-Id)}
\label{GTB_8h_a30}

\item 
\hypertarget{GTB_8h_a31}{
int {\bf gtb\-Write\-F16n} (gtb\-Hndl h, unsigned short n\-Item, unsigned short val, int fifo\-Id)}
\label{GTB_8h_a31}

\item 
\hypertarget{GTB_8h_a32}{
int {\bf gtb\-Write\-F16v} (gtb\-Hndl h, unsigned short n\-Val, unsigned short $\ast$a\-Val, int fifo\-Id)}
\label{GTB_8h_a32}

\item 
\hypertarget{GTB_8h_a33}{
int {\bf gtb\-Write\-F32} (gtb\-Hndl h, unsigned int val, int fifo\-Id)}
\label{GTB_8h_a33}

\item 
\hypertarget{GTB_8h_a34}{
int {\bf gtb\-Write\-F32n} (gtb\-Hndl h, unsigned short n\-Item, unsigned int val, int fifo\-Id)}
\label{GTB_8h_a34}

\item 
\hypertarget{GTB_8h_a35}{
int {\bf gtb\-Write\-F32v} (gtb\-Hndl h, unsigned int n\-Val, unsigned int $\ast$a\-Val, int fifo\-Id)}
\label{GTB_8h_a35}

\item 
\hypertarget{GTB_8h_a36}{
int {\bf gtb\-Enable\-All\-F} (gtb\-Hndl h)}
\label{GTB_8h_a36}

\item 
\hypertarget{GTB_8h_a37}{
int {\bf gtb\-Enable\-F} (gtb\-Hndl h, int fifo\-Id)}
\label{GTB_8h_a37}

\item 
\hypertarget{GTB_8h_a38}{
int {\bf gtb\-Enable\-PF} (gtb\-Hndl h)}
\label{GTB_8h_a38}

\item 
\hypertarget{GTB_8h_a39}{
int {\bf gtb\-Enable\-RF} (gtb\-Hndl h)}
\label{GTB_8h_a39}

\item 
\hypertarget{GTB_8h_a40}{
int {\bf gtb\-Flush\-Pipe} (gtb\-Hndl h)}
\label{GTB_8h_a40}

\item 
\hypertarget{GTB_8h_a41}{
int {\bf gtb\-Clr\-ALLhist} (gtb\-Hndl h)}
\label{GTB_8h_a41}

\item 
\hypertarget{GTB_8h_a42}{
int {\bf gtb\-Clr\-Fhist} (gtb\-Hndl h, int fifo\-Id)}
\label{GTB_8h_a42}

\item 
\hypertarget{GTB_8h_a43}{
int {\bf gtb\-Clr\-PFhist} (gtb\-Hndl h)}
\label{GTB_8h_a43}

\item 
\hypertarget{GTB_8h_a44}{
int {\bf gtb\-Clr\-RFhist} (gtb\-Hndl h)}
\label{GTB_8h_a44}

\item 
\hypertarget{GTB_8h_a45}{
int {\bf gtb\-Start\-PB} (gtb\-Hndl h)}
\label{GTB_8h_a45}

\item 
\hypertarget{GTB_8h_a46}{
int {\bf gtb\-Set\-Acq\-Src} (gtb\-Hndl h, unsigned int src)}
\label{GTB_8h_a46}

\item 
\hypertarget{GTB_8h_a47}{
int {\bf gtb\-Set\-Rec\-Dly} (gtb\-Hndl h, unsigned char dly)}
\label{GTB_8h_a47}

\item 
\hypertarget{GTB_8h_a48}{
int {\bf gtb\-Set\-Clk\-Dly} (gtb\-Hndl h, unsigned char dly)}
\label{GTB_8h_a48}

\item 
\hypertarget{GTB_8h_a49}{
int {\bf gtb\-Set\-Irq\-Delay} (gtb\-Hndl h, unsigned int dly)}
\label{GTB_8h_a49}

\item 
\hypertarget{GTB_8h_a50}{
int {\bf gtb\-Set\-Irq\-Level} (gtb\-Hndl h, unsigned int level)}
\label{GTB_8h_a50}

\item 
\hypertarget{GTB_8h_a51}{
int {\bf gtb\-Get\-Irq\-Level} (gtb\-Hndl h, unsigned int $\ast$level)}
\label{GTB_8h_a51}

\item 
\hypertarget{GTB_8h_a52}{
int {\bf gtb\-Set\-Irq\-Vec} (gtb\-Hndl h, unsigned int vector)}
\label{GTB_8h_a52}

\item 
\hypertarget{GTB_8h_a53}{
int {\bf gtb\-Get\-Irq\-Vec} (gtb\-Hndl h, unsigned int $\ast$vector)}
\label{GTB_8h_a53}

\item 
\hypertarget{GTB_8h_a54}{
int {\bf gtb\-Connect\-Irq} (gtb\-Hndl h)}
\label{GTB_8h_a54}

\item 
\hypertarget{GTB_8h_a55}{
int {\bf gtb\-Enable\-Irq} (gtb\-Hndl h)}
\label{GTB_8h_a55}

\item 
\hypertarget{GTB_8h_a56}{
int {\bf gtb\-Disable\-Irq} (gtb\-Hndl h)}
\label{GTB_8h_a56}

\item 
\hypertarget{GTB_8h_a57}{
int {\bf gtb\-Set\-Out\-Mask} (gtb\-Hndl h, unsigned int mask)}
\label{GTB_8h_a57}

\item 
\hypertarget{GTB_8h_a58}{
int {\bf gtb\-Get\-Out\-Mask} (gtb\-Hndl h, unsigned int $\ast$mask)}
\label{GTB_8h_a58}

\item 
\hypertarget{GTB_8h_a59}{
int {\bf gtb\-Take\-Int\-Sem} (gtb\-Hndl h)}
\label{GTB_8h_a59}

\item 
\hypertarget{GTB_8h_a60}{
int {\bf gtb\-Set\-Active} (gtb\-Hndl h, unsigned int mode)}
\label{GTB_8h_a60}

\item 
\hypertarget{GTB_8h_a61}{
int {\bf gtb\-Get\-Active} (gtb\-Hndl h, unsigned int $\ast$mode)}
\label{GTB_8h_a61}

\item 
\hypertarget{GTB_8h_a62}{
int {\bf gtb\-Version} (gtb\-Hndl h, unsigned short hw\-Ver, unsigned short hw\-Rev, unsigned short sw\-Ver, unsigned short sw\-Rev)}
\label{GTB_8h_a62}

\item 
int \hyperlink{GTB_8h_a63}{gtb\-Ready} (gtb\-Hndl h, int time\-Out)
\begin{CompactList}\small\item\em Waits for the COMM board to become ready, via polling. \item\end{CompactList}\item 
\hypertarget{GTB_8h_a64}{
int {\bf gtb\-Lock\-FIFO} (gtb\-Hndl h, int time\-Out)}
\label{GTB_8h_a64}

\item 
\hypertarget{GTB_8h_a65}{
int {\bf gtb\-Un\-Lock\-FIFO} (gtb\-Hndl h)}
\label{GTB_8h_a65}

\item 
\hypertarget{GTB_8h_a66}{
int {\bf gtb\-Get\-Logical\-Addr} (gtb\-Hndl h, unsigned int $\ast$addr)}
\label{GTB_8h_a66}

\item 
\hypertarget{GTB_8h_a67}{
int {\bf gtb\-Get\-Phys\-Addr} (gtb\-Hndl h, unsigned int $\ast$addr)}
\label{GTB_8h_a67}

\item 
\hypertarget{GTB_8h_a68}{
gtb\-Clk\_\-t {\bf gtb\-Clk\-Detect} (gtb\-Hndl h)}
\label{GTB_8h_a68}

\item 
\hypertarget{GTB_8h_a69}{
void {\bf gtb\-Clk\-Use} (gtb\-Hndl h, gtb\-Clk\_\-t clk)}
\label{GTB_8h_a69}

\item 
\hypertarget{GTB_8h_a70}{
void {\bf gtb\-Clk\-Force} (gtb\-Hndl h, gtb\-Clk\_\-t clk)}
\label{GTB_8h_a70}

\item 
\hypertarget{GTB_8h_a71}{
void {\bf gtb\-Arm} (gtb\-Hndl h, gtb\-Trig\_\-t trig)}
\label{GTB_8h_a71}

\item 
\hypertarget{GTB_8h_a72}{
void {\bf gtb\-Disarm} (gtb\-Hndl h, gtb\-Trig\_\-t trig)}
\label{GTB_8h_a72}

\item 
\hypertarget{GTB_8h_a73}{
gtb\-Type\_\-t {\bf gtb\-Type} (gtb\-Hndl h)}
\label{GTB_8h_a73}

\item 
\hypertarget{GTB_8h_a74}{
int {\bf gtb\-Is\-Valid\-Handle} (gtb\-Hndl h)}
\label{GTB_8h_a74}

\item 
\hypertarget{GTB_8h_a75}{
int {\bf gtb\-Is\-Full\-Fifo} (gtb\-Hndl h, int fifo\-Id)}
\label{GTB_8h_a75}

\item 
\hypertarget{GTB_8h_a76}{
int {\bf gtb\-Is\-Empty\-Fifo} (gtb\-Hndl h, int fifo\-Id)}
\label{GTB_8h_a76}

\item 
\hypertarget{GTB_8h_a77}{
int {\bf gtb\-Fifo\-Test} (gtb\-Hndl h, int fifo\-Id)}
\label{GTB_8h_a77}

\item 
\hypertarget{GTB_8h_a78}{
void {\bf gtb\-Veto\-Select} (gtb\-Hndl h)}
\label{GTB_8h_a78}

\item 
\hypertarget{GTB_8h_a79}{
void {\bf gtb\-Cno\-Select} (gtb\-Hndl h)}
\label{GTB_8h_a79}

\end{CompactItemize}


\subsection{Detailed Description}
Defines the input/output methods for the Gem Test Board driver The Gem Test Board is a modified COMM board, so this. 

\begin{Desc}
\item[Author:]Mark Mc\-Dougald -- \href{mailto:mark@slac.stanford.edu}{\tt mark@slac.stanford.edu}\end{Desc}


\subsection{Function Documentation}
\hypertarget{GTB_8h_a20}{
\index{GTB.h@{GTB.h}!gtbOpen@{gtbOpen}}
\index{gtbOpen@{gtbOpen}!GTB.h@{GTB.h}}
\subsubsection[gtbOpen]{\setlength{\rightskip}{0pt plus 5cm}gtb\-Hndl gtb\-Open (unsigned int {\em phys\-Addr})}}
\label{GTB_8h_a20}


maps the physical address to an instance of the driver object 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em phys\-Addr}]the physical address of the comm IO board \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK for success \end{Desc}
\begin{Desc}
\item[See also:]g\-Close()\end{Desc}
Attempts to map {\em phys\-Addr\/} into a local (logical) address. If successful it binds the physical and logical address to the driver object refered to by handle. If unsuccessful it clears both the physical and local address for handle and returns ERROR. \hypertarget{GTB_8h_a63}{
\index{GTB.h@{GTB.h}!gtbReady@{gtbReady}}
\index{gtbReady@{gtbReady}!GTB.h@{GTB.h}}
\subsubsection[gtbReady]{\setlength{\rightskip}{0pt plus 5cm}int gtb\-Ready (gtb\-Hndl {\em h}, int {\em time\-Out})}}
\label{GTB_8h_a63}


Waits for the COMM board to become ready, via polling. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em h}]gtb driver handle previously allocated \item[{\em time\-Out}]timeout value in sysclk ticks \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]GTB\_\-OK on success or GTB\_\-ERR\_\-READY\_\-TIMEOUT on timeout. \end{Desc}
