\hypertarget{ginit_8h}{
\section{ginit.h File Reference}
\label{ginit_8h}\index{ginit.h@{ginit.h}}
}
Defines the creation and initialization methods for the gnat driver.  


{\tt \#include \char`\"{}GNAT/gnat.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__driverInfo}{\_\-driver\-Info}
\begin{CompactList}\small\item\em Common attributes about the driver version. \item\end{CompactList}\item 
struct \hyperlink{struct__hardwareInfo}{\_\-hardware\-Info}
\begin{CompactList}\small\item\em Attributes for the hardware configuration. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{ginit_8h_a0}{
typedef \hyperlink{struct__driverInfo}{\_\-driver\-Info} \hyperlink{ginit_8h_a0}{Driver\-Info}}
\label{ginit_8h_a0}

\begin{CompactList}\small\item\em typedef for struct \hyperlink{struct__driverInfo}{\_\-driver\-Info} \item\end{CompactList}\item 
\hypertarget{ginit_8h_a1}{
typedef \hyperlink{struct__hardwareInfo}{\_\-hardware\-Info} \hyperlink{ginit_8h_a1}{Hardware\-Info}}
\label{ginit_8h_a1}

\begin{CompactList}\small\item\em typedef for struct \hyperlink{struct__hardwareInfo}{\_\-hardware\-Info} \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int \hyperlink{ginit_8h_a2}{g\-Size\-Of\-Gh} (void)
\begin{CompactList}\small\item\em Hides the private implemenation of the gnat registers. Allows user to allocate memory. \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a3}{g\-Init\-Drv} (void)
\begin{CompactList}\small\item\em Driver wide initialization: allocate memory, semaphores, etc... \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a4}{g\-Init\-Dev} (void)
\begin{CompactList}\small\item\em Device initialization: flush buffers, init registers, etc... \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a5}{g\-Open} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int phys\-Addr)
\begin{CompactList}\small\item\em maps the physical address to an instance of the driver object \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a6}{g\-Close} (\hyperlink{struct__gnat}{gnat\-Handle} gh)
\begin{CompactList}\small\item\em shuts down the device attached to {\em handle\/} \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a7}{g\-Get\-Driver\-Info} (\hyperlink{struct__driverInfo}{Driver\-Info} $\ast$di)
\begin{CompactList}\small\item\em fills in driver info struct \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a8}{g\-Get\-Hardware\-Info} (\hyperlink{struct__gnat}{gnat\-Handle} gh, \hyperlink{struct__hardwareInfo}{Hardware\-Info} $\ast$hi)
\begin{CompactList}\small\item\em fills in hardware info struct \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a9}{g\-Get\-Logical\-Addr} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int $\ast$addr)
\begin{CompactList}\small\item\em returns the logical address attached to handle \item\end{CompactList}\item 
int \hyperlink{ginit_8h_a10}{g\-Get\-Phys\-Addr} (\hyperlink{struct__gnat}{gnat\-Handle} gh, unsigned int $\ast$addr)
\begin{CompactList}\small\item\em returns the physical address attached to handle \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Defines the creation and initialization methods for the gnat driver. 

\begin{Desc}
\item[Author:]Curt Brune -- \href{mailto:curt@slac.stanford.edu}{\tt curt@slac.stanford.edu}\end{Desc}


\subsection{Function Documentation}
\hypertarget{ginit_8h_a6}{
\index{ginit.h@{ginit.h}!gClose@{gClose}}
\index{gClose@{gClose}!ginit.h@{ginit.h}}
\subsubsection[gClose]{\setlength{\rightskip}{0pt plus 5cm}int g\-Close (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh})}}
\label{ginit_8h_a6}


shuts down the device attached to {\em handle\/} 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device to close \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK if close successful \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a7}{g\-Open()} \end{Desc}
\hypertarget{ginit_8h_a7}{
\index{ginit.h@{ginit.h}!gGetDriverInfo@{gGetDriverInfo}}
\index{gGetDriverInfo@{gGetDriverInfo}!ginit.h@{ginit.h}}
\subsubsection[gGetDriverInfo]{\setlength{\rightskip}{0pt plus 5cm}int g\-Get\-Driver\-Info (\hyperlink{struct__driverInfo}{Driver\-Info} $\ast$ {\em di})}}
\label{ginit_8h_a7}


