\hypertarget{power_8h}{
\section{power.h File Reference}
\label{power_8h}\index{power.h@{power.h}}
}
Provides functions to power on and configure the LAT.  


{\tt \#include \char`\"{}LCB/LIOX\_\-sync\_\-handle.h\char`\"{}}\par


Include dependency graph for power.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=90pt]{power_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=42pt]{power_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{power_8h_a0}{power\-On} (LIOXs slh, unsigned mask0, unsigned mask1, unsigned delay)
\begin{CompactList}\small\item\em Configures the PDUs to power the required components of the LAT. \item\end{CompactList}\item 
int \hyperlink{power_8h_a1}{power\-Off} (LIOXs slh, unsigned cpt\-Mask, unsigned delay)
\begin{CompactList}\small\item\em Configures the PDUs to power the required components of the LAT. \item\end{CompactList}\item 
int \hyperlink{power_8h_a2}{config\-CRU} (LIOXs slh, unsigned cpt\-Mask)
\begin{CompactList}\small\item\em Configures the CRU to allow LATp C/R with the specified components and sets the LATp addresses of those cpts. \item\end{CompactList}\item 
int \hyperlink{power_8h_a3}{config\-EBM} (LIOXs slh, unsigned cpt\-Mask)
\begin{CompactList}\small\item\em Configures the source and destination enables of the EBM. \item\end{CompactList}\item 
int \hyperlink{power_8h_a4}{power\-On\-TWR} (LIOXs slh, unsigned tkr\-Mask, unsigned cal\-Mask, unsigned delay)
\begin{CompactList}\small\item\em Power on the CAL and TRK. \item\end{CompactList}\item 
int \hyperlink{power_8h_a5}{power\-On\-ACD} (LIOXs slh, unsigned free\-Mask, unsigned delay)
\begin{CompactList}\small\item\em Power on the FREE boards. \item\end{CompactList}\item 
int \hyperlink{power_8h_a6}{power\-Off\-TWR} (LIOXs slh, unsigned tkr\-Mask, unsigned cal\-Mask, unsigned delay)
\begin{CompactList}\small\item\em Power off the CAL and TRK. \item\end{CompactList}\item 
int \hyperlink{power_8h_a7}{power\-Off\-ACD} (LIOXs slh, unsigned free\-Mask, unsigned delay)
\begin{CompactList}\small\item\em Power on the FREE boards. \item\end{CompactList}\item 
int \hyperlink{power_8h_a8}{add\-TEM} (LIOXs slh, unsigned tem\-ID, unsigned pdu\-ID, unsigned delay)
\begin{CompactList}\small\item\em Power on a TEM and configure it along with the CRU and EBM. \item\end{CompactList}\item 
int \hyperlink{power_8h_a9}{remove\-TEM} (LIOXs slh, unsigned tem\-ID, unsigned delay)
\begin{CompactList}\small\item\em Power off a TEM and remove it from the CRU and EBM configurations. \item\end{CompactList}\item 
int \hyperlink{power_8h_a10}{add\-EPU} (LIOXs slh, unsigned epu\-ID, unsigned pdu\-ID, unsigned delay)
\begin{CompactList}\small\item\em Power on an EPU and configure it along with the CRU and EBM. \item\end{CompactList}\item 
int \hyperlink{power_8h_a11}{remove\-EPU} (LIOXs slh, unsigned epu\-ID, unsigned delay)
\begin{CompactList}\small\item\em Power off an EPU and remove it from the CRU and EBM configurations. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Provides functions to power on and configure the LAT. 

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


\subsection{Function Documentation}
\hypertarget{power_8h_a10}{
\index{power.h@{power.h}!addEPU@{addEPU}}
\index{addEPU@{addEPU}!power.h@{power.h}}
\subsubsection[addEPU]{\setlength{\rightskip}{0pt plus 5cm}int add\-EPU (LIOXs {\em slh}, unsigned {\em epu\-ID}, unsigned {\em pdu\-ID}, unsigned {\em delay})}}
\label{power_8h_a10}


Power on an EPU and configure it along with the CRU and EBM. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em epu\-ID}]0 ... 2 \item[{\em pdu\-ID}]0 -$>$ use Primary PDU, 1 -$>$ use Redundant PDU \item[{\em delay}]Time (in 60ths of a second) to wait after powering a cpt before proceeding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
\hypertarget{power_8h_a8}{
\index{power.h@{power.h}!addTEM@{addTEM}}
\index{addTEM@{addTEM}!power.h@{power.h}}
\subsubsection[addTEM]{\setlength{\rightskip}{0pt plus 5cm}int add\-TEM (LIOXs {\em slh}, unsigned {\em tem\-ID}, unsigned {\em pdu\-ID}, unsigned {\em delay})}}
\label{power_8h_a8}


Power on a TEM and configure it along with the CRU and EBM. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em tem\-ID}]0 ... 15 \item[{\em pdu\-ID}]0 -$>$ use Primary PDU, 1 -$>$ use Redundant PDU \item[{\em delay}]Time (in 60ths of a second) to wait after powering a cpt before proceeding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
\hypertarget{power_8h_a2}{
\index{power.h@{power.h}!configCRU@{configCRU}}
\index{configCRU@{configCRU}!power.h@{power.h}}
\subsubsection[configCRU]{\setlength{\rightskip}{0pt plus 5cm}int config\-CRU (LIOXs {\em slh}, unsigned {\em cpt\-Mask})}}
\label{power_8h_a2}


