ftdi.h File Reference

#include <stdint.h>
#include <sys/time.h>

Go to the source code of this file.

Classes

struct  ftdi_transfer_control
struct  ftdi_context
 Main context structure for all libftdi functions. More...
struct  ftdi_device_list
 list of usb devices created by ftdi_usb_find_all() More...
struct  size_and_time
 Progress Info for streaming read. More...
struct  FTDIProgressInfo
struct  ftdi_version_info

Defines

#define MPSSE_WRITE_NEG   0x01
#define MPSSE_BITMODE   0x02
#define MPSSE_READ_NEG   0x04
#define MPSSE_LSB   0x08
#define MPSSE_DO_WRITE   0x10
#define MPSSE_DO_READ   0x20
#define MPSSE_WRITE_TMS   0x40
#define SET_BITS_LOW   0x80
#define SET_BITS_HIGH   0x82
#define GET_BITS_LOW   0x81
#define GET_BITS_HIGH   0x83
#define LOOPBACK_START   0x84
#define LOOPBACK_END   0x85
#define TCK_DIVISOR   0x86
#define DIS_DIV_5   0x8a
#define EN_DIV_5   0x8b
#define EN_3_PHASE   0x8c
#define DIS_3_PHASE   0x8d
#define CLK_BITS   0x8e
#define CLK_BYTES   0x8f
#define CLK_WAIT_HIGH   0x94
#define CLK_WAIT_LOW   0x95
#define EN_ADAPTIVE   0x96
#define DIS_ADAPTIVE   0x97
#define CLK_BYTES_OR_HIGH   0x9c
#define CLK_BYTES_OR_LOW   0x9d
#define DRIVE_OPEN_COLLECTOR   0x9e
#define DIV_VALUE(rate)   (rate > 6000000)?0:((6000000/rate -1) > 0xffff)? 0xffff: (6000000/rate -1)
#define SEND_IMMEDIATE   0x87
#define WAIT_ON_HIGH   0x88
#define WAIT_ON_LOW   0x89
#define READ_SHORT   0x90
#define READ_EXTENDED   0x91
#define WRITE_SHORT   0x92
#define WRITE_EXTENDED   0x93
#define SIO_RESET   0
#define SIO_MODEM_CTRL   1
#define SIO_SET_FLOW_CTRL   2
#define SIO_SET_BAUD_RATE   3
#define SIO_SET_DATA   4
#define FTDI_DEVICE_OUT_REQTYPE   (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT)
#define FTDI_DEVICE_IN_REQTYPE   (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN)
#define SIO_RESET_REQUEST   SIO_RESET
#define SIO_SET_BAUDRATE_REQUEST   SIO_SET_BAUD_RATE
#define SIO_SET_DATA_REQUEST   SIO_SET_DATA
#define SIO_SET_FLOW_CTRL_REQUEST   SIO_SET_FLOW_CTRL
#define SIO_SET_MODEM_CTRL_REQUEST   SIO_MODEM_CTRL
#define SIO_POLL_MODEM_STATUS_REQUEST   0x05
#define SIO_SET_EVENT_CHAR_REQUEST   0x06
#define SIO_SET_ERROR_CHAR_REQUEST   0x07
#define SIO_SET_LATENCY_TIMER_REQUEST   0x09
#define SIO_GET_LATENCY_TIMER_REQUEST   0x0A
#define SIO_SET_BITMODE_REQUEST   0x0B
#define SIO_READ_PINS_REQUEST   0x0C
#define SIO_READ_EEPROM_REQUEST   0x90
#define SIO_WRITE_EEPROM_REQUEST   0x91
#define SIO_ERASE_EEPROM_REQUEST   0x92
#define SIO_RESET_SIO   0
#define SIO_RESET_PURGE_RX   1
#define SIO_RESET_PURGE_TX   2
#define SIO_DISABLE_FLOW_CTRL   0x0
#define SIO_RTS_CTS_HS   (0x1 << 8)
#define SIO_DTR_DSR_HS   (0x2 << 8)
#define SIO_XON_XOFF_HS   (0x4 << 8)
#define SIO_SET_DTR_MASK   0x1
#define SIO_SET_DTR_HIGH   ( 1 | ( SIO_SET_DTR_MASK << 8))
#define SIO_SET_DTR_LOW   ( 0 | ( SIO_SET_DTR_MASK << 8))
#define SIO_SET_RTS_MASK   0x2
#define SIO_SET_RTS_HIGH   ( 2 | ( SIO_SET_RTS_MASK << 8 ))
#define SIO_SET_RTS_LOW   ( 0 | ( SIO_SET_RTS_MASK << 8 ))
#define SIO_RTS_CTS_HS   (0x1 << 8)
#define FTDI_URB_USERCONTEXT_COOKIE   ((void *)0x1)
#define DEPRECATED(func)   func
#define FT1284_CLK_IDLE_STATE   0x01
#define FT1284_DATA_LSB   0x02
#define FT1284_FLOW_CONTROL   0x04
#define POWER_SAVE_DISABLE_H   0x80
#define USE_SERIAL_NUM   0x08
#define INVERT_TXD   0x01
#define INVERT_RXD   0x02
#define INVERT_RTS   0x04
#define INVERT_CTS   0x08
#define INVERT_DTR   0x10
#define INVERT_DSR   0x20
#define INVERT_DCD   0x40
#define INVERT_RI   0x80
#define CHANNEL_IS_UART   0x0
#define CHANNEL_IS_FIFO   0x1
#define CHANNEL_IS_OPTO   0x2
#define CHANNEL_IS_CPU   0x4
#define CHANNEL_IS_FT1284   0x8
#define CHANNEL_IS_RS485   0x10
#define DRIVE_4MA   0
#define DRIVE_8MA   1
#define DRIVE_12MA   2
#define DRIVE_16MA   3
#define SLOW_SLEW   4
#define IS_SCHMITT   8
#define DRIVER_VCP   0x08
#define DRIVER_VCPH   0x10
#define USE_USB_VERSION_BIT   0x10
#define SUSPEND_DBUS7_BIT   0x80
#define HIGH_CURRENT_DRIVE   0x10
#define HIGH_CURRENT_DRIVE_R   0x04