fills in driver info struct 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em di}]pointer to storage to hold driver info \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on successs \end{Desc}
\hypertarget{ginit_8h_a8}{
\index{ginit.h@{ginit.h}!gGetHardwareInfo@{gGetHardwareInfo}}
\index{gGetHardwareInfo@{gGetHardwareInfo}!ginit.h@{ginit.h}}
\subsubsection[gGetHardwareInfo]{\setlength{\rightskip}{0pt plus 5cm}int g\-Get\-Hardware\-Info (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, \hyperlink{struct__hardwareInfo}{Hardware\-Info} $\ast$ {\em hi})}}
\label{ginit_8h_a8}


fills in hardware info struct 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device \item[{\em hi}]pointer to storage to hold hardware info \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on successs \end{Desc}
\hypertarget{ginit_8h_a9}{
\index{ginit.h@{ginit.h}!gGetLogicalAddr@{gGetLogicalAddr}}
\index{gGetLogicalAddr@{gGetLogicalAddr}!ginit.h@{ginit.h}}
\subsubsection[gGetLogicalAddr]{\setlength{\rightskip}{0pt plus 5cm}int g\-Get\-Logical\-Addr (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int $\ast$ {\em addr})}}
\label{ginit_8h_a9}


returns the logical address attached to handle 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device to close \item[{\em addr}]pointer to storage for holding logical address \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on successs \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a7}{g\-Open()} \end{Desc}
\hypertarget{ginit_8h_a10}{
\index{ginit.h@{ginit.h}!gGetPhysAddr@{gGetPhysAddr}}
\index{gGetPhysAddr@{gGetPhysAddr}!ginit.h@{ginit.h}}
\subsubsection[gGetPhysAddr]{\setlength{\rightskip}{0pt plus 5cm}int g\-Get\-Phys\-Addr (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int $\ast$ {\em addr})}}
\label{ginit_8h_a10}


returns the physical address attached to handle 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]handle of device to close \item[{\em addr}]pointer to storage for holding physical address \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]G\_\-OK on successs \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a7}{g\-Open()} \end{Desc}
\hypertarget{ginit_8h_a4}{
\index{ginit.h@{ginit.h}!gInitDev@{gInitDev}}
\index{gInitDev@{gInitDev}!ginit.h@{ginit.h}}
\subsubsection[gInitDev]{\setlength{\rightskip}{0pt plus 5cm}int g\-Init\-Dev (void)}}
\label{ginit_8h_a4}


Device initialization: flush buffers, init registers, etc... 

\begin{Desc}
\item[Returns:]G\_\-OK on success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a6}{g\-Init\-Dev()} \end{Desc}
\hypertarget{ginit_8h_a3}{
\index{ginit.h@{ginit.h}!gInitDrv@{gInitDrv}}
\index{gInitDrv@{gInitDrv}!ginit.h@{ginit.h}}
\subsubsection[gInitDrv]{\setlength{\rightskip}{0pt plus 5cm}int g\-Init\-Drv (void)}}
\label{ginit_8h_a3}


Driver wide initialization: allocate memory, semaphores, etc... 

\begin{Desc}
\item[Returns:]G\_\-OK on success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a6}{g\-Init\-Dev()} \end{Desc}
\hypertarget{ginit_8h_a5}{
\index{ginit.h@{ginit.h}!gOpen@{gOpen}}
\index{gOpen@{gOpen}!ginit.h@{ginit.h}}
\subsubsection[gOpen]{\setlength{\rightskip}{0pt plus 5cm}int g\-Open (\hyperlink{struct__gnat}{gnat\-Handle} {\em gh}, unsigned int {\em phys\-Addr})}}
\label{ginit_8h_a5}


maps the physical address to an instance of the driver object 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em gh}]gnat driver handle previously allocated \item[{\em phys\-Addr}]the physical address of the comm IO board \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]OK for success \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a8}{g\-Close()}\end{Desc}
Attempts to map {\em phys\-Addr\/} into a local (logical) address. If successful it binds the physical and logical address to the driver object refered to by handle. If unsucessful it clears both the physical and local address for handle and returns ERROR. \hypertarget{ginit_8h_a2}{
\index{ginit.h@{ginit.h}!gSizeOfGh@{gSizeOfGh}}
\index{gSizeOfGh@{gSizeOfGh}!ginit.h@{ginit.h}}
\subsubsection[gSizeOfGh]{\setlength{\rightskip}{0pt plus 5cm}unsigned int g\-Size\-Of\-Gh (void)}}
\label{ginit_8h_a2}


Hides the private implemenation of the gnat registers. Allows user to allocate memory. 

\begin{Desc}
\item[Returns:]the size of struct \hyperlink{struct__gnat}{\_\-gnat} \end{Desc}
\begin{Desc}
\item[See also:]\hyperlink{ginit_8c_a7}{g\-Open()} \end{Desc}
