\hypertarget{consign_8c}{
\section{consign.c File Reference}
\label{consign_8c}\index{consign.c@{consign.c}}
}
Routines that act upon the consignment structure. 

{\tt \#include \char`\"{}LCI/LCI\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}consign\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}configure.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/MBA.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/BSWP.h\char`\"{}}\par
{\tt \#include \char`\"{}MON/MON\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/WCT.h\char`\"{}}\par
{\tt \#include \char`\"{}ITC/ITC\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}LSEC/LSEC\_\-ctx.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-cid.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-dir.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-gem\-Locate.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par


Include dependency graph for consign.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=353pt]{consign_8c__incl}
\end{center}
\end{figure}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \{ \par
{\bf LCI\_\-DATAGRAM\_\-SIZE} =  1024$\ast$128, 
\par
{\bf LCI\_\-N\_\-DATAGRAMS} =  6, 
\par
{\bf LCI\_\-CNS\_\-CYCLE\_\-SPACE} =  4$\ast$1024, 
\par
{\bf LCI\_\-SSR\_\-APID\_\-BASE} =  0x3c5
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int $\ast$ \hyperlink{consign_8c_a4}{LCI\_\-beg\-Adder} (void $\ast$prm, unsigned int $\ast$buf, unsigned int len32)
\begin{CompactList}\small\item\em Copy the calibration context information into {\em buf\/}. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{consign_8c_a5}{LCI\_\-usr\-Adder} (void $\ast$prm, void $\ast$usr\-Info, int usr\-Len, unsigned int $\ast$buf, unsigned int len32)
\begin{CompactList}\small\item\em Add User Context Contribution at an arbitrary point in the event datagram. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{consign_8c_a6}{LCI\_\-evt\-Adder} (void $\ast$prm, void $\ast$evt, unsigned int $\ast$buf, unsigned int len32)
\begin{CompactList}\small\item\em Compress the next event into the buffer. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{consign_8c_a7}{LCI\_\-poster} (void $\ast$prm, void $\ast$buf, int bytes)
\begin{CompactList}\small\item\em Send the datagram to the SDI and get a new one from the FPA. \item\end{CompactList}\item 
void \hyperlink{consign_8c_a8}{LCI\_\-cb\_\-dgm\-Free} (ITC\_\-Queue\-Item $\ast$qitem, unsigned int status, void $\ast$prm0, void $\ast$prm1, void $\ast$prm2, unsigned int tx)
\begin{CompactList}\small\item\em Completion call-back for use with ITC when sending out a datagram. \item\end{CompactList}\item 
void \hyperlink{consign_8c_a9}{init\-Framework} (LSEW\_\-dgm\-Fw $\ast$fw, \hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns, unsigned id, unsigned cpuid, unsigned srcid)
\begin{CompactList}\small\item\em Initialise one of the datagram frameworks. \item\end{CompactList}\item 
LSEW\_\-dgm\-Fw $\ast$ \hyperlink{consign_8c_a10}{get\-Framework} (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns)
\begin{CompactList}\small\item\em Get the framework appropriate for the current operating mode. \item\end{CompactList}\item 
\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ \hyperlink{consign_8c_a11}{LCI\_\-new\-Consignment} (unsigned cpuid, unsigned srcid, \hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$cnf, \hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$cll, LSEC\_\-compaction $\ast$cpc)
\begin{CompactList}\small\item\em Allocate memory for an LCI\_\-consigment structure and initialise (clear). \item\end{CompactList}\item 
void \hyperlink{consign_8c_a12}{LCI\_\-delete\-Consignment} (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns)
\begin{CompactList}\small\item\em Free the previously allocated consignment structure. \item\end{CompactList}\item 
WCT\_\-time\_\-sat \hyperlink{consign_8c_a13}{LCI\_\-prepare} (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns, unsigned runid)
\begin{CompactList}\small\item\em Set the runid and start time for the first datagram of the new calibration. \item\end{CompactList}\item 
unsigned \hyperlink{consign_8c_a14}{LCI\_\-complete} (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns)
\begin{CompactList}\small\item\em Complete a consignment. \item\end{CompactList}\item 
unsigned \hyperlink{consign_8c_a15}{LCI\_\-consign} (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns)
\begin{CompactList}\small\item\em Perform a consignment. \item\end{CompactList}\item 
void \hyperlink{consign_8c_a16}{LCI\_\-set\-Reason} (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$cns, int reason)
\begin{CompactList}\small\item\em Set the current datagram close reason. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Routines that act upon the consignment structure. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{consign_8c}{consign.c},v 1.19 2007/08/21 22:51:19 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{consign_8c_a10}{
\index{consign.c@{consign.c}!getFramework@{getFramework}}
\index{getFramework@{getFramework}!consign.c@{consign.c}}
\subsubsection[getFramework]{\setlength{\rightskip}{0pt plus 5cm}LSEW\_\-dgm\-Fw $\ast$ get\-Framework (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns})}}
\label{consign_8c_a10}


Get the framework appropriate for the current operating mode. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cns}]Pointer to the current consignment structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the framework appropriate for the current operating mode\end{Desc}
\hypertarget{consign_8c_a9}{
\index{consign.c@{consign.c}!initFramework@{initFramework}}
\index{initFramework@{initFramework}!consign.c@{consign.c}}
\subsubsection[initFramework]{\setlength{\rightskip}{0pt plus 5cm}void init\-Framework (LSEW\_\-dgm\-Fw $\ast$ {\em fw}, \hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns}, unsigned {\em id}, unsigned {\em cpuid}, unsigned {\em srcid})}}
\label{consign_8c_a9}


