\hypertarget{BFT_8h}{
\section{BFT.h File Reference}
\label{BFT_8h}\index{BFT.h@{BFT.h}}
}
Balloon Flight Trigger (low level), Interface. 


{\tt \#include \char`\"{}BTU/TEM\_\-ids.h\char`\"{}}\par
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef \hyperlink{struct__BFT__trg}{\_\-BFT\_\-trg} \hyperlink{BFT_8h_a0}{BFT\_\-trg}
\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__BFT__trg}{\_\-BFT\_\-trg}.\item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{BFT_8h_a1}{BFT\_\-configure} (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg, 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\-Trg, unsigned int ext\-Treq, unsigned int l1t\-In, unsigned int l1t\-Out, unsigned int hfull\-Enb, unsigned int hfull\-Clr, unsigned int l1t\-Tmr)
\begin{CompactList}\small\item\em Configures the triggering environment. $\backslash$oaram bft The trigger control structure.\item\end{CompactList}\item 
\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ \hyperlink{BFT_8h_a2}{BFT\_\-get} (void)
\begin{CompactList}\small\item\em Gets a pointer to the trigger control block.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a3}{BFT\_\-init} (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg, const struct \hyperlink{struct__BFM__dsc}{\_\-BFM\_\-dsc} $\ast$bfm, unsigned int tem\-List)
\begin{CompactList}\small\item\em Initializes the trigger control structures.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a4}{BFT\_\-nominate} (unsigned int tem\-List, const unsigned int $\ast$priority\-List)
\begin{CompactList}\small\item\em Nominates a TEM to be able to generate triggers.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a5}{BFT\_\-trg\-Tem\-Set} (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg, TEM\_\-tem\-Id tem\-Id)
\begin{CompactList}\small\item\em Sets the TEM to do self-triggering.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a6}{BFT\_\-global\-L1t\-Arm} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg)
\begin{CompactList}\small\item\em Arms the global trigger.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a7}{BFT\_\-global\-L1t\-Disarm} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg)
\begin{CompactList}\small\item\em Disarms the global trigger.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a8}{BFT\_\-global\-L1t\-Enable} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg)
\begin{CompactList}\small\item\em Enables the global trigger.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a9}{BFT\_\-global\-L1t\-Disable} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg)
\begin{CompactList}\small\item\em Disables the global trigger.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a10}{BFT\_\-burst\-Trigger} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg, unsigned int trg\-Cnt, unsigned int trg\-Delay)
\begin{CompactList}\small\item\em Issues {\em trg\-Cnt} triggers at a time interval of {\em trg\-Delay}.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a11}{BFT\_\-cyclic\-Trigger} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg, int cyclic\-Cnt, unsigned int cyclic\-Time, int burst\-Cnt, unsigned int burst\-Time)
\begin{CompactList}\small\item\em Issues {\em a} burst of triggers at a periodic rate.\item\end{CompactList}\item 
int \hyperlink{BFT_8h_a12}{BFT\_\-throttle\-Clr} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$trg, unsigned int tem\-List, const int $\ast$thresholds)
\begin{CompactList}\small\item\em Relieves the FIFO HALF throttling on TEMs that have occupancies that dip below a specified level.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a13}{BFT\_\-tems\-Cpu\-Bsy\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int cpu\-Bsy)
\begin{CompactList}\small\item\em Writes the CPU BSY bit for the select TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a14}{BFT\_\-tems\-Gbl\-L1t\-Arm\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int gbl\-L1t\-Arm)
\begin{CompactList}\small\item\em Writes the Global L1t Arm for the selected TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a15}{BFT\_\-tems\-Gbl\-L1t\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int gbl\-L1t\-Enb)
\begin{CompactList}\small\item\em Writes the Global L1t Enable for the selected TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a16}{BFT\_\-tems\-L1t\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Enb)
\begin{CompactList}\small\item\em Writes the L1T ENABLE bit for the select TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a17}{BFT\_\-tems\-L1t\-Tmr\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Tmr)
\begin{CompactList}\small\item\em Writes the L1T TMR bit for the select TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a18}{BFT\_\-tems\-Ext\-Treq\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int treq\-Enb)
\begin{CompactList}\small\item\em Writes the EXT TREQ ENABLE bit for the select TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a19}{BFT\_\-tems\-L1t\-In\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-In)
\begin{CompactList}\small\item\em Writes the L1T IN mask for the select TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a20}{BFT\_\-tems\-L1t\-Out\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Out)
\begin{CompactList}\small\item\em Writes the L1T OUT mask for the select TEMs.\item\end{CompactList}\item 
unsigned int \hyperlink{BFT_8h_a21}{BFT\_\-tems\-Treq\-Enb\-Write} (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$bft, unsigned int tem\-List, unsigned int l1t\-Tmr)
\begin{CompactList}\small\item\em Writes the TREQ ENABLE bit for the select TEMs.\item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Balloon Flight Trigger (low level), Interface.



