\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{struct__QPIG__cruState}{\_\-QPIG\_\-cru\-State}
\begin{CompactList}\small\item\em State of the CRU. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__pduState}{\_\-QPIG\_\-pdu\-State}
\begin{CompactList}\small\item\em State of the PDU. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__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{struct__QPIG__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{struct__QPIG__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*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{state_8h_a0}{
typedef \hyperlink{struct__QPIG__cruState}{\_\-QPIG\_\-cru\-State} \hyperlink{state_8h_a0}{QPIG\_\-cru\-State}}
\label{state_8h_a0}

\begin{CompactList}\small\item\em State of the CRU. \item\end{CompactList}\item 
\hypertarget{state_8h_a1}{
typedef \hyperlink{struct__QPIG__pduState}{\_\-QPIG\_\-pdu\-State} \hyperlink{state_8h_a1}{QPIG\_\-pdu\-State}}
\label{state_8h_a1}

\begin{CompactList}\small\item\em State of the PDU. \item\end{CompactList}\item 
\hypertarget{state_8h_a2}{
typedef \hyperlink{struct__QPIG__ebmState}{\_\-QPIG\_\-ebm\-State} \hyperlink{state_8h_a2}{QPIG\_\-ebm\-State}}
\label{state_8h_a2}

\begin{CompactList}\small\item\em Structure used to record the state of the EBM. \item\end{CompactList}\item 
\hypertarget{state_8h_a3}{
typedef \hyperlink{structQPIG__dbState}{QPIG\_\-db\-State} \hyperlink{state_8h_a3}{QPIG\_\-db\-State}}
\label{state_8h_a3}

\begin{CompactList}\small\item\em Structure holding all the registers that are configured by PIG\_\-DB. \item\end{CompactList}\item 
\hypertarget{state_8h_a4}{
typedef \hyperlink{struct__QPIG__pwrState}{\_\-QPIG\_\-pwr\-State} \hyperlink{state_8h_a4}{QPIG\_\-pwr\-State}}
\label{state_8h_a4}

\begin{CompactList}\small\item\em Structure holding all the power registers that are controlled by PIG. \item\end{CompactList}\item 
\hypertarget{state_8h_a5}{
typedef \hyperlink{struct__QPIG__state}{\_\-QPIG\_\-state} \hyperlink{state_8h_a5}{QPIG\_\-state}}
\label{state_8h_a5}

\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_a17a6}{QPIG\_\-N\_\-PDU} =  2, 
\par
\hyperlink{state_8h_a17a7}{QPIG\_\-N\_\-TEM} =  16, 
\par
\hyperlink{state_8h_a17a8}{QPIG\_\-N\_\-CCC} =  4, 
\par
\hyperlink{state_8h_a17a9}{QPIG\_\-N\_\-TCC} =  8, 
\par
\hyperlink{state_8h_a17a10}{QPIG\_\-N\_\-FREE} =  12
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
size\_\-t \hyperlink{state_8h_a11}{QPIG\_\-sizeof\-State} (void)
\begin{CompactList}\small\item\em Return the size of the QPIG state structure. \item\end{CompactList}\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8h_a12}{QPIG\_\-construct\-State} (void $\ast$buffer)
\begin{CompactList}\small\item\em Construct a QPIG\_\-state structure in the memory provided. \item\end{CompactList}\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8h_a13}{QPIG\_\-alloc\-State} (void)
\begin{CompactList}\small\item\em Allocate memory for a QPIG\_\-state structure and construct it as such. \item\end{CompactList}\item 
void \hyperlink{state_8h_a14}{QPIG\_\-destruct\-State} (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state)
\begin{CompactList}\small\item\em Release resources associated with the QPIG\_\-state structure. \item\end{CompactList}\item 
void \hyperlink{state_8h_a15}{QPIG\_\-report\-State} (const \hyperlink{struct__QPIG__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_a16}{QPIG\_\-recover\-State} (\hyperlink{struct__QPIG__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_a17}{
\subsubsection["@0]{\setlength{\rightskip}{0pt plus 5cm}anonymous enum}}
\label{state_8h_a17}


\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_a17a6}{
QPIG\_\-N\_\-PDU}
\label{state_8h_a17a6}
}]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_a17a7}{
QPIG\_\-N\_\-TEM}
\label{state_8h_a17a7}
}]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_a17a8}{
QPIG\_\-N\_\-CCC}
\label{state_8h_a17a8}
}]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_a17a9}{
QPIG\_\-N\_\-TCC}
\label{state_8h_a17a9}
}]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_a17a10}{
QPIG\_\-N\_\-FREE}
\label{state_8h_a17a10}
}]Number of FREE boards. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{state_8h_a13}{
\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{struct__QPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-alloc\-State (void)}}
\label{state_8h_a13}


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

\begin{Desc}
\item[Returns:]Allocated QPIG\_\-state structure\end{Desc}
\hypertarget{state_8h_a12}{
\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{struct__QPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-construct\-State (void $\ast$ {\em buffer})}}
\label{state_8h_a12}


Construct a QPIG\_\-state structure in the memory provided. 

\begin{Desc}
\item[Returns:]Pointer to an initialised QPIG\_\-state structure \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]block of memory to use for the QPIG\_\-state structure\end{description}
\end{Desc}
\hypertarget{state_8h_a14}{
\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{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state})}}
\label{state_8h_a14}


Release resources associated with the QPIG\_\-state structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a QPIG\_\-state structure created using \hyperlink{state_8h_a13}{QPIG\_\-alloc\-State()}\end{description}
\end{Desc}
\hypertarget{state_8h_a16}{
\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{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state}, const unsigned int $\ast$ {\em buf})}}
\label{state_8h_a16}


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_a15}{
\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{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state}, FILE $\ast$ {\em fp})}}
\label{state_8h_a15}


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_a11}{
\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_a11}


Return the size of the QPIG state structure. 

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