28 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
30 #if defined(interface)
89 #define MPSSE_WRITE_NEG 0x01
90 #define MPSSE_BITMODE 0x02
91 #define MPSSE_READ_NEG 0x04
92 #define MPSSE_LSB 0x08
93 #define MPSSE_DO_WRITE 0x10
94 #define MPSSE_DO_READ 0x20
95 #define MPSSE_WRITE_TMS 0x40
98 #define SET_BITS_LOW 0x80
101 #define SET_BITS_HIGH 0x82
104 #define GET_BITS_LOW 0x81
105 #define GET_BITS_HIGH 0x83
106 #define LOOPBACK_START 0x84
107 #define LOOPBACK_END 0x85
108 #define TCK_DIVISOR 0x86
110 #define DIS_DIV_5 0x8a
111 #define EN_DIV_5 0x8b
112 #define EN_3_PHASE 0x8c
113 #define DIS_3_PHASE 0x8d
114 #define CLK_BITS 0x8e
115 #define CLK_BYTES 0x8f
116 #define CLK_WAIT_HIGH 0x94
117 #define CLK_WAIT_LOW 0x95
118 #define EN_ADAPTIVE 0x96
119 #define DIS_ADAPTIVE 0x97
120 #define CLK_BYTES_OR_HIGH 0x9c
121 #define CLK_BYTES_OR_LOW 0x9d
123 #define DRIVE_OPEN_COLLECTOR 0x9e
126 #define DIV_VALUE(rate) (rate > 6000000)?0:((6000000/rate -1) > 0xffff)? 0xffff: (6000000/rate -1)
129 #define SEND_IMMEDIATE 0x87
130 #define WAIT_ON_HIGH 0x88
131 #define WAIT_ON_LOW 0x89
134 #define READ_SHORT 0x90
136 #define READ_EXTENDED 0x91
139 #define WRITE_SHORT 0x92
141 #define WRITE_EXTENDED 0x93
147 #define SIO_MODEM_CTRL 1
148 #define SIO_SET_FLOW_CTRL 2
149 #define SIO_SET_BAUD_RATE 3
150 #define SIO_SET_DATA 4
152 #define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT)
153 #define FTDI_DEVICE_IN_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN)
156 #define SIO_RESET_REQUEST SIO_RESET
157 #define SIO_SET_BAUDRATE_REQUEST SIO_SET_BAUD_RATE
158 #define SIO_SET_DATA_REQUEST SIO_SET_DATA
159 #define SIO_SET_FLOW_CTRL_REQUEST SIO_SET_FLOW_CTRL
160 #define SIO_SET_MODEM_CTRL_REQUEST SIO_MODEM_CTRL
161 #define SIO_POLL_MODEM_STATUS_REQUEST 0x05
162 #define SIO_SET_EVENT_CHAR_REQUEST 0x06
163 #define SIO_SET_ERROR_CHAR_REQUEST 0x07
164 #define SIO_SET_LATENCY_TIMER_REQUEST 0x09
165 #define SIO_GET_LATENCY_TIMER_REQUEST 0x0A
166 #define SIO_SET_BITMODE_REQUEST 0x0B
167 #define SIO_READ_PINS_REQUEST 0x0C
168 #define SIO_READ_EEPROM_REQUEST 0x90
169 #define SIO_WRITE_EEPROM_REQUEST 0x91
170 #define SIO_ERASE_EEPROM_REQUEST 0x92
173 #define SIO_RESET_SIO 0
174 #define SIO_RESET_PURGE_RX 1
175 #define SIO_RESET_PURGE_TX 2
177 #define SIO_DISABLE_FLOW_CTRL 0x0
178 #define SIO_RTS_CTS_HS (0x1 << 8)
179 #define SIO_DTR_DSR_HS (0x2 << 8)
180 #define SIO_XON_XOFF_HS (0x4 << 8)
182 #define SIO_SET_DTR_MASK 0x1
183 #define SIO_SET_DTR_HIGH ( 1 | ( SIO_SET_DTR_MASK << 8))
184 #define SIO_SET_DTR_LOW ( 0 | ( SIO_SET_DTR_MASK << 8))
185 #define SIO_SET_RTS_MASK 0x2
186 #define SIO_SET_RTS_HIGH ( 2 | ( SIO_SET_RTS_MASK << 8 ))
187 #define SIO_SET_RTS_LOW ( 0 | ( SIO_SET_RTS_MASK << 8 ))
189 #define SIO_RTS_CTS_HS (0x1 << 8)
193 #define FTDI_URB_USERCONTEXT_COOKIE ((void *)0x1)
196 #define DEPRECATED(func) func __attribute__ ((deprecated))
197 #elif defined(_MSC_VER)
198 #define DEPRECATED(func) __declspec(deprecated) func
200 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
201 #define DEPRECATED(func) func
347 struct libusb_device *
dev;
349 #define FT1284_CLK_IDLE_STATE 0x01
350 #define FT1284_DATA_LSB 0x02
351 #define FT1284_FLOW_CONTROL 0x04
352 #define POWER_SAVE_DISABLE_H 0x80
354 #define USE_SERIAL_NUM 0x08
379 #define INVERT_TXD 0x01
381 #define INVERT_RXD 0x02
383 #define INVERT_RTS 0x04
385 #define INVERT_CTS 0x08
387 #define INVERT_DTR 0x10
389 #define INVERT_DSR 0x20
391 #define INVERT_DCD 0x40
393 #define INVERT_RI 0x80
396 #define CHANNEL_IS_UART 0x0
397 #define CHANNEL_IS_FIFO 0x1
398 #define CHANNEL_IS_OPTO 0x2
399 #define CHANNEL_IS_CPU 0x4
400 #define CHANNEL_IS_FT1284 0x8
402 #define CHANNEL_IS_RS485 0x10
412 #define DRIVER_VCP 0x08
413 #define DRIVER_VCPH 0x10
415 #define USE_USB_VERSION_BIT 0x10
417 #define SUSPEND_DBUS7_BIT 0x80
420 #define HIGH_CURRENT_DRIVE 0x10
421 #define HIGH_CURRENT_DRIVE_R 0x04
479 int vendor,
int product);
483 char *manufacturer,
int mnf_len,
484 char *description,
int desc_len,
485 char *serial,
int serial_len);
487 char *manufacturer,
int mnf_len,
488 char *description,
int desc_len,
489 char *serial,
int serial_len);
491 char * product,
char * serial);
495 const char* description,
const char* serial);
497 const char* description,
const char* serial,
unsigned int index);
523 void *userdata,
int packetsPerTransfer,
int numTransfers);
550 char * manufacturer,
char *product,
struct ftdi_transfer_control * ftdi_write_data_submit(struct ftdi_context *ftdi, unsigned char *buf, int size)
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins)
int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product)
enum ftdi_module_detach_mode module_detach_mode
list of usb devices created by ftdi_usb_find_all()
struct ftdi_device_list * next
int ftdi_eeprom_set_strings(struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
int ftdi_readstream(struct ftdi_context *ftdi, FTDIStreamCallback *callback, void *userdata, int packetsPerTransfer, int numTransfers)
void ftdi_transfer_data_cancel(struct ftdi_transfer_control *tc, struct timeval *to)
void ftdi_list_free2(struct ftdi_device_list *devlist)
int ftdi_usb_purge_tx_buffer(struct ftdi_context *ftdi)
int ftdi_read_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val)
void ftdi_deinit(struct ftdi_context *ftdi)
void ftdi_set_usbdev(struct ftdi_context *ftdi, struct libusb_device_handle *usbdev)
int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial, unsigned int index)
struct libusb_transfer * transfer
int ftdi_set_baudrate(struct ftdi_context *ftdi, int baudrate)
int ftdi_write_data(struct ftdi_context *ftdi, const unsigned char *buf, int size)
Main context structure for all libftdi functions.
int ftdi_set_event_char(struct ftdi_context *ftdi, unsigned char eventch, unsigned char enable)
int ftdi_set_bitmode(struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode)
void ftdi_list_free(struct ftdi_device_list **devlist)
int ftdi_set_line_property(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
Progress Info for streaming read.
int ftdi_usb_purge_rx_buffer(struct ftdi_context *ftdi)
struct ftdi_context * ftdi_new(void)
int ftdi_erase_eeprom(struct ftdi_context *ftdi)
int ftdi_set_eeprom_user_data(struct ftdi_context *ftdi, const char *buf, int size)
int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
int ftdi_transfer_data_done(struct ftdi_transfer_control *tc)
unsigned int readbuffer_remaining
int ftdi_set_error_char(struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose)
struct libusb_device * dev
int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int *value)
int ftdi_init(struct ftdi_context *ftdi)
unsigned char * readbuffer
struct ftdi_transfer_control * ftdi_read_data_submit(struct ftdi_context *ftdi, unsigned char *buf, int size)
struct libusb_context * usb_ctx
unsigned int writebuffer_chunksize
int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status)
int ftdi_setdtr_rts(struct ftdi_context *ftdi, int dtr, int rts)
int ftdi_set_eeprom_buf(struct ftdi_context *ftdi, const unsigned char *buf, int size)
int ftdi_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
unsigned char bitbang_mode
int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct libusb_device *dev)
struct ftdi_context * ftdi
int ftdi_set_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int value)
const char * snapshot_str
int ftdi_setflowctrl(struct ftdi_context *ftdi, int flowctrl)
int ftdi_usb_open_desc(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial)
struct libusb_device_handle * usb_dev
int ftdi_usb_close(struct ftdi_context *ftdi)
unsigned int max_packet_size
int ftdi_setrts(struct ftdi_context *ftdi, int state)
int ftdi_usb_reset(struct ftdi_context *ftdi)
int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency)
int ftdi_usb_get_strings(struct ftdi_context *ftdi, struct libusb_device *dev, char *manufacturer, int mnf_len, char *description, int desc_len, char *serial, int serial_len)
int ftdi_usb_get_strings2(struct ftdi_context *ftdi, struct libusb_device *dev, char *manufacturer, int mnf_len, char *description, int desc_len, char *serial, int serial_len)
int ftdi_read_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
unsigned char bitbang_enabled
int ftdi_write_eeprom(struct ftdi_context *ftdi)
int ftdi_usb_open_string(struct ftdi_context *ftdi, const char *description)
int ftdi_disable_bitbang(struct ftdi_context *ftdi)
int ftdi_setdtr(struct ftdi_context *ftdi, int state)
int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency)
unsigned int readbuffer_chunksize
int ftdi_read_eeprom(struct ftdi_context *ftdi)
char * ftdi_get_error_string(struct ftdi_context *ftdi)
int ftdi_eeprom_build(struct ftdi_context *ftdi)
int ftdi_usb_purge_buffers(struct ftdi_context *ftdi)
int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
int ftdi_write_eeprom_location(struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val)
int ftdi_get_eeprom_buf(struct ftdi_context *ftdi, unsigned char *buf, int size)
int( FTDIStreamCallback)(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *userdata)
unsigned int readbuffer_offset
void ftdi_free(struct ftdi_context *ftdi)
int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid)
int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product)
int ftdi_set_line_property2(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity, enum ftdi_break_type break_type)
struct ftdi_eeprom * eeprom