\begin{Desc}
\item[Author: ]\par
JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}
BFT provides the basic routines to do trigger setup and query. This is not the part of the trigger that most people think of, it has only to do with very low level enables and mode bits. The setup of these bits is only dependent on hardware considerations such as which TEMs are in the system and which trigger paths (i.e. the triply redundant stuff) are to be enabled.



\subsection{Typedef Documentation}
\hypertarget{BFT_8h_a0}{
\index{BFT.h@{BFT.h}!BFT_trg@{BFT\_\-trg}}
\index{BFT_trg@{BFT\_\-trg}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-trg]{\setlength{\rightskip}{0pt plus 5cm}BFT\_\-trg}}
\label{BFT_8h_a0}


Typedef for struct \hyperlink{struct__BFT__trg}{\_\-BFT\_\-trg}.



 This mainly serves as a cache of information relevant to setting up the trigger and doing test triggering. The {\em meat} of the this structure is the array of pointers to the TEM trigger structure. This structure contains the address of relevant registers and the bit offsets needed to perform the various triggering functions.

A single TEM must appointed to issue self-generated triggers. A pointer to this TEM's trigger structure is assigned. Various trigger routines may use this information when generating triggers. 

\subsection{Function Documentation}
\hypertarget{BFT_8h_a10}{
\index{BFT.h@{BFT.h}!BFT_burstTrigger@{BFT\_\-burstTrigger}}
\index{BFT_burstTrigger@{BFT\_\-burstTrigger}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-burstTrigger]{\setlength{\rightskip}{0pt plus 5cm}int BFT\_\-burst\-Trigger (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em trg\-Cnt}, unsigned int {\em trg\-Delay})}}
\label{BFT_8h_a10}


Issues {\em trg\-Cnt} triggers at a time interval of {\em trg\-Delay}.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control structure. \item[{\em 
trg\-Cnt}]The number of triggers to issue. \item[{\em 
trg\-Delay}]The time interval, expressed in PTU's to wait between each trigger.\end{description}
\end{Desc}
The burst triggers are issued synchronously in a loop. Contrast this with the BFT\_\-cyclic\-Trigger which primes a watchdog timer to issue its triggers. \hypertarget{BFT_8h_a1}{
\index{BFT.h@{BFT.h}!BFT_configure@{BFT\_\-configure}}
\index{BFT_configure@{BFT\_\-configure}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-configure]{\setlength{\rightskip}{0pt plus 5cm}int BFT\_\-configure (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, const struct \hyperlink{struct__BFM__dsc}{\_\-BFM\_\-dsc} $\ast$ {\em bfm}, unsigned int {\em tem\-List}, unsigned int {\em l1t\-Enb}, unsigned int {\em treq\-Enb}, unsigned int {\em cpu\-Treq\-Enb}, unsigned int {\em ext\-Treq\-Enb}, unsigned int {\em l1t\-In}, unsigned int {\em l1t\-Out}, unsigned int {\em h\-Full\-Enb}, unsigned int {\em h\-Full\-Clr}, unsigned int {\em l1t\-Tmr})}}
\label{BFT_8h_a1}


Configures the triggering environment. $\backslash$oaram bft The trigger control structure.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfm}]The module description structure. \item[{\em 
tem\-List}]The list of TEMs to participate in the trigger. \item[{\em 
l1t\-Enb}]The list of TEMs which can generate an L1t. \item[{\em 
treq\-Enb}]The list of TEMS which will respond to an L1t. \item[{\em 
cpu\-Treq\-Enb}]A list of TEMs eligible to do the self triggering. More than TEM is selected, this routine will pick the 'best' candidate to do the triggering. \item[{\em 
ext\-Treq\-Enb}]A list of TEMs to enable the external TREQ input. \item[{\em 
l1t\-In}]The L1t In masks by TEM \item[{\em 
l1t\-Out}]The L1t Out masks by TEM \item[{\em 
hfull\-Enb}]The list of FPGAs to enable FIFO Half-Full Throttling on. \item[{\em 
hfull\-Clr}]The list of FPGAs to enable FIFO Half-Full Throttling manual-clear on. \item[{\em 
l1t\-Tmr}]The list of TEMs to enable the longer L1t timeout on. \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
0, if}]successful. \item[{\em 
-2, if}]list of self-triggering CPUs is inconsistent with whats available. \item[{\em 
-3, if}]the list is inconsistent with proper triggering. \item[{\em 
$>$0, a}]list of TEMs which could not be properly configured.\end{description}
\end{Desc}
This is a convenience routine to configure the triggering environment. All the parameters which are lists of TEMs/FPGAs may be specified as -1, in which case a sensible default is chosen.

