\hypertarget{event_8c}{
\section{event.c File Reference}
\label{event_8c}\index{event.c@{event.c}}
}
Routines that handle raw event data. 

{\tt \#include \char`\"{}LSEC\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-dir.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-edw.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-siv.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__event}{\_\-LSEC\_\-event}
\begin{CompactList}\small\item\em Structure holding raw event data. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \{ \hyperlink{event_8c_dc29c2ff13d900c2f185ee95427fb06c6bfd1c3fbdf2b545a5d1bc1dd4533283}{MAX\_\-OVERHEAD\_\-PER\_\-EVENT} =  sizeof(EBF\_\-pktHdr) $\ast$ 8 $\ast$ 56
 \}
\begin{CompactList}\small\item\em Various constants. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{event_8c_74c11eb498c64ea9102c02cd5e7d200e}{LSEC\_\-eventClear} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Clear the stored event data. \item\end{CompactList}\item 
\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$ \hyperlink{event_8c_aad0a8ea7ad8e102cb728f086c0f5b8d}{LSEC\_\-eventCreate} (int cap, long long $\ast$times)
\begin{CompactList}\small\item\em Create a new event structure. \item\end{CompactList}\item 
void \hyperlink{event_8c_a02662052945c47d0daae9d509b8dc33}{LSEC\_\-eventDelete} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Delete the previously allocated event structure. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{event_8c_f924b2fe44aa4bda49541974946114d1}{LSEC\_\-eventGet} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Get the address of the next stored event. \item\end{CompactList}\item 
void \hyperlink{event_8c_cd78b1641346f4ed318d68e036e5f79a}{LSEC\_\-eventPrepare} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Prepare for a new run. \item\end{CompactList}\item 
unsigned \hyperlink{event_8c_9f17c7359e0610fe8dbcb33c868192aa}{LSEC\_\-eventProcess} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt, unsigned int edw, EBF\_\-pkt $\ast$pkt)
\begin{CompactList}\small\item\em Process an event packet. \item\end{CompactList}\item 
void \hyperlink{event_8c_ed1d905c08fc50554e39e280dc714259}{LSEC\_\-eventProcSet} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt, \hyperlink{LSEC__p_8h_ceefe78efae20f2d0feec10d79684caf}{LSEC\_\-eventProcRtn} $\ast$rtn, void $\ast$parm)
\begin{CompactList}\small\item\em Set the event processing routine to use. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{event_8c_45ce390f5d402310dfd1c7f6325d1861}{LSEC\_\-eventPut} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Get the address of the next event to store. \item\end{CompactList}\item 
void \hyperlink{event_8c_53cc6db1d2110a772e1142add01e0877}{LSEC\_\-eventRewind} (\hyperlink{struct__LSEC__event}{LSEC\_\-event} $\ast$evt)
\begin{CompactList}\small\item\em Rewind the event store reading to the beginning. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Routines that handle raw event data. 

\begin{Desc}
\item[Author:]Owen Saxton\end{Desc}
{\bf \$Id:} \hyperlink{event_8c}{event.c},v 1.4 2010/08/12 21:17:33 saxton Exp \$ 

\subsection{Enumeration Type Documentation}
\hypertarget{event_8c_dc29c2ff13d900c2f185ee95427fb06c}{
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}}
\label{event_8c_dc29c2ff13d900c2f185ee95427fb06c}


Various constants. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{MAX_OVERHEAD_PER_EVENT@{MAX\_\-OVERHEAD\_\-PER\_\-EVENT}!event.c@{event.c}}\index{event.c@{event.c}!MAX_OVERHEAD_PER_EVENT@{MAX\_\-OVERHEAD\_\-PER\_\-EVENT}}\item[{\em 
\hypertarget{event_8c_dc29c2ff13d900c2f185ee95427fb06c6bfd1c3fbdf2b545a5d1bc1dd4533283}{
MAX\_\-OVERHEAD\_\-PER\_\-EVENT}
\label{event_8c_dc29c2ff13d900c2f185ee95427fb06c6bfd1c3fbdf2b545a5d1bc1dd4533283}
}]Maximum fragmentation gives 8 pktHdrs and 8 event descriptor words per KB,. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{event_8c_74c11eb498c64ea9102c02cd5e7d200e}{
\index{event.c@{event.c}!LSEC_eventClear@{LSEC\_\-eventClear}}
\index{LSEC_eventClear@{LSEC\_\-eventClear}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventClear ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_74c11eb498c64ea9102c02cd5e7d200e}


Clear the stored event data. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure. \end{description}
\end{Desc}
\hypertarget{event_8c_aad0a8ea7ad8e102cb728f086c0f5b8d}{
\index{event.c@{event.c}!LSEC_eventCreate@{LSEC\_\-eventCreate}}
\index{LSEC_eventCreate@{LSEC\_\-eventCreate}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf LSEC\_\-event}$\ast$ LSEC\_\-eventCreate (int {\em cap}, long long $\ast$ {\em times})}}
\label{event_8c_aad0a8ea7ad8e102cb728f086c0f5b8d}


