\hypertarget{LSEC_8h}{
\section{LSEC.h File Reference}
\label{LSEC_8h}\index{LSEC.h@{LSEC.h}}
}
Public definitions for the calibration event system.  


{\tt \#include $<$LSEC/LSEC\_\-ctx.h$>$}\par
{\tt \#include $<$EDS/EBF\_\-pkt.h$>$}\par
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{LSEC_8h_7d36ae53d4120093fc435cf36a0a698a}{
typedef enum \hyperlink{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c}{\_\-LSEC\_\-compLevel} \hyperlink{LSEC_8h_7d36ae53d4120093fc435cf36a0a698a}{LSEC\_\-compLevel}}
\label{LSEC_8h_7d36ae53d4120093fc435cf36a0a698a}

\begin{CompactList}\small\item\em Compression level values. \item\end{CompactList}\item 
\hypertarget{LSEC_8h_906cd92f93c84589cece757e81326b3f}{
typedef enum \hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd}{\_\-LSEC\_\-evtStatus} \hyperlink{LSEC_8h_906cd92f93c84589cece757e81326b3f}{LSEC\_\-evtStatus}}
\label{LSEC_8h_906cd92f93c84589cece757e81326b3f}

\begin{CompactList}\small\item\em Event processing status values. \item\end{CompactList}\item 
\hypertarget{LSEC_8h_45de16732b4a3661b54ae59203680e25}{
typedef struct \hyperlink{struct__LSEC__control}{\_\-LSEC\_\-control} \hyperlink{LSEC_8h_45de16732b4a3661b54ae59203680e25}{LSEC\_\-control}}
\label{LSEC_8h_45de16732b4a3661b54ae59203680e25}

\begin{CompactList}\small\item\em Declaration of the opaque control structure. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c}{\_\-LSEC\_\-compLevel} \{ \par
\hyperlink{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c49a1d4df4cfe2d7604459af885496f3f}{LSEC\_\-COMP\_\-NORM} =  0, 
\par
\hyperlink{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c1ae289af2c148231cfe05eb61578a8af}{LSEC\_\-COMP\_\-ONLY} =  1, 
\par
\hyperlink{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c3873f38356b14f1e3fdfe7f03cefeb75}{LSEC\_\-COMP\_\-NONE} =  2, 
\par
\hyperlink{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c022824651aa163b6c9c755d58b3e7ade}{LSEC\_\-COMP\_\-DROP} =  3
 \}
\begin{CompactList}\small\item\em Compression level values. \item\end{CompactList}\item 
enum \hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd}{\_\-LSEC\_\-evtStatus} \{ \par
\hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd6e3d0bcd67d4cedff34e5118f663a95e}{LSEC\_\-EVT\_\-FREE} =  0x01, 
\par
\hyperlink{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bdc89e347fdb8dde9f617fc63aca9e0b70}{LSEC\_\-EVT\_\-DONE} =  0x02
 \}
\begin{CompactList}\small\item\em Event processing status values. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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{LSEC_8h_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}
Public definitions for the calibration event system. 

\begin{Desc}
\item[Author:]Owen Saxton\end{Desc}
{\bf \$Id:} \hyperlink{LSEC_8h}{LSEC.h},v 1.5 2011/03/27 17:33:21 saxton Exp \$ 

\subsection{Enumeration Type Documentation}
\hypertarget{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c}{
\index{LSEC.h@{LSEC.h}!\_\-LSEC\_\-compLevel@{\_\-LSEC\_\-compLevel}}
\index{\_\-LSEC\_\-compLevel@{\_\-LSEC\_\-compLevel}!LSEC.h@{LSEC.h}}
\subsubsection[{\_\-LSEC\_\-compLevel}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \_\-LSEC\_\-compLevel}}}
\label{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c}


