\section{util/firmdl/rcx\_\-comm.c File Reference}
\label{rcx__comm_8c}\index{util/firmdl/rcx_comm.c@{util/firmdl/rcx\_\-comm.c}}
{\tt \#include $<$sys/types.h$>$}\par
{\tt \#include $<$sys/stat.h$>$}\par
{\tt \#include $<$fcntl.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$termios.h$>$}\par
{\tt \#include $<$sys/time.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$ctype.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$sys/ioctl.h$>$}\par
{\tt \#include $<$errno.h$>$}\par
{\tt \#include \char`\"{}rcx\_\-comm.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf BUFFERSIZE}\ 4096
\item 
\#define {\bf tvupdate}(tv)\ gettimeofday(tv,NULL)
\item 
\#define {\bf tvsec}(tv)\ ((tv) $\rightarrow$ tv\_\-sec)
\item 
\#define {\bf tvmsec}(tv)\ ((tv) $\rightarrow$ tv\_\-usec $\ast$ 1e-3)
\item 
\#define {\bf LINE\_\-SIZE}\ 16
\item 
\#define {\bf GROUP\_\-SIZE}\ 4
\item 
\#define {\bf UNPRINTABLE}\ '.'
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef timeval {\bf timeval\_\-t}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
float {\bf timer\_\-reset} ({\bf timeval\_\-t} $\ast$timer)
\item 
float {\bf timer\_\-read} ({\bf timeval\_\-t} $\ast$timer)
\item 
void {\bf myperror} (char $\ast$str)
\begin{CompactList}\small\item\em perror() wrapper \item\end{CompactList}\item 
int {\bf nbread} (FILEDESCR fd, void $\ast$buf, int maxlen, int timeout)
\item 
void {\bf rx\_\-flush} (FILEDESCR fd)
\item 
int {\bf mywrite} (FILEDESCR fd, const void $\ast$buf, {\bf size\_\-t} len)
\begin{CompactList}\small\item\em write() wrapper \item\end{CompactList}\item 
FILEDESCR {\bf rcx\_\-init} (char $\ast$tty, int is\_\-fast)
\item 
void {\bf rcx\_\-close} (FILEDESCR fd)
\item 
int {\bf rcx\_\-wakeup\_\-tower} (FILEDESCR fd, int timeout)
\item 
void {\bf hexdump} (char $\ast$prefix, void $\ast$buf, int len)
\item 
int {\bf rcx\_\-send} (FILEDESCR fd, void $\ast$buf, int len, int use\_\-comp)
\item 
int {\bf rcx\_\-recv} (FILEDESCR fd, void $\ast$buf, int maxlen, int timeout, int use\_\-comp)
\item 
int {\bf rcx\_\-sendrecv} (FILEDESCR fd, void $\ast$send, int slen, void $\ast$recv, int rlen, int timeout, int retries, int use\_\-comp)
\item 
int {\bf rcx\_\-is\_\-alive} (FILEDESCR fd, int use\_\-comp)
\item 
char $\ast$ {\bf rcx\_\-strerror} (int error)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
int {\bf \_\-\_\-comm\_\-debug} = 0
\item 
int {\bf tty\_\-usb}
\end{CompactItemize}


\subsection{Define Documentation}
\index{rcx_comm.c@{rcx\_\-comm.c}!BUFFERSIZE@{BUFFERSIZE}}
\index{BUFFERSIZE@{BUFFERSIZE}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define BUFFERSIZE\ 4096}\label{rcx__comm_8c_a0}




Definition at line 61 of file rcx\_\-comm.c.\index{rcx_comm.c@{rcx\_\-comm.c}!GROUP_SIZE@{GROUP\_\-SIZE}}
\index{GROUP_SIZE@{GROUP\_\-SIZE}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define GROUP\_\-SIZE\ 4}\label{rcx__comm_8c_a5}




Definition at line 399 of file rcx\_\-comm.c.

Referenced by hexdump().\index{rcx_comm.c@{rcx\_\-comm.c}!LINE_SIZE@{LINE\_\-SIZE}}
\index{LINE_SIZE@{LINE\_\-SIZE}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LINE\_\-SIZE\ 16}\label{rcx__comm_8c_a4}




Definition at line 398 of file rcx\_\-comm.c.\index{rcx_comm.c@{rcx\_\-comm.c}!tvmsec@{tvmsec}}
\index{tvmsec@{tvmsec}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define tvmsec(tv)\ ((tv) $\rightarrow$ tv\_\-usec $\ast$ 1e-3)}\label{rcx__comm_8c_a3}




Definition at line 74 of file rcx\_\-comm.c.

Referenced by timer\_\-read().\index{rcx_comm.c@{rcx\_\-comm.c}!tvsec@{tvsec}}
\index{tvsec@{tvsec}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define tvsec(tv)\ ((tv) $\rightarrow$ tv\_\-sec)}\label{rcx__comm_8c_a2}




Definition at line 73 of file rcx\_\-comm.c.

Referenced by timer\_\-read().\index{rcx_comm.c@{rcx\_\-comm.c}!tvupdate@{tvupdate}}
\index{tvupdate@{tvupdate}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define tvupdate(tv)\ gettimeofday(tv,NULL)}\label{rcx__comm_8c_a1}




Definition at line 72 of file rcx\_\-comm.c.

Referenced by timer\_\-read(), and timer\_\-reset().\index{rcx_comm.c@{rcx\_\-comm.c}!UNPRINTABLE@{UNPRINTABLE}}
\index{UNPRINTABLE@{UNPRINTABLE}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define UNPRINTABLE\ '.'}\label{rcx__comm_8c_a6}




Definition at line 400 of file rcx\_\-comm.c.

\subsection{Typedef Documentation}
\index{rcx_comm.c@{rcx\_\-comm.c}!timeval_t@{timeval\_\-t}}
\index{timeval_t@{timeval\_\-t}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef struct timeval {\bf timeval\_\-t}}\label{rcx__comm_8c_a9}




Definition at line 70 of file rcx\_\-comm.c.

Referenced by rcx\_\-wakeup\_\-tower(), and timer\_\-read().

\subsection{Function Documentation}
\index{rcx_comm.c@{rcx\_\-comm.c}!hexdump@{hexdump}}
\index{hexdump@{hexdump}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void hexdump (char $\ast$ {\em prefix}, void $\ast$ {\em buf}, int {\em len})}\label{rcx__comm_8c_a19}




Definition at line 402 of file rcx\_\-comm.c.

References GROUP\_\-SIZE.

Referenced by rcx\_\-recv(), rcx\_\-send(), and rcx\_\-wakeup\_\-tower().\index{rcx_comm.c@{rcx\_\-comm.c}!myperror@{myperror}}
\index{myperror@{myperror}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void myperror (char $\ast$ {\em str})}\label{rcx__comm_8c_a12}


perror() wrapper 



Definition at line 91 of file rcx\_\-comm.c.

Referenced by keepalive\-Send(), LNPinit(), nbread(), rcx\_\-init(), rcx\_\-send(), rcx\_\-wakeup\_\-tower(), and rcx\-Init().\index{rcx_comm.c@{rcx\_\-comm.c}!mywrite@{mywrite}}
\index{mywrite@{mywrite}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int mywrite (FILEDESCR {\em fd}, const void $\ast$ {\em buf}, {\bf size\_\-t} {\em len})}\label{rcx__comm_8c_a15}


write() wrapper 



Definition at line 230 of file rcx\_\-comm.c.

References NULL.

Referenced by keepalive\-Send(), lnp\_\-logical\_\-write(), rcx\_\-send(), and rcx\_\-wakeup\_\-tower().\index{rcx_comm.c@{rcx\_\-comm.c}!nbread@{nbread}}
\index{nbread@{nbread}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int nbread (FILEDESCR {\em fd}, void $\ast$ {\em buf}, int {\em maxlen}, int {\em timeout})\hspace{0.3cm}{\tt  [static]}}\label{rcx__comm_8c_a13}




Definition at line 101 of file rcx\_\-comm.c.

References exit(), myperror(), NULL, and tty\_\-usb.

Referenced by rcx\_\-recv(), rcx\_\-send(), rcx\_\-wakeup\_\-tower(), and rx\_\-flush().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_close@{rcx\_\-close}}
\index{rcx_close@{rcx\_\-close}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void rcx\_\-close (FILEDESCR {\em fd})}\label{rcx__comm_8c_a17}




Definition at line 346 of file rcx\_\-comm.c.

Referenced by main().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_init@{rcx\_\-init}}
\index{rcx_init@{rcx\_\-init}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}FILEDESCR rcx\_\-init (char $\ast$ {\em tty}, int {\em is\_\-fast})}\label{rcx__comm_8c_a16}




Definition at line 266 of file rcx\_\-comm.c.

References B2400, B4800, exit(), FILEDESCR, memset(), myperror(), NULL, and tty\_\-usb.

Referenced by main().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_is_alive@{rcx\_\-is\_\-alive}}
\index{rcx_is_alive@{rcx\_\-is\_\-alive}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rcx\_\-is\_\-alive (FILEDESCR {\em fd}, int {\em use\_\-comp})}\label{rcx__comm_8c_a23}




Definition at line 621 of file rcx\_\-comm.c.

References rcx\_\-sendrecv().

Referenced by main().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_recv@{rcx\_\-recv}}
\index{rcx_recv@{rcx\_\-recv}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rcx\_\-recv (FILEDESCR {\em fd}, void $\ast$ {\em buf}, int {\em maxlen}, int {\em timeout}, int {\em use\_\-comp})}\label{rcx__comm_8c_a21}




Definition at line 492 of file rcx\_\-comm.c.

References BUFFERSIZE, hexdump(), and nbread().

Referenced by rcx\_\-sendrecv().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_send@{rcx\_\-send}}
\index{rcx_send@{rcx\_\-send}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rcx\_\-send (FILEDESCR {\em fd}, void $\ast$ {\em buf}, int {\em len}, int {\em use\_\-comp})}\label{rcx__comm_8c_a20}




