\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=134pt]{state_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__QPIG__cruState__V0}{\_\-QPIG\_\-cru\-State\_\-V0}
\begin{CompactList}\small\item\em State of the CRU - version 0. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__pduState__V0}{\_\-QPIG\_\-pdu\-State\_\-V0}
\begin{CompactList}\small\item\em State of the PDU - version 0. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__ebmState__V0}{\_\-QPIG\_\-ebm\-State\_\-V0}
\begin{CompactList}\small\item\em Structure used to record the state of the EBM - version 0. \item\end{CompactList}\item 
struct \hyperlink{structQPIG__dbState__V0}{QPIG\_\-db\-State\_\-V0}
\begin{CompactList}\small\item\em Structure holding registers configured by PIG\_\-DB - version 0. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__pwrState__V0}{\_\-QPIG\_\-pwr\-State\_\-V0}
\begin{CompactList}\small\item\em Structure holding the power registers - version 0. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__state__V0}{\_\-QPIG\_\-state\_\-V0}
\begin{CompactList}\small\item\em Combination of structures encapsulating the current state of the registers manipulated by PIG - version 0. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__cruState}{\_\-QPIG\_\-cru\-State}
\begin{CompactList}\small\item\em Structure holding the state of the CRU. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__pduState}{\_\-QPIG\_\-pdu\-State}
\begin{CompactList}\small\item\em Structure holding the 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 the registers configured by PIG\_\-DB. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__pwrState}{\_\-QPIG\_\-pwr\-State}
\begin{CompactList}\small\item\em Structure holding the power registers. \item\end{CompactList}\item 
struct \hyperlink{struct__QPIG__state}{\_\-QPIG\_\-state}
\begin{CompactList}\small\item\em Combination of structures 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__V0}{\_\-QPIG\_\-cru\-State\_\-V0} \hyperlink{state_8h_a0}{QPIG\_\-cru\-State\_\-V0}}
\label{state_8h_a0}

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

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

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

\begin{CompactList}\small\item\em Structure holding registers configured by PIG\_\-DB - version 0. \item\end{CompactList}\item 
\hypertarget{state_8h_a4}{
typedef \hyperlink{struct__QPIG__pwrState__V0}{\_\-QPIG\_\-pwr\-State\_\-V0} \hyperlink{state_8h_a4}{QPIG\_\-pwr\-State\_\-V0}}
\label{state_8h_a4}

\begin{CompactList}\small\item\em Structure holding the power registers - version 0. \item\end{CompactList}\item 
\hypertarget{state_8h_a5}{
typedef \hyperlink{struct__QPIG__state__V0}{\_\-QPIG\_\-state\_\-V0} \hyperlink{state_8h_a5}{QPIG\_\-state\_\-V0}}
\label{state_8h_a5}

\begin{CompactList}\small\item\em Combination of structures encapsulating the current state of the registers manipulated by PIG - version 0. \item\end{CompactList}\item 
\hypertarget{state_8h_a6}{
typedef \hyperlink{struct__QPIG__cruState}{\_\-QPIG\_\-cru\-State} \hyperlink{state_8h_a6}{QPIG\_\-cru\-State}}
\label{state_8h_a6}

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

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

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

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

\begin{CompactList}\small\item\em Structure holding the power registers. \item\end{CompactList}\item 
\hypertarget{state_8h_a11}{
typedef \hyperlink{struct__QPIG__state}{\_\-QPIG\_\-state} \hyperlink{state_8h_a11}{QPIG\_\-state}}
\label{state_8h_a11}

\begin{CompactList}\small\item\em Combination of structures 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_a24a12}{QPIG\_\-N\_\-PDU} =  2, 
\par
\hyperlink{state_8h_a24a13}{QPIG\_\-N\_\-TEM} =  16, 
\par
\hyperlink{state_8h_a24a14}{QPIG\_\-N\_\-CCC} =  4, 
\par
\hyperlink{state_8h_a24a15}{QPIG\_\-N\_\-TCC} =  8, 
\par
\hyperlink{state_8h_a24a16}{QPIG\_\-N\_\-FREE} =  12
 \}
\begin{CompactList}\small\item\em Detector constants. \item\end{CompactList}\item 
enum \{ {\bf QPIG\_\-CURR\_\-VERSION} =  1
 \}
\begin{CompactList}\small\item\em Current version of the register state data. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8h_a18}{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 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8h_a19}{QPIG\_\-construct\-State} (void $\ast$buffer)
\begin{CompactList}\small\item\em Construct a QPIG\_\-state structure in the memory provided. \item\end{CompactList}\item 
void \hyperlink{state_8h_a20}{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 
const unsigned int $\ast$ \hyperlink{state_8h_a21}{QPIG\_\-recover\-State} (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state, int version, const unsigned int $\ast$buf)
\begin{CompactList}\small\item\em Copy the state information from the buffer. \item\end{CompactList}\item 
void \hyperlink{state_8h_a22}{QPIG\_\-report\-State} (unsigned int secs, int version, const \hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Write a formatted ASCII description of the state. \item\end{CompactList}\item 
size\_\-t \hyperlink{state_8h_a23}{QPIG\_\-sizeof\-State} (void)
\begin{CompactList}\small\item\em Return the size of the QPIG state structure. \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 \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{state_8h}{state.h},v 1.3 2009/02/20 23:00:15 saxton Exp \end{Desc}


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


Detector constants. 

\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_a24a12}{
QPIG\_\-N\_\-PDU}
\label{state_8h_a24a12}
}]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_a24a13}{
QPIG\_\-N\_\-TEM}
\label{state_8h_a24a13}
}]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_a24a14}{
QPIG\_\-N\_\-CCC}
\label{state_8h_a24a14}
}]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_a24a15}{
QPIG\_\-N\_\-TCC}
\label{state_8h_a24a15}
}]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_a24a16}{
QPIG\_\-N\_\-FREE}
\label{state_8h_a24a16}
}]Number of FREE boards. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{state_8h_a18}{
\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_a18}


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


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

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


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_a18}{QPIG\_\-alloc\-State()}\end{description}
\end{Desc}
\hypertarget{state_8h_a21}{
\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}, int {\em version}, const unsigned int $\ast$ {\em buf})}}
\label{state_8h_a21}


Copy the state information from the buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a state structure\item[{\em version}]The version of the state data.\item[{\em buf}]Pointer to the context data\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next word in the buffer\end{Desc}
\hypertarget{state_8h_a22}{
\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 (unsigned int {\em secs}, int {\em version}, const \hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ {\em state}, FILE $\ast$ {\em fp})}}
\label{state_8h_a22}


Write a formatted ASCII description of the state. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em secs}]The time the state was sent (spacecraft time)\item[{\em version}]The version of the state data.\item[{\em state}]Pointer to a state structure\item[{\em fp}]Pointer to the output file\end{description}
\end{Desc}
\hypertarget{state_8h_a23}{
\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_a23}


Return the size of the QPIG state structure. 

\begin{Desc}
\item[Returns:]Size of memory block required to hold the structure\end{Desc}
