\hypertarget{LSEPW_8h}{
\section{LSEPW.h File Reference}
\label{LSEPW_8h}\index{LSEPW.h@{LSEPW.h}}
}
Interface to the physics context specific information structures and routines.  


{\tt \#include $<$LSF/LSF\_\-cpu.h$>$}\par
{\tt \#include $<$LSF/LSF\_\-mode.h$>$}\par
{\tt \#include $<$LSF/LSF\_\-origin.h$>$}\par
{\tt \#include $<$LSF/LSF\_\-reason.h$>$}\par
{\tt \#include $<$LSE/LSEW\_\-dgmFw.h$>$}\par
{\tt \#include $<$EDS/EDS\_\-cfg.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{LSEPW_8h_e56dc1c5585528f8887b633592045b43}{LSEPW\_\-sizeof} (int level)
\begin{CompactList}\small\item\em Return the size of the LSEP data structure. \item\end{CompactList}\item 
const EDS\_\-fwPostServices $\ast$ \hyperlink{LSEPW_8h_2dc98c5a75ca83f3f048fc21bc1c4400}{LSEPW\_\-constructC} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, int level, const void $\ast$cfg, unsigned short int apid, unsigned int dgm\_\-id, LSF\_\-CPU\_\-K cpu, LSF\_\-ORIGIN\_\-K origin, unsigned int sw\_\-key, LSEW\_\-dgmFwPoster postRtn, void $\ast$postPrm, unsigned int $\ast$buf, int buf\_\-size)
\begin{CompactList}\small\item\em Constructs/initializes the physics application specific context. \item\end{CompactList}\item 
const EDS\_\-fwPostServices $\ast$ \hyperlink{LSEPW_8h_31d923b6697ca248a4240cd6c2bb6a5d}{LSEPW\_\-construct} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, int level, unsigned short int apid, unsigned int dgm\_\-id, LSF\_\-CPU\_\-K cpu, LSF\_\-ORIGIN\_\-K origin, unsigned int sw\_\-key, LSEW\_\-dgmFwPoster postRtn, void $\ast$postPrm, unsigned int $\ast$buf, int buf\_\-size)
\begin{CompactList}\small\item\em Constructs/initializes the physics application specific context. \item\end{CompactList}\item 
int \hyperlink{LSEPW_8h_3fe1c38e7fdbed781dc79383e64c7f01}{LSEPW\_\-start} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, LSF\_\-REASON\_\-OPEN\_\-K reason, unsigned int run\_\-id, unsigned int startTime, LSF\_\-MODE\_\-K mode, unsigned int hw\_\-key, unsigned int lpa\_\-key)
\begin{CompactList}\small\item\em Start or more accurately, prepare a posting stream to receive events. \item\end{CompactList}\item 
int \hyperlink{LSEPW_8h_31f9a1d01aed2d0468953bbd9a605a59}{LSEPW\_\-notify} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, unsigned int mode, unsigned int active, const EDS\_\-cfgInfo cfgs\mbox{[}32\mbox{]}, const EDS\_\-rsdTbl $\ast$rsdTbl)
\begin{CompactList}\small\item\em Called when the configuration has changed, for example by a mode change. \item\end{CompactList}\item 
int \hyperlink{LSEPW_8h_6c0dc9e48db0e677df727589442f1428}{LSEPW\_\-flush} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, int reason)
\begin{CompactList}\small\item\em Flushes the current datagram. \item\end{CompactList}\item 
int \hyperlink{LSEPW_8h_8ac6a0749876c9a65f488cdecce67bc7}{LSEPW\_\-levelSet} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, int level)
\begin{CompactList}\small\item\em Modifies to the current working level to the minimum of {\em level\/} and the maximum allowable compression level that LSEPW is configured to. \item\end{CompactList}\item 
unsigned int $\ast$ \hyperlink{LSEPW_8h_41ff2e987cac1ac25482b09e51f3f817}{LSEPW\_\-ctbAdd} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, unsigned int $\ast$cur, int len32)
\begin{CompactList}\small\item\em Adds the Physics specific context contribution to the datagram. \item\end{CompactList}\item 
int \hyperlink{LSEPW_8h_3cbc7fbbd7252297a37654e0f9c15db8}{LSEPW\_\-evtAdd} (\hyperlink{struct__LSEPW}{LSEPW} $\ast$lsepw, EDS\_\-fwIxb $\ast$ixb)
\begin{CompactList}\small\item\em Formats the event specified in by the EDS\_\-fw Information Exchange block, flushing the current record to the output stream if the datagram is full. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Interface to the physics context specific information structures and routines. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}

   CVS $Id: LSEPW.h,v 1.9 2011/03/26 23:32:30 russell Exp $