Definition at line 424 of file rcx\_\-comm.c.

References exit(), hexdump(), myperror(), mywrite(), nbread(), rx\_\-flush(), and tty\_\-usb.

Referenced by rcx\_\-sendrecv().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_sendrecv@{rcx\_\-sendrecv}}
\index{rcx_sendrecv@{rcx\_\-sendrecv}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rcx\_\-sendrecv (FILEDESCR {\em fd}, void $\ast$ {\em send}, int {\em slen}, void $\ast$ {\em recv}, int {\em rlen}, int {\em timeout}, int {\em retries}, int {\em use\_\-comp})}\label{rcx__comm_8c_a22}




Definition at line 592 of file rcx\_\-comm.c.

References rcx\_\-recv(), rcx\_\-send(), and rcx\_\-strerror().

Referenced by image\_\-dl(), and rcx\_\-is\_\-alive().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_strerror@{rcx\_\-strerror}}
\index{rcx_strerror@{rcx\_\-strerror}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ rcx\_\-strerror (int {\em error})}\label{rcx__comm_8c_a24}




Definition at line 629 of file rcx\_\-comm.c.

References RCX\_\-BAD\_\-ECHO, RCX\_\-BAD\_\-LINK, RCX\_\-BAD\_\-RESPONSE, RCX\_\-NO\_\-RESPONSE, RCX\_\-NO\_\-TOWER, and RCX\_\-OK.

