\hypertarget{control_8c}{
\section{control.c File Reference}
\label{control_8c}\index{control.c@{control.c}}
}
Interface to the calibration event system. 

{\tt \#include \char`\"{}LSEC\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC\_\-ctx.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-pkt.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/MBA.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-pubdefs.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__LSEC__control}{\_\-LSEC\_\-control}
\begin{CompactList}\small\item\em Overall control structure. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{control_8c_c289e5372d1b1366a28fdd2e39de764a}{LSEC\_\-clearEvent} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec)
\begin{CompactList}\small\item\em Clear the event processor for the next data collection. \item\end{CompactList}\item 
unsigned \hyperlink{control_8c_c489ec2a0c38e5c18cf5728dd2c18a5e}{LSEC\_\-consign} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec)
\begin{CompactList}\small\item\em Complete the consignment of the event data. \item\end{CompactList}\item 
\hyperlink{structLSEC__ctx}{LSEC\_\-ctx} $\ast$ \hyperlink{control_8c_37436bbb8c799c3cf1b33f89a6bf8215}{LSEC\_\-getCtx} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec)
\begin{CompactList}\small\item\em Get the address of the context structure. \item\end{CompactList}\item 
void \hyperlink{control_8c_114678b09a97e72b3413fcb969e9ecf8}{LSEC\_\-getTimes} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec, long long $\ast$times)
\begin{CompactList}\small\item\em Get the contents of the processing times array. \item\end{CompactList}\item 
\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$ \hyperlink{control_8c_05549bbdd8f7432ff3a61f84c5b8ca5b}{LSEC\_\-initialize} (unsigned cpuid, unsigned srcid, unsigned cap)
\begin{CompactList}\small\item\em Initialize the calibration event system. \item\end{CompactList}\item 
void \hyperlink{control_8c_2531d5ec433a17c46ded050b4b609cca}{LSEC\_\-initRun} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec, unsigned runid, unsigned mode, \hyperlink{LSEC_8h_7d36ae53d4120093fc435cf36a0a698a}{LSEC\_\-compLevel} comp)
\begin{CompactList}\small\item\em Initialize a new calibration run. \item\end{CompactList}\item 
\hyperlink{LSEC_8h_906cd92f93c84589cece757e81326b3f}{LSEC\_\-evtStatus} \hyperlink{control_8c_9235db9695444250e8c356dce80522bc}{LSEC\_\-processEvent} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec, unsigned int edw, EBF\_\-pkt $\ast$pkt)
\begin{CompactList}\small\item\em Process an event. \item\end{CompactList}\item 
void \hyperlink{control_8c_1d75195906ca74dd325eb1e2586afb16}{LSEC\_\-setReason} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec, int reason)
\begin{CompactList}\small\item\em Set the current datagram close reason. \item\end{CompactList}\item 
void \hyperlink{control_8c_9fdf4d19548cfb43b696173a84580de1}{LSEC\_\-terminate} (\hyperlink{struct__LSEC__control}{LSEC\_\-control} $\ast$lsec)
\begin{CompactList}\small\item\em Free the resources used by the calibration event system. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Interface to the calibration event system. 

\begin{Desc}
\item[Author:]Owen Saxton\end{Desc}
{\bf \$Id:} \hyperlink{control_8c}{control.c},v 1.2 2010/05/21 21:36:53 saxton Exp \$ 

