\hypertarget{SIV_8c}{
\section{SIV.c File Reference}
\label{SIV_8c}\index{SIV.c@{SIV.c}}
}
The packet state information vector code. 

{\tt \#include \char`\"{}SIV.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-pkt.h\char`\"{}}\par
{\tt \#include \char`\"{}EDS/EBF\_\-edw.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/PARITY.ih\char`\"{}}\par


Include dependency graph for SIV.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=109pt]{SIV_8c__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{SIV_8c_a0}{ERR\_\-XFR\_\-BY\_\-XSTATUS}
\begin{CompactList}\small\item\em Bit array giving the {\em ERR\_\-XFR\/} bit as a function of the transfer status field in the event descriptor word. \item\end{CompactList}\item 
\#define \hyperlink{SIV_8c_a1}{ERR\_\-XFR}(\_\-xstatus)~((ERR\_\-XFR\_\-BY\_\-XSTATUS $<$$<$ (\_\-xstatus)) \& SIV\_\-M\_\-ERR\_\-XFR)
\begin{CompactList}\small\item\em Translates the event descriptors's transfer status, {\em \_\-xstatus\/} into the corresponding {\em ERR\_\-XFR\/} mask. \item\end{CompactList}\item 
\#define \hyperlink{SIV_8c_a2}{MORE\_\-ERR\_\-RCV\_\-BY\_\-RSTATUS}
\begin{CompactList}\small\item\em Bit array giving the {\em MORE\/} and ERR\_\-RCV bit by {\em rstatus\/}. \item\end{CompactList}\item 
\#define \hyperlink{SIV_8c_a3}{MORE\_\-ERR\_\-RCV}(\_\-rstatus)
\begin{CompactList}\small\item\em Translates the event descriptors's receive status, {\em \_\-rstatus\/} into the corresponding {\em MORE\/} and {\em ERR\_\-RCV\/} mask. \item\end{CompactList}\item 
\#define \hyperlink{SIV_8c_a4}{ERR\_\-EBM\_\-BY\_\-EBMERR}
\begin{CompactList}\small\item\em Bit array giving 0 or depending on whether the EBM error field contains an error. \item\end{CompactList}\item 
\#define \hyperlink{SIV_8c_a5}{ERR\_\-EBM}(\_\-ebm\_\-err)~(((ERR\_\-EBM\_\-BY\_\-EBMERR $>$$>$ (\_\-ebm\_\-err)) \& 1) $<$$<$ SIV\_\-V\_\-ERR\_\-EBM)
\begin{CompactList}\small\item\em Translates the EBM's 3 bit error field. \item\end{CompactList}\item 
\#define \hyperlink{SIV_8c_a6}{NOTFIRST}(\_\-siv)
\begin{CompactList}\small\item\em Sets the {\em NOTFIRST\/} bit based on the state of the {\em MORE\/} bit in the State Information Vector, {\em \_\-siv\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{SIV_8h_a2}{SIV} \hyperlink{SIV_8c_a7}{SIV\_\-init} (void)
\begin{CompactList}\small\item\em Returns an initializes the Packet Reassembly State Information Vector. \item\end{CompactList}\item 
\hyperlink{SIV_8h_a2}{SIV} \hyperlink{SIV_8c_a8}{SIV\_\-update} (\hyperlink{SIV_8h_a2}{SIV} siv, unsigned int edw, const EBF\_\-pkt $\ast$pkt)
\begin{CompactList}\small\item\em Returns the updated the State Information Vector. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
The packet state information vector code. 

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


\footnotesize\begin{verbatim}   CVS $Id: SIV.c,v 1.1 2006/02/15 22:31:41 russell Exp $
\end{verbatim}
\normalsize


\subsection{Define Documentation}
\hypertarget{SIV_8c_a5}{
\index{SIV.c@{SIV.c}!ERR_EBM@{ERR\_\-EBM}}
\index{ERR_EBM@{ERR\_\-EBM}!SIV.c@{SIV.c}}
\subsubsection[ERR\_\-EBM]{\setlength{\rightskip}{0pt plus 5cm}\#define ERR\_\-EBM(\_\-ebm\_\-err)~(((ERR\_\-EBM\_\-BY\_\-EBMERR $>$$>$ (\_\-ebm\_\-err)) \& 1) $<$$<$ SIV\_\-V\_\-ERR\_\-EBM)}}
\label{SIV_8c_a5}


Translates the EBM's 3 bit error field. 

\begin{Desc}
\item[Returns:]The value of the {\em ERR\_\-EBM\/} mask corresponding to the {\em \_\-ebm\_\-err\/} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ebm\_\-err}]The EBM's error field\end{description}
\end{Desc}
\hypertarget{SIV_8c_a4}{
\index{SIV.c@{SIV.c}!ERR_EBM_BY_EBMERR@{ERR\_\-EBM\_\-BY\_\-EBMERR}}
\index{ERR_EBM_BY_EBMERR@{ERR\_\-EBM\_\-BY\_\-EBMERR}!SIV.c@{SIV.c}}
\subsubsection[ERR\_\-EBM\_\-BY\_\-EBMERR]{\setlength{\rightskip}{0pt plus 5cm}\#define ERR\_\-EBM\_\-BY\_\-EBMERR}}
\label{SIV_8c_a4}


{\bf Value:}

\footnotesize\begin{verbatim}( (0 << 0)  /* Success     */           \
                           | (1 << 1)  /* Parity      */           \
                           | (1 << 2)  /* Truncated   */           \
                           | (1 << 3)  /* Write Fault */           \
                           | (1 << 4)  /* Timed out   */           \
                           | (1 << 5)  /* Undefined   */           \
                           | (1 << 6)  /* Undefined   */           \
                           | (1 << 7))
\end{verbatim}\normalsize 
Bit array giving 0 or depending on whether the EBM error field contains an error. 

\begin{Desc}
\item[]If one shifts this word up by SIV\_\-V\_\-ERR\_\-EBM, the resulting bit will occupy its orresponding position in the {\em SIV\/}.\end{Desc}
\begin{Desc}
\item[Warning:]This word is not made for public consumption. It is only used in support of the ERR\_\-EBM macro.\end{Desc}
\hypertarget{SIV_8c_a1}{
\index{SIV.c@{SIV.c}!ERR_XFR@{ERR\_\-XFR}}
\index{ERR_XFR@{ERR\_\-XFR}!SIV.c@{SIV.c}}
\subsubsection[ERR\_\-XFR]{\setlength{\rightskip}{0pt plus 5cm}\#define ERR\_\-XFR(\_\-xstatus)~((ERR\_\-XFR\_\-BY\_\-XSTATUS $<$$<$ (\_\-xstatus)) \& SIV\_\-M\_\-ERR\_\-XFR)}}
\label{SIV_8c_a1}


Translates the event descriptors's transfer status, {\em \_\-xstatus\/} into the corresponding {\em ERR\_\-XFR\/} mask. 

\begin{Desc}
\item[Returns:]The value of the {\em ERR\_\-XFR\/} mask corresponding to the {\em \_\-xstatus\/} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-xstatus}]The event descriptor's transfer status\end{description}
\end{Desc}
\hypertarget{SIV_8c_a0}{
\index{SIV.c@{SIV.c}!ERR_XFR_BY_XSTATUS@{ERR\_\-XFR\_\-BY\_\-XSTATUS}}
\index{ERR_XFR_BY_XSTATUS@{ERR\_\-XFR\_\-BY\_\-XSTATUS}!SIV.c@{SIV.c}}
\subsubsection[ERR\_\-XFR\_\-BY\_\-XSTATUS]{\setlength{\rightskip}{0pt plus 5cm}\#define ERR\_\-XFR\_\-BY\_\-XSTATUS}}
\label{SIV_8c_a0}


{\bf Value:}

\footnotesize\begin{verbatim}((0                  >> 0)                     \
                             |   (SIV_M_ERR_XFR >> 1)                     \
                             |   (SIV_M_ERR_XFR >> 2)                     \
                             |   (SIV_M_ERR_XFR >> 3)                     \
                             |   (SIV_M_ERR_XFR >> 4)                     \
                             |   (SIV_M_ERR_XFR >> 5)                     \
                             |   (SIV_M_ERR_XFR >> 6)                     \
                             |   (SIV_M_ERR_XFR >> 7))                    \
\end{verbatim}\normalsize 
Bit array giving the {\em ERR\_\-XFR\/} bit as a function of the transfer status field in the event descriptor word. 

\begin{Desc}
\item[]If one shifts this word up xstatus, the ERR\_\-XFR bits will occupy its orresponding position in the {\em SIV\/}.\end{Desc}
\begin{Desc}
\item[Warning:]This word is not made for public consumption. It is only used in support of the ERR\_\-XFR macro.\end{Desc}
\hypertarget{SIV_8c_a3}{
\index{SIV.c@{SIV.c}!MORE_ERR_RCV@{MORE\_\-ERR\_\-RCV}}
\index{MORE_ERR_RCV@{MORE\_\-ERR\_\-RCV}!SIV.c@{SIV.c}}
\subsubsection[MORE\_\-ERR\_\-RCV]{\setlength{\rightskip}{0pt plus 5cm}\#define MORE\_\-ERR\_\-RCV(\_\-rstatus)}}
\label{SIV_8c_a3}


{\bf Value:}

\footnotesize\begin{verbatim}((MORE_ERR_RCV_BY_RSTATUS << (3 * _rstatus)) &                         \
    (SIV_M_STATE_MORE | SIV_M_ERR_RCV))
\end{verbatim}\normalsize 
Translates the event descriptors's receive status, {\em \_\-rstatus\/} into the corresponding {\em MORE\/} and {\em ERR\_\-RCV\/} mask. 

\begin{Desc}
\item[Returns:]The value of the {\em MORE\/} and {\em ERR\_\-RCV\/} bits corresponding to the {\em \_\-rstatus\/} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-rstatus}]The event descriptor receive status\end{description}
\end{Desc}
\hypertarget{SIV_8c_a2}{
\index{SIV.c@{SIV.c}!MORE_ERR_RCV_BY_RSTATUS@{MORE\_\-ERR\_\-RCV\_\-BY\_\-RSTATUS}}
\index{MORE_ERR_RCV_BY_RSTATUS@{MORE\_\-ERR\_\-RCV\_\-BY\_\-RSTATUS}!SIV.c@{SIV.c}}
\subsubsection[MORE\_\-ERR\_\-RCV\_\-BY\_\-RSTATUS]{\setlength{\rightskip}{0pt plus 5cm}\#define MORE\_\-ERR\_\-RCV\_\-BY\_\-RSTATUS}}
\label{SIV_8c_a2}


{\bf Value:}

\footnotesize\begin{verbatim}/* Status      More     RErr     */     \
    ((0                              >> 3*0)   /*  No       No     */     \
    |((unsigned int)SIV_M_ERR_RCV    >> 3*1)   /*  No      Yes     */     \
    |((unsigned int)SIV_M_ERR_RCV    >> 3*2)   /*  No      Yes     */     \
    |((unsigned int)SIV_M_STATE_MORE >> 3*3))
\end{verbatim}\normalsize 
Bit array giving the {\em MORE\/} and ERR\_\-RCV bit by {\em rstatus\/}. 

\begin{Desc}
\item[]If one shifts this word up by 2$\ast$rstatus, the {\em MORE\/} and {\em ERR\_\-RCV\/} bits will occupy their corresponding positions in the {\em SIV\/}.\end{Desc}
\begin{Desc}
\item[Warning:]This word is not made for public consumption. It is only used in support of the MORE\_\-ERR\_\-RCV macro.\end{Desc}
\hypertarget{SIV_8c_a6}{
\index{SIV.c@{SIV.c}!NOTFIRST@{NOTFIRST}}
\index{NOTFIRST@{NOTFIRST}!SIV.c@{SIV.c}}
\subsubsection[NOTFIRST]{\setlength{\rightskip}{0pt plus 5cm}\#define NOTFIRST(\_\-siv)}}
\label{SIV_8c_a6}


{\bf Value:}

\footnotesize\begin{verbatim}((((unsigned int)(_siv)) >>                                             \
     (SIV_V_STATE_MORE - SIV_V_STATE_NOTFIRST))                           \
    & SIV_M_STATE_NOTFIRST)
\end{verbatim}\normalsize 
Sets the {\em NOTFIRST\/} bit based on the state of the {\em MORE\/} bit in the State Information Vector, {\em \_\-siv\/}. 

\begin{Desc}
\item[Returns:]The new value of the {\em NOTFIRST\/} bit\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-siv}]The State Information Vector\end{description}
\end{Desc}


\subsection{Function Documentation}
\hypertarget{SIV_8c_a7}{
\index{SIV.c@{SIV.c}!SIV_init@{SIV\_\-init}}
\index{SIV_init@{SIV\_\-init}!SIV.c@{SIV.c}}
\subsubsection[SIV\_\-init]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{SIV_8h_a2}{SIV} SIV\_\-init (void)}}
\label{SIV_8c_a7}


Returns an initializes the Packet Reassembly State Information Vector. 

\begin{Desc}
\item[Returns:]The inialization value of the Packet Reassembly State Information\end{Desc}
\hypertarget{SIV_8c_a8}{
\index{SIV.c@{SIV.c}!SIV_update@{SIV\_\-update}}
\index{SIV_update@{SIV\_\-update}!SIV.c@{SIV.c}}
\subsubsection[SIV\_\-update]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{SIV_8h_a2}{SIV} SIV\_\-update (\hyperlink{SIV_8h_a2}{SIV} {\em siv}, unsigned int {\em edw}, const EBF\_\-pkt $\ast$ {\em pkt})}}
\label{SIV_8c_a8}


Returns the updated the State Information Vector. 

\begin{Desc}
\item[Returns:]The updated the State Information Vector\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em siv}]The current value of the State Information Vector \item[{\em edw}]The event descriptor word \item[{\em pkt}]The new EBF packet. This contains the information used to perform the update\end{description}
\end{Desc}
