30 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
32 #if defined(interface)
91 #define MPSSE_WRITE_NEG 0x01
92 #define MPSSE_BITMODE 0x02
93 #define MPSSE_READ_NEG 0x04
94 #define MPSSE_LSB 0x08
95 #define MPSSE_DO_WRITE 0x10
96 #define MPSSE_DO_READ 0x20
97 #define MPSSE_WRITE_TMS 0x40
100 #define SET_BITS_LOW 0x80
103 #define SET_BITS_HIGH 0x82
106 #define GET_BITS_LOW 0x81
107 #define GET_BITS_HIGH 0x83
108 #define LOOPBACK_START 0x84
109 #define LOOPBACK_END 0x85
110 #define TCK_DIVISOR 0x86
112 #define DIS_DIV_5 0x8a
113 #define EN_DIV_5 0x8b
114 #define EN_3_PHASE 0x8c
115 #define DIS_3_PHASE 0x8d
116 #define CLK_BITS 0x8e
117 #define CLK_BYTES 0x8f
118 #define CLK_WAIT_HIGH 0x94
119 #define CLK_WAIT_LOW 0x95
120 #define EN_ADAPTIVE 0x96
121 #define DIS_ADAPTIVE 0x97
122 #define CLK_BYTES_OR_HIGH 0x9c
123 #define CLK_BYTES_OR_LOW 0x9d
125 #define DRIVE_OPEN_COLLECTOR 0x9e
128 #define DIV_VALUE(rate) (rate > 6000000)?0:((6000000/rate -1) > 0xffff)? 0xffff: (6000000/rate -1)
131 #define SEND_IMMEDIATE 0x87
132 #define WAIT_ON_HIGH 0x88
133 #define WAIT_ON_LOW 0x89
136 #define READ_SHORT 0x90
138 #define READ_EXTENDED 0x91
141 #define WRITE_SHORT 0x92
143 #define WRITE_EXTENDED 0x93
149 #define SIO_MODEM_CTRL 1
150 #define SIO_SET_FLOW_CTRL 2
151 #define SIO_SET_BAUD_RATE 3
152 #define SIO_SET_DATA 4
154 #define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT)
155 #define FTDI_DEVICE_IN_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN)
158 #define SIO_RESET_REQUEST SIO_RESET
159 #define SIO_SET_BAUDRATE_REQUEST SIO_SET_BAUD_RATE
160 #define SIO_SET_DATA_REQUEST SIO_SET_DATA
161 #define SIO_SET_FLOW_CTRL_REQUEST SIO_SET_FLOW_CTRL
162 #define SIO_SET_MODEM_CTRL_REQUEST SIO_MODEM_CTRL
163 #define SIO_POLL_MODEM_STATUS_REQUEST 0x05
164 #define SIO_SET_EVENT_CHAR_REQUEST 0x06
165 #define SIO_SET_ERROR_CHAR_REQUEST 0x07
166 #define SIO_SET_LATENCY_TIMER_REQUEST 0x09
167 #define SIO_GET_LATENCY_TIMER_REQUEST 0x0A
168 #define SIO_SET_BITMODE_REQUEST 0x0B
169 #define SIO_READ_PINS_REQUEST 0x0C
170 #define SIO_READ_EEPROM_REQUEST 0x90
171 #define SIO_WRITE_EEPROM_REQUEST 0x91
172 #define SIO_ERASE_EEPROM_REQUEST 0x92
175 #define SIO_RESET_SIO 0
176 #define SIO_RESET_PURGE_RX 1
177 #define SIO_RESET_PURGE_TX 2
179 #define SIO_DISABLE_FLOW_CTRL 0x0
180 #define SIO_RTS_CTS_HS (0x1 << 8)
181 #define SIO_DTR_DSR_HS (0x2 << 8)
182 #define SIO_XON_XOFF_HS (0x4 << 8)
184 #define SIO_SET_DTR_MASK 0x1
185 #define SIO_SET_DTR_HIGH ( 1 | ( SIO_SET_DTR_MASK << 8))
186 #define SIO_SET_DTR_LOW ( 0 | ( SIO_SET_DTR_MASK << 8))
187 #define SIO_SET_RTS_MASK 0x2
188 #define SIO_SET_RTS_HIGH ( 2 | ( SIO_SET_RTS_MASK << 8 ))
189 #define SIO_SET_RTS_LOW ( 0 | ( SIO_SET_RTS_MASK << 8 ))
191 #define SIO_RTS_CTS_HS (0x1 << 8)
195 #define FTDI_URB_USERCONTEXT_COOKIE ((void *)0x1)
198 #define DEPRECATED(func) func __attribute__ ((deprecated))
199 #elif defined(_MSC_VER)
200 #define DEPRECATED(func) __declspec(deprecated) func
202 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
203 #define DEPRECATED(func) func
349 struct libusb_device *
dev;
351 #define FT1284_CLK_IDLE_STATE 0x01
352 #define FT1284_DATA_LSB 0x02
353 #define FT1284_FLOW_CONTROL 0x04
354 #define POWER_SAVE_DISABLE_H 0x80
356 #define USE_SERIAL_NUM 0x08
381 #define INVERT_TXD 0x01
383 #define INVERT_RXD 0x02
385 #define INVERT_RTS 0x04
387 #define INVERT_CTS 0x08
389 #define INVERT_DTR 0x10
391 #define INVERT_DSR 0x20
393 #define INVERT_DCD 0x40
395 #define INVERT_RI 0x80
398 #define CHANNEL_IS_UART 0x0
399 #define CHANNEL_IS_FIFO 0x1
400 #define CHANNEL_IS_OPTO 0x2
401 #define CHANNEL_IS_CPU 0x4
402 #define CHANNEL_IS_FT1284 0x8
404 #define CHANNEL_IS_RS485 0x10
414 #define DRIVER_VCP 0x08
415 #define DRIVER_VCPH 0x10
417 #define USE_USB_VERSION_BIT 0x10
419 #define SUSPEND_DBUS7_BIT 0x80
422 #define HIGH_CURRENT_DRIVE 0x10
423 #define HIGH_CURRENT_DRIVE_R 0x04
481 int vendor,
int product);
485 char *manufacturer,
int mnf_len,
486 char *description,
int desc_len,
487 char *serial,
int serial_len);
489 char *manufacturer,
int mnf_len,
490 char *description,
int desc_len,
491 char *serial,
int serial_len);
494 char *manufacturer,
int mnf_len,
495 char *product,
int prod_len,
496 char *serial,
int serial_len);
498 char * product,
char * serial);
502 const char* description,
const char* serial);
504 const char* description,
const char* serial,
unsigned int index);
531 void *userdata,
int packetsPerTransfer,
int numTransfers);
558 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)
int ftdi_eeprom_get_strings(struct ftdi_context *ftdi, char *manufacturer, int mnf_len, char *product, int prod_len, char *serial, int serial_len)
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)
const char * ftdi_get_error_string(struct ftdi_context *ftdi)
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)
int ftdi_usb_open_bus_addr(struct ftdi_context *ftdi, uint8_t bus, uint8_t addr)
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