\hypertarget{CCU_8c}{
\section{CCU.c File Reference}
\label{CCU_8c}\index{CCU.c@{CCU.c}}
}
{\tt \#include \char`\"{}vx\-Works.h\char`\"{}}\par
{\tt \#include \char`\"{}stdlib.h\char`\"{}}\par
{\tt \#include \char`\"{}string.h\char`\"{}}\par
{\tt \#include \char`\"{}stdio.h\char`\"{}}\par
{\tt \#include \char`\"{}CCU/CCU.h\char`\"{}}\par
{\tt \#include \char`\"{}BTRM/CAL\_\-trm.h\char`\"{}}\par
{\tt \#include \char`\"{}DTT/DTT.h\char`\"{}}\par
{\tt \#include \char`\"{}BCI/BCI\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}BFU/BFM.h\char`\"{}}\par
{\tt \#include \char`\"{}BTU/TEM\_\-ids.h\char`\"{}}\par
{\tt \#include \char`\"{}BGW/BGW\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}BBC/IVTE\_\-id.h\char`\"{}}\par
{\tt \#include \char`\"{}CCU\_\-parse\_\-private.h\char`\"{}}\par
{\tt \#include \char`\"{}CCU\_\-lock\_\-private.h\char`\"{}}\par
{\tt \#include \char`\"{}CCU\_\-config\_\-private.h\char`\"{}}\par
{\tt \#include \char`\"{}CCU\_\-rates\_\-private.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned \hyperlink{CCU_8c_a3}{CCU\_\-parse} (void $\ast$usr, BCI\_\-CMD\_\-TYPE type, BCI\_\-SUBSYSTEM sys, unsigned len, unsigned $\ast$cmd)
\begin{CompactList}\small\item\em BCI dispatch callback for calorimeter 2 and 4 byte commands.\item\end{CompactList}\item 
unsigned \hyperlink{CCU_8c_a4}{CCU\_\-config} (void $\ast$usr, char $\ast$buf, int $\ast$len)
\begin{CompactList}\small\item\em BCW callback to record calorimeter configuration.\item\end{CompactList}\item 
int \hyperlink{CCU_8c_a5}{CCU\_\-init} (char $\ast$macro\-Path)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
volatile CAL\_\-trm $\ast$ \hyperlink{CCU_8c_a0}{CCU\_\-trm}
\item 
unsigned \hyperlink{CCU_8c_a1}{CCU\_\-rate\-Addr}
\item 
\hyperlink{structCCU__CONFIG}{CCU\_\-CONFIG} \hyperlink{CCU_8c_a2}{CCU\_\-cache}
\end{CompactItemize}


\subsection{Detailed Description}




\subsection{Function Documentation}
\hypertarget{CCU_8c_a4}{
\index{CCU.c@{CCU.c}!CCU_config@{CCU\_\-config}}
\index{CCU_config@{CCU\_\-config}!CCU.c@{CCU.c}}
\subsubsection[CCU\_\-config]{\setlength{\rightskip}{0pt plus 5cm}unsigned CCU\_\-config (void $\ast$ {\em usr}, char $\ast$ {\em buf}, int $\ast$ {\em len})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{CCU_8c_a4}


BCW callback to record calorimeter configuration.

This function is registered as the calorimeter configuration writer with the BCW service. It is called twice by the BCW code for each config dump. The first call sets {\em buf} to NULL and expects {\em len} to be filled in. The second call is the actual config dump to the area {\em buf}.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
usr}]A pointer to the DAC settings cache. \item[{\em 
buf}]A pointer to config dump buffer, or NULL if this is the size probe call. \item[{\em 
len}]A pointer to a buffer to hold the size for a size probe call; the buffer contains the expected config dump size for the actual write call.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
0 \end{Desc}
\hypertarget{CCU_8c_a5}{
\index{CCU.c@{CCU.c}!CCU_init@{CCU\_\-init}}
\index{CCU_init@{CCU\_\-init}!CCU.c@{CCU.c}}
\subsubsection[CCU\_\-init]{\setlength{\rightskip}{0pt plus 5cm}int CCU\_\-init (char $\ast$ {\em macro\-Path})}}
\label{CCU_8c_a5}


Setup all of the components of the calorimeter command and configuration library. The 16-bit and 32-bit parsers are registered with the BCI service. The calorimeter configuration dump record is registered with the BGW service.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
macro\-Path}]The directory path to the calorimeter command macro files.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
0}]Success. \item[{\em 
-1}]Failure. \end{description}
\end{Desc}
\hypertarget{CCU_8c_a3}{
\index{CCU.c@{CCU.c}!CCU_parse@{CCU\_\-parse}}
\index{CCU_parse@{CCU\_\-parse}!CCU.c@{CCU.c}}
\subsubsection[CCU\_\-parse]{\setlength{\rightskip}{0pt plus 5cm}unsigned CCU\_\-parse (void $\ast$ {\em usr}, BCI\_\-CMD\_\-TYPE {\em type}, BCI\_\-SUBSYSTEM {\em sys}, unsigned {\em len}, unsigned $\ast$ {\em cmd})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{CCU_8c_a3}


BCI dispatch callback for calorimeter 2 and 4 byte commands.

This function is the master command parser for all calorimeter BFEM commands. Depeding on the value of the {\em type} parameter, either the calorimeter 16-bit command parser (\hyperlink{CCU__parse16_8c_a1}{CCU\_\-parse16Cmd}()) or the 32-bit command parser (\hyperlink{CCU__parse32_8c_a12}{CCU\_\-parse32Cmd}()) is called.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
usr}]User-specific parameter. \item[{\em 
type}]The type of BFEM command to parse. \item[{\em 
sys}]The BFEM subsystem this command targets (should be BCI\_\-SS\_\-CAL). \item[{\em 
len}]The size of the BFEM command to parse. \item[{\em 
cmd}]A pointer to the command word.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The response word from either the calorimeter 16-bit parser or the 32-bit parser, or -1 if the {\em type} or {\em sys} parameters contain unknown values. \end{Desc}


\subsection{Variable Documentation}
\hypertarget{CCU_8c_a2}{
\index{CCU.c@{CCU.c}!CCU_cache@{CCU\_\-cache}}
\index{CCU_cache@{CCU\_\-cache}!CCU.c@{CCU.c}}
\subsubsection[CCU\_\-cache]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structCCU__CONFIG}{CCU\_\-CONFIG} CCU\_\-cache}}
\label{CCU_8c_a2}


The CCU\_\-cache? (apw added documentation to make doxygen work) \hypertarget{CCU_8c_a1}{
\index{CCU.c@{CCU.c}!CCU_rateAddr@{CCU\_\-rateAddr}}
\index{CCU_rateAddr@{CCU\_\-rateAddr}!CCU.c@{CCU.c}}
\subsubsection[CCU\_\-rateAddr]{\setlength{\rightskip}{0pt plus 5cm}unsigned CCU\_\-rate\-Addr}}
\label{CCU_8c_a1}


The current calorimter side address for reading the rate couters. \hypertarget{CCU_8c_a0}{
\index{CCU.c@{CCU.c}!CCU_trm@{CCU\_\-trm}}
\index{CCU_trm@{CCU\_\-trm}!CCU.c@{CCU.c}}
\subsubsection[CCU\_\-trm]{\setlength{\rightskip}{0pt plus 5cm}volatile CAL\_\-trm$\ast$ CCU\_\-trm}}
\label{CCU_8c_a0}


A pointer to the calorimeter TEM registers. 