\hypertarget{state_8h}{
\section{state.h File Reference}
\label{state_8h}\index{state.h@{state.h}}
}
Structures that make up the PIG datagram sent to the SSR by PIG\_\-record. 

{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par


Include dependency graph for state.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=88pt]{state_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=179pt]{state_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structQPIG__cruState}{QPIG\_\-cru\-State}
\begin{CompactList}\small\item\em State of the CRU. \item\end{CompactList}\item 
struct \hyperlink{structQPIG__pduState}{QPIG\_\-pdu\-State}
\begin{CompactList}\small\item\em State of the PDU. \item\end{CompactList}\item 
struct \hyperlink{structQPIG__ebmState}{QPIG\_\-ebm\-State}
\begin{CompactList}\small\item\em Structure used to record the state of the EBM. \item\end{CompactList}\item 
struct \hyperlink{structQPIG__dbState}{QPIG\_\-db\-State}
\begin{CompactList}\small\item\em Structure holding all the registers that are configured by PIG\_\-DB. \item\end{CompactList}\item 
struct \hyperlink{structQPIG__pwrState}{QPIG\_\-pwr\-State}
\begin{CompactList}\small\item\em Structure holding all the power registers that are controlled by PIG. \item\end{CompactList}\item 
struct \hyperlink{structQPIG__state}{QPIG\_\-state}
\begin{CompactList}\small\item\em Combination of structure encapsulating the current state of the registers manipulated by PIG. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \{ \par
\hyperlink{state_8h_a11a0}{QPIG\_\-N\_\-PDU} =  2, 
\par
\hyperlink{state_8h_a11a1}{QPIG\_\-N\_\-TEM} =  16, 
\par
\hyperlink{state_8h_a11a2}{QPIG\_\-N\_\-CCC} =  4, 
\par
\hyperlink{state_8h_a11a3}{QPIG\_\-N\_\-TCC} =  8, 
\par
\hyperlink{state_8h_a11a4}{QPIG\_\-N\_\-FREE} =  12
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
size\_\-t \hyperlink{state_8h_a5}{QPIG\_\-sizeof\-State} (void)
\begin{CompactList}\small\item\em Return the size of the QPIG state structure. \item\end{CompactList}\item 
\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8h_a6}{QPIG\_\-construct\-State} (void $\ast$buffer)
\begin{CompactList}\small\item\em Construct a \hyperlink{structQPIG__state}{QPIG\_\-state} structure in the memory provided. \item\end{CompactList}\item 
\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8h_a7}{QPIG\_\-alloc\-State} (void)
\begin{CompactList}\small\item\em Allocate memory for a \hyperlink{structQPIG__state}{QPIG\_\-state} structure and construct it as such. \item\end{CompactList}\item 
void \hyperlink{state_8h_a8}{QPIG\_\-destruct\-State} (\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$state)
\begin{CompactList}\small\item\em Release resources associated with the \hyperlink{structQPIG__state}{QPIG\_\-state} structure. \item\end{CompactList}\item 
void \hyperlink{state_8h_a9}{QPIG\_\-report\-State} (const \hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Write a formatted ASCII description of the contents of the context to the file {\em fp\/}. \item\end{CompactList}\item 
const unsigned int $\ast$ \hyperlink{state_8h_a10}{QPIG\_\-recover\-State} (\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$state, const unsigned int $\ast$buf)
\begin{CompactList}\small\item\em Copy the context information from the buffer. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Structures that make up the PIG datagram sent to the SSR by PIG\_\-record. 

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


\subsection{Enumeration Type Documentation}
\hypertarget{state_8h_a11}{
\subsubsection["@0]{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}}
\label{state_8h_a11}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{QPIG_N_PDU@{QPIG\_\-N\_\-PDU}!state.h@{state.h}}\index{state.h@{state.h}!QPIG_N_PDU@{QPIG\_\-N\_\-PDU}}\item[{\em 
\hypertarget{state_8h_a11a0}{
QPIG\_\-N\_\-PDU}
\label{state_8h_a11a0}
}]Number of PDUs. \index{QPIG_N_TEM@{QPIG\_\-N\_\-TEM}!state.h@{state.h}}\index{state.h@{state.h}!QPIG_N_TEM@{QPIG\_\-N\_\-TEM}}\item[{\em 
\hypertarget{state_8h_a11a1}{
QPIG\_\-N\_\-TEM}
\label{state_8h_a11a1}
}]Number of TEMs. \index{QPIG_N_CCC@{QPIG\_\-N\_\-CCC}!state.h@{state.h}}\index{state.h@{state.h}!QPIG_N_CCC@{QPIG\_\-N\_\-CCC}}\item[{\em 
\hypertarget{state_8h_a11a2}{
QPIG\_\-N\_\-CCC}
\label{state_8h_a11a2}
}]Number of CCCs. \index{QPIG_N_TCC@{QPIG\_\-N\_\-TCC}!state.h@{state.h}}\index{state.h@{state.h}!QPIG_N_TCC@{QPIG\_\-N\_\-TCC}}\item[{\em 
\hypertarget{state_8h_a11a3}{
QPIG\_\-N\_\-TCC}
\label{state_8h_a11a3}
}]Number of TCCs. \index{QPIG_N_FREE@{QPIG\_\-N\_\-FREE}!state.h@{state.h}}\index{state.h@{state.h}!QPIG_N_FREE@{QPIG\_\-N\_\-FREE}}\item[{\em 
\hypertarget{state_8h_a11a4}{
QPIG\_\-N\_\-FREE}
\label{state_8h_a11a4}
}]Number of FREE boards. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{state_8h_a7}{
\index{state.h@{state.h}!QPIG_allocState@{QPIG\_\-allocState}}
\index{QPIG_allocState@{QPIG\_\-allocState}!state.h@{state.h}}
\subsubsection[QPIG\_\-allocState]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structQPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-alloc\-State (void)}}
\label{state_8h_a7}


Allocate memory for a \hyperlink{structQPIG__state}{QPIG\_\-state} structure and construct it as such. 

\begin{Desc}
\item[Returns:]Allocated \hyperlink{structQPIG__state}{QPIG\_\-state} structure\end{Desc}
\hypertarget{state_8h_a6}{
\index{state.h@{state.h}!QPIG_constructState@{QPIG\_\-constructState}}
\index{QPIG_constructState@{QPIG\_\-constructState}!state.h@{state.h}}
\subsubsection[QPIG\_\-constructState]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structQPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-construct\-State (void $\ast$ {\em buffer})}}
\label{state_8h_a6}


Construct a \hyperlink{structQPIG__state}{QPIG\_\-state} structure in the memory provided. 

\begin{Desc}
\item[Returns:]Pointer to an initialised \hyperlink{structQPIG__state}{QPIG\_\-state} structure \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]block of memory to use for the \hyperlink{structQPIG__state}{QPIG\_\-state} structure\end{description}
\end{Desc}
\hypertarget{state_8h_a8}{
\index{state.h@{state.h}!QPIG_destructState@{QPIG\_\-destructState}}
\index{QPIG_destructState@{QPIG\_\-destructState}!state.h@{state.h}}
\subsubsection[QPIG\_\-destructState]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-destruct\-State (\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ {\em state})}}
\label{state_8h_a8}