Compression level values. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{LSEC\_\-COMP\_\-NORM@{LSEC\_\-COMP\_\-NORM}!LSEC.h@{LSEC.h}}\index{LSEC.h@{LSEC.h}!LSEC\_\-COMP\_\-NORM@{LSEC\_\-COMP\_\-NORM}}\item[{\em 
\hypertarget{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c49a1d4df4cfe2d7604459af885496f3f}{
LSEC\_\-COMP\_\-NORM}
\label{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c49a1d4df4cfe2d7604459af885496f3f}
}]Normal compression. \index{LSEC\_\-COMP\_\-ONLY@{LSEC\_\-COMP\_\-ONLY}!LSEC.h@{LSEC.h}}\index{LSEC.h@{LSEC.h}!LSEC\_\-COMP\_\-ONLY@{LSEC\_\-COMP\_\-ONLY}}\item[{\em 
\hypertarget{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c1ae289af2c148231cfe05eb61578a8af}{
LSEC\_\-COMP\_\-ONLY}
\label{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c1ae289af2c148231cfe05eb61578a8af}
}]No compression and send only data for type. \index{LSEC\_\-COMP\_\-NONE@{LSEC\_\-COMP\_\-NONE}!LSEC.h@{LSEC.h}}\index{LSEC.h@{LSEC.h}!LSEC\_\-COMP\_\-NONE@{LSEC\_\-COMP\_\-NONE}}\item[{\em 
\hypertarget{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c3873f38356b14f1e3fdfe7f03cefeb75}{
LSEC\_\-COMP\_\-NONE}
\label{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c3873f38356b14f1e3fdfe7f03cefeb75}
}]No compression and send all data. \index{LSEC\_\-COMP\_\-DROP@{LSEC\_\-COMP\_\-DROP}!LSEC.h@{LSEC.h}}\index{LSEC.h@{LSEC.h}!LSEC\_\-COMP\_\-DROP@{LSEC\_\-COMP\_\-DROP}}\item[{\em 
\hypertarget{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c022824651aa163b6c9c755d58b3e7ade}{
LSEC\_\-COMP\_\-DROP}
\label{LSEC_8h_6b61e77ea8e0ee17888619077d1ed94c022824651aa163b6c9c755d58b3e7ade}
}]Drop all the data on the floor. \end{description}
\end{Desc}

\hypertarget{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd}{
\index{LSEC.h@{LSEC.h}!\_\-LSEC\_\-evtStatus@{\_\-LSEC\_\-evtStatus}}
\index{\_\-LSEC\_\-evtStatus@{\_\-LSEC\_\-evtStatus}!LSEC.h@{LSEC.h}}
\subsubsection[{\_\-LSEC\_\-evtStatus}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf \_\-LSEC\_\-evtStatus}}}
\label{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd}


Event processing status values. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{LSEC\_\-EVT\_\-FREE@{LSEC\_\-EVT\_\-FREE}!LSEC.h@{LSEC.h}}\index{LSEC.h@{LSEC.h}!LSEC\_\-EVT\_\-FREE@{LSEC\_\-EVT\_\-FREE}}\item[{\em 
\hypertarget{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd6e3d0bcd67d4cedff34e5118f663a95e}{
LSEC\_\-EVT\_\-FREE}
\label{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bd6e3d0bcd67d4cedff34e5118f663a95e}
}]Free the packet. \index{LSEC\_\-EVT\_\-DONE@{LSEC\_\-EVT\_\-DONE}!LSEC.h@{LSEC.h}}\index{LSEC.h@{LSEC.h}!LSEC\_\-EVT\_\-DONE@{LSEC\_\-EVT\_\-DONE}}\item[{\em 
\hypertarget{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bdc89e347fdb8dde9f617fc63aca9e0b70}{
LSEC\_\-EVT\_\-DONE}
\label{LSEC_8h_a80313f67e97ae160a5ae3b03292b1bdc89e347fdb8dde9f617fc63aca9e0b70}
}]Event is complete. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{LSEC_8h_c289e5372d1b1366a28fdd2e39de764a}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-clearEvent@{LSEC\_\-clearEvent}}
\index{LSEC\_\-clearEvent@{LSEC\_\-clearEvent}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-clearEvent}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-clearEvent ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{LSEC_8h_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}


References \_\-LSEC\_\-control::evt, and LSEC\_\-eventClear().\hypertarget{LSEC_8h_c489ec2a0c38e5c18cf5728dd2c18a5e}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-consign@{LSEC\_\-consign}}
\index{LSEC\_\-consign@{LSEC\_\-consign}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-consign}]{\setlength{\rightskip}{0pt plus 5cm}unsigned LSEC\_\-consign ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{LSEC_8h_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}


References \_\-LSEC\_\-control::cns, and LSEC\_\-consProcess().\hypertarget{LSEC_8h_37436bbb8c799c3cf1b33f89a6bf8215}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-getCtx@{LSEC\_\-getCtx}}
\index{LSEC\_\-getCtx@{LSEC\_\-getCtx}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-getCtx}]{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-ctx}$\ast$ LSEC\_\-getCtx ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{LSEC_8h_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}


