\hypertarget{state_8c}{
\section{state.c File Reference}
\label{state_8c}\index{state.c@{state.c}}
}
Functions used to retrieve the power and initialisation state. 

{\tt \#include \char`\"{}state\_\-p.h\char`\"{}}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par


Include dependency graph for state.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=186pt]{state_8c__incl}
\end{center}
\end{figure}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \{ \par
{\bf CRU\_\-MASK\_\-PDU\_\-0} =  0x080000, 
\par
{\bf CRU\_\-MASK\_\-PDU\_\-1} =  0x100000
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static void \hyperlink{state_8c_a2}{report\_\-ebm\-State} (const \hyperlink{structQPIG__ebmState}{QPIG\_\-ebm\-State} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Report the EBM state. \item\end{CompactList}\item 
static void \hyperlink{state_8c_a3}{report\_\-cru\-State} (const \hyperlink{structQPIG__cruState}{QPIG\_\-cru\-State} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Report the CRU state. \item\end{CompactList}\item 
static void \hyperlink{state_8c_a4}{report\_\-pdu\-State} (const \hyperlink{structQPIG__pduState}{QPIG\_\-pdu\-State} $\ast$state, const \hyperlink{structQPIG__cruState}{QPIG\_\-cru\-State} $\ast$cru, FILE $\ast$fp)
\begin{CompactList}\small\item\em Report the PDU register state. \item\end{CompactList}\item 
static void \hyperlink{state_8c_a5}{report\_\-pdb\-State} (const \hyperlink{structQPIG__dbState}{QPIG\_\-db\-State} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Report the state of the PIG\_\-DB registers. \item\end{CompactList}\item 
static void \hyperlink{state_8c_a6}{report\_\-pwr\-State} (const \hyperlink{structQPIG__pwrState}{QPIG\_\-pwr\-State} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Report the state of the power registers. \item\end{CompactList}\item 
size\_\-t \hyperlink{state_8c_a7}{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_8c_a8}{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_8c_a9}{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_8c_a10}{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 
const unsigned int $\ast$ \hyperlink{state_8c_a11}{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}\item 
void \hyperlink{state_8c_a12}{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}\end{CompactItemize}


\subsection{Detailed Description}
Functions used to retrieve the power and initialisation state. 

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


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


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_8c_a8}{
\index{state.c@{state.c}!QPIG_constructState@{QPIG\_\-constructState}}
\index{QPIG_constructState@{QPIG\_\-constructState}!state.c@{state.c}}
\subsubsection[QPIG\_\-constructState]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structQPIG__state}{QPIG\_\-state}$\ast$ QPIG\_\-construct\-State (void $\ast$ {\em buffer})}}
\label{state_8c_a8}


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_8c_a10}{
\index{state.c@{state.c}!QPIG_destructState@{QPIG\_\-destructState}}
\index{QPIG_destructState@{QPIG\_\-destructState}!state.c@{state.c}}
\subsubsection[QPIG\_\-destructState]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-destruct\-State (\hyperlink{structQPIG__state}{QPIG\_\-state} $\ast$ {\em state})}}
\label{state_8c_a10}


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_8c_a11}{
\index{state.c@{state.c}!QPIG_recoverState@{QPIG\_\-recoverState}}
\index{QPIG_recoverState@{QPIG\_\-recoverState}!state.c@{state.c}}
\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_8c_a11}


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_8c_a12}{
\index{state.c@{state.c}!QPIG_reportState@{QPIG\_\-reportState}}
\index{QPIG_reportState@{QPIG\_\-reportState}!state.c@{state.c}}
\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_8c_a12}


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_8c_a7}{
\index{state.c@{state.c}!QPIG_sizeofState@{QPIG\_\-sizeofState}}
\index{QPIG_sizeofState@{QPIG\_\-sizeofState}!state.c@{state.c}}
\subsubsection[QPIG\_\-sizeofState]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t QPIG\_\-sizeof\-State (void)}}
\label{state_8c_a7}


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}
\hypertarget{state_8c_a3}{
\index{state.c@{state.c}!report_cruState@{report\_\-cruState}}
\index{report_cruState@{report\_\-cruState}!state.c@{state.c}}
\subsubsection[report\_\-cruState]{\setlength{\rightskip}{0pt plus 5cm}void report\_\-cru\-State (const \hyperlink{structQPIG__cruState}{QPIG\_\-cru\-State} $\ast$ {\em state}, FILE $\ast$ {\em fp})\hspace{0.3cm}{\tt  \mbox{[}inline, static\mbox{]}}}}
\label{state_8c_a3}