This routine does some autoconfiguring if inputs are set to -1.

If {\em tem\-List} is specified as -1, then the list of READIED TEMs is used.

If {\em cpu\-Treq} = -1, then the best 'candidate' is chosen from the input list. The best candidate is 1. If only one TEM is chosen, then that's it. 2. If multiple TEMs are chosen, its the ACD if available. If the ACD is not available, then error.

If {\em cpu\-Treq} is a list of CPUs, the same rules apply, except in case 2, no error is returned, but no default self trigger is established.

If {\em l1t\-Enb} = -1, then the same rules apply as in the cpu\-Treq. If {\em l1t\-Enb} is a specific list, then you get what you chose. \hypertarget{BFT_8h_a11}{
\index{BFT.h@{BFT.h}!BFT_cyclicTrigger@{BFT\_\-cyclicTrigger}}
\index{BFT_cyclicTrigger@{BFT\_\-cyclicTrigger}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-cyclicTrigger]{\setlength{\rightskip}{0pt plus 5cm}int BFT\_\-cyclic\-Trigger (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, int {\em cyclic\-Cnt}, unsigned int {\em cyclic\-Time}, int {\em burst\-Cnt}, unsigned int {\em burst\-Time})}}
\label{BFT_8h_a11}


Issues {\em a} burst of triggers at a periodic rate.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control structure. \item[{\em 
cyclic\-Cnt}]The number of bursts to send \item[{\em 
cyclic\-Time}]The number of Vx\-Works ticks to wait between bursts. \item[{\em 
burst\-Cnt}]The number of triggers in each burst. \item[{\em 
burst\-Time}]The time interval, expressed in PTU's to wait between each trigger.\end{description}
\end{Desc}
This function issues a burst of {\em burst\-Cnt} triggers at a cyclic rate. The number of such bursts is controlled by {\em cyclic\-Cnt}. The time between bursts is specified by {\em cyclic\-Time} and the interval between each trigger in the burst is determined by burst\-Time.

\begin{Desc}
\item[Warning: ]\par
 Since the burst of triggers is controlled by spinning the CPU for the requisite amount of time, do not make the product of {\em burst\-Cnt} {\em burst\-Time} too long, ie $>$ $\sim$1-5msecs. \end{Desc}
\hypertarget{BFT_8h_a2}{
\index{BFT.h@{BFT.h}!BFT_get@{BFT\_\-get}}
\index{BFT_get@{BFT\_\-get}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-get]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ BFT\_\-get (void)}}
\label{BFT_8h_a2}


Gets a pointer to the trigger control block.

\begin{Desc}
\item[Returns: ]\par
The trigger control block. \end{Desc}
\hypertarget{BFT_8h_a6}{
\index{BFT.h@{BFT.h}!BFT_globalL1tArm@{BFT\_\-globalL1tArm}}
\index{BFT_globalL1tArm@{BFT\_\-globalL1tArm}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-globalL1tArm]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-global\-L1t\-Arm (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft})}}
\label{BFT_8h_a6}


Arms the global trigger.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
-1, there}]is no global trigger 0, the previous state was disabled 1, the previous state was enabled.\end{description}
\end{Desc}
If the system is being run is a single TEM mode, it is possible that there is no global trigger, hence the -1 return value. If there is a global trigger, the previous state (before modification) is returned. \hypertarget{BFT_8h_a9}{
\index{BFT.h@{BFT.h}!BFT_globalL1tDisable@{BFT\_\-globalL1tDisable}}
\index{BFT_globalL1tDisable@{BFT\_\-globalL1tDisable}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-globalL1tDisable]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-global\-L1t\-Disable (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft})}}
\label{BFT_8h_a9}