Initialise one of the datagram frameworks. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fw}]Pointer to the framework to initalise\item[{\em cns}]Pointer to the consignment structure holding the FW\item[{\em id}]Datagram ID\item[{\em srcid}]ID of the data source\item[{\em cpuid}]ID of the CPU LCI is being run on\end{description}
\end{Desc}
\hypertarget{consign_8c_a4}{
\index{consign.c@{consign.c}!LCI_begAdder@{LCI\_\-begAdder}}
\index{LCI_begAdder@{LCI\_\-begAdder}!consign.c@{consign.c}}
\subsubsection[LCI\_\-begAdder]{\setlength{\rightskip}{0pt plus 5cm}unsigned int $\ast$ LCI\_\-beg\-Adder (void $\ast$ {\em prm}, unsigned int $\ast$ {\em buf}, unsigned int {\em len32})}}
\label{consign_8c_a4}


Copy the calibration context information into {\em buf\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Pointer to a consignment structure\item[{\em buf}]The buffer to accept the Begin Contribution data\item[{\em len32}]The number of 32-bit words available in {\em buf\/}.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next output location to be filled, or NULL if the current buffer is not large enough to hold the context\end{Desc}
\hypertarget{consign_8c_a8}{
\index{consign.c@{consign.c}!LCI_cb_dgmFree@{LCI\_\-cb\_\-dgmFree}}
\index{LCI_cb_dgmFree@{LCI\_\-cb\_\-dgmFree}!consign.c@{consign.c}}
\subsubsection[LCI\_\-cb\_\-dgmFree]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-cb\_\-dgm\-Free (ITC\_\-Queue\-Item $\ast$ {\em qitem}, unsigned int {\em status}, void $\ast$ {\em prm0}, void $\ast$ {\em prm1}, void $\ast$ {\em prm2}, unsigned int {\em tx})}}
\label{consign_8c_a8}


Completion call-back for use with ITC when sending out a datagram. 

Just returns the qitem to the pool.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em qitem}]Queue item to be returned to the pool\item[{\em status}]Success or failure of the ITC delivery\item[{\em prm0}]User defined parameter 0 (pointer to the FPM pool)\item[{\em prm1}]User defined (NULL)\item[{\em prm2}]User defined (NULL)\item[{\em tx}]Transmission status\end{description}
\end{Desc}
\hypertarget{consign_8c_a14}{
\index{consign.c@{consign.c}!LCI_complete@{LCI\_\-complete}}
\index{LCI_complete@{LCI\_\-complete}!consign.c@{consign.c}}
\subsubsection[LCI\_\-complete]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-complete (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns})}}
\label{consign_8c_a14}


Complete a consignment. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cns}]pointer to the consignment\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]If all goes well\end{description}
\end{Desc}
\hypertarget{consign_8c_a15}{
\index{consign.c@{consign.c}!LCI_consign@{LCI\_\-consign}}
\index{LCI_consign@{LCI\_\-consign}!consign.c@{consign.c}}
\subsubsection[LCI\_\-consign]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCI\_\-consign (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns})}}
\label{consign_8c_a15}


Perform a consignment. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cns}]Pointer to a consignment structure\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em LCI\_\-SUCCESS}]If all goes well\end{description}
\end{Desc}
\hypertarget{consign_8c_a12}{
\index{consign.c@{consign.c}!LCI_deleteConsignment@{LCI\_\-deleteConsignment}}
\index{LCI_deleteConsignment@{LCI\_\-deleteConsignment}!consign.c@{consign.c}}
\subsubsection[LCI\_\-deleteConsignment]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-delete\-Consignment (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns})}}
\label{consign_8c_a12}


Free the previously allocated consignment structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cns}]Pointer to allocated, intialised consignment structure (from LCI\_\-new\-Consignment)\end{description}
\end{Desc}
\hypertarget{consign_8c_a6}{
\index{consign.c@{consign.c}!LCI_evtAdder@{LCI\_\-evtAdder}}
\index{LCI_evtAdder@{LCI\_\-evtAdder}!consign.c@{consign.c}}
\subsubsection[LCI\_\-evtAdder]{\setlength{\rightskip}{0pt plus 5cm}unsigned int $\ast$ LCI\_\-evt\-Adder (void $\ast$ {\em prm}, void $\ast$ {\em evt}, unsigned int $\ast$ {\em buf}, unsigned int {\em len32})}}
\label{consign_8c_a6}


