\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/LIOX\_\-sync\_\-handle.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB.h\char`\"{}}\par


Include dependency graph for start.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=194pt]{start_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=37pt]{start_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{start_8h_a0}{power\-On} (LIOXs slh, unsigned pri\-Mask, unsigned red\-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{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 
int \hyperlink{start_8h_a3}{power\-On\_\-load} (LIOXs slh, unsigned tem\-Mask, unsigned delay)
\begin{CompactList}\small\item\em Power on the CAL and TRK. \item\end{CompactList}\item 
unsigned \hyperlink{start_8h_a4}{get\-EPUaddr} (LIOXs slh)
\begin{CompactList}\small\item\em Returns address to use in the event contributions. \item\end{CompactList}\item 
int \hyperlink{start_8h_a5}{add\-TEM} (LIOXs slh, unsigned tem\-ID, unsigned red\-PDU)
\begin{CompactList}\small\item\em Power on a TEM and configure it along with the CRU and EBM. \item\end{CompactList}\item 
int \hyperlink{start_8h_a6}{remove\-TEM} (LIOXs slh, unsigned tem\-ID)
\begin{CompactList}\small\item\em Power off a TEM and remove it from the CRU and EBM configurations. \item\end{CompactList}\item 
int \hyperlink{start_8h_a7}{add\-EPU} (LIOXs slh, unsigned epu\-ID, unsigned red\-PDU)
\begin{CompactList}\small\item\em Power on an EPU and configure it along with the CRU and EBM. \item\end{CompactList}\item 
int \hyperlink{start_8h_a8}{remove\-EPU} (LIOXs slh, unsigned epu\-ID)
\begin{CompactList}\small\item\em Power off an EPU and remove it from the CRU and EBM configurations. \item\end{CompactList}\item 
unsigned \hyperlink{start_8h_a9}{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_a10}{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}\item 
unsigned \hyperlink{start_8h_a11}{LCB\_\-promote} (LIOXs slh)
\begin{CompactList}\small\item\em Assert the LCB commander wire - field promotion from SLAVE to COMMANDER. \item\end{CompactList}\item 
unsigned \hyperlink{start_8h_a12}{LCB\_\-demote} (LIOXs slh)
\begin{CompactList}\small\item\em De-assert the LCB commander wire. \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_a7}{
\index{start.h@{start.h}!addEPU@{addEPU}}
\index{addEPU@{addEPU}!start.h@{start.h}}
\subsubsection[addEPU]{\setlength{\rightskip}{0pt plus 5cm}int add\-EPU (LIOXs {\em slh}, unsigned {\em epu\-ID}, unsigned {\em red\-PDU})}}
\label{start_8h_a7}


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 red\-PDU}]0 -$>$ use Primary PDU, 1 -$>$ use Redundant PDU \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
\hypertarget{start_8h_a5}{
\index{start.h@{start.h}!addTEM@{addTEM}}
\index{addTEM@{addTEM}!start.h@{start.h}}
\subsubsection[addTEM]{\setlength{\rightskip}{0pt plus 5cm}int add\-TEM (LIOXs {\em slh}, unsigned {\em tem\-ID}, unsigned {\em red\-PDU})}}
\label{start_8h_a5}


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 red\-PDU}]0 -$>$ use Primary PDU, 1 -$>$ use Redundant PDU \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
\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_8c_a5}{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{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_8c_a6}{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_a9}{
\index{start.h@{start.h}!createSLH@{createSLH}}
\index{createSLH@{createSLH}!start.h@{start.h}}
\subsubsection[createSLH]{\setlength{\rightskip}{0pt plus 5cm}unsigned int create\-SLH (LCB {\em lcb}, LIOXs $\ast$ {\em slh})}}
\label{start_8h_a9}


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


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_a12}{
\index{start.h@{start.h}!LCB_demote@{LCB\_\-demote}}
\index{LCB_demote@{LCB\_\-demote}!start.h@{start.h}}
\subsubsection[LCB\_\-demote]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCB\_\-demote (LIOXs {\em slh})}}
\label{start_8h_a12}


De-assert the LCB commander wire. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status of the CSR write \end{Desc}
\hypertarget{start_8h_a11}{
\index{start.h@{start.h}!LCB_promote@{LCB\_\-promote}}
\index{LCB_promote@{LCB\_\-promote}!start.h@{start.h}}
\subsubsection[LCB\_\-promote]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCB\_\-promote (LIOXs {\em slh})}}
\label{start_8h_a11}


Assert the LCB commander wire - field promotion from SLAVE to COMMANDER. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Status of the CSR write \end{Desc}
\hypertarget{start_8h_a10}{
\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_a10}


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}


Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=125pt]{start_8h_a10_cgraph}
\end{center}
\end{figure}
\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}void power\-On (LIOXs {\em slh}, unsigned {\em pri\-Mask}, unsigned {\em red\-Mask}, unsigned {\em delay})}}
\label{start_8h_a0}


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

void power\-On (LIOXs slh, unsigned pri\-Mask, unsigned red\-Mask, unsigned delay) \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 \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 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 GEM = 0x00010000 AEM = 0x00020000 EBM = 0x00040000 PDU0 = 0x00080000 PDU1 = 0x00100000 SIUx = 0x01000000 SIU0 = 0x02000000 SIU1 = 0x04000000 EPU0 = 0x08000000 EPU1 = 0x10000000 EPU2 = 0x20000000 \hypertarget{start_8h_a3}{
\index{start.h@{start.h}!powerOn_load@{powerOn\_\-load}}
\index{powerOn_load@{powerOn\_\-load}!start.h@{start.h}}
\subsubsection[powerOn\_\-load]{\setlength{\rightskip}{0pt plus 5cm}int power\-On\_\-load (LIOXs {\em slh}, unsigned {\em tem\-Mask}, unsigned {\em delay})}}
\label{start_8h_a3}


Power on the CAL and TRK. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em slh}]Synchronous LIOX handle \item[{\em tem\-Mask}]Bitmask indicating the load boards to power \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{start_8h_a8}{
\index{start.h@{start.h}!removeEPU@{removeEPU}}
\index{removeEPU@{removeEPU}!start.h@{start.h}}
\subsubsection[removeEPU]{\setlength{\rightskip}{0pt plus 5cm}int remove\-EPU (LIOXs {\em slh}, unsigned {\em epu\-ID})}}
\label{start_8h_a8}


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 \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
\hypertarget{start_8h_a6}{
\index{start.h@{start.h}!removeTEM@{removeTEM}}
\index{removeTEM@{removeTEM}!start.h@{start.h}}
\subsubsection[removeTEM]{\setlength{\rightskip}{0pt plus 5cm}int remove\-TEM (LIOXs {\em slh}, unsigned {\em tem\-ID})}}
\label{start_8h_a6}


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 \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 if successful, -1 if failed \end{Desc}
