\hypertarget{BSET_8c}{
\section{BSET.c File Reference}
\label{BSET_8c}\index{BSET.c@{BSET.c}}
}
{\tt \#include \char`\"{}vx\-Works.h\char`\"{}}\par
{\tt \#include \char`\"{}stdlib.h\char`\"{}}\par
{\tt \#include \char`\"{}stdio.h\char`\"{}}\par
{\tt \#include \char`\"{}task\-Lib.h\char`\"{}}\par
{\tt \#include \char`\"{}sig\-Lib.h\char`\"{}}\par
{\tt \#include \char`\"{}sock\-Lib.h\char`\"{}}\par
{\tt \#include \char`\"{}netinet/in.h\char`\"{}}\par
{\tt \#include \char`\"{}BSYNC/BSYNC.h\char`\"{}}\par
{\tt \#include \char`\"{}BSYNC/BSET.h\char`\"{}}\par
{\tt \#include \char`\"{}BSYNC/BSET\_\-port.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{BSET_8c_a1}{BSET} (unsigned tx\-Rate)
\begin{CompactList}\small\item\em The BSET application main task entry function.\item\end{CompactList}\item 
int \hyperlink{BSET_8c_a2}{BSET\_\-init} (void)
\begin{CompactList}\small\item\em Initialize resources for BSET application.\item\end{CompactList}\item 
void \hyperlink{BSET_8c_a3}{BSET\_\-exit} (int signal)
\begin{CompactList}\small\item\em Cleanup resources for BSET application.\item\end{CompactList}\item 
int \hyperlink{BSET_8c_a4}{BSET\_\-start} (int task\-Pri, int stack\-Size, unsigned tx\-Rate)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
int \hyperlink{BSET_8c_a0}{BSET\_\-rate\-Sock} = -1
\end{CompactItemize}


\subsection{Detailed Description}




\subsection{Function Documentation}
\hypertarget{BSET_8c_a1}{
\index{BSET.c@{BSET.c}!BSET@{BSET}}
\index{BSET@{BSET}!BSET.c@{BSET.c}}
\subsubsection[BSET]{\setlength{\rightskip}{0pt plus 5cm}void BSET (unsigned {\em tx\-Rate})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BSET_8c_a1}


The BSET application main task entry function.

After initializing resources, the \hyperlink{BSET_8c_a1}{BSET}() task function runs forever, listening on the \hyperlink{BSET_8c_a0}{BSET\_\-rate\-Sock} socket for a new rate command word. Once received, the bit sync library function \hyperlink{BSYNC_8h_a7}{BSYNC\_\-configure}() is called to set the new bit rate in hardware.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
tx\-Rate}]The initial telemetry rate in bits / sec. \end{description}
\end{Desc}
\hypertarget{BSET_8c_a3}{
\index{BSET.c@{BSET.c}!BSET_exit@{BSET\_\-exit}}
\index{BSET_exit@{BSET\_\-exit}!BSET.c@{BSET.c}}
\subsubsection[BSET\_\-exit]{\setlength{\rightskip}{0pt plus 5cm}void BSET\_\-exit (int {\em signal})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BSET_8c_a3}


Cleanup resources for BSET application.

This function peforms the following actions to cleanup the BSET application after operation:

\begin{CompactItemize}
\item 
Closes the \hyperlink{BSET_8c_a0}{BSET\_\-rate\-Sock}.\item 
Calles exit() to stop the \hyperlink{BSET_8c_a1}{BSET}() task.\end{CompactItemize}
This function is called when signal SIGTERM is sent to task \hyperlink{BSET_8c_a1}{BSET}().\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
signal}]Ignored. \end{description}
\end{Desc}
\hypertarget{BSET_8c_a2}{
\index{BSET.c@{BSET.c}!BSET_init@{BSET\_\-init}}
\index{BSET_init@{BSET\_\-init}!BSET.c@{BSET.c}}
\subsubsection[BSET\_\-init]{\setlength{\rightskip}{0pt plus 5cm}int BSET\_\-init (void)\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BSET_8c_a2}


Initialize resources for BSET application.

This function peforms the following actions to setup the BSET application for operation:

\begin{CompactItemize}
\item 
Creates the \hyperlink{BSET_8c_a0}{BSET\_\-rate\-Sock} UDP socket.\item 
Binds \hyperlink{BSET_8c_a0}{BSET\_\-rate\-Sock} to port \hyperlink{BSET__port_8h_a0}{BSET\_\-RATE\_\-PORT}.\item 
Attaches the \hyperlink{BSET_8c_a3}{BSET\_\-exit}() function to the SIGTERM signal for the the BSET application task.\end{CompactItemize}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
0}]Success. \item[{\em 
-1}]Failure because a resource could not be created or initialized. \end{description}
\end{Desc}
\hypertarget{BSET_8c_a4}{
\index{BSET.c@{BSET.c}!BSET_start@{BSET\_\-start}}
\index{BSET_start@{BSET\_\-start}!BSET.c@{BSET.c}}
\subsubsection[BSET\_\-start]{\setlength{\rightskip}{0pt plus 5cm}int BSET\_\-start (int {\em task\-Pri}, int {\em stack\-Size}, unsigned {\em tx\-Rate})}}
\label{BSET_8c_a4}


Starts the \hyperlink{BSET_8c_a1}{BSET}() task running.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
task\-Pri}]The priority of the BIU application task. \item[{\em 
task\-Stack}]The stack size of the BIU application task. \item[{\em 
tx\-Rate}]The initial telemetry rate in bits / sec.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values: ]\par
\begin{description}
\item[{\em 
0}]Success. \item[{\em 
-1}]Failure. \end{description}
\end{Desc}


\subsection{Variable Documentation}
\hypertarget{BSET_8c_a0}{
\index{BSET.c@{BSET.c}!BSET_rateSock@{BSET\_\-rateSock}}
\index{BSET_rateSock@{BSET\_\-rateSock}!BSET.c@{BSET.c}}
\subsubsection[BSET\_\-rateSock]{\setlength{\rightskip}{0pt plus 5cm}int BSET\_\-rate\-Sock = -1\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{BSET_8c_a0}


A UDP/IP socket for receiving rate commands. 