Typedefs

typedef int( FTDIStreamCallback )(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *userdata)

Enumerations

enum  ftdi_chip_type {
  TYPE_AM = 0, TYPE_BM = 1, TYPE_2232C = 2, TYPE_R = 3,
  TYPE_2232H = 4, TYPE_4232H = 5, TYPE_232H = 6, TYPE_230X = 7
}
enum  ftdi_parity_type {
  NONE = 0, ODD = 1, EVEN = 2, MARK = 3,
  SPACE = 4
}
enum  ftdi_stopbits_type { STOP_BIT_1 = 0, STOP_BIT_15 = 1, STOP_BIT_2 = 2 }
enum  ftdi_bits_type { BITS_7 = 7, BITS_8 = 8 }
enum  ftdi_break_type { BREAK_OFF = 0, BREAK_ON = 1 }
enum  ftdi_mpsse_mode {
  BITMODE_RESET = 0x00, BITMODE_BITBANG = 0x01, BITMODE_MPSSE = 0x02, BITMODE_SYNCBB = 0x04,
  BITMODE_MCU = 0x08, BITMODE_OPTO = 0x10, BITMODE_CBUS = 0x20, BITMODE_SYNCFF = 0x40,
  BITMODE_FT1284 = 0x80
}
enum  ftdi_interface {
  INTERFACE_ANY = 0, INTERFACE_A = 1, INTERFACE_B = 2, INTERFACE_C = 3,
  INTERFACE_D = 4
}
enum  ftdi_module_detach_mode { AUTO_DETACH_SIO_MODULE = 0, DONT_DETACH_SIO_MODULE = 1 }
enum  ftdi_eeprom_value {
  VENDOR_ID = 0, PRODUCT_ID = 1, SELF_POWERED = 2, REMOTE_WAKEUP = 3,
  IS_NOT_PNP = 4, SUSPEND_DBUS7 = 5, IN_IS_ISOCHRONOUS = 6, OUT_IS_ISOCHRONOUS = 7,
  SUSPEND_PULL_DOWNS = 8, USE_SERIAL = 9, USB_VERSION = 10, USE_USB_VERSION = 11,
  MAX_POWER = 12, CHANNEL_A_TYPE = 13, CHANNEL_B_TYPE = 14, CHANNEL_A_DRIVER = 15,
  CHANNEL_B_DRIVER = 16, CBUS_FUNCTION_0 = 17, CBUS_FUNCTION_1 = 18, CBUS_FUNCTION_2 = 19,
  CBUS_FUNCTION_3 = 20, CBUS_FUNCTION_4 = 21, CBUS_FUNCTION_5 = 22, CBUS_FUNCTION_6 = 23,
  CBUS_FUNCTION_7 = 24, CBUS_FUNCTION_8 = 25, CBUS_FUNCTION_9 = 26, HIGH_CURRENT = 27,
  HIGH_CURRENT_A = 28, HIGH_CURRENT_B = 29, INVERT = 30, GROUP0_DRIVE = 31,
  GROUP0_SCHMITT = 32, GROUP0_SLEW = 33, GROUP1_DRIVE = 34, GROUP1_SCHMITT = 35,
  GROUP1_SLEW = 36, GROUP2_DRIVE = 37, GROUP2_SCHMITT = 38, GROUP2_SLEW = 39,
  GROUP3_DRIVE = 40, GROUP3_SCHMITT = 41, GROUP3_SLEW = 42, CHIP_SIZE = 43,
  CHIP_TYPE = 44, POWER_SAVE = 45, CLOCK_POLARITY = 46, DATA_ORDER = 47,
  FLOW_CONTROL = 48, CHANNEL_C_DRIVER = 49, CHANNEL_D_DRIVER = 50, CHANNEL_A_RS485 = 51,
  CHANNEL_B_RS485 = 52, CHANNEL_C_RS485 = 53, CHANNEL_D_RS485 = 54, RELEASE_NUMBER = 55,
  EXTERNAL_OSCILLATOR = 56, USER_DATA_ADDR = 57
}
enum  ftdi_cbus_func {
  CBUS_TXDEN = 0, CBUS_PWREN = 1, CBUS_RXLED = 2, CBUS_TXLED = 3,
  CBUS_TXRXLED = 4, CBUS_SLEEP = 5, CBUS_CLK48 = 6, CBUS_CLK24 = 7,
  CBUS_CLK12 = 8, CBUS_CLK6 = 9, CBUS_IOMODE = 0xa, CBUS_BB_WR = 0xb,
  CBUS_BB_RD = 0xc
}
enum  ftdi_cbush_func {
  CBUSH_TRISTATE = 0, CBUSH_TXLED = 1, CBUSH_RXLED = 2, CBUSH_TXRXLED = 3,
  CBUSH_PWREN = 4, CBUSH_SLEEP = 5, CBUSH_DRIVE_0 = 6, CBUSH_DRIVE1 = 7,
  CBUSH_IOMODE = 8, CBUSH_TXDEN = 9, CBUSH_CLK30 = 10, CBUSH_CLK15 = 11,
  CBUSH_CLK7_5 = 12
}
enum  ftdi_cbusx_func {
  CBUSX_TRISTATE = 0, CBUSX_TXLED = 1, CBUSX_RXLED = 2, CBUSX_TXRXLED = 3,
  CBUSX_PWREN = 4, CBUSX_SLEEP = 5, CBUSX_DRIVE_0 = 6, CBUSX_DRIVE1 = 7,
  CBUSX_IOMODE = 8, CBUSX_TXDEN = 9, CBUSX_CLK24 = 10, CBUSX_CLK12 = 11,
  CBUSX_CLK6 = 12, CBUSX_BAT_DETECT = 13, CBUSX_BAT_DETECT_NEG = 14, CBUSX_I2C_TXE = 15,
  CBUSX_I2C_RXF = 16, CBUSX_VBUS_SENSE = 17, CBUSX_BB_WR = 18, CBUSX_BB_RD = 19,
  CBUSX_TIME_STAMP = 20, CBUSX_AWAKE = 21
}

