Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

rcx_comm.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <sys/time.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <sys/ioctl.h>
#include <errno.h>
#include "rcx_comm.h"

Go to the source code of this file.

Defines

#define BUFFERSIZE   4096
#define tvupdate(tv)   gettimeofday(tv,NULL)
#define tvsec(tv)   ((tv)->tv_sec)
#define tvmsec(tv)   ((tv)->tv_usec * 1e-3)
#define LINE_SIZE   16
#define GROUP_SIZE   4
#define UNPRINTABLE   '.'

Typedefs

typedef timeval timeval_t

Functions

float timer_reset (timeval_t *timer)
float timer_read (timeval_t *timer)
void myperror (char *str)
 perror() wrapper
int nbread (FILEDESCR fd, void *buf, int maxlen, int timeout)
void rx_flush (FILEDESCR fd)
int mywrite (FILEDESCR fd, const void *buf, size_t len)
 write() wrapper
FILEDESCR rcx_init (char *tty, int is_fast)
void rcx_close (FILEDESCR fd)
int rcx_wakeup_tower (FILEDESCR fd, int timeout)
void hexdump (char *prefix, void *buf, int len)
int rcx_send (FILEDESCR fd, void *buf, int len, int use_comp)
int rcx_recv (FILEDESCR fd, void *buf, int maxlen, int timeout, int use_comp)
int rcx_sendrecv (FILEDESCR fd, void *send, int slen, void *recv, int rlen, int timeout, int retries, int use_comp)
int rcx_is_alive (FILEDESCR fd, int use_comp)
char * rcx_strerror (int error)

Variables

int __comm_debug = 0
int tty_usb


Define Documentation

#define BUFFERSIZE   4096
 

Definition at line 61 of file rcx_comm.c.

#define GROUP_SIZE   4
 

Definition at line 399 of file rcx_comm.c.

Referenced by hexdump().

#define LINE_SIZE   16
 

Definition at line 398 of file rcx_comm.c.

#define tvmsec tv   )     ((tv)->tv_usec * 1e-3)
 

Definition at line 74 of file rcx_comm.c.

Referenced by timer_read().

#define tvsec tv   )     ((tv)->tv_sec)
 

Definition at line 73 of file rcx_comm.c.

Referenced by timer_read().

#define tvupdate tv   )     gettimeofday(tv,NULL)
 

Definition at line 72 of file rcx_comm.c.

Referenced by timer_read(), and timer_reset().

#define UNPRINTABLE   '.'
 

Definition at line 400 of file rcx_comm.c.


Typedef Documentation

typedef struct timeval timeval_t
 

Definition at line 70 of file rcx_comm.c.

Referenced by rcx_wakeup_tower(), and timer_read().


Function Documentation

void hexdump char *  prefix,
void *  buf,
int  len
 

Definition at line 402 of file rcx_comm.c.

References GROUP_SIZE.

Referenced by rcx_recv(), rcx_send(), and rcx_wakeup_tower().

void myperror char *  str  ) 
 

perror() wrapper

Definition at line 91 of file rcx_comm.c.

Referenced by keepaliveSend(), LNPinit(), nbread(), rcx_init(), rcx_send(), rcx_wakeup_tower(), and rcxInit().

int mywrite FILEDESCR  fd,
const void *  buf,
size_t  len
 

write() wrapper

Definition at line 230 of file rcx_comm.c.

References NULL.

Referenced by keepaliveSend(), lnp_logical_write(), rcx_send(), and rcx_wakeup_tower().

int nbread FILEDESCR  fd,
void *  buf,
int  maxlen,
int  timeout
[static]
 

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().

void rcx_close FILEDESCR  fd  ) 
 

Definition at line 346 of file rcx_comm.c.

Referenced by main().

FILEDESCR rcx_init char *  tty,
int  is_fast
 

Definition at line 266 of file rcx_comm.c.

References B2400, B4800, exit(), FILEDESCR, memset(), myperror(), NULL, and tty_usb.

Referenced by main().

int rcx_is_alive FILEDESCR  fd,
int  use_comp
 

Definition at line 621 of file rcx_comm.c.

References rcx_sendrecv().

Referenced by main().

int rcx_recv FILEDESCR  fd,
void *  buf,
int  maxlen,
int  timeout,
int  use_comp
 

Definition at line 492 of file rcx_comm.c.

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

Referenced by rcx_sendrecv().

int rcx_send FILEDESCR  fd,
void *  buf,
int  len,
int  use_comp
 

Definition at line 424 of file rcx_comm.c.

References exit(), hexdump(), myperror(), mywrite(), nbread(), rx_flush(), and tty_usb.

Referenced by rcx_sendrecv().

int rcx_sendrecv FILEDESCR  fd,
void *  send,
int  slen,
void *  recv,
int  rlen,
int  timeout,
int  retries,
int  use_comp
 

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().

char* rcx_strerror int  error  ) 
 

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().

int rcx_wakeup_tower FILEDESCR  fd,
int  timeout
 

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().

void rx_flush FILEDESCR  fd  )  [static]
 

Definition at line 215 of file rcx_comm.c.

References BUFFERSIZE, nbread(), and tty_usb.

Referenced by rcx_send(), and rcx_wakeup_tower().

float timer_read timeval_t timer  )  [static]
 

Definition at line 84 of file rcx_comm.c.

References timeval_t, tvmsec, tvsec, and tvupdate.

Referenced by rcx_wakeup_tower().

float timer_reset timeval_t timer  )  [static]
 

Definition at line 77 of file rcx_comm.c.

References tvupdate.

Referenced by rcx_wakeup_tower().


Variable Documentation

int __comm_debug = 0
 

Definition at line 65 of file rcx_comm.c.

Referenced by main().

int tty_usb
 

Definition at line 153 of file loader.c.


Generated on Fri Feb 25 08:02:48 2005 for brickos by  doxygen 1.3.9.1