\hypertarget{collect_8h}{
\section{collect.h File Reference}
\label{collect_8h}\index{collect.h@{collect.h}}
}
The collection routines coordinate between the LCDB task recieving the event packets and the LCI task that will handle the complete events. 

{\tt \#include \char`\"{}EDS/EBF\_\-pkt.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-dir.h\char`\"{}}\par
{\tt \#include \char`\"{}LCBD/LCBD\_\-evt.h\char`\"{}}\par


Include dependency graph for collect.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=123pt]{collect_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=201pt]{collect_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{collect_8h_a0}{
typedef \hyperlink{struct__LCI__collection}{\_\-LCI\_\-collection} \hyperlink{collect_8h_a0}{LCI\_\-collection}}
\label{collect_8h_a0}

\begin{CompactList}\small\item\em Declaration of the opaque collection structure. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{collect_8h_a1}{LCI\_\-clear\-Coll\-Counts} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Clear collection counters. \item\end{CompactList}\item 
void \hyperlink{collect_8h_a2}{LCI\_\-clear\-Collection} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Clear out anything left from a previous cycle. \item\end{CompactList}\item 
void \hyperlink{collect_8h_a3}{LCI\_\-coll\-Counts} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll, unsigned int $\ast$n\-Wait, unsigned int $\ast$n\-Signal, unsigned int $\ast$n\-Timeout)
\begin{CompactList}\small\item\em Get collection counters. \item\end{CompactList}\item 
unsigned \hyperlink{collect_8h_a4}{LCI\_\-collect} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll, unsigned nev, unsigned period)
\begin{CompactList}\small\item\em Initiate the calibration triggers and wait for the events to be collected and constructed. \item\end{CompactList}\item 
unsigned \hyperlink{collect_8h_a5}{LCI\_\-collected} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Get the number of events collected. \item\end{CompactList}\item 
void \hyperlink{collect_8h_a6}{LCI\_\-delete\-Collection} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Free a structure previously allocated using LCI\_\-new\-Collection. \item\end{CompactList}\item 
unsigned \hyperlink{collect_8h_a7}{LCI\_\-evt\_\-cb} (void $\ast$prm, unsigned int dsc, LCBD\_\-evt $\ast$pkt)
\begin{CompactList}\small\item\em LCI event handler that initiates the event collection. \item\end{CompactList}\item 
EBF\_\-dir $\ast$ \hyperlink{collect_8h_a8}{LCI\_\-get} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Return the directory of the next event (or NULL) and advance the read counter. \item\end{CompactList}\item 
\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ \hyperlink{collect_8h_a9}{LCI\_\-new\-Collection} (unsigned cap)
\begin{CompactList}\small\item\em Allocate and initialise an LCI\_\-collection structure. \item\end{CompactList}\item 
void \hyperlink{collect_8h_a10}{LCI\_\-put} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll, unsigned edw, EBF\_\-pkt $\ast$pkt)
\begin{CompactList}\small\item\em Copy the packet into the storage area, update the state information vector and compose the directory - on the last packet of the event construct the event. \item\end{CompactList}\item 
void \hyperlink{collect_8h_a11}{LCI\_\-restart} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll)
\begin{CompactList}\small\item\em Reset the read counter to 0. \item\end{CompactList}\item 
void \hyperlink{collect_8h_a12}{LCI\_\-set\-Collection\-Com} (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll, void $\ast$lcbd, void $\ast$cr)
\begin{CompactList}\small\item\em Set the communications pointers of the collection structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
The collection routines coordinate between the LCDB task recieving the event packets and the LCI task that will handle the complete events. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{collect_8h}{collect.h},v 1.7 2007/08/21 22:44:42 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{collect_8h_a1}{
\index{collect.h@{collect.h}!LCI_clearCollCounts@{LCI\_\-clearCollCounts}}
\index{LCI_clearCollCounts@{LCI\_\-clearCollCounts}!collect.h@{collect.h}}
\subsubsection[LCI\_\-clearCollCounts]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-clear\-Coll\-Counts (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8h_a1}


Clear collection counters. 

This routine calls through to the cue counter clear routine.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised collection structure that has been used to collect events\end{description}
\end{Desc}
\hypertarget{collect_8h_a2}{
\index{collect.h@{collect.h}!LCI_clearCollection@{LCI\_\-clearCollection}}
\index{LCI_clearCollection@{LCI\_\-clearCollection}!collect.h@{collect.h}}
\subsubsection[LCI\_\-clearCollection]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-clear\-Collection (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8h_a2}


Clear out anything left from a previous cycle. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised LCI\_\-collection structure\end{description}
\end{Desc}
\hypertarget{collect_8h_a3}{
\index{collect.h@{collect.h}!LCI_collCounts@{LCI\_\-collCounts}}
\index{LCI_collCounts@{LCI\_\-collCounts}!collect.h@{collect.h}}
\subsubsection[LCI\_\-collCounts]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-coll\-Counts (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll}, unsigned int $\ast$ {\em n\-Wait}, unsigned int $\ast$ {\em n\-Signal}, unsigned int $\ast$ {\em n\-Timeout})}}
\label{collect_8h_a3}


Get collection counters. 

This routine calls through to the cue counters get routine, returning the counts accumulated since the last clear.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised collection structure that has been used to collect events\item[{\em n\-Wait}]Address of an integer to receive the number of wait calls, or NULL if not needed.\item[{\em n\-Signal}]Address of an integer to receive the number of signal calls, or NULL if not needed.\item[{\em n\-Timeout}]Address of an integer to receive the number of timeouts, or NULL if not needed.\end{description}
\end{Desc}
\hypertarget{collect_8h_a4}{
\index{collect.h@{collect.h}!LCI_collect@{LCI\_\-collect}}
\index{LCI_collect@{LCI\_\-collect}!collect.h@{collect.h}}
\subsubsection[LCI\_\-collect]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-collect (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll}, unsigned {\em nev}, unsigned {\em period})}}
\label{collect_8h_a4}