Create a new event structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cap}]The maximum number of events that can be stored.\item[{\em times}]Address of the processing times array.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the new event structure, or NULL if there is insufficient memory available. \end{Desc}
\hypertarget{event_8c_a02662052945c47d0daae9d509b8dc33}{
\index{event.c@{event.c}!LSEC_eventDelete@{LSEC\_\-eventDelete}}
\index{LSEC_eventDelete@{LSEC\_\-eventDelete}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventDelete ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_a02662052945c47d0daae9d509b8dc33}


Delete the previously allocated event structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to allocated, intialised event structure \end{description}
\end{Desc}
\hypertarget{event_8c_f924b2fe44aa4bda49541974946114d1}{
\index{event.c@{event.c}!LSEC_eventGet@{LSEC\_\-eventGet}}
\index{LSEC_eventGet@{LSEC\_\-eventGet}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int$\ast$ LSEC\_\-eventGet ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_f924b2fe44aa4bda49541974946114d1}


Get the address of the next stored event. 

This routine return a pointer to the next event and advances the read pointer.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next event, or NULL if there are no more events. \end{Desc}
\hypertarget{event_8c_cd78b1641346f4ed318d68e036e5f79a}{
\index{event.c@{event.c}!LSEC_eventPrepare@{LSEC\_\-eventPrepare}}
\index{LSEC_eventPrepare@{LSEC\_\-eventPrepare}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventPrepare ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_cd78b1641346f4ed318d68e036e5f79a}


Prepare for a new run. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to allocated, intialised event structure \end{description}
\end{Desc}
\hypertarget{event_8c_9f17c7359e0610fe8dbcb33c868192aa}{
\index{event.c@{event.c}!LSEC_eventProcess@{LSEC\_\-eventProcess}}
\index{LSEC_eventProcess@{LSEC\_\-eventProcess}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned LSEC\_\-eventProcess ({\bf LSEC\_\-event} $\ast$ {\em evt}, unsigned int {\em edw}, EBF\_\-pkt $\ast$ {\em pkt})}}
\label{event_8c_9f17c7359e0610fe8dbcb33c868192aa}


Process an event packet. 

This routine is called whenever a new event packet arrives.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure\item[{\em edw}]Description of the event (a thirty-two bit number that indicates, among other things, errors in the event transmission)\item[{\em pkt}]Pointer to 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{event_8c_ed1d905c08fc50554e39e280dc714259}{
\index{event.c@{event.c}!LSEC_eventProcSet@{LSEC\_\-eventProcSet}}
\index{LSEC_eventProcSet@{LSEC\_\-eventProcSet}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventProcSet ({\bf LSEC\_\-event} $\ast$ {\em evt}, {\bf LSEC\_\-eventProcRtn} $\ast$ {\em rtn}, void $\ast$ {\em parm})}}
\label{event_8c_ed1d905c08fc50554e39e280dc714259}


Set the event processing routine to use. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure.\item[{\em rtn}]Pointer to the processing routine.\item[{\em parm}]Parameter to pass to the processing routine. \end{description}
\end{Desc}
\hypertarget{event_8c_45ce390f5d402310dfd1c7f6325d1861}{
\index{event.c@{event.c}!LSEC_eventPut@{LSEC\_\-eventPut}}
\index{LSEC_eventPut@{LSEC\_\-eventPut}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int$\ast$ LSEC\_\-eventPut ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_45ce390f5d402310dfd1c7f6325d1861}


Get the address of the next event to store. 

This routine return a pointer to the next event that can be stored and advances the write pointer.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next event to store, or NULL if the storage area is filled to capacity. \end{Desc}
\hypertarget{event_8c_53cc6db1d2110a772e1142add01e0877}{
\index{event.c@{event.c}!LSEC_eventRewind@{LSEC\_\-eventRewind}}
\index{LSEC_eventRewind@{LSEC\_\-eventRewind}!event.c@{event.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void LSEC\_\-eventRewind ({\bf LSEC\_\-event} $\ast$ {\em evt})}}
\label{event_8c_53cc6db1d2110a772e1142add01e0877}


Rewind the event store reading to the beginning. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em evt}]Pointer to an event structure. \end{description}
\end{Desc}