References \_\-LSEC\_\-control::cns, and LSEC\_\-consCtxGet().\hypertarget{LSEC_8h_114678b09a97e72b3413fcb969e9ecf8}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-getTimes@{LSEC\_\-getTimes}}
\index{LSEC\_\-getTimes@{LSEC\_\-getTimes}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-getTimes}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-getTimes ({\bf LSEC\_\-control} $\ast$ {\em lsec}, \/  long long $\ast$ {\em times})}}
\label{LSEC_8h_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}


References LSEC\_\-N\_\-TIMES, LSEC\_\-TIM\_\-ACM, LSEC\_\-TIM\_\-CPC, LSEC\_\-TIM\_\-ENC, LSEC\_\-TIM\_\-EVT, \_\-LSEC\_\-control::save, and \_\-LSEC\_\-control::times.\hypertarget{LSEC_8h_05549bbdd8f7432ff3a61f84c5b8ca5b}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-initialize@{LSEC\_\-initialize}}
\index{LSEC\_\-initialize@{LSEC\_\-initialize}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-initialize}]{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-control}$\ast$ LSEC\_\-initialize (unsigned {\em cpuid}, \/  unsigned {\em srcid}, \/  unsigned {\em cap})}}
\label{LSEC_8h_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}


References \_\-LSEC\_\-control::cns, \_\-LSEC\_\-control::cpc, \_\-LSEC\_\-control::evt, LSEC\_\-consCreate(), LSEC\_\-consCtxGet(), LSEC\_\-eventCreate(), LSEC\_\-newCompaction(), LSEC\_\-setContext(), LSEC\_\-terminate(), and \_\-LSEC\_\-control::times.\hypertarget{LSEC_8h_2531d5ec433a17c46ded050b4b609cca}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-initRun@{LSEC\_\-initRun}}
\index{LSEC\_\-initRun@{LSEC\_\-initRun}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-initRun}]{\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{LSEC_8h_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}


References \_\-LSEC\_\-control::cns, \_\-LSEC\_\-control::cpc, \_\-LSEC\_\-control::evt, LSEC\_\-COMP\_\-DROP, LSEC\_\-COMP\_\-NORM, LSEC\_\-consEventCal(), LSEC\_\-consEventImm(), LSEC\_\-consPrepare(), LSEC\_\-eventPrepare(), LSEC\_\-eventProcSet(), LSEC\_\-setMode(), \_\-LSEC\_\-control::save, and \_\-LSEC\_\-control::times.\hypertarget{LSEC_8h_9235db9695444250e8c356dce80522bc}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-processEvent@{LSEC\_\-processEvent}}
\index{LSEC\_\-processEvent@{LSEC\_\-processEvent}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-processEvent}]{\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{LSEC_8h_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}


References \_\-LSEC\_\-control::evt, and LSEC\_\-eventProcess().\hypertarget{LSEC_8h_1d75195906ca74dd325eb1e2586afb16}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-setReason@{LSEC\_\-setReason}}
\index{LSEC\_\-setReason@{LSEC\_\-setReason}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-setReason}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-setReason ({\bf LSEC\_\-control} $\ast$ {\em lsec}, \/  int {\em reason})}}
\label{LSEC_8h_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}


References \_\-LSEC\_\-control::cns, and LSEC\_\-consReason().\hypertarget{LSEC_8h_9fdf4d19548cfb43b696173a84580de1}{
\index{LSEC.h@{LSEC.h}!LSEC\_\-terminate@{LSEC\_\-terminate}}
\index{LSEC\_\-terminate@{LSEC\_\-terminate}!LSEC.h@{LSEC.h}}
\subsubsection[{LSEC\_\-terminate}]{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-terminate ({\bf LSEC\_\-control} $\ast$ {\em lsec})}}
\label{LSEC_8h_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}


References \_\-LSEC\_\-control::cns, \_\-LSEC\_\-control::cpc, \_\-LSEC\_\-control::evt, LSEC\_\-consDelete(), LSEC\_\-deleteCompaction(), and LSEC\_\-eventDelete().

Referenced by LSEC\_\-initialize().