Configures the CRU to allow LATp C/R with the specified components and sets the LATp addresses of those cpts. 

int \hyperlink{power_8c_a4}{config\-CRU(LIOXs slh, unsigned cpt\-Mask)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em cpt\-Mask}]Bit mask indicating which components should be configured \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
1) Any component that is not specified in {\em cpt\-Mask\/} will be inaccessible following the execution of this function

2) Only the TEMs, DAB and PDUs are configured by this function.

3) {\em cpt\-Mask\/} is laid out in the manner of the CRU command and response enable bit masks (LAT-TD-01547, figs 12 \& 13).

TEM0 = 0x00000001 TEM1 = 0x00000002 TEM2 = 0x00000004 : TEMe = 0x00004000 TEMf = 0x00008000 GEM = 0x00010000 AEM = 0x00020000 EBM = 0x00040000 PDU0 = 0x00080000 PDU1 = 0x00100000 SIUx = 0x01000000 SIU0 = 0x02000000 SIU1 = 0x04000000 EPU0 = 0x08000000 EPU1 = 0x10000000 EPU2 = 0x20000000 \hypertarget{power_8h_a3}{
\index{power.h@{power.h}!configEBM@{configEBM}}
\index{configEBM@{configEBM}!power.h@{power.h}}
\subsubsection[configEBM]{\setlength{\rightskip}{0pt plus 5cm}int config\-EBM (LIOXs {\em slh}, unsigned {\em cpt\-Mask})}}
\label{power_8h_a3}


Configures the source and destination enables of the EBM. 

int \hyperlink{power_8c_a5}{config\-EBM(LIOXs slh, unsigned cpt\-Mask)} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em cpt\-Mask}]Bit mask indicating which components should be configured \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
1) {\em cpt\-Mask\/} is the concatenation of registers 4-6 of the EBM controller block (LAT-TD-01546, the source enable registers) with an additional bit in the most- significant-byte representing the SSR

GEM = 0x00000001 TEM0 = 0x00000002 TEM1 = 0x00000004 TEM2 = 0x00000008 : TEMe = 0x00008000 TEMf = 0x00010000 AEM = 0x00020000 SIUX = 0x00040000 SIU0 = 0x00080000 SIU1 = 0x00100000 EPU0 = 0x00200000 EPU1 = 0x00400000 EPU2 = 0x00800000 \hypertarget{power_8h_a1}{
\index{power.h@{power.h}!powerOff@{powerOff}}
\index{powerOff@{powerOff}!power.h@{power.h}}
\subsubsection[powerOff]{\setlength{\rightskip}{0pt plus 5cm}int power\-Off (LIOXs {\em slh}, unsigned {\em cpt\-Mask}, unsigned {\em delay})}}
\label{power_8h_a1}


Configures the PDUs to power the required components of the LAT. 

int power\-Off (LIOXs slh, unsigned cpt\-Mask, unsigned delay) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em cpt\-Mask}]Bit mask indicating which components should be powered off \item[{\em delay}]Time (in 60ths of a second) to wait after powering a cpt before powering the next \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
1) Function assumes that the CRU is unconfigured so begins by configuring the CRU to access the requested PDUs and sets the LATp addresses of the aforementioned PDUs.

2) Currently only the Primary EPU DC-DC converters are available.

3) Currently only the Primary ACD supply and converters are available.

4) {\em cpt\-Mask\/} is laid out in the manner of the CRU command and response enable bit masks (LAT-TD-01547, figs 12 \& 13).

TEM0 = 0x00000001 TEM1 = 0x00000002 TEM2 = 0x00000004 : TEMe = 0x00004000 TEMf = 0x00008000 GEM = 0x00010000 AEM = 0x00020000 EBM = 0x00040000 PDU0 = 0x00080000 PDU1 = 0x00100000 SIUx = 0x01000000 SIU0 = 0x02000000 SIU1 = 0x04000000 EPU0 = 0x08000000 EPU1 = 0x10000000 EPU2 = 0x20000000 \hypertarget{power_8h_a7}{
\index{power.h@{power.h}!powerOffACD@{powerOffACD}}
\index{powerOffACD@{powerOffACD}!power.h@{power.h}}
\subsubsection[powerOffACD]{\setlength{\rightskip}{0pt plus 5cm}int power\-Off\-ACD (LIOXs {\em slh}, unsigned {\em free\-Mask}, unsigned {\em delay})}}
\label{power_8h_a7}


Power on the FREE boards. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchrounous LIOX handle \item[{\em free\-Mask}]Bitmask indicating which free boards should be powered \item[{\em delay}]Time (in 60ths of a second) between each power-on command \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
\hypertarget{power_8h_a6}{
\index{power.h@{power.h}!powerOffTWR@{powerOffTWR}}
\index{powerOffTWR@{powerOffTWR}!power.h@{power.h}}
\subsubsection[powerOffTWR]{\setlength{\rightskip}{0pt plus 5cm}int power\-Off\-TWR (LIOXs {\em slh}, unsigned {\em tkr\-Mask}, unsigned {\em cal\-Mask}, unsigned {\em delay})}}
\label{power_8h_a6}