Functions

int ftdi_init (struct ftdi_context *ftdi)
struct ftdi_contextftdi_new (void)
int ftdi_set_interface (struct ftdi_context *ftdi, enum ftdi_interface interface)
void ftdi_deinit (struct ftdi_context *ftdi)
void ftdi_free (struct ftdi_context *ftdi)
void ftdi_set_usbdev (struct ftdi_context *ftdi, struct libusb_device_handle *usbdev)
struct ftdi_version_info ftdi_get_library_version (void)
 Get libftdi library version.
int ftdi_usb_find_all (struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product)
void ftdi_list_free (struct ftdi_device_list **devlist)
void ftdi_list_free2 (struct ftdi_device_list *devlist)
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_eeprom_get_strings (struct ftdi_context *ftdi, char *manufacturer, int mnf_len, char *product, int prod_len, char *serial, int serial_len)
int ftdi_eeprom_set_strings (struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
int ftdi_usb_open (struct ftdi_context *ftdi, int vendor, int product)
int ftdi_usb_open_desc (struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial)
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_usb_open_bus_addr (struct ftdi_context *ftdi, uint8_t bus, uint8_t addr)
int ftdi_usb_open_dev (struct ftdi_context *ftdi, struct libusb_device *dev)
int ftdi_usb_open_string (struct ftdi_context *ftdi, const char *description)
int ftdi_usb_close (struct ftdi_context *ftdi)
int ftdi_usb_reset (struct ftdi_context *ftdi)
int ftdi_usb_purge_rx_buffer (struct ftdi_context *ftdi)
int ftdi_usb_purge_tx_buffer (struct ftdi_context *ftdi)
int ftdi_usb_purge_buffers (struct ftdi_context *ftdi)
int ftdi_set_baudrate (struct ftdi_context *ftdi, int baudrate)
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_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)
int ftdi_read_data (struct ftdi_context *ftdi, unsigned char *buf, int size)
int ftdi_read_data_set_chunksize (struct ftdi_context *ftdi, unsigned int chunksize)
int ftdi_read_data_get_chunksize (struct ftdi_context *ftdi, unsigned int *chunksize)
int ftdi_write_data (struct ftdi_context *ftdi, const unsigned char *buf, int size)
int ftdi_write_data_set_chunksize (struct ftdi_context *ftdi, unsigned int chunksize)
int ftdi_write_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)
struct ftdi_transfer_controlftdi_write_data_submit (struct ftdi_context *ftdi, unsigned char *buf, int size)
struct ftdi_transfer_controlftdi_read_data_submit (struct ftdi_context *ftdi, unsigned char *buf, int size)
int ftdi_transfer_data_done (struct ftdi_transfer_control *tc)
void ftdi_transfer_data_cancel (struct ftdi_transfer_control *tc, struct timeval *to)
int ftdi_set_bitmode (struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode)
int ftdi_disable_bitbang (struct ftdi_context *ftdi)
int ftdi_read_pins (struct ftdi_context *ftdi, unsigned char *pins)
int ftdi_set_latency_timer (struct ftdi_context *ftdi, unsigned char latency)
int ftdi_get_latency_timer (struct ftdi_context *ftdi, unsigned char *latency)
int ftdi_poll_modem_status (struct ftdi_context *ftdi, unsigned short *status)
int ftdi_setflowctrl (struct ftdi_context *ftdi, int flowctrl)
int ftdi_setdtr_rts (struct ftdi_context *ftdi, int dtr, int rts)
int ftdi_setdtr (struct ftdi_context *ftdi, int state)
int ftdi_setrts (struct ftdi_context *ftdi, int state)
int ftdi_set_event_char (struct ftdi_context *ftdi, unsigned char eventch, unsigned char enable)
int ftdi_set_error_char (struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
int ftdi_eeprom_initdefaults (struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
int ftdi_eeprom_build (struct ftdi_context *ftdi)
int ftdi_eeprom_decode (struct ftdi_context *ftdi, int verbose)
int ftdi_get_eeprom_value (struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int *value)
int ftdi_set_eeprom_value (struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int value)
int ftdi_get_eeprom_buf (struct ftdi_context *ftdi, unsigned char *buf, int size)
int ftdi_set_eeprom_buf (struct ftdi_context *ftdi, const unsigned char *buf, int size)
int ftdi_set_eeprom_user_data (struct ftdi_context *ftdi, const char *buf, int size)
int ftdi_read_eeprom (struct ftdi_context *ftdi)
int ftdi_read_chipid (struct ftdi_context *ftdi, unsigned int *chipid)
int ftdi_write_eeprom (struct ftdi_context *ftdi)
int ftdi_erase_eeprom (struct ftdi_context *ftdi)
int ftdi_read_eeprom_location (struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val)
int ftdi_write_eeprom_location (struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val)
const char * ftdi_get_error_string (struct ftdi_context *ftdi)

Define Documentation

#define MPSSE_WRITE_NEG   0x01

Definition at line 91 of file ftdi.h.

#define MPSSE_BITMODE   0x02

Definition at line 92 of file ftdi.h.

#define MPSSE_READ_NEG   0x04

Definition at line 93 of file ftdi.h.

#define MPSSE_LSB   0x08

Definition at line 94 of file ftdi.h.

#define MPSSE_DO_WRITE   0x10

Definition at line 95 of file ftdi.h.

#define MPSSE_DO_READ   0x20

Definition at line 96 of file ftdi.h.

#define MPSSE_WRITE_TMS   0x40

Definition at line 97 of file ftdi.h.

#define SET_BITS_LOW   0x80

Definition at line 100 of file ftdi.h.

#define SET_BITS_HIGH   0x82

Definition at line 103 of file ftdi.h.

#define GET_BITS_LOW   0x81

Definition at line 106 of file ftdi.h.

#define GET_BITS_HIGH   0x83

Definition at line 107 of file ftdi.h.

#define LOOPBACK_START   0x84

Definition at line 108 of file ftdi.h.

#define LOOPBACK_END   0x85

Definition at line 109 of file ftdi.h.

#define TCK_DIVISOR   0x86

Definition at line 110 of file ftdi.h.

#define DIS_DIV_5   0x8a

Definition at line 112 of file ftdi.h.

#define EN_DIV_5   0x8b

Definition at line 113 of file ftdi.h.

#define EN_3_PHASE   0x8c

Definition at line 114 of file ftdi.h.

#define DIS_3_PHASE   0x8d

Definition at line 115 of file ftdi.h.

#define CLK_BITS   0x8e

Definition at line 116 of file ftdi.h.

#define CLK_BYTES   0x8f

Definition at line 117 of file ftdi.h.

#define CLK_WAIT_HIGH   0x94

Definition at line 118 of file ftdi.h.

#define CLK_WAIT_LOW   0x95

Definition at line 119 of file ftdi.h.

#define EN_ADAPTIVE   0x96

Definition at line 120 of file ftdi.h.

#define DIS_ADAPTIVE   0x97

Definition at line 121 of file ftdi.h.

#define CLK_BYTES_OR_HIGH   0x9c

Definition at line 122 of file ftdi.h.

#define CLK_BYTES_OR_LOW   0x9d

Definition at line 123 of file ftdi.h.

#define DRIVE_OPEN_COLLECTOR   0x9e

Definition at line 125 of file ftdi.h.

#define DIV_VALUE ( rate   )     (rate > 6000000)?0:((6000000/rate -1) > 0xffff)? 0xffff: (6000000/rate -1)

Definition at line 128 of file ftdi.h.

#define SEND_IMMEDIATE   0x87

Definition at line 131 of file ftdi.h.

#define WAIT_ON_HIGH   0x88

Definition at line 132 of file ftdi.h.

#define WAIT_ON_LOW   0x89

Definition at line 133 of file ftdi.h.

#define READ_SHORT   0x90

Definition at line 136 of file ftdi.h.

#define READ_EXTENDED   0x91

Definition at line 138 of file ftdi.h.

#define WRITE_SHORT   0x92

Definition at line 141 of file ftdi.h.

#define WRITE_EXTENDED   0x93

Definition at line 143 of file ftdi.h.

#define SIO_RESET   0

Definition at line 148 of file ftdi.h.

#define SIO_MODEM_CTRL   1

Definition at line 149 of file ftdi.h.

#define SIO_SET_FLOW_CTRL   2

Definition at line 150 of file ftdi.h.

#define SIO_SET_BAUD_RATE   3

Definition at line 151 of file ftdi.h.

#define SIO_SET_DATA   4

Definition at line 152 of file ftdi.h.

#define FTDI_DEVICE_OUT_REQTYPE   (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT)
#define FTDI_DEVICE_IN_REQTYPE   (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN)
#define SIO_RESET_REQUEST   SIO_RESET

Definition at line 158 of file ftdi.h.

Referenced by ftdi_usb_purge_rx_buffer(), ftdi_usb_purge_tx_buffer(), and ftdi_usb_reset().

#define SIO_SET_BAUDRATE_REQUEST   SIO_SET_BAUD_RATE

Definition at line 159 of file ftdi.h.

Referenced by ftdi_set_baudrate().

#define SIO_SET_DATA_REQUEST   SIO_SET_DATA

Definition at line 160 of file ftdi.h.

Referenced by ftdi_set_line_property2().

#define SIO_SET_FLOW_CTRL_REQUEST   SIO_SET_FLOW_CTRL

Definition at line 161 of file ftdi.h.

Referenced by ftdi_setflowctrl().

#define SIO_SET_MODEM_CTRL_REQUEST   SIO_MODEM_CTRL

Definition at line 162 of file ftdi.h.

Referenced by ftdi_setdtr(), ftdi_setdtr_rts(), and ftdi_setrts().

#define SIO_POLL_MODEM_STATUS_REQUEST   0x05

Definition at line 163 of file ftdi.h.

Referenced by ftdi_poll_modem_status().

#define SIO_SET_EVENT_CHAR_REQUEST   0x06

Definition at line 164 of file ftdi.h.

Referenced by ftdi_set_event_char().

#define SIO_SET_ERROR_CHAR_REQUEST   0x07

Definition at line 165 of file ftdi.h.

Referenced by ftdi_set_error_char().

#define SIO_SET_LATENCY_TIMER_REQUEST   0x09

Definition at line 166 of file ftdi.h.

Referenced by ftdi_set_latency_timer().

#define SIO_GET_LATENCY_TIMER_REQUEST   0x0A

Definition at line 167 of file ftdi.h.

Referenced by ftdi_get_latency_timer().

#define SIO_SET_BITMODE_REQUEST   0x0B

Definition at line 168 of file ftdi.h.

Referenced by ftdi_disable_bitbang(), and ftdi_set_bitmode().

#define SIO_READ_PINS_REQUEST   0x0C

Definition at line 169 of file ftdi.h.

Referenced by ftdi_read_pins().

#define SIO_READ_EEPROM_REQUEST   0x90

Definition at line 170 of file ftdi.h.

Referenced by ftdi_read_chipid(), ftdi_read_eeprom(), and ftdi_read_eeprom_location().

#define SIO_WRITE_EEPROM_REQUEST   0x91

Definition at line 171 of file ftdi.h.

Referenced by ftdi_erase_eeprom(), ftdi_write_eeprom(), and ftdi_write_eeprom_location().

#define SIO_ERASE_EEPROM_REQUEST   0x92

Definition at line 172 of file ftdi.h.

Referenced by ftdi_erase_eeprom().

#define SIO_RESET_SIO   0

Definition at line 175 of file ftdi.h.

Referenced by ftdi_usb_reset().

#define SIO_RESET_PURGE_RX   1

Definition at line 176 of file ftdi.h.

Referenced by ftdi_usb_purge_rx_buffer().

#define SIO_RESET_PURGE_TX   2

Definition at line 177 of file ftdi.h.

Referenced by ftdi_usb_purge_tx_buffer().

#define SIO_DISABLE_FLOW_CTRL   0x0

Definition at line 179 of file ftdi.h.

#define SIO_RTS_CTS_HS   (0x1 << 8)

Definition at line 191 of file ftdi.h.

#define SIO_DTR_DSR_HS   (0x2 << 8)

Definition at line 181 of file ftdi.h.

#define SIO_XON_XOFF_HS   (0x4 << 8)

Definition at line 182 of file ftdi.h.

#define SIO_SET_DTR_MASK   0x1

Definition at line 184 of file ftdi.h.

#define SIO_SET_DTR_HIGH   ( 1 | ( SIO_SET_DTR_MASK << 8))

Definition at line 185 of file ftdi.h.

Referenced by ftdi_setdtr(), and ftdi_setdtr_rts().

#define SIO_SET_DTR_LOW   ( 0 | ( SIO_SET_DTR_MASK << 8))

Definition at line 186 of file ftdi.h.

Referenced by ftdi_setdtr(), and ftdi_setdtr_rts().

#define SIO_SET_RTS_MASK   0x2

Definition at line 187 of file ftdi.h.

#define SIO_SET_RTS_HIGH   ( 2 | ( SIO_SET_RTS_MASK << 8 ))

Definition at line 188 of file ftdi.h.

Referenced by ftdi_setdtr_rts(), and ftdi_setrts().

#define SIO_SET_RTS_LOW   ( 0 | ( SIO_SET_RTS_MASK << 8 ))

Definition at line 189 of file ftdi.h.

Referenced by ftdi_setdtr_rts(), and ftdi_setrts().

#define SIO_RTS_CTS_HS   (0x1 << 8)

Definition at line 191 of file ftdi.h.

#define FTDI_URB_USERCONTEXT_COOKIE   ((void *)0x1)

Definition at line 195 of file ftdi.h.

#define DEPRECATED ( func   )     func

Definition at line 203 of file ftdi.h.

#define FT1284_CLK_IDLE_STATE   0x01

Definition at line 351 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define FT1284_DATA_LSB   0x02

Definition at line 352 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define FT1284_FLOW_CONTROL   0x04

Definition at line 353 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define POWER_SAVE_DISABLE_H   0x80

Definition at line 354 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define USE_SERIAL_NUM   0x08

Definition at line 356 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define INVERT_TXD   0x01

Invert TXD#

Definition at line 381 of file ftdi.h.

#define INVERT_RXD   0x02

Invert RXD#

Definition at line 383 of file ftdi.h.

#define INVERT_RTS   0x04

Invert RTS#

Definition at line 385 of file ftdi.h.

#define INVERT_CTS   0x08

Invert CTS#

Definition at line 387 of file ftdi.h.

#define INVERT_DTR   0x10

Invert DTR#

Definition at line 389 of file ftdi.h.

#define INVERT_DSR   0x20

Invert DSR#

Definition at line 391 of file ftdi.h.

#define INVERT_DCD   0x40

Invert DCD#

Definition at line 393 of file ftdi.h.

#define INVERT_RI   0x80

Invert RI#

Definition at line 395 of file ftdi.h.

#define CHANNEL_IS_UART   0x0

Interface Mode.

Definition at line 398 of file ftdi.h.

#define CHANNEL_IS_FIFO   0x1

Definition at line 399 of file ftdi.h.

#define CHANNEL_IS_OPTO   0x2

Definition at line 400 of file ftdi.h.

#define CHANNEL_IS_CPU   0x4

Definition at line 401 of file ftdi.h.

#define CHANNEL_IS_FT1284   0x8

Definition at line 402 of file ftdi.h.

#define CHANNEL_IS_RS485   0x10

Definition at line 404 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define DRIVE_4MA   0

Definition at line 406 of file ftdi.h.

#define DRIVE_8MA   1

Definition at line 407 of file ftdi.h.

#define DRIVE_12MA   2

Definition at line 408 of file ftdi.h.

#define DRIVE_16MA   3

Definition at line 409 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define SLOW_SLEW   4

Definition at line 410 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define IS_SCHMITT   8

Definition at line 411 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define DRIVER_VCP   0x08

Driver Type.

Definition at line 414 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define DRIVER_VCPH   0x10

Definition at line 415 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define USE_USB_VERSION_BIT   0x10

Definition at line 417 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define SUSPEND_DBUS7_BIT   0x80

Definition at line 419 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define HIGH_CURRENT_DRIVE   0x10

High current drive.

Definition at line 422 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().

#define HIGH_CURRENT_DRIVE_R   0x04

Definition at line 423 of file ftdi.h.

Referenced by ftdi_eeprom_build(), and ftdi_eeprom_decode().


Typedef Documentation

typedef int( FTDIStreamCallback)(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *userdata)

Definition at line 444 of file ftdi.h.


Enumeration Type Documentation

FTDI chip type

Enumerator:
TYPE_AM 
TYPE_BM 
TYPE_2232C 
TYPE_R 
TYPE_2232H 
TYPE_4232H 
TYPE_232H 
TYPE_230X 

Definition at line 38 of file ftdi.h.

Parity mode for ftdi_set_line_property()

Enumerator:
NONE 
ODD 
EVEN 
MARK 
SPACE 

Definition at line 50 of file ftdi.h.

Number of stop bits for ftdi_set_line_property()

Enumerator:
STOP_BIT_1 
STOP_BIT_15 
STOP_BIT_2 

Definition at line 52 of file ftdi.h.

Number of bits for ftdi_set_line_property()

Enumerator:
BITS_7 
BITS_8 

Definition at line 54 of file ftdi.h.

Break type for ftdi_set_line_property2()

Enumerator:
BREAK_OFF 
BREAK_ON 

Definition at line 56 of file ftdi.h.

MPSSE bitbang modes

Enumerator:
BITMODE_RESET 

switch off bitbang mode, back to regular serial/FIFO

BITMODE_BITBANG 

classical asynchronous bitbang mode, introduced with B-type chips

BITMODE_MPSSE 

MPSSE mode, available on 2232x chips

BITMODE_SYNCBB 

synchronous bitbang mode, available on 2232x and R-type chips

BITMODE_MCU 

MCU Host Bus Emulation mode, available on 2232x chips

BITMODE_OPTO 

Fast Opto-Isolated Serial Interface Mode, available on 2232x chips

BITMODE_CBUS 

Bitbang on CBUS pins of R-type chips, configure in EEPROM before

BITMODE_SYNCFF 

Single Channel Synchronous FIFO mode, available on 2232H chips

BITMODE_FT1284 

FT1284 mode, available on 232H chips

Definition at line 59 of file ftdi.h.

Port interface for chips with multiple interfaces

Enumerator:
INTERFACE_ANY 
INTERFACE_A 
INTERFACE_B 
INTERFACE_C 
INTERFACE_D 

Definition at line 74 of file ftdi.h.

Automatic loading / unloading of kernel modules

Enumerator:
AUTO_DETACH_SIO_MODULE 
DONT_DETACH_SIO_MODULE 

Definition at line 84 of file ftdi.h.

List all handled EEPROM values. Append future new values only at the end to provide API/ABI stability

Enumerator:
VENDOR_ID 
PRODUCT_ID 
SELF_POWERED 
REMOTE_WAKEUP 
IS_NOT_PNP 
SUSPEND_DBUS7 
IN_IS_ISOCHRONOUS 
OUT_IS_ISOCHRONOUS 
SUSPEND_PULL_DOWNS 
USE_SERIAL 
USB_VERSION 
USE_USB_VERSION 
MAX_POWER 
CHANNEL_A_TYPE 
CHANNEL_B_TYPE 
CHANNEL_A_DRIVER 
CHANNEL_B_DRIVER 
CBUS_FUNCTION_0 
CBUS_FUNCTION_1 
CBUS_FUNCTION_2 
CBUS_FUNCTION_3 
CBUS_FUNCTION_4 
CBUS_FUNCTION_5 
CBUS_FUNCTION_6 
CBUS_FUNCTION_7 
CBUS_FUNCTION_8 
CBUS_FUNCTION_9 
HIGH_CURRENT 
HIGH_CURRENT_A 
HIGH_CURRENT_B 
INVERT 
GROUP0_DRIVE 
GROUP0_SCHMITT 
GROUP0_SLEW 
GROUP1_DRIVE 
GROUP1_SCHMITT 
GROUP1_SLEW 
GROUP2_DRIVE 
GROUP2_SCHMITT 
GROUP2_SLEW 
GROUP3_DRIVE 
GROUP3_SCHMITT 
GROUP3_SLEW 
CHIP_SIZE 
CHIP_TYPE 
POWER_SAVE 
CLOCK_POLARITY 
DATA_ORDER 
FLOW_CONTROL 
CHANNEL_C_DRIVER 
CHANNEL_D_DRIVER 
CHANNEL_A_RS485 
CHANNEL_B_RS485 
CHANNEL_C_RS485 
CHANNEL_D_RS485 
RELEASE_NUMBER 
EXTERNAL_OSCILLATOR 
USER_DATA_ADDR 

Definition at line 279 of file ftdi.h.

Enumerator:
CBUS_TXDEN 
CBUS_PWREN 
CBUS_RXLED 
CBUS_TXLED 
CBUS_TXRXLED 
CBUS_SLEEP 
CBUS_CLK48 
CBUS_CLK24 
CBUS_CLK12 
CBUS_CLK6 
CBUS_IOMODE 
CBUS_BB_WR 
CBUS_BB_RD 

Definition at line 357 of file ftdi.h.

Enumerator:
CBUSH_TRISTATE 
CBUSH_TXLED 
CBUSH_RXLED 
CBUSH_TXRXLED 
CBUSH_PWREN 
CBUSH_SLEEP 
CBUSH_DRIVE_0 
CBUSH_DRIVE1 
CBUSH_IOMODE 
CBUSH_TXDEN 
CBUSH_CLK30 
CBUSH_CLK15 
CBUSH_CLK7_5 

Definition at line 364 of file ftdi.h.

Enumerator:
CBUSX_TRISTATE 
CBUSX_TXLED 
CBUSX_RXLED 
CBUSX_TXRXLED 
CBUSX_PWREN 
CBUSX_SLEEP 
CBUSX_DRIVE_0 
CBUSX_DRIVE1 
CBUSX_IOMODE 
CBUSX_TXDEN 
CBUSX_CLK24 
CBUSX_CLK12 
CBUSX_CLK6 
CBUSX_BAT_DETECT 
CBUSX_BAT_DETECT_NEG 
CBUSX_I2C_TXE 
CBUSX_I2C_RXF 
CBUSX_VBUS_SENSE 
CBUSX_BB_WR 
CBUSX_BB_RD 
CBUSX_TIME_STAMP 
CBUSX_AWAKE 

Definition at line 371 of file ftdi.h.


Function Documentation

int ftdi_readstream ( struct ftdi_context ftdi,
FTDIStreamCallback callback,
void *  userdata,
int  packetsPerTransfer,
int  numTransfers 
)

Streaming reading of data from the device

Use asynchronous transfers in libusb-1.0 for high-performance streaming of data from a device interface back to the PC. This function continuously transfers data until either an error occurs or the callback returns a nonzero value. This function returns a libusb error code or the callback's return value.

For every contiguous block of received data, the callback will be invoked.

Parameters:
ftdi pointer to ftdi_context
callback to user supplied function for one block of data
userdata 
packetsPerTransfer number of packets per transfer
numTransfers Number of transfers per callback

Definition at line 148 of file ftdi_stream.c.

References FTDIStreamState::activity, BITMODE_RESET, BITMODE_SYNCFF, FTDIStreamState::callback, FTDIProgressInfo::current, FTDIProgressInfo::currentRate, FTDIProgressInfo::first, ftdi_get_error_string(), ftdi_set_bitmode(), ftdi_usb_purge_buffers(), ftdi_context::max_packet_size, ftdi_context::out_ep, FTDIProgressInfo::prev, FTDIStreamState::progress, FTDIStreamState::result, size_and_time::time, size_and_time::totalBytes, FTDIProgressInfo::totalRate, FTDIProgressInfo::totalTime, ftdi_context::type, TYPE_2232H, TYPE_232H, ftdi_context::usb_ctx, ftdi_context::usb_dev, ftdi_context::usb_read_timeout, and FTDIStreamState::userdata.


Generated on 9 Dec 2019 for libftdi1 by  doxygen 1.6.1