\hypertarget{BFT_8c}{
\section{BFT.c File Reference}
\label{BFT_8c}\index{BFT.c@{BFT.c}}
}
Balloon Flight Trigger, Implementation. 


{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$task\-Lib.h$>$}\par
{\tt \#include \char`\"{}BBC/SPIN.h\char`\"{}}\par
{\tt \#include \char`\"{}BBC/INT.ih\char`\"{}}\par
{\tt \#include \char`\"{}BTU/TEM\_\-tem\-Int.h\char`\"{}}\par
{\tt \#include \char`\"{}BFU/BFM.h\char`\"{}}\par
{\tt \#include \char`\"{}BFU/BFT.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__BFT__trg}{\_\-BFT\_\-trg}
\begin{CompactList}\small\item\em Structure to contain information related to triggering.\item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{BFT_8c_a0}{
\index{BFT_M_NEVTS_HALF_FULL@{BFT\_\-M\_\-NEVTS\_\-HALF\_\-FULL}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_M_NEVTS_HALF_FULL@{BFT\_\-M\_\-NEVTS\_\-HALF\_\-FULL}}
\#define \hyperlink{BFT_8c_a0}{BFT\_\-M\_\-NEVTS\_\-HALF\_\-FULL}\ 0x4000}
\label{BFT_8c_a0}

\begin{CompactList}\small\item\em The bit mask for the FIFO HALF FULL sticky bit.\item\end{CompactList}\item 
\hypertarget{BFT_8c_a1}{
\index{BFT_M_NEVTS_COUNT@{BFT\_\-M\_\-NEVTS\_\-COUNT}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_M_NEVTS_COUNT@{BFT\_\-M\_\-NEVTS\_\-COUNT}}
\#define \hyperlink{BFT_8c_a1}{BFT\_\-M\_\-NEVTS\_\-COUNT}\ 0x07ff}
\label{BFT_8c_a1}

\begin{CompactList}\small\item\em The bit mask for projecting out the number of events. Each TEM implements a different maximum number, but the width of the nevents field is always 11 bits,.\item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hypertarget{BFT_8c_a3}{
\index{BFT_cyclicTrigger@{BFT\_\-cyclicTrigger}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_cyclicTrigger@{BFT\_\-cyclic\-Trigger}}
int {\bf BFT\_\-cyclic\-Trigger} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, int cyclic\-Cnt, unsigned int cyclic\-Time, int burst\-Cnt, unsigned int burst\-Time)}
\label{BFT_8c_a3}

\item 
\hypertarget{BFT_8c_a4}{
\index{BFT_burstTrigger@{BFT\_\-burstTrigger}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_burstTrigger@{BFT\_\-burst\-Trigger}}
int {\bf BFT\_\-burst\-Trigger} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int trg\-Cnt, unsigned int trg\-Delay)}
\label{BFT_8c_a4}

\item 
\hypertarget{BFT_8c_a5}{
\index{BFT_configure@{BFT\_\-configure}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_configure@{BFT\_\-configure}}
int {\bf BFT\_\-configure} (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, const struct \hyperlink{struct__BFM__dsc}{\_\-BFM\_\-dsc} $\ast$bfm, unsigned int tem\-List, unsigned int l1t\-Enb, unsigned int treq\-Enb, unsigned int cpu\-Treq\-Enb, unsigned int ext\-Treq\-Enb, unsigned int l1t\-In, unsigned int l1t\-Out, unsigned int hfull\-Enb, unsigned int hfull\-Clr, unsigned int l1t\-Tmr)}
\label{BFT_8c_a5}

\item 
\hypertarget{BFT_8c_a6}{
\index{BFT_get@{BFT\_\-get}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_get@{BFT\_\-get}}
\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\bf BFT\_\-get} (void)}
\label{BFT_8c_a6}

\item 
\hypertarget{BFT_8c_a7}{
\index{BFT_globalL1tArm@{BFT\_\-globalL1tArm}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_globalL1tArm@{BFT\_\-global\-L1t\-Arm}}
int {\bf BFT\_\-global\-L1t\-Arm} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft)}
\label{BFT_8c_a7}

\item 
\hypertarget{BFT_8c_a8}{
\index{BFT_globalL1tDisarm@{BFT\_\-globalL1tDisarm}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_globalL1tDisarm@{BFT\_\-global\-L1t\-Disarm}}
int {\bf BFT\_\-global\-L1t\-Disarm} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft)}
\label{BFT_8c_a8}

\item 
\hypertarget{BFT_8c_a9}{
\index{BFT_globalL1tDisable@{BFT\_\-globalL1tDisable}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_globalL1tDisable@{BFT\_\-global\-L1t\-Disable}}
int {\bf BFT\_\-global\-L1t\-Disable} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft)}
\label{BFT_8c_a9}

\item 
\hypertarget{BFT_8c_a10}{
\index{BFT_globalL1tEnable@{BFT\_\-globalL1tEnable}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_globalL1tEnable@{BFT\_\-global\-L1t\-Enable}}
int {\bf BFT\_\-global\-L1t\-Enable} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft)}
\label{BFT_8c_a10}

\item 
\hypertarget{BFT_8c_a11}{
\index{BFT_init@{BFT\_\-init}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_init@{BFT\_\-init}}
unsigned int {\bf BFT\_\-init} (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, const struct \hyperlink{struct__BFM__dsc}{\_\-BFM\_\-dsc} $\ast$bfm, unsigned int tem\-List)}
\label{BFT_8c_a11}

