\hypertarget{bndl_8c}{
\section{bndl.c File Reference}
\label{bndl_8c}\index{bndl.c@{bndl.c}}
}
Implements the channel bundle methods.  


{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}GNAT/gnat.h\char`\"{}}\par
{\tt \#include \char`\"{}GNAT/bndl.h\char`\"{}}\par
{\tt \#include \char`\"{}gnat\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}GNAT/log.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{bndl_8c_a0}{
\#define \hyperlink{bndl_8c_a0}{BNDL\_\-DATA}(p)\ ((unsigned short int $\ast$)(p $\rightarrow$ m\_\-bndl\-Data))}
\label{bndl_8c_a0}

\begin{CompactList}\small\item\em Accessor macro to bundle data. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{bndl_8c_a1}{g\-Bndl\-Clear} (\hyperlink{struct__gnat}{gnat\-Handle} gh)
\begin{CompactList}\small\item\em zeroes out the bundle array \item\end{CompactList}\item 
int \hyperlink{bndl_8c_a2}{g\-Bndl\-Get\-Depth} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int $\ast$depth)
\begin{CompactList}\small\item\em Returns the depth of the bunlde {\em bh\/} in the pointer {\em depth\/}. \item\end{CompactList}\item 
int \hyperlink{bndl_8c_a3}{g\-Bndl\-Add\-Chnl} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned char chnl\-Num, unsigned int n\-Chnl\-Data, unsigned int $\ast$p\-Chnl\-Data)
\begin{CompactList}\small\item\em Inserts the bits pointed to by {\em chnl\-Data\/} into channel {\em chnl\-Num\/} of the channel bundle. \item\end{CompactList}\item 
int \hyperlink{bndl_8c_a4}{g\-Bndl\-Get\-Chnl} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned char chnl\-Num, unsigned int n\-Chnl\-Data, unsigned int $\ast$p\-Chnl\-Data)
\begin{CompactList}\small\item\em Retrieves the bits contained in channel number {\em chnl\-Num\/} of bundle in {\em gh\/}. \item\end{CompactList}\item 
unsigned short $\ast$ \hyperlink{bndl_8c_a5}{g\-Bndl\-Get\-Bndl} (\hyperlink{struct__gnat}{gnat\-Handle} gh)
\begin{CompactList}\small\item\em returns pointer to bundle storage \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Implements the channel bundle methods. 

\begin{Desc}
\item[Author:]Curt Brune -- \href{mailto:curt@slac.stanford.edu}{\tt curt@slac.stanford.edu} \end{Desc}
These routines allow for the creation and manipulation of channel bundles for the COMM I/O board. Essentially this boils down to a serial to parallel conversion

\subsection{Function Documentation}
\hypertarget{bndl_8c_a3}{
\index{bndl.c@{bndl.c}!gBndlAddChnl@{gBndlAddChnl}}
\index{gBndlAddChnl@{gBndlAddChnl}!bndl.c@{bndl.c}}
\subsubsection[gBndlAddChnl]{\setlength{\rightskip}{0pt plus 5cm}int g\-Bndl\-Add\-Chnl (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned char {\em chnl\-Num}, unsigned int {\em n\-Chnl\-Data}, unsigned int $\ast$ {\em p\-Chnl\-Data})}}
\label{bndl_8c_a3}


Inserts the bits pointed to by {\em chnl\-Data\/} into channel {\em chnl\-Num\/} of the channel bundle. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]gnat driver handle previously allocated \item[{\em chnl\-Num}]the channel in the bundle that {\em chnl\-Data\/} is to be inserted into (0-15) \item[{\em n\-Chnl\-Data}]the number of 32-bit words in {\em p\-Chnl\-Data\/} \item[{\em p\-Chnl\-Data}]a pointer to the channel bits. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK if close successful \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{bndl_8c_a4}{g\-Bndl\-Get\-Chnl()}\end{Desc}
The number of unsigned ints in {\em p\-Chnl\-Data\/} must be less than or equal to the bundle depth of {\em gh\/}, i.e. if {\em p\-Chnl\-Data\/} points to two unsigned ints (64 bits) then depth of {\em gh\/} must be two 32-entry blocks (64 entries total) or greater. \hypertarget{bndl_8c_a1}{
\index{bndl.c@{bndl.c}!gBndlClear@{gBndlClear}}
\index{gBndlClear@{gBndlClear}!bndl.c@{bndl.c}}
\subsubsection[gBndlClear]{\setlength{\rightskip}{0pt plus 5cm}int g\-Bndl\-Clear (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh})}}
\label{bndl_8c_a1}


zeroes out the bundle array 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]gnat driver handle previously allocated \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK if close successful \end{Desc}
\hypertarget{bndl_8c_a5}{
\index{bndl.c@{bndl.c}!gBndlGetBndl@{gBndlGetBndl}}
\index{gBndlGetBndl@{gBndlGetBndl}!bndl.c@{bndl.c}}
\subsubsection[gBndlGetBndl]{\setlength{\rightskip}{0pt plus 5cm}unsignd short $\ast$ g\-Bndl\-Get\-Bndl (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh})}}
\label{bndl_8c_a5}


returns pointer to bundle storage 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]gnat driver handle previously allocated \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]pointer to bunlde storage or NULL \end{Desc}
\hypertarget{bndl_8c_a4}{
\index{bndl.c@{bndl.c}!gBndlGetChnl@{gBndlGetChnl}}
\index{gBndlGetChnl@{gBndlGetChnl}!bndl.c@{bndl.c}}
\subsubsection[gBndlGetChnl]{\setlength{\rightskip}{0pt plus 5cm}int g\-Bndl\-Get\-Chnl (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned char {\em chnl\-Num}, unsigned int {\em n\-Chnl\-Data}, unsigned int $\ast$ {\em p\-Chnl\-Data})}}
\label{bndl_8c_a4}


Retrieves the bits contained in channel number {\em chnl\-Num\/} of bundle in {\em gh\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]gnat driver handle previously allocated \item[{\em chnl\-Num}]the channel number in the bundle {\em bh\/} to fetch. \item[{\em n\-Chnl\-Data}]the number of 32-bit words to fetch and store in {\em p\-Chnl\-Data\/} \item[{\em p\-Chnl\-Data}]a pointer to store to hold the channel bits. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK if close successful \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{bndl_8c_a3}{g\-Bndl\-Add\-Chnl()}\end{Desc}
The number of unsigned ints {\em n\-Chnl\-Data\/} in {\em p\-Chnl\-Data\/} must be less than or equal to the bundle depth of @ gh, i.e. if {\em gh\/} has a depth of 2 {\em n\-Chnl\-Data\/} can be 2 or 1. \hypertarget{bndl_8c_a2}{
\index{bndl.c@{bndl.c}!gBndlGetDepth@{gBndlGetDepth}}
\index{gBndlGetDepth@{gBndlGetDepth}!bndl.c@{bndl.c}}
\subsubsection[gBndlGetDepth]{\setlength{\rightskip}{0pt plus 5cm}int g\-Bndl\-Get\-Depth (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int $\ast$ {\em depth})}}
\label{bndl_8c_a2}


Returns the depth of the bunlde {\em bh\/} in the pointer {\em depth\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]gnat driver handle previously allocated \item[{\em depth}]output parameter used to return the depth of {\em bh\/} \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK if close successful \end{Desc}