Referenced by main(), and rcx\_\-sendrecv().\index{rcx_comm.c@{rcx\_\-comm.c}!rcx_wakeup_tower@{rcx\_\-wakeup\_\-tower}}
\index{rcx_wakeup_tower@{rcx\_\-wakeup\_\-tower}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int rcx\_\-wakeup\_\-tower (FILEDESCR {\em fd}, int {\em timeout})}\label{rcx__comm_8c_a18}




Definition at line 355 of file rcx\_\-comm.c.

References BUFFERSIZE, exit(), hexdump(), myperror(), mywrite(), nbread(), rx\_\-flush(), timer\_\-read(), timer\_\-reset(), and timeval\_\-t.

Referenced by main().\index{rcx_comm.c@{rcx\_\-comm.c}!rx_flush@{rx\_\-flush}}
\index{rx_flush@{rx\_\-flush}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void rx\_\-flush (FILEDESCR {\em fd})\hspace{0.3cm}{\tt  [static]}}\label{rcx__comm_8c_a14}




Definition at line 215 of file rcx\_\-comm.c.

References BUFFERSIZE, nbread(), and tty\_\-usb.

Referenced by rcx\_\-send(), and rcx\_\-wakeup\_\-tower().\index{rcx_comm.c@{rcx\_\-comm.c}!timer_read@{timer\_\-read}}
\index{timer_read@{timer\_\-read}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}float timer\_\-read ({\bf timeval\_\-t} $\ast$ {\em timer})\hspace{0.3cm}{\tt  [static]}}\label{rcx__comm_8c_a11}




Definition at line 84 of file rcx\_\-comm.c.

References timeval\_\-t, tvmsec, tvsec, and tvupdate.

Referenced by rcx\_\-wakeup\_\-tower().\index{rcx_comm.c@{rcx\_\-comm.c}!timer_reset@{timer\_\-reset}}
\index{timer_reset@{timer\_\-reset}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}float timer\_\-reset ({\bf timeval\_\-t} $\ast$ {\em timer})\hspace{0.3cm}{\tt  [static]}}\label{rcx__comm_8c_a10}




Definition at line 77 of file rcx\_\-comm.c.

References tvupdate.

Referenced by rcx\_\-wakeup\_\-tower().

\subsection{Variable Documentation}
\index{rcx_comm.c@{rcx\_\-comm.c}!__comm_debug@{\_\-\_\-comm\_\-debug}}
\index{__comm_debug@{\_\-\_\-comm\_\-debug}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf \_\-\_\-comm\_\-debug} = 0}\label{rcx__comm_8c_a7}




Definition at line 65 of file rcx\_\-comm.c.

Referenced by main().\index{rcx_comm.c@{rcx\_\-comm.c}!tty_usb@{tty\_\-usb}}
\index{tty_usb@{tty\_\-usb}!rcx_comm.c@{rcx\_\-comm.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf tty\_\-usb}}\label{rcx__comm_8c_a8}




Definition at line 153 of file loader.c.