\end{verbatim}
\normalsize
 

\subsection{Function Documentation}
\hypertarget{LSEPW_8h_31d923b6697ca248a4240cd6c2bb6a5d}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-construct@{LSEPW\_\-construct}}
\index{LSEPW\_\-construct@{LSEPW\_\-construct}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-construct}]{\setlength{\rightskip}{0pt plus 5cm}const EDS\_\-fwPostServices $\ast$ LSEPW\_\-construct ({\bf LSEPW} $\ast$ {\em lsepw}, \/  int {\em level}, \/  unsigned short int {\em apid}, \/  unsigned int {\em dgm\_\-id}, \/  LSF\_\-CPU\_\-K {\em cpu}, \/  LSF\_\-ORIGIN\_\-K {\em origin}, \/  unsigned int {\em sw\_\-key}, \/  LSEW\_\-dgmFwPoster {\em postRtn}, \/  void $\ast$ {\em postPrm}, \/  unsigned int $\ast$ {\em buf}, \/  int {\em buf\_\-size})}}
\label{LSEPW_8h_31d923b6697ca248a4240cd6c2bb6a5d}


Constructs/initializes the physics application specific context. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context to construct \item[{\em level}]The maximum compression level that will be used \item[{\em apid}]The application id to use in the CCSDS packets \item[{\em dgm\_\-id}]The LAT Science Format Data Id (LSF) to use \item[{\em cpu}]The originating CPU \item[{\em origin}]The data source type \item[{\em sw\_\-key}]The master software configuration key; this is the key to the Secondary Boot File. \item[{\em postRtn}]Routine used to post a formatted event \item[{\em postPrm}]Parameter passed to the post routine \item[{\em buf}]The first, preallocated buffer to fill \item[{\em buf\_\-size}]The size, in bytes, of the ouptut buffer. Events will be packed into this buffer until full \end{description}
\end{Desc}


References LSEPW\_\-constructC().\hypertarget{LSEPW_8h_2dc98c5a75ca83f3f048fc21bc1c4400}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-constructC@{LSEPW\_\-constructC}}
\index{LSEPW\_\-constructC@{LSEPW\_\-constructC}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-constructC}]{\setlength{\rightskip}{0pt plus 5cm}const EDS\_\-fwPostServices $\ast$ LSEPW\_\-constructC ({\bf LSEPW} $\ast$ {\em lsepw}, \/  int {\em level}, \/  const void $\ast$ {\em cfg}, \/  unsigned short int {\em apid}, \/  unsigned int {\em dgm\_\-id}, \/  LSF\_\-CPU\_\-K {\em cpu}, \/  LSF\_\-ORIGIN\_\-K {\em origin}, \/  unsigned int {\em sw\_\-key}, \/  LSEW\_\-dgmFwPoster {\em postRtn}, \/  void $\ast$ {\em postPrm}, \/  unsigned int $\ast$ {\em buf}, \/  int {\em buf\_\-size})}}
\label{LSEPW_8h_2dc98c5a75ca83f3f048fc21bc1c4400}


Constructs/initializes the physics application specific context. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context to construct \item[{\em level}]The maximum compression level that will be used \item[{\em cfg}]Level level specific configuration parameters \item[{\em apid}]The application id to use in the CCSDS packets \item[{\em dgm\_\-id}]The LAT Science Format Data Id (LSF) to use \item[{\em cpu}]The originating CPU \item[{\em origin}]The data source type \item[{\em sw\_\-key}]The master software configuration key; this is the key to the Secondary Boot File. \item[{\em postRtn}]Routine used to post a formatted event \item[{\em postPrm}]Parameter passed to the post routine \item[{\em buf}]The first, preallocated buffer to fill \item[{\em buf\_\-size}]The size, in bytes, of the ouptut buffer. Events will be packed into this buffer until full\end{description}
\end{Desc}
This routine is something of a royal kludge. The original call for LSEPW\_\-construct did not include a configuration parameter. To keep things backwardly compatiable, this routine was invented. It should be become LSEPW\_\-construct if a reorganization permits it. 