\item 
\hypertarget{BFT_8c_a12}{
\index{BFT_temsCpuBsyWrite@{BFT\_\-temsCpuBsyWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsCpuBsyWrite@{BFT\_\-tems\-Cpu\-Bsy\-Write}}
unsigned int {\bf BFT\_\-tems\-Cpu\-Bsy\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int cpu\-Bsy)}
\label{BFT_8c_a12}

\item 
\hypertarget{BFT_8c_a13}{
\index{BFT_temsGblL1tArmWrite@{BFT\_\-temsGblL1tArmWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsGblL1tArmWrite@{BFT\_\-tems\-Gbl\-L1t\-Arm\-Write}}
unsigned int {\bf BFT\_\-tems\-Gbl\-L1t\-Arm\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int gbl\-L1t\-Arm)}
\label{BFT_8c_a13}

\item 
\hypertarget{BFT_8c_a14}{
\index{BFT_temsGblL1tEnbWrite@{BFT\_\-temsGblL1tEnbWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsGblL1tEnbWrite@{BFT\_\-tems\-Gbl\-L1t\-Enb\-Write}}
unsigned int {\bf BFT\_\-tems\-Gbl\-L1t\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int gbl\-L1t\-Enb)}
\label{BFT_8c_a14}

\item 
\hypertarget{BFT_8c_a15}{
\index{BFT_temsL1tEnbWrite@{BFT\_\-temsL1tEnbWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsL1tEnbWrite@{BFT\_\-tems\-L1t\-Enb\-Write}}
unsigned int {\bf BFT\_\-tems\-L1t\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Enb)}
\label{BFT_8c_a15}

\item 
\hypertarget{BFT_8c_a16}{
\index{BFT_temsL1tTmrWrite@{BFT\_\-temsL1tTmrWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsL1tTmrWrite@{BFT\_\-tems\-L1t\-Tmr\-Write}}
unsigned int {\bf BFT\_\-tems\-L1t\-Tmr\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Tmr)}
\label{BFT_8c_a16}

\item 
\hypertarget{BFT_8c_a17}{
\index{BFT_temsExtTreqEnbWrite@{BFT\_\-temsExtTreqEnbWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsExtTreqEnbWrite@{BFT\_\-tems\-Ext\-Treq\-Enb\-Write}}
unsigned int {\bf BFT\_\-tems\-Ext\-Treq\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int treq\-Enb)}
\label{BFT_8c_a17}

\item 
\hypertarget{BFT_8c_a18}{
\index{BFT_temsL1tInWrite@{BFT\_\-temsL1tInWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsL1tInWrite@{BFT\_\-tems\-L1t\-In\-Write}}
unsigned int {\bf BFT\_\-tems\-L1t\-In\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-In)}
\label{BFT_8c_a18}

\item 
\hypertarget{BFT_8c_a19}{
\index{BFT_temsL1tOutWrite@{BFT\_\-temsL1tOutWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsL1tOutWrite@{BFT\_\-tems\-L1t\-Out\-Write}}
unsigned int {\bf BFT\_\-tems\-L1t\-Out\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Out)}
\label{BFT_8c_a19}

\item 
\hypertarget{BFT_8c_a20}{
\index{BFT_temsTreqEnbWrite@{BFT\_\-temsTreqEnbWrite}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_temsTreqEnbWrite@{BFT\_\-tems\-Treq\-Enb\-Write}}
unsigned int {\bf BFT\_\-tems\-Treq\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int treq\-Enb)}
\label{BFT_8c_a20}

\item 
\hypertarget{BFT_8c_a21}{
\index{BFT_trgTemSet@{BFT\_\-trgTemSet}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_trgTemSet@{BFT\_\-trg\-Tem\-Set}}
int {\bf BFT\_\-trg\-Tem\-Set} (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, TEM\_\-tem\-Id tem\-Id)}
\label{BFT_8c_a21}

\item 
\hypertarget{BFT_8c_a22}{
\index{BFT_nominate@{BFT\_\-nominate}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_nominate@{BFT\_\-nominate}}
unsigned int {\bf BFT\_\-nominate} (unsigned int tem\-List, const unsigned int $\ast$priority\-List)}
\label{BFT_8c_a22}

\item 
\hypertarget{BFT_8c_a23}{
\index{BFT_throttleClr@{BFT\_\-throttleClr}!BFT.c@{BFT.c}}\index{BFT.c@{BFT.c}!BFT_throttleClr@{BFT\_\-throttle\-Clr}}
int {\bf BFT\_\-throttle\-Clr} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, const int $\ast$thresholds)}
\label{BFT_8c_a23}

\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
const unsigned int \hyperlink{BFT_8c_a2}{Bft\_\-Trigger\-Priority\-List} \mbox{[}TEM\_\-C\_\-CNT\mbox{]}
\begin{CompactList}\small\item\em Any array of TEM ids, arranged by priority of perference of which TEM to use as the CPU trigger generator.\item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Balloon Flight Trigger, Implementation.



\begin{Desc}
\item[Author: ]\par
JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\subsection{Variable Documentation}
\hypertarget{BFT_8c_a2}{
\index{BFT.c@{BFT.c}!Bft_TriggerPriorityList@{Bft\_\-TriggerPriorityList}}
\index{Bft_TriggerPriorityList@{Bft\_\-TriggerPriorityList}!BFT.c@{BFT.c}}
\subsubsection[Bft\_\-TriggerPriorityList]{\setlength{\rightskip}{0pt plus 5cm}Bft\_\-Trigger\-Priority\-List}}
\label{BFT_8c_a2}


{\bf Initial value:}

\footnotesize\begin{verbatim}
{
    TEM_C_LTC,
    TEM_C_CAL,
    TEM_C_TKR,
    TEM_C_ACD
}\end{verbatim}\normalsize 
Any array of TEM ids, arranged by priority of perference of which TEM to use as the CPU trigger generator.



 The first TEM which appears in the list which is also a member of the active list is select as the TEM which generates a CPU trigger 