\hypertarget{gCRU_8c}{
\section{g\-CRU.c File Reference}
\label{gCRU_8c}\index{gCRU.c@{gCRU.c}}
}
Implements command/response for the CRU.  


{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}GDAB/g\-CRU.h\char`\"{}}\par
{\tt \#include \char`\"{}GDAB/g\-DAB.h\char`\"{}}\par
{\tt \#include \char`\"{}g\-CRU\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}g\-DAB\_\-p.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{gCRU_8c_a0}{g\-CRUcmd} (\hyperlink{struct__gdab}{gdab\-Handle} gdab, unsigned short opcode)
\begin{CompactList}\small\item\em Sends a dataless command to the CRU address. \item\end{CompactList}\item 
int \hyperlink{gCRU_8c_a1}{g\-CRUload} (\hyperlink{struct__gdab}{gdab\-Handle} gdab, unsigned short reg, unsigned int value)
\begin{CompactList}\small\item\em Loads a register with value. \item\end{CompactList}\item 
int \hyperlink{gCRU_8c_a2}{g\-CRUread} (\hyperlink{struct__gdab}{gdab\-Handle} gdab, 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 CRU. 

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


\subsection{Function Documentation}
\hypertarget{gCRU_8c_a0}{
\index{gCRU.c@{g\-CRU.c}!gCRUcmd@{gCRUcmd}}
\index{gCRUcmd@{gCRUcmd}!gCRU.c@{g\-CRU.c}}
\subsubsection[gCRUcmd]{\setlength{\rightskip}{0pt plus 5cm}int g\-CRUcmd (\hyperlink{struct__gdab}{gdab\-Handle} {\em gdab}, unsigned short {\em opcode})}}
\label{gCRU_8c_a0}


Sends a dataless command to the CRU address. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gdab}]gdab\-Handle for CRU \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 CRU \hypertarget{gCRU_8c_a1}{
\index{gCRU.c@{g\-CRU.c}!gCRUload@{gCRUload}}
\index{gCRUload@{gCRUload}!gCRU.c@{g\-CRU.c}}
\subsubsection[gCRUload]{\setlength{\rightskip}{0pt plus 5cm}int g\-CRUload (\hyperlink{struct__gdab}{gdab\-Handle} {\em gdab}, unsigned short {\em reg}, unsigned int {\em value})}}
\label{gCRU_8c_a1}


Loads a register with value. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gdab}]gdab\-Handle for CRU \item[{\em reg}]register of CRU to load \item[{\em value}]32-bit value to load into CRU register \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on success\end{Desc}
Loads the CRU register specified by {\em reg\/} with {\em value\/} \hypertarget{gCRU_8c_a2}{
\index{gCRU.c@{g\-CRU.c}!gCRUread@{gCRUread}}
\index{gCRUread@{gCRUread}!gCRU.c@{g\-CRU.c}}
\subsubsection[gCRUread]{\setlength{\rightskip}{0pt plus 5cm}int g\-CRUread (\hyperlink{struct__gdab}{gdab\-Handle} {\em gdab}, unsigned short {\em reg}, unsigned int $\ast$ {\em val})}}
\label{gCRU_8c_a2}


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

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gdab}]gdab\-Handle for CRU \item[{\em reg}]register of CRU 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 CRU 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}