Power off the CAL and TRK. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em tkr\-Mask}]Bitmask indicating which tracker towers to turn on \item[{\em cal\-Mask}]Bitmask indicating which cal towers to turn on \item[{\em delay}]Time (in 60ths of a second) between each power-on command \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
\hypertarget{power_8h_a0}{
\index{power.h@{power.h}!powerOn@{powerOn}}
\index{powerOn@{powerOn}!power.h@{power.h}}
\subsubsection[powerOn]{\setlength{\rightskip}{0pt plus 5cm}void power\-On (LIOXs {\em slh}, unsigned {\em mask0}, unsigned {\em mask1}, unsigned {\em delay})}}
\label{power_8h_a0}


Configures the PDUs to power the required components of the LAT. 

void power\-On (LIOXs slh, unsigned mask0, unsigned mask1, unsigned delay) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em mask0}]Bit mask indicating which components should be powered on by the PRIMARY PDU \item[{\em mask1}]Bit mask indicating which components should be powered on by the REDUNDANT PDU \item[{\em delay}]Time (in 60ths of a second) to wait after powering a cpt before powering the next \end{description}
\end{Desc}
1) Function assumes that the CRU is unconfigured so begins by configuring the CRU to access the requested PDUs and sets the LATp addresses of the aforementioned PDUs.

2) Currently only the Primary EPU DC-DC converters are available.

3) Currently only the Primary ACD supply and converters are available.

4) {\em mask0\/} and {\em mask1\/} are laid out in the manner of the CRU command and response enable bit masks (LAT-TD-01547, figs 12 \& 13).

TEM0 = 0x00000001 TEM1 = 0x00000002 TEM2 = 0x00000004 : TEMe = 0x00004000 TEMf = 0x00008000 GEM = 0x00010000 AEM = 0x00020000 EBM = 0x00040000 PDU0 = 0x00080000 PDU1 = 0x00100000 SIUx = 0x01000000 SIU0 = 0x02000000 SIU1 = 0x04000000 EPU0 = 0x08000000 EPU1 = 0x10000000 EPU2 = 0x20000000 \hypertarget{power_8h_a5}{
\index{power.h@{power.h}!powerOnACD@{powerOnACD}}
\index{powerOnACD@{powerOnACD}!power.h@{power.h}}
\subsubsection[powerOnACD]{\setlength{\rightskip}{0pt plus 5cm}int power\-On\-ACD (LIOXs {\em slh}, unsigned {\em free\-Mask}, unsigned {\em delay})}}
\label{power_8h_a5}


Power on the FREE boards. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchrounous LIOX handle \item[{\em free\-Mask}]Bitmask indicating which free boards should be powered \item[{\em delay}]Time (in 60ths of a second) between each power-on command \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
\hypertarget{power_8h_a4}{
\index{power.h@{power.h}!powerOnTWR@{powerOnTWR}}
\index{powerOnTWR@{powerOnTWR}!power.h@{power.h}}
\subsubsection[powerOnTWR]{\setlength{\rightskip}{0pt plus 5cm}int power\-On\-TWR (LIOXs {\em slh}, unsigned {\em tkr\-Mask}, unsigned {\em cal\-Mask}, unsigned {\em delay})}}
\label{power_8h_a4}


Power on the CAL and TRK. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em tkr\-Mask}]Bitmask indicating which tracker towers to turn on \item[{\em cal\-Mask}]Bitmask indicating which cal towers to turn on \item[{\em delay}]Time (in 60ths of a second) between each power-on command \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on failure \end{Desc}
\hypertarget{power_8h_a11}{
\index{power.h@{power.h}!removeEPU@{removeEPU}}
\index{removeEPU@{removeEPU}!power.h@{power.h}}
\subsubsection[removeEPU]{\setlength{\rightskip}{0pt plus 5cm}int remove\-EPU (LIOXs {\em slh}, unsigned {\em epu\-ID}, unsigned {\em delay})}}
\label{power_8h_a11}


Power off an EPU and remove it from the CRU and EBM configurations. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em epu\-ID}]0 ... 3 \item[{\em delay}]Time (in 60ths of a second) to wait after powering a cpt before proceeding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
\hypertarget{power_8h_a9}{
\index{power.h@{power.h}!removeTEM@{removeTEM}}
\index{removeTEM@{removeTEM}!power.h@{power.h}}
\subsubsection[removeTEM]{\setlength{\rightskip}{0pt plus 5cm}int remove\-TEM (LIOXs {\em slh}, unsigned {\em tem\-ID}, unsigned {\em delay})}}
\label{power_8h_a9}


Power off a TEM and remove it from the CRU and EBM configurations. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em tem\-ID}]0 ... 15 \item[{\em delay}]Time (in 60ths of a second) to wait after powering a cpt before proceeding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
