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


{\tt \#include \char`\"{}DUTIL/start.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB\_\-cfg\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/MBA.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/FORK.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/TASK.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/FPA.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-log.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-init.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-io.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-dispatch.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-err.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-bulk.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LCB\_\-reg.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-init.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-sys.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-sync.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-cmd.h\char`\"{}}\par
{\tt \#include \char`\"{}LCB/LIOX\_\-addr.h\char`\"{}}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$string.h$>$}\par


Include dependency graph for start.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=184pt]{start_8c__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{start_8c_a0}{\_\-printf}(format, args...)
\begin{CompactList}\small\item\em Provide printf-like functionality. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{start_8c_a1}{use\-Other\-LATp} (LCB lcb, LIOXs slh)
\begin{CompactList}\small\item\em Invert the command and event path bits in the configuration registers of the LCB (change to the other LATp fabric) Note that the switching is order dependant. Change the command path first, then change the event path. \item\end{CompactList}\item 
void \hyperlink{start_8c_a2}{use\-Primary\-LATp} (LCB lcb, LIOXs slh)
\begin{CompactList}\small\item\em Clear the C/R and event path bits Note that the switching is order dependant. Change the command path first, then change the event path. \item\end{CompactList}\item 
void \hyperlink{start_8c_a3}{use\-Redundant\-LATp} (LCB lcb, LIOXs slh)
\begin{CompactList}\small\item\em Set the C/R and event path bits Note that the switching is order dependant. Change the command path first, then change the event path. \item\end{CompactList}\item 
unsigned \hyperlink{start_8c_a4}{get\-EPUaddr} (LIOXs slh)
\begin{CompactList}\small\item\em Returns address to use in the event contributions. \item\end{CompactList}\item 
unsigned int \hyperlink{start_8c_a5}{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 int \hyperlink{start_8c_a6}{t\_\-LCB\_\-drain\-Q} (LCB lcb)
\begin{CompactList}\small\item\em Drains the result and event hardware FIFOs. \item\end{CompactList}\item 
unsigned \hyperlink{start_8c_a7}{LCB\_\-startup} (LCB $\ast$p\-LCB, \hyperlink{struct__LCB__cfg}{LCB\_\-cfg} $\ast$cfg)
\begin{CompactList}\small\item\em Laundry list of LCB initializations. \item\end{CompactList}\item 
unsigned \hyperlink{start_8c_a8}{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_8c_a9}{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{Define Documentation}
\hypertarget{start_8c_a0}{
\index{start.c@{start.c}!_printf@{\_\-printf}}
\index{_printf@{\_\-printf}!start.c@{start.c}}
\subsubsection[\_\-printf]{\setlength{\rightskip}{0pt plus 5cm}\#define \_\-printf(format, args...)}}
\label{start_8c_a0}


{\bf Value:}

\footnotesize\begin{verbatim}printf ( __FUNCTION__"():%05d "format".\n" , __LINE__ , ## args); \
          fflush ( stdout);
\end{verbatim}\normalsize 
Provide printf-like functionality. 



\subsection{Function Documentation}
\hypertarget{start_8c_a5}{
\index{start.c@{start.c}!createSLH@{createSLH}}
\index{createSLH@{createSLH}!start.c@{start.c}}
\subsubsection[createSLH]{\setlength{\rightskip}{0pt plus 5cm}unsigned int create\-SLH (LCB {\em lcb}, LIOXs $\ast$ {\em slh})}}
\label{start_8c_a5}


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_8c_a4}{
\index{start.c@{start.c}!getEPUaddr@{getEPUaddr}}
\index{getEPUaddr@{getEPUaddr}!start.c@{start.c}}
\subsubsection[getEPUaddr]{\setlength{\rightskip}{0pt plus 5cm}unsigned get\-EPUaddr (LIOXs {\em slh})}}
\label{start_8c_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_8c_a9}{
\index{start.c@{start.c}!LCB_demote@{LCB\_\-demote}}
\index{LCB_demote@{LCB\_\-demote}!start.c@{start.c}}
\subsubsection[LCB\_\-demote]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCB\_\-demote (LIOXs {\em slh})}}
\label{start_8c_a9}


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_8c_a8}{
\index{start.c@{start.c}!LCB_promote@{LCB\_\-promote}}
\index{LCB_promote@{LCB\_\-promote}!start.c@{start.c}}
\subsubsection[LCB\_\-promote]{\setlength{\rightskip}{0pt plus 5cm}unsigned LCB\_\-promote (LIOXs {\em slh})}}
\label{start_8c_a8}


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_8c_a7}{
\index{start.c@{start.c}!LCB_startup@{LCB\_\-startup}}
\index{LCB_startup@{LCB\_\-startup}!start.c@{start.c}}
\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_8c_a7}


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_8c_a7_cgraph}
\end{center}
\end{figure}
\hypertarget{start_8c_a6}{
\index{start.c@{start.c}!t_LCB_drainQ@{t\_\-LCB\_\-drainQ}}
\index{t_LCB_drainQ@{t\_\-LCB\_\-drainQ}!start.c@{start.c}}
\subsubsection[t\_\-LCB\_\-drainQ]{\setlength{\rightskip}{0pt plus 5cm}unsigned int t\_\-LCB\_\-drain\-Q (LCB {\em lcb})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{start_8c_a6}


Drains the result and event hardware FIFOs. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lcb}]Initialized LCB handle \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]LCB\_\-OK \end{Desc}
\hypertarget{start_8c_a1}{
\index{start.c@{start.c}!useOtherLATp@{useOtherLATp}}
\index{useOtherLATp@{useOtherLATp}!start.c@{start.c}}
\subsubsection[useOtherLATp]{\setlength{\rightskip}{0pt plus 5cm}void use\-Other\-LATp (LCB {\em lcb}, LIOXs {\em slh})}}
\label{start_8c_a1}


Invert the command and event path bits in the configuration registers of the LCB (change to the other LATp fabric) Note that the switching is order dependant. Change the command path first, then change the event path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lcb}]Pointer to the LCB \item[{\em slh}]Synchronous LIOX handle \end{description}
\end{Desc}
\hypertarget{start_8c_a2}{
\index{start.c@{start.c}!usePrimaryLATp@{usePrimaryLATp}}
\index{usePrimaryLATp@{usePrimaryLATp}!start.c@{start.c}}
\subsubsection[usePrimaryLATp]{\setlength{\rightskip}{0pt plus 5cm}void use\-Primary\-LATp (LCB {\em lcb}, LIOXs {\em slh})}}
\label{start_8c_a2}


Clear the C/R and event path bits Note that the switching is order dependant. Change the command path first, then change the event path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lcb}]Pointer to the LCB \item[{\em slh}]Synchronous LIOX handle \end{description}
\end{Desc}
\hypertarget{start_8c_a3}{
\index{start.c@{start.c}!useRedundantLATp@{useRedundantLATp}}
\index{useRedundantLATp@{useRedundantLATp}!start.c@{start.c}}
\subsubsection[useRedundantLATp]{\setlength{\rightskip}{0pt plus 5cm}void use\-Redundant\-LATp (LCB {\em lcb}, LIOXs {\em slh})}}
\label{start_8c_a3}


Set the C/R and event path bits Note that the switching is order dependant. Change the command path first, then change the event path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em lcb}]Pointer to the LCB \item[{\em slh}]Synchronous LIOX handle \end{description}
\end{Desc}
