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


{\tt \#include \char`\"{}DUTIL/LCB\_\-cfg.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-sync\_\-handle.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-addr\_\-def.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{start_8h_a0}{power\-On} (LIOXs slh, unsigned pri\-Mask, unsigned red\-Mask)
\begin{CompactList}\small\item\em Configures the PDUs to power the required components of the LAT. \item\end{CompactList}\item 
int \hyperlink{start_8h_a1}{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{start_8h_a2}{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 
unsigned \hyperlink{start_8h_a3}{get\-EPUaddr} (LIOXs slh)
\begin{CompactList}\small\item\em Returns address to use in the event contributions. \item\end{CompactList}\item 
unsigned \hyperlink{start_8h_a4}{create\-SLH} (LCB lcb, LIOXs $\ast$slh)
\begin{CompactList}\small\item\em Allocate memory for and initializes Synchronous LIOX handle. \item\end{CompactList}\item 
unsigned \hyperlink{start_8h_a5}{LCB\_\-startup} (LCB $\ast$p\-LCB, \hyperlink{struct__LCB__cfg}{LCB\_\-cfg} $\ast$conf)
\begin{CompactList}\small\item\em Laundry list of LCB initializations. \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{start_8h_a1}{
\index{start.h@{start.h}!configCRU@{configCRU}}
\index{configCRU@{configCRU}!start.h@{start.h}}
\subsubsection[configCRU]{\setlength{\rightskip}{0pt plus 5cm}int config\-CRU (LIOXs {\em slh}, unsigned {\em cpt\-Mask})}}
\label{start_8h_a1}


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

int \hyperlink{start_8h_a1}{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 PDU0 = 0x00010000 PDU1 = 0x00020000 GEM = 0x00040000 AEM = 0x00080000 EBM = 0x00100000 SIU0 = 0x01000000 SIU1 = 0x02000000 SIUx = 0x04000000 EPU0 = 0x08000000 EPU1 = 0x10000000 EPU2 = 0x20000000 \hypertarget{start_8h_a2}{
\index{start.h@{start.h}!configEBM@{configEBM}}
\index{configEBM@{configEBM}!start.h@{start.h}}
\subsubsection[configEBM]{\setlength{\rightskip}{0pt plus 5cm}int config\-EBM (LIOXs {\em slh}, unsigned {\em cpt\-Mask})}}
\label{start_8h_a2}


Configures the source and destination enables of the EBM. 

int \hyperlink{start_8h_a2}{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{start_8h_a4}{
\index{start.h@{start.h}!createSLH@{createSLH}}
\index{createSLH@{createSLH}!start.h@{start.h}}
\subsubsection[createSLH]{\setlength{\rightskip}{0pt plus 5cm}unsigned create\-SLH (LCB {\em lcb}, LIOXs $\ast$ {\em slh})}}
\label{start_8h_a4}


Allocate memory for and initializes Synchronous LIOX handle. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lcb}]Initialized LCB handle \item[{\em slh}]Pointer to uninitialed Synchronous LIOX handle \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]LCB\_\-OK \end{Desc}
\hypertarget{start_8h_a3}{
\index{start.h@{start.h}!getEPUaddr@{getEPUaddr}}
\index{getEPUaddr@{getEPUaddr}!start.h@{start.h}}
\subsubsection[getEPUaddr]{\setlength{\rightskip}{0pt plus 5cm}unsigned get\-EPUaddr (LIOXs {\em slh})}}
\label{start_8h_a3}


Returns address to use in the event contributions. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Destination address to use when configuring the GEM \end{Desc}
Once the round-robin functionality is available in the EBM, this will return 0. Until then it returns the address of the commander node. \hypertarget{start_8h_a5}{
\index{start.h@{start.h}!LCB_startup@{LCB\_\-startup}}
\index{LCB_startup@{LCB\_\-startup}!start.h@{start.h}}
\subsubsection[LCB\_\-startup]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCB\_\-startup (LCB $\ast$ {\em p\-LCB}, \hyperlink{struct__LCB__cfg}{LCB\_\-cfg} $\ast$ {\em cfg})}}
\label{start_8h_a5}


Laundry list of LCB initializations. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p\-LCB}]pointer to hold Initialized LCB handle \item[{\em cfg}]Pointer to a LCB\_\-cfg structure containing configuration information \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]LCB\_\-OK \end{Desc}
\hypertarget{start_8h_a0}{
\index{start.h@{start.h}!powerOn@{powerOn}}
\index{powerOn@{powerOn}!start.h@{start.h}}
\subsubsection[powerOn]{\setlength{\rightskip}{0pt plus 5cm}int power\-On (LIOXs {\em slh}, unsigned {\em pri\-Mask}, unsigned {\em red\-Mask})}}
\label{start_8h_a0}


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

int power\-On (LIOXs slh, unsigned pri\-Mask, unsigned red\-Mask) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em pri\-Mask}]Bit mask indicating which components should be powered on by the PRIMARY PDU \item[{\em red\-Mask}]Bit mask indicating which components should be powered on by the REDUNDANT PDU \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on error \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) Function begins by verifying that the requested action would not result in simulataneously powering on a component from BOTH PDUs. The current state of the PDUs is considered, in addition to the contents of {\em pri\-Mask\/} and {\em red\-Mask\/}.

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

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

5) {\em pri\-Mask\/} and {\em red\-Mask\/} 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 PDU0 = 0x00010000 PDU1 = 0x00020000 GEM = 0x00040000 AEM = 0x00080000 EBM = 0x00100000 SIU0 = 0x01000000 SIU1 = 0x02000000 SIUx = 0x04000000 EPU0 = 0x08000000 EPU1 = 0x10000000 EPU2 = 0x20000000 