Disables the global trigger.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block.  \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
-1, there}]is no global trigger 0, the previous state was disabled 1, the previous state was enabled.\end{description}
\end{Desc}
If the system is being run is a single TEM mode, it is possible that there is no global trigger, hence the -1 return value. If there is a global trigger, the previous state (before modification) is returned. \hypertarget{BFT_8h_a7}{
\index{BFT.h@{BFT.h}!BFT_globalL1tDisarm@{BFT\_\-globalL1tDisarm}}
\index{BFT_globalL1tDisarm@{BFT\_\-globalL1tDisarm}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-globalL1tDisarm]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-global\-L1t\-Disarm (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft})}}
\label{BFT_8h_a7}


Disarms the global trigger.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
trg}]The trigger control block.  \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
-1, there}]is no global trigger. 0, the previous state was disabled 1, the previous state was enabled.\end{description}
\end{Desc}
If the system is being run is a single TEM mode, it is possible that there is no global trigger, hence the -1 return value. If there is a global trigger, the previous state (before modification) is returned. \hypertarget{BFT_8h_a8}{
\index{BFT.h@{BFT.h}!BFT_globalL1tEnable@{BFT\_\-globalL1tEnable}}
\index{BFT_globalL1tEnable@{BFT\_\-globalL1tEnable}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-globalL1tEnable]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-global\-L1t\-Enable (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft})}}
\label{BFT_8h_a8}


Enables the global trigger.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
-1, there}]is no global trigger 0, the previous state was disabled 1, the previous state was enabled.\end{description}
\end{Desc}
If the system is being run is a single TEM mode, it is possible that there is no global trigger, hence the -1 return value. If there is a global trigger, the previous state (before modification) is returned. \hypertarget{BFT_8h_a3}{
\index{BFT.h@{BFT.h}!BFT_init@{BFT\_\-init}}
\index{BFT_init@{BFT\_\-init}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-init]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-init (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, const struct \hyperlink{struct__BFM__dsc}{\_\-BFM\_\-dsc} $\ast$ {\em bfm}, unsigned int {\em tem\-List})}}
\label{BFT_8h_a3}


Initializes the trigger control structures.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfm}]The Balloon Flight Module Description \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
List of TEMs that were requested, but were unable to participate in the trigger.\end{Desc}
To be eligle to participate in the trigger, the TEM must be included in the configuration and present on the VME bus. \hypertarget{BFT_8h_a4}{
\index{BFT.h@{BFT.h}!BFT_nominate@{BFT\_\-nominate}}
\index{BFT_nominate@{BFT\_\-nominate}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-nominate]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-nominate (unsigned int {\em tem\-List}, const unsigned int $\ast$ {\em priority\-List})}}
\label{BFT_8h_a4}


Nominates a TEM to be able to generate triggers.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
tem\-List}]The list of candidate TEMs to chose from. \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
TEM\_\-C\_\-INV, if}]no good candidate could be found. \item[{\em 
The}]TEM id, if a good candidate could be found.\end{description}
\end{Desc}
Nominates a TEM to be the triggering TEM. The rules are easy. If there is only one TEM, that's the triggering TEM. If there is more than one TEM, then it must be the ACD. In the latter case, if the ACD is not in the configuration, then error. \hypertarget{BFT_8h_a13}{
\index{BFT.h@{BFT.h}!BFT_temsCpuBsyWrite@{BFT\_\-temsCpuBsyWrite}}
\index{BFT_temsCpuBsyWrite@{BFT\_\-temsCpuBsyWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsCpuBsyWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-Cpu\-Bsy\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em cpu\-Bsy})}}
\label{BFT_8h_a13}


Writes the CPU BSY bit for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask, to write. \item[{\em 
cpu\-Bsys}]The value to the CPU BSY bits, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the CPU BSY bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a CPU BSY mode or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tem\-Cpu\-Bsy\-Supported(), to get a list of the TEMs which support a CPU BSY. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are active. \hypertarget{BFT_8h_a18}{
\index{BFT.h@{BFT.h}!BFT_temsExtTreqEnbWrite@{BFT\_\-temsExtTreqEnbWrite}}
\index{BFT_temsExtTreqEnbWrite@{BFT\_\-temsExtTreqEnbWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsExtTreqEnbWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-Ext\-Treq\-Enb\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em treq\-Enb})}}
\label{BFT_8h_a18}