Initiate the calibration triggers and wait for the events to be collected and constructed. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an intialised event collection structure\item[{\em nev}]Number of events to be collected\item[{\em period}]The period (in 50 ns ticks) between triggers\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]If all the expected events were successfully collected \item[{\em LCI\_\-LOSTEVT}]If some of the events were not collected\end{description}
\end{Desc}
\hypertarget{collect_8h_a5}{
\index{collect.h@{collect.h}!LCI_collected@{LCI\_\-collected}}
\index{LCI_collected@{LCI\_\-collected}!collect.h@{collect.h}}
\subsubsection[LCI\_\-collected]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-collected (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8h_a5}


Get the number of events collected. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised collection structure that has been used to collect events\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Number of events collected\end{Desc}
\hypertarget{collect_8h_a6}{
\index{collect.h@{collect.h}!LCI_deleteCollection@{LCI\_\-deleteCollection}}
\index{LCI_deleteCollection@{LCI\_\-deleteCollection}!collect.h@{collect.h}}
\subsubsection[LCI\_\-deleteCollection]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-delete\-Collection (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8h_a6}


Free a structure previously allocated using LCI\_\-new\-Collection. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised LCI\_\-collection structure\end{description}
\end{Desc}
\hypertarget{collect_8h_a7}{
\index{collect.h@{collect.h}!LCI_evt_cb@{LCI\_\-evt\_\-cb}}
\index{LCI_evt_cb@{LCI\_\-evt\_\-cb}!collect.h@{collect.h}}
\subsubsection[LCI\_\-evt\_\-cb]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-evt\_\-cb (void $\ast$ {\em prm}, unsigned int {\em dsc}, LCBD\_\-evt $\ast$ {\em pkt})}}
\label{collect_8h_a7}


LCI event handler that initiates the event collection. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Pointer to the LCI\_\-collection structure, passed through the LCBD event handler\item[{\em dsc}]Description of the event (a thirty-two bit number that indicates, among other things, errors in the event transmission)\item[{\em pkt}]Pointer to an event packet\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Indicates that the packet should be freed by the LCB driver\end{description}
\end{Desc}
\hypertarget{collect_8h_a8}{
\index{collect.h@{collect.h}!LCI_get@{LCI\_\-get}}
\index{LCI_get@{LCI\_\-get}!collect.h@{collect.h}}
\subsubsection[LCI\_\-get]{\setlength{\rightskip}{0pt plus 5cm}EBF\_\-dir$\ast$ LCI\_\-get (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8h_a8}


Return the directory of the next event (or NULL) and advance the read counter. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised collection\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the directory of the next event, or none if the collection has been exhausted.\end{Desc}
\hypertarget{collect_8h_a9}{
\index{collect.h@{collect.h}!LCI_newCollection@{LCI\_\-newCollection}}
\index{LCI_newCollection@{LCI\_\-newCollection}!collect.h@{collect.h}}
\subsubsection[LCI\_\-newCollection]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__LCI__collection}{LCI\_\-collection}$\ast$ LCI\_\-new\-Collection (unsigned {\em cap})}}
\label{collect_8h_a9}


Allocate and initialise an LCI\_\-collection structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cap}]Capacity, the maximum number of events that can be collected\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an allocated, initialised LCI\_\-collection\end{Desc}
\hypertarget{collect_8h_a10}{
\index{collect.h@{collect.h}!LCI_put@{LCI\_\-put}}
\index{LCI_put@{LCI\_\-put}!collect.h@{collect.h}}
\subsubsection[LCI\_\-put]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-put (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll}, unsigned {\em edw}, EBF\_\-pkt $\ast$ {\em pkt})}}
\label{collect_8h_a10}


Copy the packet into the storage area, update the state information vector and compose the directory - on the last packet of the event construct the event. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and prepared LCI\_\-collection structure\item[{\em edw}]Event descriptor word\item[{\em pkt}]Pointer to the packet that just arrived on the LCB\end{description}
\end{Desc}
\hypertarget{collect_8h_a11}{
\index{collect.h@{collect.h}!LCI_restart@{LCI\_\-restart}}
\index{LCI_restart@{LCI\_\-restart}!collect.h@{collect.h}}
\subsubsection[LCI\_\-restart]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-restart (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll})}}
\label{collect_8h_a11}


Reset the read counter to 0. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to a collection structure\end{description}
\end{Desc}
\hypertarget{collect_8h_a12}{
\index{collect.h@{collect.h}!LCI_setCollectionCom@{LCI\_\-setCollectionCom}}
\index{LCI_setCollectionCom@{LCI\_\-setCollectionCom}!collect.h@{collect.h}}
\subsubsection[LCI\_\-setCollectionCom]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-set\-Collection\-Com (\hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll}, void $\ast$ {\em lcbd}, void $\ast$ {\em cr})}}
\label{collect_8h_a12}


Set the communications pointers of the collection structure. 

The lcbd and cr pointers are void to avoid dragging in LCBD and LEM dependancies

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cll}]Pointer to an allocated and initialised LCI\_\-collection structure\item[{\em lcbd}]Pointer to the LCB control block\item[{\em cr}]Pointer to a multi-item command-response list\end{description}
\end{Desc}