References ADVANCE, \_\-LSEP\_\-etxCtb::bdy, \_\-LSEPW::cur\_\-level, \_\-LSEPW::defaults, \_\-LSEPW::dgmFw, \_\-LSEPW::etx, \_\-LSEP\_\-etxCtb::hdr, \_\-LSEP\_\-etxBdy::keys, LSEP\_\-ID\_\-K\_\-ETX, LSEPW\_\-ctbAdd(), LSEPW\_\-evt0\_\-construct(), LSEPW\_\-evt0\_\-sizeof(), LSEPW\_\-evtAdd(), LSEPW\_\-flush(), LSEPW\_\-notify(), LSEPW\_\-start(), \_\-LSEPW::max\_\-level, \_\-LSEP\_\-etxKeys::software, and \_\-LSEPW::usrCtxs.

Referenced by LSEPW\_\-construct().\hypertarget{LSEPW_8h_41ff2e987cac1ac25482b09e51f3f817}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-ctbAdd@{LSEPW\_\-ctbAdd}}
\index{LSEPW\_\-ctbAdd@{LSEPW\_\-ctbAdd}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-ctbAdd}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int $\ast$ LSEPW\_\-ctbAdd ({\bf LSEPW} $\ast$ {\em lsepw}, \/  unsigned int $\ast$ {\em cur}, \/  int {\em len32})}}
\label{LSEPW_8h_41ff2e987cac1ac25482b09e51f3f817}


Adds the Physics specific context contribution to the datagram. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context \item[{\em cur}]Pointer to the where to add the informaton \item[{\em len32}]The length, in 32-bit words, of the available space in the datagram \end{description}
\end{Desc}


Referenced by beg8\_\-add(), and LSEPW\_\-constructC().\hypertarget{LSEPW_8h_3cbc7fbbd7252297a37654e0f9c15db8}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-evtAdd@{LSEPW\_\-evtAdd}}
\index{LSEPW\_\-evtAdd@{LSEPW\_\-evtAdd}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-evtAdd}]{\setlength{\rightskip}{0pt plus 5cm}int LSEPW\_\-evtAdd ({\bf LSEPW} $\ast$ {\em lsepw}, \/  EDS\_\-fwIxb $\ast$ {\em ixb})}}
\label{LSEPW_8h_3cbc7fbbd7252297a37654e0f9c15db8}


Formats the event specified in by the EDS\_\-fw Information Exchange block, flushing the current record to the output stream if the datagram is full. 

\begin{Desc}
\item[Returns:]Status\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context \item[{\em ixb}]The Information Exchange Block \end{description}
\end{Desc}


References \_\-LSEPW::dgmFw.

Referenced by LSEPW\_\-constructC().\hypertarget{LSEPW_8h_6c0dc9e48db0e677df727589442f1428}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-flush@{LSEPW\_\-flush}}
\index{LSEPW\_\-flush@{LSEPW\_\-flush}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-flush}]{\setlength{\rightskip}{0pt plus 5cm}int LSEPW\_\-flush ({\bf LSEPW} $\ast$ {\em lsepw}, \/  int {\em reason})}}
\label{LSEPW_8h_6c0dc9e48db0e677df727589442f1428}


Flushes the current datagram. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context \item[{\em reason}]The reason for the flush \end{description}
\end{Desc}


References \_\-LSEPW::dgmFw.

Referenced by LSEPW\_\-constructC().\hypertarget{LSEPW_8h_8ac6a0749876c9a65f488cdecce67bc7}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-levelSet@{LSEPW\_\-levelSet}}
\index{LSEPW\_\-levelSet@{LSEPW\_\-levelSet}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-levelSet}]{\setlength{\rightskip}{0pt plus 5cm}int LSEPW\_\-levelSet ({\bf LSEPW} $\ast$ {\em lsepw}, \/  int {\em level})}}
\label{LSEPW_8h_8ac6a0749876c9a65f488cdecce67bc7}


Modifies to the current working level to the minimum of {\em level\/} and the maximum allowable compression level that LSEPW is configured to. 

\begin{Desc}
\item[Returns:]The actual level is was set to, {\em i.e\/}. the minimum of {\em level\/} and the maximum allowable compression level. On failure this value is -1.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context \item[{\em level}]The new compression level \end{description}
\end{Desc}


