\hypertarget{gGTCC_8c}{
\section{g\-GTCC.c File Reference}
\label{gGTCC_8c}\index{gGTCC.c@{gGTCC.c}}
}
Implements command/response for the GTCC.  


{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}gt\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}g\-TKR\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}GTEM/g\-GTCC.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{gGTCC_8c_a0}{set\-Cmd\-Header\-TKR} (\hyperlink{struct__gtem}{gtem\-Handle} gt, \hyperlink{union__cmdHeaderTKR}{cmd\-Header\-TKR} $\ast$ch, unsigned short ext, unsigned short gtcc\-Addr)
\begin{CompactList}\small\item\em initializes a command header structure for a GTCC \item\end{CompactList}\item 
int \hyperlink{gGTCC_8c_a1}{\_\-\_\-gtcc\-Cmd\-Load} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gtcc\-Addr, unsigned short func, unsigned short reg, unsigned int value)
\begin{CompactList}\small\item\em Generic routine for sending response-less commands. \item\end{CompactList}\item 
int \hyperlink{gGTCC_8c_a2}{g\-GTCCcmd} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gtcc\-Addr, unsigned short opcode)
\begin{CompactList}\small\item\em Sends a dataless command to the TEM address. \item\end{CompactList}\item 
int \hyperlink{gGTCC_8c_a3}{g\-GTCCload} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gtcc\-Addr, unsigned short reg, unsigned int value)
\begin{CompactList}\small\item\em Loads a register with value. \item\end{CompactList}\item 
int \hyperlink{gGTCC_8c_a4}{g\-GTCCread} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gtcc\-Addr, unsigned short reg, unsigned int $\ast$val)
\begin{CompactList}\small\item\em Reads a register returing value in {\em val\/}. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Implements command/response for the GTCC. 

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


\subsection{Function Documentation}
\hypertarget{gGTCC_8c_a1}{
\index{gGTCC.c@{g\-GTCC.c}!__gtccCmdLoad@{\_\-\_\-gtccCmdLoad}}
\index{__gtccCmdLoad@{\_\-\_\-gtccCmdLoad}!gGTCC.c@{g\-GTCC.c}}
\subsubsection[\_\-\_\-gtccCmdLoad]{\setlength{\rightskip}{0pt plus 5cm}static int \_\-\_\-gtcc\-Cmd\-Load (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gtcc\-Addr}, unsigned short {\em func}, unsigned short {\em reg}, unsigned int {\em value})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{gGTCC_8c_a1}


Generic routine for sending response-less commands. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gt}]gtem\-Handle for TEM \item[{\em tem\-Addr}]TEM address of command \item[{\em gtcc\-Addr}]GTCC address of command \item[{\em func}]command/response function code \item[{\em reg}]register of GTCC to load \item[{\em value}]32-bit value to load into GTCC register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Common subroutine for sending dataless commands and loading GTCC registers. The {\em func\/} parameter indicates a \char`\"{}dataless\char`\"{} or \char`\"{}load\char`\"{} command.

For dataless commands {\em reg\/} is interpreted as the \char`\"{}opcode\char`\"{} of the dataless command and {\em value\/} is ignored.

For load commands {\em reg\/} is the GTCC register to load with {\em value\/}. \hypertarget{gGTCC_8c_a2}{
\index{gGTCC.c@{g\-GTCC.c}!gGTCCcmd@{gGTCCcmd}}
\index{gGTCCcmd@{gGTCCcmd}!gGTCC.c@{g\-GTCC.c}}
\subsubsection[gGTCCcmd]{\setlength{\rightskip}{0pt plus 5cm}int g\-GTCCcmd (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gtcc\-Addr}, unsigned short {\em opcode})}}
\label{gGTCC_8c_a2}


Sends a dataless command to the TEM address. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gt}]gtem\-Handle for TEM \item[{\em tem\-Addr}]TEM address of command \item[{\em gtcc\-Addr}]GTCC address \item[{\em opcode}]opcode of command to send \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Sends the dataless command specified by {\em opcode\/} to the TEM address specified by {\em tem\-Addr\/}. \hypertarget{gGTCC_8c_a3}{
\index{gGTCC.c@{g\-GTCC.c}!gGTCCload@{gGTCCload}}
\index{gGTCCload@{gGTCCload}!gGTCC.c@{g\-GTCC.c}}
\subsubsection[gGTCCload]{\setlength{\rightskip}{0pt plus 5cm}int g\-GTCCload (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gtcc\-Addr}, unsigned short {\em reg}, unsigned int {\em value})}}
\label{gGTCC_8c_a3}


Loads a register with value. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gt}]gtem\-Handle for TEM \item[{\em tem\-Addr}]TEM address of command \item[{\em gtcc\-Addr}]GTCC address \item[{\em reg}]register of GTCC to load \item[{\em value}]32-bit value to load into GTCC register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Loads the GTCC register specified by {\em reg\/} with {\em value\/} \hypertarget{gGTCC_8c_a4}{
\index{gGTCC.c@{g\-GTCC.c}!gGTCCread@{gGTCCread}}
\index{gGTCCread@{gGTCCread}!gGTCC.c@{g\-GTCC.c}}
\subsubsection[gGTCCread]{\setlength{\rightskip}{0pt plus 5cm}int g\-GTCCread (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gtcc\-Addr}, unsigned short {\em reg}, unsigned int $\ast$ {\em val})}}
\label{gGTCC_8c_a4}


Reads a register returing value in {\em val\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gt}]gtem\-Handle for TEM \item[{\em tem\-Addr}]TEM address of command \item[{\em gtcc\-Addr}]GTCC address \item[{\em reg}]register of GTCC to read \item[{\em val}]pointer to storage to hold the response of the read command \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Reads the GTCC register specified by {\em reg\/}. {\em val\/} is filled on return.

The following error codes are returned when LATp errors occur:

\begin{itemize}
\item GERR\_\-LATP\_\-HEADER\_\-PARITY \item GERR\_\-LATP\_\-CELL\_\-PARITY \item GERR\_\-LATP\_\-TRUNCATE \end{itemize}
\hypertarget{gGTCC_8c_a0}{
\index{gGTCC.c@{g\-GTCC.c}!setCmdHeaderTKR@{setCmdHeaderTKR}}
\index{setCmdHeaderTKR@{setCmdHeaderTKR}!gGTCC.c@{g\-GTCC.c}}
\subsubsection[setCmdHeaderTKR]{\setlength{\rightskip}{0pt plus 5cm}void set\-Cmd\-Header\-TKR (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, \hyperlink{union__cmdHeaderTKR}{cmd\-Header\-TKR} $\ast$ {\em ch}, unsigned short {\em ext}, unsigned short {\em gtcc\-Addr})}}
\label{gGTCC_8c_a0}


initializes a command header structure for a GTCC 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gt}]gtem\-Handle for TEM \item[{\em ch}]pointer to command header structure \item[{\em ext}]set for \char`\"{}off board\char`\"{} commands, i.e. GTRC and GTFE commands \item[{\em gtcc\-Addr}]GTCC address \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on void \end{Desc}