Compress the next event into the buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Pointer to the consignment structure\item[{\em evt}]User supplied event pointer\item[{\em buf}]Pointer to the destination buffer\item[{\em len32}]Number of 32 bit words available in {\em buf\/} \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next output location, or NULL if the compressed event will not fit\end{Desc}
\hypertarget{consign_8c_a11}{
\index{consign.c@{consign.c}!LCI_newConsignment@{LCI\_\-newConsignment}}
\index{LCI_newConsignment@{LCI\_\-newConsignment}!consign.c@{consign.c}}
\subsubsection[LCI\_\-newConsignment]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__LCI__consignment}{LCI\_\-consignment}$\ast$ LCI\_\-new\-Consignment (unsigned {\em cpuid}, unsigned {\em srcid}, \hyperlink{struct__LCI__configuration}{LCI\_\-configuration} $\ast$ {\em cnf}, \hyperlink{struct__LCI__collection}{LCI\_\-collection} $\ast$ {\em cll}, LSEC\_\-compaction $\ast$ {\em cpc})}}
\label{consign_8c_a11}


Allocate memory for an LCI\_\-consigment structure and initialise (clear). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em srcid}]ID of the data source\item[{\em cpuid}]ID of the CPU LCI is being run on\item[{\em cll}]Pointer to the collection of events to consign\item[{\em cpc}]Pointer to the compaction state information\item[{\em cnf}]Pointer to the configuration data\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an allocated, initialised consignment (NULL if there is an error allocating memory)\end{Desc}
\hypertarget{consign_8c_a7}{
\index{consign.c@{consign.c}!LCI_poster@{LCI\_\-poster}}
\index{LCI_poster@{LCI\_\-poster}!consign.c@{consign.c}}
\subsubsection[LCI\_\-poster]{\setlength{\rightskip}{0pt plus 5cm}unsigned int $\ast$ LCI\_\-poster (void $\ast$ {\em prm}, void $\ast$ {\em buf}, int {\em bytes})}}
\label{consign_8c_a7}


Send the datagram to the SDI and get a new one from the FPA. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Pointer to the consignment structure\item[{\em buf}]The buffer to post\item[{\em bytes}]The number of bytes in the buffer\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next buffer to be filled.\end{Desc}
\hypertarget{consign_8c_a13}{
\index{consign.c@{consign.c}!LCI_prepare@{LCI\_\-prepare}}
\index{LCI_prepare@{LCI\_\-prepare}!consign.c@{consign.c}}
\subsubsection[LCI\_\-prepare]{\setlength{\rightskip}{0pt plus 5cm}WCT\_\-time\_\-sat LCI\_\-prepare (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns}, unsigned {\em runid})}}
\label{consign_8c_a13}


Set the runid and start time for the first datagram of the new calibration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cns}]Pointer to allocated, intialised consignment structure (from LCI\_\-new\-Consignment)\item[{\em runid}]32-bit number identifying the calibration run\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The run start time (as a 64-bit Spectrum Astro time)\end{Desc}
\hypertarget{consign_8c_a16}{
\index{consign.c@{consign.c}!LCI_setReason@{LCI\_\-setReason}}
\index{LCI_setReason@{LCI\_\-setReason}!consign.c@{consign.c}}
\subsubsection[LCI\_\-setReason]{\setlength{\rightskip}{0pt plus 5cm}void LCI\_\-set\-Reason (\hyperlink{struct__LCI__consignment}{LCI\_\-consignment} $\ast$ {\em cns}, int {\em reason})}}
\label{consign_8c_a16}


Set the current datagram close reason. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cns}]Pointer to the consignment structure\item[{\em reason}]The reason code to be set\end{description}
\end{Desc}
\hypertarget{consign_8c_a5}{
\index{consign.c@{consign.c}!LCI_usrAdder@{LCI\_\-usrAdder}}
\index{LCI_usrAdder@{LCI\_\-usrAdder}!consign.c@{consign.c}}
\subsubsection[LCI\_\-usrAdder]{\setlength{\rightskip}{0pt plus 5cm}unsigned int $\ast$ LCI\_\-usr\-Adder (void $\ast$ {\em prm}, void $\ast$ {\em usr\-Info}, int {\em usr\-Len}, unsigned int $\ast$ {\em buf}, unsigned int {\em len32})}}
\label{consign_8c_a5}


Add User Context Contribution at an arbitrary point in the event datagram. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Static user provided parameter\item[{\em usr\-Info}]Pointer to the information (or some representation of the information) to be written\item[{\em usr\-Len}]Can be interpretted as the length of the information or can be used as an arbitrary 32-bit piece of information, i.e. it is just passed as is through to the user routine.\item[{\em buf}]The buffer to accept the User Contribution data\item[{\em len32}]The number of 32-bit words available in {\em buf\/}. If the information does not fit in this space, return NULL.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]If the information fits in the alloted space, a pointer to the next output location to be filled or NULL if the information does not fit.\end{Desc}