Release resources associated with the \hyperlink{structQPIG__state}{QPIG\_\-state} structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a \hyperlink{structQPIG__state}{QPIG\_\-state} structure created using \hyperlink{state_8h_a7}{QPIG\_\-alloc\-State()}\end{description}
\end{Desc}
\hypertarget{state_8h_a10}{
\index{state.h@{state.h}!QPIG_recoverState@{QPIG\_\-recoverState}}
\index{QPIG_recoverState@{QPIG\_\-recoverState}!state.h@{state.h}}
\subsubsection[QPIG\_\-recoverState]{\setlength{\rightskip}{0pt plus 5cm}const unsigned int$\ast$ QPIG\_\-recover\-State (\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ {\em state}, const unsigned int $\ast$ {\em buf})}}
\label{state_8h_a10}


Copy the context information from the buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a state structure \item[{\em buf}]Pointer to the context data \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next word in the contribution\end{Desc}
\hypertarget{state_8h_a9}{
\index{state.h@{state.h}!QPIG_reportState@{QPIG\_\-reportState}}
\index{QPIG_reportState@{QPIG\_\-reportState}!state.h@{state.h}}
\subsubsection[QPIG\_\-reportState]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-report\-State (const \hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ {\em state}, FILE $\ast$ {\em fp})}}
\label{state_8h_a9}


Write a formatted ASCII description of the contents of the context to the file {\em fp\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a context structure \item[{\em fp}]Pointer to the output file\end{description}
\end{Desc}
\hypertarget{state_8h_a5}{
\index{state.h@{state.h}!QPIG_sizeofState@{QPIG\_\-sizeofState}}
\index{QPIG_sizeofState@{QPIG\_\-sizeofState}!state.h@{state.h}}
\subsubsection[QPIG\_\-sizeofState]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t QPIG\_\-sizeof\-State (void)}}
\label{state_8h_a5}


Return the size of the QPIG state structure. 

\begin{Desc}
\item[Returns:]Size of memory block required to accomodate the \hyperlink{structQPIG__state}{QPIG\_\-state} structure\end{Desc}
