\hypertarget{gGCCC_8c}{
\section{g\-GCCC.c File Reference}
\label{gGCCC_8c}\index{gGCCC.c@{gGCCC.c}}
}
Implements command/response for the GCCC.  


{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}gt\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}g\-CAL\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}GTEM/g\-GCCC.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{gGCCC_8c_a0}{set\-Cmd\-Header\-CAL} (\hyperlink{struct__gtem}{gtem\-Handle} gt, \hyperlink{union__cmdHeaderCAL}{cmd\-Header\-CAL} $\ast$ch, unsigned short ext, unsigned short gccc\-Addr, unsigned short gcrc\-Addr)
\begin{CompactList}\small\item\em initializes a command header structure for a GCCC \item\end{CompactList}\item 
int \hyperlink{gGCCC_8c_a1}{\_\-\_\-gccc\-Cmd\-Load} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gccc\-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{gGCCC_8c_a2}{g\-GCCCcmd} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gccc\-Addr, unsigned short opcode)
\begin{CompactList}\small\item\em Sends a dataless command to the TEM address. \item\end{CompactList}\item 
int \hyperlink{gGCCC_8c_a3}{g\-GCCCload} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gccc\-Addr, unsigned short reg, unsigned int value)
\begin{CompactList}\small\item\em Loads a register with value. \item\end{CompactList}\item 
int \hyperlink{gGCCC_8c_a4}{g\-GCCCread} (\hyperlink{struct__gtem}{gtem\-Handle} gt, unsigned short tem\-Addr, unsigned short gccc\-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 GCCC. 

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


\subsection{Function Documentation}
\hypertarget{gGCCC_8c_a1}{
\index{gGCCC.c@{g\-GCCC.c}!__gcccCmdLoad@{\_\-\_\-gcccCmdLoad}}
\index{__gcccCmdLoad@{\_\-\_\-gcccCmdLoad}!gGCCC.c@{g\-GCCC.c}}
\subsubsection[\_\-\_\-gcccCmdLoad]{\setlength{\rightskip}{0pt plus 5cm}static int \_\-\_\-gccc\-Cmd\-Load (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gccc\-Addr}, unsigned short {\em func}, unsigned short {\em reg}, unsigned int {\em value})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{gGCCC_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 gccc\-Addr}]GCCC address of command \item[{\em func}]command/response function code \item[{\em reg}]register of GCCC to load \item[{\em value}]32-bit value to load into GCCC register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Common subroutine for sending dataless commands and loading GCCC 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 GCCC register to load with {\em value\/}. \hypertarget{gGCCC_8c_a2}{
\index{gGCCC.c@{g\-GCCC.c}!gGCCCcmd@{gGCCCcmd}}
\index{gGCCCcmd@{gGCCCcmd}!gGCCC.c@{g\-GCCC.c}}
\subsubsection[gGCCCcmd]{\setlength{\rightskip}{0pt plus 5cm}int g\-GCCCcmd (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gccc\-Addr}, unsigned short {\em opcode})}}
\label{gGCCC_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 gccc\-Addr}]GCCC 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{gGCCC_8c_a3}{
\index{gGCCC.c@{g\-GCCC.c}!gGCCCload@{gGCCCload}}
\index{gGCCCload@{gGCCCload}!gGCCC.c@{g\-GCCC.c}}
\subsubsection[gGCCCload]{\setlength{\rightskip}{0pt plus 5cm}int g\-GCCCload (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gccc\-Addr}, unsigned short {\em reg}, unsigned int {\em value})}}
\label{gGCCC_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 gccc\-Addr}]GCCC address \item[{\em reg}]register of GCCC to load \item[{\em value}]32-bit value to load into GCCC register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Loads the GCCC register specified by {\em reg\/} with {\em value\/} \hypertarget{gGCCC_8c_a4}{
\index{gGCCC.c@{g\-GCCC.c}!gGCCCread@{gGCCCread}}
\index{gGCCCread@{gGCCCread}!gGCCC.c@{g\-GCCC.c}}
\subsubsection[gGCCCread]{\setlength{\rightskip}{0pt plus 5cm}int g\-GCCCread (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, unsigned short {\em tem\-Addr}, unsigned short {\em gccc\-Addr}, unsigned short {\em reg}, unsigned int $\ast$ {\em val})}}
\label{gGCCC_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 gccc\-Addr}]GCCC address \item[{\em reg}]register of GCCC 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 GCCC 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{gGCCC_8c_a0}{
\index{gGCCC.c@{g\-GCCC.c}!setCmdHeaderCAL@{setCmdHeaderCAL}}
\index{setCmdHeaderCAL@{setCmdHeaderCAL}!gGCCC.c@{g\-GCCC.c}}
\subsubsection[setCmdHeaderCAL]{\setlength{\rightskip}{0pt plus 5cm}void set\-Cmd\-Header\-CAL (\hyperlink{struct__gtem}{gtem\-Handle} {\em gt}, \hyperlink{union__cmdHeaderCAL}{cmd\-Header\-CAL} $\ast$ {\em ch}, unsigned short {\em ext}, unsigned short {\em gccc\-Addr}, unsigned short {\em gcrc\-Addr})}}
\label{gGCCC_8c_a0}


initializes a command header structure for a GCCC 

\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. GCRC and GCFE commands \item[{\em gccc\-Addr}]GCCC address \item[{\em gcrc\-Addr}]GCRC address \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on void \end{Desc}
