22 #define FTDI_DEFAULT_EEPROM_SIZE 128
67 #define MPSSE_WRITE_NEG 0x01
68 #define MPSSE_BITMODE 0x02
69 #define MPSSE_READ_NEG 0x04
70 #define MPSSE_LSB 0x08
71 #define MPSSE_DO_WRITE 0x10
72 #define MPSSE_DO_READ 0x20
73 #define MPSSE_WRITE_TMS 0x40
76 #define SET_BITS_LOW 0x80
79 #define SET_BITS_HIGH 0x82
82 #define GET_BITS_LOW 0x81
83 #define GET_BITS_HIGH 0x83
84 #define LOOPBACK_START 0x84
85 #define LOOPBACK_END 0x85
86 #define TCK_DIVISOR 0x86
88 #define DIS_DIV_5 0x8a
90 #define EN_3_PHASE 0x8c
91 #define DIS_3_PHASE 0x8d
93 #define CLK_BYTES 0x8f
94 #define CLK_WAIT_HIGH 0x94
95 #define CLK_WAIT_LOW 0x95
96 #define EN_ADAPTIVE 0x96
97 #define DIS_ADAPTIVE 0x97
98 #define CLK_BYTES_OR_HIGH 0x9c
99 #define CLK_BYTES_OR_LOW 0x0d
101 #define DRIVE_OPEN_COLLECTOR 0x9e
104 #define DIV_VALUE(rate) (rate > 6000000)?0:((6000000/rate -1) > 0xffff)? 0xffff: (6000000/rate -1)
107 #define SEND_IMMEDIATE 0x87
108 #define WAIT_ON_HIGH 0x88
109 #define WAIT_ON_LOW 0x89
112 #define READ_SHORT 0x90
114 #define READ_EXTENDED 0x91
117 #define WRITE_SHORT 0x92
119 #define WRITE_EXTENDED 0x93
125 #define SIO_MODEM_CTRL 1
126 #define SIO_SET_FLOW_CTRL 2
127 #define SIO_SET_BAUD_RATE 3
128 #define SIO_SET_DATA 4
130 #define FTDI_DEVICE_OUT_REQTYPE (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT)
131 #define FTDI_DEVICE_IN_REQTYPE (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN)
134 #define SIO_RESET_REQUEST SIO_RESET
135 #define SIO_SET_BAUDRATE_REQUEST SIO_SET_BAUD_RATE
136 #define SIO_SET_DATA_REQUEST SIO_SET_DATA
137 #define SIO_SET_FLOW_CTRL_REQUEST SIO_SET_FLOW_CTRL
138 #define SIO_SET_MODEM_CTRL_REQUEST SIO_MODEM_CTRL
139 #define SIO_POLL_MODEM_STATUS_REQUEST 0x05
140 #define SIO_SET_EVENT_CHAR_REQUEST 0x06
141 #define SIO_SET_ERROR_CHAR_REQUEST 0x07
142 #define SIO_SET_LATENCY_TIMER_REQUEST 0x09
143 #define SIO_GET_LATENCY_TIMER_REQUEST 0x0A
144 #define SIO_SET_BITMODE_REQUEST 0x0B
145 #define SIO_READ_PINS_REQUEST 0x0C
146 #define SIO_READ_EEPROM_REQUEST 0x90
147 #define SIO_WRITE_EEPROM_REQUEST 0x91
148 #define SIO_ERASE_EEPROM_REQUEST 0x92
151 #define SIO_RESET_SIO 0
152 #define SIO_RESET_PURGE_RX 1
153 #define SIO_RESET_PURGE_TX 2
155 #define SIO_DISABLE_FLOW_CTRL 0x0
156 #define SIO_RTS_CTS_HS (0x1 << 8)
157 #define SIO_DTR_DSR_HS (0x2 << 8)
158 #define SIO_XON_XOFF_HS (0x4 << 8)
160 #define SIO_SET_DTR_MASK 0x1
161 #define SIO_SET_DTR_HIGH ( 1 | ( SIO_SET_DTR_MASK << 8))
162 #define SIO_SET_DTR_LOW ( 0 | ( SIO_SET_DTR_MASK << 8))
163 #define SIO_SET_RTS_MASK 0x2
164 #define SIO_SET_RTS_HIGH ( 2 | ( SIO_SET_RTS_MASK << 8 ))
165 #define SIO_SET_RTS_LOW ( 0 | ( SIO_SET_RTS_MASK << 8 ))
167 #define SIO_RTS_CTS_HS (0x1 << 8)
171 #define FTDI_URB_USERCONTEXT_COOKIE ((void *)0x1)
174 #define DEPRECATED(func) func __attribute__ ((deprecated))
175 #elif defined(_MSC_VER)
176 #define DEPRECATED(func) __declspec(deprecated) func
178 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
179 #define DEPRECATED(func) func
267 #define CBUS_TXRXLED 4
279 #define CBUS_IOMODE 10
281 #define CBUS_BB_WR 11
283 #define CBUS_BB_RD 12
287 #define INVERT_TXD 0x01
289 #define INVERT_RXD 0x02
291 #define INVERT_RTS 0x04
293 #define INVERT_CTS 0x08
295 #define INVERT_DTR 0x10
297 #define INVERT_DSR 0x20
299 #define INVERT_DCD 0x40
301 #define INVERT_RI 0x80
304 #define HIGH_CURRENT_DRIVE 0x04
373 int vendor,
int product);
377 char * manufacturer,
int mnf_len,
378 char * description,
int desc_len,
379 char * serial,
int serial_len);
383 const char* description,
const char* serial);
385 const char* description,
const char* serial,
unsigned int index);
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_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize)
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)
int ftdi_usb_open_desc_index(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial, unsigned int index)
int ftdi_set_baudrate(struct ftdi_context *ftdi, int baudrate)
int ftdi_write_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom)
Main context structure for all libftdi functions.
int ftdi_usb_get_strings(struct ftdi_context *ftdi, struct usb_device *dev, char *manufacturer, int mnf_len, char *description, int desc_len, char *serial, int serial_len)
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_enable_bitbang(struct ftdi_context *ftdi, unsigned char bitmask)
int ftdi_set_line_property(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)
int ftdi_usb_purge_rx_buffer(struct ftdi_context *ftdi)
struct ftdi_context * ftdi_new(void)
int ftdi_write_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
void ftdi_eeprom_setsize(struct ftdi_context *ftdi, struct ftdi_eeprom *eeprom, int size)
int ftdi_erase_eeprom(struct ftdi_context *ftdi)
int ftdi_set_interface(struct ftdi_context *ftdi, enum ftdi_interface interface)
int ftdi_read_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom)
unsigned int readbuffer_remaining
void ftdi_set_usbdev(struct ftdi_context *ftdi, usb_dev_handle *usbdev)
int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct usb_device *dev)
int ftdi_set_error_char(struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
unsigned int async_usb_buffer_size
int ftdi_init(struct ftdi_context *ftdi)
int ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, unsigned char *output, int size)
void ftdi_async_complete(struct ftdi_context *ftdi, int wait_for_more)
unsigned char * readbuffer
unsigned int writebuffer_chunksize
void ftdi_eeprom_initdefaults(struct ftdi_eeprom *eeprom)
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_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize)
unsigned char bitbang_mode
int ftdi_eeprom_build(struct ftdi_eeprom *eeprom, unsigned char *output)
int ftdi_setflowctrl(struct ftdi_context *ftdi, int flowctrl)
void ftdi_eeprom_free(struct ftdi_eeprom *eeprom)
int ftdi_usb_open_desc(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial)
struct usb_dev_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_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_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
char * ftdi_get_error_string(struct ftdi_context *ftdi)
int ftdi_read_eeprom_getsize(struct ftdi_context *ftdi, unsigned char *eeprom, int maxsize)
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)
unsigned int readbuffer_offset
int ftdi_write_data_async(struct ftdi_context *ftdi, unsigned char *buf, int size)
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)