Writes the EXT TREQ ENABLE bit for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask, to write. \item[{\em 
treq\-Enb}]The value of the EXT TREQ ENABLE bits, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the EXT TREQ ENABLE bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a EXT TREQ ENABLE mode or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tems\-Ext\-Treq\-Enb\-Supported(), to get a list of the TEMs which support a EXT TREQ ENABLE. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are not active. \hypertarget{BFT_8h_a14}{
\index{BFT.h@{BFT.h}!BFT_temsGblL1tArmWrite@{BFT\_\-temsGblL1tArmWrite}}
\index{BFT_temsGblL1tArmWrite@{BFT\_\-temsGblL1tArmWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsGblL1tArmWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-Gbl\-L1t\-Arm\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em gbl\-L1t\-Arm})}}
\label{BFT_8h_a14}


Writes the Global L1t Arm for the selected TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask to write. \item[{\em 
gbl\-L1t\-Arm}]The value of the Global L1t Arm, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the GBL L1T ARM bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a GBL L1T ARM or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tems\-Gbl\-L1t\-Arm\-Supported(), to get a list of the TEMs which support a GBL L1T ARM. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are active. \hypertarget{BFT_8h_a15}{
\index{BFT.h@{BFT.h}!BFT_temsGblL1tEnbWrite@{BFT\_\-temsGblL1tEnbWrite}}
\index{BFT_temsGblL1tEnbWrite@{BFT\_\-temsGblL1tEnbWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsGblL1tEnbWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-Gbl\-L1t\-Enb\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em gbl\-L1t\-Arm})}}
\label{BFT_8h_a15}


Writes the Global L1t Enable for the selected TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask to write. \item[{\em 
gbl\-L1t\-Enb}]The value of the Global L1t Enable, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the GBL L1T Enable bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a GBL L1T ENB or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tems\-Gbl\-L1t\-Enb\-Supported(), to get a list of the TEMs which support a L1T ENABLE. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are active. \hypertarget{BFT_8h_a16}{
\index{BFT.h@{BFT.h}!BFT_temsL1tEnbWrite@{BFT\_\-temsL1tEnbWrite}}
\index{BFT_temsL1tEnbWrite@{BFT\_\-temsL1tEnbWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsL1tEnbWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-L1t\-Enb\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em l1t\-Enbs})}}
\label{BFT_8h_a16}


Writes the L1T ENABLE bit for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask, to write. \item[{\em 
l1t\-Enbs}]The value of the L1T ENABLE bits, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the L1T ENABLE bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a L1T ENABLE mode or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tems\-L1t\-Enb\-Supported(), to get a list of the TEMs which support a L1T ENABLE. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are active. \hypertarget{BFT_8h_a19}{
\index{BFT.h@{BFT.h}!BFT_temsL1tInWrite@{BFT\_\-temsL1tInWrite}}
\index{BFT_temsL1tInWrite@{BFT\_\-temsL1tInWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsL1tInWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-L1t\-In\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em l1t\-In})}}
\label{BFT_8h_a19}


Writes the L1T IN mask for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask to write. \item[{\em 
l1t\-In}]The value of the L1T IN mask , expressed as a bit mask. 3 bits/per TEM. This limits the number of TEMs that can be supported to 10. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the TREQ ENABLE bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM is incapable of having the L1T IN mask written to it. Currently all TEMs support this functionality, so the only failure mode is if the TEM is not in the ready state. The user may call \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to determine this. \hypertarget{BFT_8h_a20}{
\index{BFT.h@{BFT.h}!BFT_temsL1tOutWrite@{BFT\_\-temsL1tOutWrite}}
\index{BFT_temsL1tOutWrite@{BFT\_\-temsL1tOutWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsL1tOutWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-L1t\-Out\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em l1t\-Out})}}
\label{BFT_8h_a20}


Writes the L1T OUT mask for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block.  \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask to write. \item[{\em 
l1t\-Out}]The value of the L1T OUT mask , expressed as a bit mask. 3 bits/per TEM. This limits the number of TEMs that can be supported to 10. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the TREQ OUT mask could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM is incapable of having the L1T OUT mask written to it. Currently all TEMs support this functionality, so the only failure mode is if the TEM is not in the ready state. The user may call \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to determine this. \hypertarget{BFT_8h_a17}{
\index{BFT.h@{BFT.h}!BFT_temsL1tTmrWrite@{BFT\_\-temsL1tTmrWrite}}
\index{BFT_temsL1tTmrWrite@{BFT\_\-temsL1tTmrWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsL1tTmrWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-L1t\-Tmr\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em l1t\-Tmrs})}}
\label{BFT_8h_a17}