Report the CRU state. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a structure for caching the state of the PDU/CRU registers \item[{\em fp}]Pointer to file where the report will be written\end{description}
\end{Desc}
\hypertarget{state_8c_a2}{
\index{state.c@{state.c}!report_ebmState@{report\_\-ebmState}}
\index{report_ebmState@{report\_\-ebmState}!state.c@{state.c}}
\subsubsection[report\_\-ebmState]{\setlength{\rightskip}{0pt plus 5cm}void report\_\-ebm\-State (const \hyperlink{structQPIG__ebmState}{QPIG\_\-ebm\-State} $\ast$ {\em state}, FILE $\ast$ {\em fp})\hspace{0.3cm}{\tt  \mbox{[}inline, static\mbox{]}}}}
\label{state_8c_a2}


Report the EBM state. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a structure for caching the state of the EBM registers \item[{\em fp}]Pointer to file where the report will be written\end{description}
\end{Desc}
\hypertarget{state_8c_a5}{
\index{state.c@{state.c}!report_pdbState@{report\_\-pdbState}}
\index{report_pdbState@{report\_\-pdbState}!state.c@{state.c}}
\subsubsection[report\_\-pdbState]{\setlength{\rightskip}{0pt plus 5cm}void report\_\-pdb\-State (const \hyperlink{structQPIG__dbState}{QPIG\_\-db\-State} $\ast$ {\em state}, FILE $\ast$ {\em fp})\hspace{0.3cm}{\tt  \mbox{[}inline, static\mbox{]}}}}
\label{state_8c_a5}


Report the state of the PIG\_\-DB registers. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a structure for caching the state of the PIG\_\-DB registers \item[{\em fp}]Pointer to file where the report will be written\end{description}
\end{Desc}
\hypertarget{state_8c_a4}{
\index{state.c@{state.c}!report_pduState@{report\_\-pduState}}
\index{report_pduState@{report\_\-pduState}!state.c@{state.c}}
\subsubsection[report\_\-pduState]{\setlength{\rightskip}{0pt plus 5cm}void report\_\-pdu\-State (const \hyperlink{structQPIG__pduState}{QPIG\_\-pdu\-State} $\ast$ {\em state}, const \hyperlink{structQPIG__cruState}{QPIG\_\-cru\-State} $\ast$ {\em cru}, FILE $\ast$ {\em fp})\hspace{0.3cm}{\tt  \mbox{[}inline, static\mbox{]}}}}
\label{state_8c_a4}


Report the PDU register state. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a structure for caching the state of the PDU registers \item[{\em cru}]Pointer to a structure containing the state of the CRU \item[{\em fp}]Pointer to file where the report will be written\end{description}
\end{Desc}
\hypertarget{state_8c_a6}{
\index{state.c@{state.c}!report_pwrState@{report\_\-pwrState}}
\index{report_pwrState@{report\_\-pwrState}!state.c@{state.c}}
\subsubsection[report\_\-pwrState]{\setlength{\rightskip}{0pt plus 5cm}void report\_\-pwr\-State (const \hyperlink{structQPIG__pwrState}{QPIG\_\-pwr\-State} $\ast$ {\em state}, FILE $\ast$ {\em fp})\hspace{0.3cm}{\tt  \mbox{[}inline, static\mbox{]}}}}
\label{state_8c_a6}


Report the state of the power registers. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a structure for caching the state of the power registers \item[{\em fp}]Pointer to file where the report will be written\end{description}
\end{Desc}