References \_\-LSEPW::cur\_\-level, \_\-LSEPW::defaults, \_\-LSEPW::dgmFw, LSEPW\_\-evt0\_\-level\_\-set(), \_\-LSEPW::max\_\-level, and \_\-LSEPW::usrCtxs.\hypertarget{LSEPW_8h_31f9a1d01aed2d0468953bbd9a605a59}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-notify@{LSEPW\_\-notify}}
\index{LSEPW\_\-notify@{LSEPW\_\-notify}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-notify}]{\setlength{\rightskip}{0pt plus 5cm}int LSEPW\_\-notify ({\bf LSEPW} $\ast$ {\em lsepw}, \/  unsigned int {\em mode}, \/  unsigned int {\em active}, \/  const EDS\_\-cfgInfo {\em cfgs}\mbox{[}32\mbox{]}, \/  const EDS\_\-rsdTbl $\ast$ {\em rsdTbl})}}
\label{LSEPW_8h_31f9a1d01aed2d0468953bbd9a605a59}


Called when the configuration has changed, for example by a mode change. 

\begin{Desc}
\item[Returns:]0 if successful, non-zero if not\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context \item[{\em mode}]The new mode \item[{\em active}]The list of active handlers \item[{\em cfgs}]The current configuration information for each handler. \item[{\em rsdTbl}]The result summary data table \end{description}
\end{Desc}


References \_\-LSEP\_\-etxCtb::bdy, copy\_\-pack\_\-rsds(), \_\-LSEPW::dgmFw, \_\-LSEPW::eds, \_\-LSEP\_\-etxBdy::eds, \_\-LSEPW::etx, \_\-LSEP\_\-etxCtb::hdr, LSEP\_\-ROOTHDR\_\-BRIDGE\_\-M\_\-RSD, pack\_\-cfgs(), \_\-LSEPW::rsdTbl, and \_\-LSEP\_\-etxEds::wrds.

Referenced by LSEPW\_\-constructC().\hypertarget{LSEPW_8h_e56dc1c5585528f8887b633592045b43}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-sizeof@{LSEPW\_\-sizeof}}
\index{LSEPW\_\-sizeof@{LSEPW\_\-sizeof}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-sizeof}]{\setlength{\rightskip}{0pt plus 5cm}int LSEPW\_\-sizeof (int {\em level})}}
\label{LSEPW_8h_e56dc1c5585528f8887b633592045b43}


Return the size of the LSEP data structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em level}]The maximum compression level that will be used. Resources will be allocated consistent with supporting events written in this and all lesser compression levels. \end{description}
\end{Desc}


References LSEPW\_\-evt0\_\-sizeof().\hypertarget{LSEPW_8h_3fe1c38e7fdbed781dc79383e64c7f01}{
\index{LSEPW.h@{LSEPW.h}!LSEPW\_\-start@{LSEPW\_\-start}}
\index{LSEPW\_\-start@{LSEPW\_\-start}!LSEPW.h@{LSEPW.h}}
\subsubsection[{LSEPW\_\-start}]{\setlength{\rightskip}{0pt plus 5cm}int LSEPW\_\-start ({\bf LSEPW} $\ast$ {\em lsepw}, \/  LSF\_\-REASON\_\-OPEN\_\-K {\em reason}, \/  unsigned int {\em run\_\-id}, \/  unsigned int {\em startTime}, \/  LSF\_\-MODE\_\-K {\em mode}, \/  unsigned int {\em hw\_\-key}, \/  unsigned int {\em lpa\_\-key})}}
\label{LSEPW_8h_3fe1c38e7fdbed781dc79383e64c7f01}


Start or more accurately, prepare a posting stream to receive events. 

\begin{Desc}
\item[Returns:]Status, currectly what LSEW\_\-dgmFwRunStart returns.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lsepw}]The physics application specific context \item[{\em reason}]The reason why this run is being started \item[{\em run\_\-id}]The run identifier. Only the first 24-bits are used. \item[{\em startTime}]The run start time rounded to the nearest second \item[{\em mode}]The operational mode \item[{\em hw\_\-key}]The master hardware configuraion key; this is the key to the LATc file \item[{\em lpa\_\-key}]The LPA\_\-DB file key \end{description}
\end{Desc}


References \_\-LSEP\_\-etxCtb::bdy, \_\-LSEPW::dgmFw, \_\-LSEPW::etx, \_\-LSEP\_\-etxKeys::hardware, \_\-LSEP\_\-etxBdy::keys, and \_\-LSEP\_\-etxKeys::lpa\_\-db.

Referenced by LSEPW\_\-constructC().