Writes the L1T TMR bit for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block. \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask, to write. \item[{\em 
l1t\-Enbs}]The value of the L1T TMR bits, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the L1T TMR bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a L1T TMR mode or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tems\-L1t\-Tmr\-Supported(), to get a list of the TEMs which support a L1T TMR. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are not active. \hypertarget{BFT_8h_a21}{
\index{BFT.h@{BFT.h}!BFT_temsTreqEnbWrite@{BFT\_\-temsTreqEnbWrite}}
\index{BFT_temsTreqEnbWrite@{BFT\_\-temsTreqEnbWrite}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-temsTreqEnbWrite]{\setlength{\rightskip}{0pt plus 5cm}unsigned int BFT\_\-tems\-Treq\-Enb\-Write (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, unsigned int {\em treq\-Enb})}}
\label{BFT_8h_a21}


Writes the TREQ ENABLE bit for the select TEMs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block.  \item[{\em 
tem\-List}]The set of target TEMs, expressed as a bit mask, to write. \item[{\em 
treq\-Enb}]The value of the TREQ ENABLE bits, expressed as a bit mask. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The TEMs for which the TREQ ENABLE bit could not be written. This is proper subset of {\em tem\-List}.\end{Desc}
A non-0 return value indicates either the TEM does not support a TREQ ENABLE mode or it is incapable of returning it. The most likely reason for the latter is that TEM is not loaded. One should call BFT\_\-tems\-Treq\-Enb\-Supported(), to get a list of the TEMs which support a TREQ ENABLE. and \hyperlink{BFM_8h_a24}{BFM\_\-tems\-Readied}() to get a list of the TEMs which are not active. \hypertarget{BFT_8h_a12}{
\index{BFT.h@{BFT.h}!BFT_throttleClr@{BFT\_\-throttleClr}}
\index{BFT_throttleClr@{BFT\_\-throttleClr}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-throttleClr]{\setlength{\rightskip}{0pt plus 5cm}BFT\_\-throttle\-Clr (const \hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, unsigned int {\em tem\-List}, const int $\ast$ {\em thresholds})}}
\label{BFT_8h_a12}


Relieves the FIFO HALF throttling on TEMs that have occupancies that dip below a specified level.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bfm}]The Balloon Flight Module Database handle. \item[{\em 
tem\-List}]The list of TEMs to consider. \item[{\em 
thresholds}]The occupancy threshold array. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
A bit mask of which TEMs have had there half full throttle relieved.\end{Desc}
The specified TEMs are scanned to determine which TEMs are in the fifo half full throttle mode. The current event occupancy of each  such TEM is then checked against the its corresponding occupancy threshold. If the occupancy is below this threshold, the half full throttle is relieved.

\begin{Desc}
\item[Warning: ]\par
 Unfortunately one cannot do the correct thing, which is compare against the actual FIFO byte occupancy. One is forced to try to convert occupancy in bytes to occupancy in event count. This  conversion is straightforward and unambigious for those subsystems  with a fixed length data, one merely multiples NEVTS $\ast$ sizeof (data) to get a byte count. Howerver for those with variable length data, all one can do is take an estimate. This estimate will likely be based on either the average event size or the maximum. To the extent that these are similar, no real problem, setting the occupancy  threshold is not an exacting task. But to the extent that there is a big spread between the two, well, life is hard... \end{Desc}
\hypertarget{BFT_8h_a5}{
\index{BFT.h@{BFT.h}!BFT_trgTemSet@{BFT\_\-trgTemSet}}
\index{BFT_trgTemSet@{BFT\_\-trgTemSet}!BFT.h@{BFT.h}}
\subsubsection[BFT\_\-trgTemSet]{\setlength{\rightskip}{0pt plus 5cm}int BFT\_\-trg\-Tem\-Set (\hyperlink{BFT_8h_a0}{BFT\_\-trg} $\ast$ {\em bft}, TEM\_\-tem\-Id {\em tem\-Id})}}
\label{BFT_8h_a5}


Sets the TEM to do self-triggering.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
bft}]The trigger control block.  \item[{\em 
tem\-Id}]The ID of the TEM \end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
0, if}]successful \item[{\em 
-1, if}]the selected TEM is cannot do the self-triggering.\end{description}
\end{Desc}
This routine selects the TEM can which can issue self-triggers. One and only one TEM should be selected to do this task. The only reason for failure is that the selected TEM either not in the system or it is in the proper state. It must have reached the READY state. 