libexsid  2.1
exSID_ftdiwrap.h
Go to the documentation of this file.
1 //
2 // exSID_ftdiwrap.h
3 // A FTDI access wrapper for exSID USB - header file
4 //
5 // (C) 2016 Thibaut VARENE
6 // License: GPLv2 - http://www.gnu.org/licenses/gpl-2.0.html
7 //
8 
14 #ifndef exSID_ftdiwrap_h
15 #define exSID_ftdiwrap_h
16 
18 typedef void * (* xSfw_new_p)(void);
19 
21 typedef void (* xSfw_free_p)(void * ftdi);
22 
31 typedef int (* xSfw_write_data_p)(void * ftdi, const unsigned char * buf, int size);
32 
41 typedef int (* xSfw_read_data_p)(void * ftdi, unsigned char * buf, int size);
42 
54 typedef int (* xSfw_usb_open_desc_p)(void ** ftdi, int vid, int pid, const char * desc, const char * serial);
55 
57 typedef int (* xSfw_usb_purge_buffers_p)(void * ftdi);
58 
60 typedef int (* xSfw_usb_close_p)(void * ftdi);
61 
68 typedef char * (* xSfw_get_error_string_p)(void * ftdi);
69 
70 #ifndef XSFW_WRAPDECL
71 #define XSFW_EXTERN extern
72 #else
73 #define XSFW_EXTERN /* nothing */
74 #endif
75 
76 #define XSFW_PROTODEF(a) XSFW_EXTERN a ## _p a
77 
85 int xSfw_usb_setup(void *ftdi, int baudrate, int latency);
86 
87 int xSfw_dlopen();
88 void xSfw_dlclose();
89 
90 #endif /* exSID_ftdiwrap_h */
xSfw_write_data_p xSfw_write_data
Data write callback.
int(* xSfw_usb_close_p)(void *ftdi)
Close FTDI device.
const int vid
USB VID.
Definition: exSID.c:75
void(* xSfw_free_p)(void *ftdi)
Free ftdi handle.
int xSfw_usb_setup(void *ftdi, int baudrate, int latency)
Setup FTDI chip to match exSID firmware.
void * ftdi
FTDI device handle.
Definition: exSID.c:119
xSfw_read_data_p xSfw_read_data
Data read callback.
int(* xSfw_read_data_p)(void *ftdi, unsigned char *buf, int size)
Read data from FTDI.
const int pid
USB PID.
Definition: exSID.c:74
xSfw_new_p xSfw_new
Handle allocation callback.
xSfw_usb_open_desc_p xSfw_usb_open_desc
Device open callback.
int(* xSfw_usb_open_desc_p)(void **ftdi, int vid, int pid, const char *desc, const char *serial)
Open device by description.
xSfw_get_error_string_p xSfw_get_error_string
Human readable error string callback.
const char * desc
USB device description string.
Definition: exSID.c:73
#define XSFW_PROTODEF(a)
xSfw_free_p xSfw_free
Handle deallocation callback.
int(* xSfw_write_data_p)(void *ftdi, const unsigned char *buf, int size)
Write data to FTDI.
int xSfw_dlopen()
Attempt to dlopen a known working library to access FTDI chip.
void xSfw_dlclose()
Release dlopen'd library.
xSfw_usb_close_p xSfw_usb_close
Device close callback.
int(* xSfw_usb_purge_buffers_p)(void *ftdi)
Purge FTDI buffers.