\subsection{Function Documentation}
\hypertarget{control_8c_c289e5372d1b1366a28fdd2e39de764a}{
\index{control.c@{control.c}!LSEC_clearEvent@{LSEC\_\-clearEvent}}
\index{LSEC_clearEvent@{LSEC\_\-clearEvent}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-clearEvent ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{control_8c_c289e5372d1b1366a28fdd2e39de764a}


Clear the event processor for the next data collection. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize. \end{description}
\end{Desc}
\hypertarget{control_8c_c489ec2a0c38e5c18cf5728dd2c18a5e}{
\index{control.c@{control.c}!LSEC_consign@{LSEC\_\-consign}}
\index{LSEC_consign@{LSEC\_\-consign}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned LSEC\_\-consign ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{control_8c_c489ec2a0c38e5c18cf5728dd2c18a5e}


Complete the consignment of the event data. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LSEC\_\-SUCCESS}]If all goes well \end{description}
\end{Desc}
\hypertarget{control_8c_37436bbb8c799c3cf1b33f89a6bf8215}{
\index{control.c@{control.c}!LSEC_getCtx@{LSEC\_\-getCtx}}
\index{LSEC_getCtx@{LSEC\_\-getCtx}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-ctx}$\ast$ LSEC\_\-getCtx ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{control_8c_37436bbb8c799c3cf1b33f89a6bf8215}


Get the address of the context structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The address of the context structure \end{Desc}
\hypertarget{control_8c_114678b09a97e72b3413fcb969e9ecf8}{
\index{control.c@{control.c}!LSEC_getTimes@{LSEC\_\-getTimes}}
\index{LSEC_getTimes@{LSEC\_\-getTimes}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-getTimes ({\bf LSEC\_\-control} $\ast$ {\em lsec}, long long $\ast$ {\em times})}}
\label{control_8c_114678b09a97e72b3413fcb969e9ecf8}


Get the contents of the processing times array. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize.\item[{\em times}]Address of an array to receive the processing times. It must contain at least LSEC\_\-N\_\-TIMES entries. \end{description}
\end{Desc}
\hypertarget{control_8c_05549bbdd8f7432ff3a61f84c5b8ca5b}{
\index{control.c@{control.c}!LSEC_initialize@{LSEC\_\-initialize}}
\index{LSEC_initialize@{LSEC\_\-initialize}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-control}$\ast$ LSEC\_\-initialize (unsigned {\em cpuid}, unsigned {\em srcid}, unsigned {\em cap})}}
\label{control_8c_05549bbdd8f7432ff3a61f84c5b8ca5b}


Initialize the calibration event system. 

This routine creates the components of the calibration event system.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em srcid}]ID of the data source\item[{\em cpuid}]ID of the CPU the calibration is being run on\item[{\em cap}]The capacity (in events) of the system\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Handle for further access to the system, or NULL if initialization failed. \end{Desc}
\hypertarget{control_8c_2531d5ec433a17c46ded050b4b609cca}{
\index{control.c@{control.c}!LSEC_initRun@{LSEC\_\-initRun}}
\index{LSEC_initRun@{LSEC\_\-initRun}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-initRun ({\bf LSEC\_\-control} $\ast$ {\em lsec}, unsigned {\em runid}, unsigned {\em mode}, {\bf LSEC\_\-compLevel} {\em comp})}}
\label{control_8c_2531d5ec433a17c46ded050b4b609cca}


Initialize a new calibration run. 

This routine sets the runid and start time for the first datagram of a new calibration.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize.\item[{\em runid}]32-bit number identifying the calibration run\item[{\em mode}]The calibration mode (ACD, CAL or TKR)\item[{\em comp}]The compression level (normal, only, none) \end{description}
\end{Desc}
\hypertarget{control_8c_9235db9695444250e8c356dce80522bc}{
\index{control.c@{control.c}!LSEC_processEvent@{LSEC\_\-processEvent}}
\index{LSEC_processEvent@{LSEC\_\-processEvent}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-evtStatus} LSEC\_\-processEvent ({\bf LSEC\_\-control} $\ast$ {\em lsec}, unsigned int {\em edw}, EBF\_\-pkt $\ast$ {\em pkt})}}
\label{control_8c_9235db9695444250e8c356dce80522bc}


Process an event. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize.\item[{\em edw}]The event descriptor word.\item[{\em pkt}]The event packet.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The OR of zero or more of the bits:\begin{itemize}
\item \hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd6e3d0bcd67d4cedff34e5118f663a95e}{LSEC\_\-EVT\_\-FREE} Free the packet\item \hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bdc89e347fdb8dde9f617fc63aca9e0b70}{LSEC\_\-EVT\_\-DONE} Event is complete \end{itemize}
\end{Desc}
\hypertarget{control_8c_1d75195906ca74dd325eb1e2586afb16}{
\index{control.c@{control.c}!LSEC_setReason@{LSEC\_\-setReason}}
\index{LSEC_setReason@{LSEC\_\-setReason}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-setReason ({\bf LSEC\_\-control} $\ast$ {\em lsec}, int {\em reason})}}
\label{control_8c_1d75195906ca74dd325eb1e2586afb16}


Set the current datagram close reason. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize.\item[{\em reason}]The reason code to be set \end{description}
\end{Desc}
\hypertarget{control_8c_9fdf4d19548cfb43b696173a84580de1}{
\index{control.c@{control.c}!LSEC_terminate@{LSEC\_\-terminate}}
\index{LSEC_terminate@{LSEC\_\-terminate}!control.c@{control.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-terminate ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{control_8c_9fdf4d19548cfb43b696173a84580de1}


Free the resources used by the calibration event system. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsec}]Control handle, returned by LSEC\_\-initialize. \end{description}
\end{Desc}
