\hypertarget{LCBT_8c}{
\section{LCBT.c File Reference}
\label{LCBT_8c}\index{LCBT.c@{LCBT.c}}
}
Basic init and misc public funcs for LCBT module.  


{\tt \#include $<$PBS/PBS.h$>$}\par
{\tt \#include $<$PBS/MBA.h$>$}\par
{\tt \#include $<$PBS/CACHE.h$>$}\par
{\tt \#include $<$MSG/MSG\_\-pubdefs.h$>$}\par
{\tt \#include $<$LCBT/LCBT\_\-initBoard.h$>$}\par
{\tt \#include $<$LCBT/LCBT.h$>$}\par
{\tt \#include $<$LCBT\_\-printf.h$>$}\par
{\tt \#include $<$trace.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{LCBT_8c_e40cfdebf673339c53847caa8af47f47}{LCBT\_\-init} (int latpAddr, int useRedundantPath, LCBD lcb)
\begin{CompactList}\small\item\em inits LCB driver (which starts 2 tasks associated with driver) \item\end{CompactList}\item 
int \hyperlink{LCBT_8c_3f3272e0ac34b5aca3d159da87b2c12f}{LCBT\_\-isInit} ()
\begin{CompactList}\small\item\em indicates if LCBT\_\-init has been run ok \item\end{CompactList}\item 
void \hyperlink{LCBT_8c_3ef8ad2e547d44d00d921562c022b7a2}{LCBT\_\-setOption} (unsigned int mask)
\begin{CompactList}\small\item\em set test option mask, see \hyperlink{LCBT_8h}{LCBT.h} for values \item\end{CompactList}\item 
void \hyperlink{LCBT_8c_d098b606037b7ace51e8cd1d26d73816}{LCBT\_\-stats} (int mask)
\begin{CompactList}\small\item\em print stats for LCB driver \item\end{CompactList}\item 
void \hyperlink{LCBT_8c_672b5565f962fa95fe4ffe768b091778}{LCBT\_\-clearStats} ()
\begin{CompactList}\small\item\em clear stats for LCB driver \item\end{CompactList}\item 
void \hyperlink{LCBT_8c_1fd40ba3040035b542c4108af81e76ee}{LCBT\_\-resetTest} (int numReqPer)
\begin{CompactList}\small\item\em special test for reset fix on FpgaLat=0x5d \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Basic init and misc public funcs for LCBT module. 

\begin{Desc}
\item[Author:]Ed Bacho -- \href{mailto:ebacho@slac.stanford.edu}{\tt ebacho@slac.stanford.edu} \end{Desc}


\subsection{Function Documentation}
\hypertarget{LCBT_8c_672b5565f962fa95fe4ffe768b091778}{
\index{LCBT.c@{LCBT.c}!LCBT\_\-clearStats@{LCBT\_\-clearStats}}
\index{LCBT\_\-clearStats@{LCBT\_\-clearStats}!LCBT.c@{LCBT.c}}
\subsubsection[{LCBT\_\-clearStats}]{\setlength{\rightskip}{0pt plus 5cm}void LCBT\_\-clearStats ()}}
\label{LCBT_8c_672b5565f962fa95fe4ffe768b091778}


clear stats for LCB driver 

\begin{Desc}
\item[Returns:]none \end{Desc}
\hypertarget{LCBT_8c_e40cfdebf673339c53847caa8af47f47}{
\index{LCBT.c@{LCBT.c}!LCBT\_\-init@{LCBT\_\-init}}
\index{LCBT\_\-init@{LCBT\_\-init}!LCBT.c@{LCBT.c}}
\subsubsection[{LCBT\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}int LCBT\_\-init (int {\em latpAddr}, \/  int {\em useRedundantPath}, \/  LCBD {\em lcb})}}
\label{LCBT_8c_e40cfdebf673339c53847caa8af47f47}


inits LCB driver (which starts 2 tasks associated with driver) 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em latpAddr}]LATp addr to assign to this board \item[{\em useRedundantPath}]0=primary path, 1=redundant path \item[{\em lcb}]lcbd driver handle is driver if already init (use LCBD\_\-get()), if 0 will load driver \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0=sucess else indicates errors in init This routine inits the LCBT module and optionaly load the LCBD driver. It must be called once after boot to setup the LCBT module for tests. \end{Desc}


References LCBT\_\-eventInit(), LCBT\_\-initBoard(), and LCBT\_\-printInit().\hypertarget{LCBT_8c_3f3272e0ac34b5aca3d159da87b2c12f}{
\index{LCBT.c@{LCBT.c}!LCBT\_\-isInit@{LCBT\_\-isInit}}
\index{LCBT\_\-isInit@{LCBT\_\-isInit}!LCBT.c@{LCBT.c}}
\subsubsection[{LCBT\_\-isInit}]{\setlength{\rightskip}{0pt plus 5cm}int LCBT\_\-isInit ()}}
\label{LCBT_8c_3f3272e0ac34b5aca3d159da87b2c12f}


indicates if LCBT\_\-init has been run ok 

\begin{Desc}
\item[Returns:]0=not init, 1=been init \end{Desc}
\hypertarget{LCBT_8c_1fd40ba3040035b542c4108af81e76ee}{
\index{LCBT.c@{LCBT.c}!LCBT\_\-resetTest@{LCBT\_\-resetTest}}
\index{LCBT\_\-resetTest@{LCBT\_\-resetTest}!LCBT.c@{LCBT.c}}
\subsubsection[{LCBT\_\-resetTest}]{\setlength{\rightskip}{0pt plus 5cm}void LCBT\_\-resetTest (int {\em numReqPer})}}
\label{LCBT_8c_1fd40ba3040035b542c4108af81e76ee}


special test for reset fix on FpgaLat=0x5d 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em numReqPer}]num of read for each of 4 part test \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]nothing This test was developed to reproduce a problem seen with LatFpga $<$ 0x5d on the cPci LCB board. The problem was that the discrete fifo's failed to be reset properly if there was no 20 MHz clock from the GASU (i.e. GASU was not yet powered up).\end{Desc}
This test requires USER INTERACTION to turn off/on the 20 MHz clock (usually by powering the GASU on and off).

The fix in LatFpga=0x5d allows this test to run sucessfully without errors. 

References LCBT\_\-readResultQ(), LCBT\_\-writeCsr(), LCBT\_\-writeIrq(), and PRINTF.\hypertarget{LCBT_8c_3ef8ad2e547d44d00d921562c022b7a2}{
\index{LCBT.c@{LCBT.c}!LCBT\_\-setOption@{LCBT\_\-setOption}}
\index{LCBT\_\-setOption@{LCBT\_\-setOption}!LCBT.c@{LCBT.c}}
\subsubsection[{LCBT\_\-setOption}]{\setlength{\rightskip}{0pt plus 5cm}void LCBT\_\-setOption (unsigned int {\em mask})}}
\label{LCBT_8c_3ef8ad2e547d44d00d921562c022b7a2}


set test option mask, see \hyperlink{LCBT_8h}{LCBT.h} for values 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mask}]mask of tests options \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none \end{Desc}
\hypertarget{LCBT_8c_d098b606037b7ace51e8cd1d26d73816}{
\index{LCBT.c@{LCBT.c}!LCBT\_\-stats@{LCBT\_\-stats}}
\index{LCBT\_\-stats@{LCBT\_\-stats}!LCBT.c@{LCBT.c}}
\subsubsection[{LCBT\_\-stats}]{\setlength{\rightskip}{0pt plus 5cm}void LCBT\_\-stats (int {\em mask})}}
\label{LCBT_8c_d098b606037b7ace51e8cd1d26d73816}


print stats for LCB driver 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mask}]0=all,1=ISR,2=rst,4=evt,8=time \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]none \end{Desc}
