/* $Id: surf_int.h,v 1.13 2004/03/25 00:06:14 jmuelmen Exp $ */ /* internal libsurf stuff */ #ifndef _surf_int_inc #define _surf_int_inc #define STRLEN 100 #define NCHN 4 /* USB timeout in ms */ #define SURF_TO 1500 #ifdef HAVE_LIBUSB #include #elif defined HAVE_SURFWAX /* #include "surfwax.h" */ #endif #include /***************************************************************************** * types we need *****************************************************************************/ struct chan_t { char board_name[STRLEN]; int chn_no; int foo; int bar; }; struct surf_t { struct chan_t *chn[NCHN]; char board_name[STRLEN]; #ifdef HAVE_LIBUSB usb_dev_handle *h; #elif defined HAVE_SURFWAX int h; #endif char stale; int baz; int qux; unsigned char rev_major, rev_minor, rev_subminor; /* firmware rev */ }; /***************************************************************************** * functions we need *****************************************************************************/ struct surf_t *surf_get_boards (); int surflib_init (); int surf_mod_init (); int surf_board_init (); int surft_print_boards (); /* various flavors of read/write */ #if 0 /* These are way obsolete */ int surf_write (struct chan_t *, char *buf, int count); int surf_read (struct chan_t *, char *buf, int count); int surf_write_mod (const char *mod, char *buf, int count); #endif int surf_read_ep (struct surf_t *, int ep, char *buf, int count); int surf_write_ep (struct surf_t *, int ep, char *buf, int count); int surf_write_board (const char *b_name, int ep, char *buf, int count); int surf_read_board (const char *b_name, int ep, char *buf, int count); /* accessors */ void surft_init (struct surf_t *); struct surf_t *surft_create (const char *name); int surft_set_name (struct surf_t *, const char *); const char *surft_get_name (const struct surf_t *); void surft_make_stale (struct surf_t *); void surft_make_fresh (struct surf_t *); int surft_stale (const struct surf_t *); void surft_set_rev (struct surf_t *, unsigned char major, unsigned char minor, unsigned char subminor); #ifdef HAVE_LIBUSB usb_dev_handle *surft_get_dev (const struct surf_t *); void surft_set_dev (struct surf_t *, usb_dev_handle *); #else int surft_get_dev (const struct surf_t *); void surft_set_dev (struct surf_t *, int); #endif struct surf_t *surf_search (const char *); int surf_find_boards (); void chant_init (struct chan_t *); int chant_set_board (struct chan_t *, const char *); const char *chant_get_board (const struct chan_t *); void chant_set_chn (struct chan_t *, int); int chant_get_chn (const struct chan_t *); /***************************************************************************** * errors *****************************************************************************/ #define ESURFDEV 1 #define ENBOARDS 2 #define ENOBOARD 4 #define ENOMOD 8 extern int surf_errno; /***************************************************************************** * logging *****************************************************************************/ extern int surf_log_level; #define SURF_LOG(l, args...) if (l >= surf_log_level) fprintf(stderr, args) #define LOGSURF_LOUD 1 #define LOGSURF_CONNECT 5 #define LOGSURF_ERROR 10 #endif /* _surf_int_inc */