| 
    libftdi1
    1.5
    
   | 
 
#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 | 
Macros | |
| #define | _Ftdi_Pragma(_msg) _Pragma(_msg) | 
| #define | MPSSE_WRITE_NEG 0x01 /* Write TDI/DO on negative TCK/SK edge*/ | 
| #define | MPSSE_BITMODE 0x02 /* Write bits, not bytes */ | 
| #define | MPSSE_READ_NEG 0x04 /* Sample TDO/DI on negative TCK/SK edge */ | 
| #define | MPSSE_LSB 0x08 /* LSB first */ | 
| #define | MPSSE_DO_WRITE 0x10 /* Write TDI/DO */ | 
| #define | MPSSE_DO_READ 0x20 /* Read TDO/DI */ | 
| #define | MPSSE_WRITE_TMS 0x40 /* Write TMS/CS */ | 
| #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 /* Reset the port */ | 
| #define | SIO_MODEM_CTRL 1 /* Set the modem control register */ | 
| #define | SIO_SET_FLOW_CTRL 2 /* Set flow control register */ | 
| #define | SIO_SET_BAUD_RATE 3 /* Set baud rate */ | 
| #define | SIO_SET_DATA 4 /* Set the data characteristics of the port */ | 
| #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_TCIFLUSH 2 | 
| #define | SIO_TCOFLUSH 1 | 
| #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 /* DS_FT232H 1.3 amd ftd2xx.h 1.0.4 disagree here*/ | 
| #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 /* FT232H has moved the VCP bit */ | 
| #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) | 
Functions | |
| int | ftdi_init (struct ftdi_context *ftdi) | 
| struct ftdi_context * | ftdi_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.  More... | |
| 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, const char *manufacturer, const char *product, const 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_tciflush (struct ftdi_context *ftdi) | 
| int | ftdi_tcoflush (struct ftdi_context *ftdi) | 
| int | ftdi_tcioflush (struct ftdi_context *ftdi) | 
| int | DEPRECATED (ftdi_usb_purge_rx_buffer(struct ftdi_context *ftdi)) | 
| int | DEPRECATED (ftdi_usb_purge_tx_buffer(struct ftdi_context *ftdi)) | 
| int | DEPRECATED (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_control * | ftdi_write_data_submit (struct ftdi_context *ftdi, unsigned char *buf, int size) | 
| struct ftdi_transfer_control * | ftdi_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_setflowctrl_xonxoff (struct ftdi_context *ftdi, unsigned char xon, unsigned char xoff) | 
| 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 MPSSE_WRITE_NEG 0x01 /* Write TDI/DO on negative TCK/SK edge*/ | 
| #define MPSSE_READ_NEG 0x04 /* Sample TDO/DI on negative TCK/SK edge */ | 
| #define DIV_VALUE | ( | rate | ) | (rate > 6000000)?0:((6000000/rate -1) > 0xffff)? 0xffff: (6000000/rate -1) | 
| #define SIO_MODEM_CTRL 1 /* Set the modem control register */ | 
| #define SIO_SET_DATA 4 /* Set the data characteristics of the port */ | 
| #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_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_SET_DTR_HIGH ( 1 | ( SIO_SET_DTR_MASK << 8)) | 
| #define SIO_SET_DTR_LOW ( 0 | ( SIO_SET_DTR_MASK << 8)) | 
| #define SIO_SET_RTS_HIGH ( 2 | ( SIO_SET_RTS_MASK << 8 )) | 
| #define SIO_SET_RTS_LOW ( 0 | ( SIO_SET_RTS_MASK << 8 )) | 
| #define FT1284_DATA_LSB 0x02 /* DS_FT232H 1.3 amd ftd2xx.h 1.0.4 disagree here*/ | 
| typedef int() FTDIStreamCallback(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *userdata) | 
| enum ftdi_chip_type | 
| enum ftdi_parity_type | 
Parity mode for ftdi_set_line_property()
| Enumerator | |
|---|---|
| NONE | |
| ODD | |
| EVEN | |
| MARK | |
| SPACE | |
| enum ftdi_stopbits_type | 
Number of stop bits for ftdi_set_line_property()
| Enumerator | |
|---|---|
| STOP_BIT_1 | |
| STOP_BIT_15 | |
| STOP_BIT_2 | |
| enum ftdi_bits_type | 
Number of bits for ftdi_set_line_property()
| Enumerator | |
|---|---|
| BITS_7 | |
| BITS_8 | |
| enum ftdi_break_type | 
Break type for ftdi_set_line_property2()
| Enumerator | |
|---|---|
| BREAK_OFF | |
| BREAK_ON | |
| enum ftdi_mpsse_mode | 
MPSSE bitbang modes
| enum ftdi_interface | 
| enum ftdi_eeprom_value | 
List all handled EEPROM values. Append future new values only at the end to provide API/ABI stability
| enum ftdi_cbus_func | 
| enum ftdi_cbush_func | 
| enum ftdi_cbusx_func | 
| int ftdi_init | ( | struct ftdi_context * | ftdi | ) | 
Initializes a ftdi_context.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | couldn't allocate read buffer | 
| -2 | couldn't allocate struct buffer | 
| -3 | libusb_init() failed | 
Definition at line 91 of file ftdi.c.
References AUTO_DETACH_SIO_MODULE, ftdi_context::baudrate, ftdi_context::bitbang_enabled, ftdi_context::bitbang_mode, ftdi_context::eeprom, ftdi_context::error_str, ftdi_error_return, ftdi_read_data_set_chunksize(), ftdi_set_interface(), INTERFACE_ANY, ftdi_context::max_packet_size, ftdi_context::module_detach_mode, ftdi_context::readbuffer, ftdi_context::readbuffer_offset, ftdi_context::readbuffer_remaining, ftdi_context::type, TYPE_BM, ftdi_context::usb_ctx, ftdi_context::usb_dev, ftdi_context::usb_read_timeout, ftdi_context::usb_write_timeout, and ftdi_context::writebuffer_chunksize.
Referenced by ftdi_new().
| struct ftdi_context* ftdi_new | ( | void | ) | 
Allocate and initialize a new ftdi_context
Definition at line 132 of file ftdi.c.
References ftdi_init().
Referenced by Ftdi::Context::Private::Private().
| int ftdi_set_interface | ( | struct ftdi_context * | ftdi, | 
| enum ftdi_interface | interface | ||
| ) | 
Open selected channels on a chip, otherwise use first channel.
| ftdi | pointer to ftdi_context | 
| interface | Interface to use for FT2232C/2232H/4232H chips. | 
| 0 | all fine | 
| -1 | unknown interface | 
| -2 | USB device unavailable | 
| -3 | Device already open, interface can't be set in that state | 
Definition at line 161 of file ftdi.c.
References ftdi_error_return, ftdi_context::in_ep, ftdi_context::index, ftdi_context::interface, INTERFACE_A, INTERFACE_ANY, INTERFACE_B, INTERFACE_C, INTERFACE_D, ftdi_context::out_ep, and ftdi_context::usb_dev.
Referenced by ftdi_init(), and Ftdi::Context::set_interface().
| void ftdi_deinit | ( | struct ftdi_context * | ftdi | ) | 
Deinitializes a ftdi_context.
| ftdi | pointer to ftdi_context | 
Definition at line 214 of file ftdi.c.
Referenced by ftdi_free().
| void ftdi_free | ( | struct ftdi_context * | ftdi | ) | 
Deinitialize and free an ftdi_context.
| ftdi | pointer to ftdi_context | 
Definition at line 260 of file ftdi.c.
References ftdi_deinit().
Referenced by Ftdi::Context::set_context(), and Ftdi::Context::Private::~Private().
| void ftdi_set_usbdev | ( | struct ftdi_context * | ftdi, | 
| libusb_device_handle * | usb | ||
| ) | 
Use an already open libusb device.
| ftdi | pointer to ftdi_context | 
| usb | libusb libusb_device_handle to use | 
Definition at line 272 of file ftdi.c.
References ftdi_context::usb_dev.
Referenced by Ftdi::Context::set_usb_device().
| struct ftdi_version_info ftdi_get_library_version | ( | void | ) | 
Get libftdi library version.
Definition at line 285 of file ftdi.c.
References ftdi_version_info::major, ftdi_version_info::micro, ftdi_version_info::minor, ftdi_version_info::snapshot_str, and ftdi_version_info::version_str.
| int ftdi_usb_find_all | ( | struct ftdi_context * | ftdi, | 
| struct ftdi_device_list ** | devlist, | ||
| int | vendor, | ||
| int | product | ||
| ) | 
Finds all ftdi devices with given VID:PID on the usb bus. Creates a new ftdi_device_list which needs to be deallocated by ftdi_list_free() after use. With VID:PID 0:0, search for the default devices (0x403:0x6001, 0x403:0x6010, 0x403:0x6011, 0x403:0x6014, 0x403:0x6015)
| ftdi | pointer to ftdi_context | 
| devlist | Pointer where to store list of found devices | 
| vendor | Vendor ID to search for | 
| product | Product ID to search for | 
| >0 | number of devices found | 
| -3 | out of memory | 
| -5 | libusb_get_device_list() failed | 
| -6 | libusb_get_device_descriptor() failed | 
Definition at line 314 of file ftdi.c.
References ftdi_device_list::dev, ftdi_error_return, ftdi_error_return_free_device_list, ftdi_device_list::next, and ftdi_context::usb_ctx.
Referenced by Ftdi::List::find_all().
| void ftdi_list_free | ( | struct ftdi_device_list ** | devlist | ) | 
Frees a usb device list.
| devlist | USB device list created by ftdi_usb_find_all() | 
Definition at line 362 of file ftdi.c.
References ftdi_device_list::dev, and ftdi_device_list::next.
Referenced by Ftdi::List::clear(), ftdi_list_free2(), and Ftdi::List::Private::~Private().
| void ftdi_list_free2 | ( | struct ftdi_device_list * | devlist | ) | 
Frees a usb device list.
| devlist | USB device list created by ftdi_usb_find_all() | 
Definition at line 382 of file ftdi.c.
References ftdi_list_free().
| 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 | ||
| ) | 
Return device ID strings from the usb device.
The parameters manufacturer, description and serial may be NULL or pointer to buffers to store the fetched strings.
| ftdi | pointer to ftdi_context | 
| dev | libusb usb_dev to use | 
| manufacturer | Store manufacturer string here if not NULL | 
| mnf_len | Buffer size of manufacturer string | 
| description | Store product description string here if not NULL | 
| desc_len | Buffer size of product description string | 
| serial | Store serial string here if not NULL | 
| serial_len | Buffer size of serial string | 
| 0 | all fine | 
| -1 | wrong arguments | 
| -4 | unable to open device | 
| -7 | get product manufacturer failed | 
| -8 | get product description failed | 
| -9 | get serial number failed | 
| -11 | libusb_get_device_descriptor() failed | 
Definition at line 413 of file ftdi.c.
References ftdi_device_list::dev, ftdi_error_return, ftdi_usb_get_strings2(), and ftdi_context::usb_dev.
Referenced by Ftdi::Context::get_strings().
| 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 | ||
| ) | 
Return device ID strings from the usb device.
The parameters manufacturer, description and serial may be NULL or pointer to buffers to store the fetched strings.
| ftdi | pointer to ftdi_context | 
| dev | libusb usb_dev to use | 
| manufacturer | Store manufacturer string here if not NULL | 
| mnf_len | Buffer size of manufacturer string | 
| description | Store product description string here if not NULL | 
| desc_len | Buffer size of product description string | 
| serial | Store serial string here if not NULL | 
| serial_len | Buffer size of serial string | 
| 0 | all fine | 
| -1 | wrong arguments | 
| -4 | unable to open device | 
| -7 | get product manufacturer failed | 
| -8 | get product description failed | 
| -9 | get serial number failed | 
| -11 | libusb_get_device_descriptor() failed | 
Definition at line 470 of file ftdi.c.
References ftdi_error_return, and ftdi_context::usb_dev.
Referenced by ftdi_usb_get_strings().
| int ftdi_eeprom_get_strings | ( | struct ftdi_context * | ftdi, | 
| char * | manufacturer, | ||
| int | mnf_len, | ||
| char * | product, | ||
| int | prod_len, | ||
| char * | serial, | ||
| int | serial_len | ||
| ) | 
Return device ID strings from the eeprom. Device needs to be connected.
The parameters manufacturer, description and serial may be NULL or pointer to buffers to store the fetched strings.
| ftdi | pointer to ftdi_context | 
| manufacturer | Store manufacturer string here if not NULL | 
| mnf_len | Buffer size of manufacturer string | 
| product | Store product description string here if not NULL | 
| prod_len | Buffer size of product description string | 
| serial | Store serial string here if not NULL | 
| serial_len | Buffer size of serial string | 
| 0 | all fine | 
| -1 | ftdi context invalid | 
| -2 | ftdi eeprom buffer invalid | 
Definition at line 2793 of file ftdi.c.
References ftdi_context::eeprom, ftdi_error_return, ftdi_eeprom::manufacturer, ftdi_eeprom::product, and ftdi_eeprom::serial.
| int ftdi_eeprom_set_strings | ( | struct ftdi_context * | ftdi, | 
| const char * | manufacturer, | ||
| const char * | product, | ||
| const char * | serial | ||
| ) | 
Definition at line 2727 of file ftdi.c.
References ftdi_context::eeprom, ftdi_error_return, ftdi_eeprom::manufacturer, ftdi_eeprom::product, ftdi_eeprom::serial, ftdi_context::usb_dev, and ftdi_eeprom::use_serial.
| int ftdi_usb_open | ( | struct ftdi_context * | ftdi, | 
| int | vendor, | ||
| int | product | ||
| ) | 
Opens the first device with a given vendor and product ids.
| ftdi | pointer to ftdi_context | 
| vendor | Vendor ID | 
| product | Product ID | 
| same | as ftdi_usb_open_desc() | 
Definition at line 707 of file ftdi.c.
References ftdi_usb_open_desc().
Referenced by Ftdi::Context::open().
| int ftdi_usb_open_desc | ( | struct ftdi_context * | ftdi, | 
| int | vendor, | ||
| int | product, | ||
| const char * | description, | ||
| const char * | serial | ||
| ) | 
Opens the first device with a given, vendor id, product id, description and serial.
| ftdi | pointer to ftdi_context | 
| vendor | Vendor ID | 
| product | Product ID | 
| description | Description to search for. Use NULL if not needed. | 
| serial | Serial to search for. Use NULL if not needed. | 
| 0 | all fine | 
| -3 | usb device not found | 
| -4 | unable to open device | 
| -5 | unable to claim device | 
| -6 | reset failed | 
| -7 | set baudrate failed | 
| -8 | get product description failed | 
| -9 | get serial number failed | 
| -12 | libusb_get_device_list() failed | 
| -13 | libusb_get_device_descriptor() failed | 
Definition at line 733 of file ftdi.c.
References ftdi_usb_open_desc_index().
Referenced by ftdi_usb_open().
| int ftdi_usb_open_desc_index | ( | struct ftdi_context * | ftdi, | 
| int | vendor, | ||
| int | product, | ||
| const char * | description, | ||
| const char * | serial, | ||
| unsigned int | index | ||
| ) | 
Opens the index-th device with a given, vendor id, product id, description and serial.
| ftdi | pointer to ftdi_context | 
| vendor | Vendor ID | 
| product | Product ID | 
| description | Description to search for. Use NULL if not needed. | 
| serial | Serial to search for. Use NULL if not needed. | 
| index | Number of matching device to open if there are more than one, starts with 0. | 
| 0 | all fine | 
| -1 | usb_find_busses() failed | 
| -2 | usb_find_devices() failed | 
| -3 | usb device not found | 
| -4 | unable to open device | 
| -5 | unable to claim device | 
| -6 | reset failed | 
| -7 | set baudrate failed | 
| -8 | get product description failed | 
| -9 | get serial number failed | 
| -10 | unable to close device | 
| -11 | ftdi context invalid | 
| -12 | libusb_get_device_list() failed | 
Definition at line 764 of file ftdi.c.
References ftdi_error_return, ftdi_error_return_free_device_list, ftdi_context::usb_ctx, and ftdi_context::usb_dev.
Referenced by ftdi_usb_open_desc(), ftdi_usb_open_string(), and Ftdi::Context::open().
| int ftdi_usb_open_bus_addr | ( | struct ftdi_context * | ftdi, | 
| uint8_t | bus, | ||
| uint8_t | addr | ||
| ) | 
Opens the device at a given USB bus and device address.
| ftdi | pointer to ftdi_context | 
| bus | Bus number | 
| addr | Device address | 
| 0 | all fine | 
| -1 | usb_find_busses() failed | 
| -2 | usb_find_devices() failed | 
| -3 | usb device not found | 
| -4 | unable to open device | 
| -5 | unable to claim device | 
| -6 | reset failed | 
| -7 | set baudrate failed | 
| -8 | get product description failed | 
| -9 | get serial number failed | 
| -10 | unable to close device | 
| -11 | ftdi context invalid | 
| -12 | libusb_get_device_list() failed | 
Definition at line 857 of file ftdi.c.
References ftdi_error_return, ftdi_error_return_free_device_list, ftdi_usb_open_dev(), and ftdi_context::usb_ctx.
| int ftdi_usb_open_dev | ( | struct ftdi_context * | ftdi, | 
| libusb_device * | dev | ||
| ) | 
Opens a ftdi device given by an usb_device.
| ftdi | pointer to ftdi_context | 
| dev | libusb usb_dev to use | 
| 0 | all fine | 
| -3 | unable to config device | 
| -4 | unable to open device | 
| -5 | unable to claim device | 
| -6 | reset failed | 
| -7 | set baudrate failed | 
| -8 | ftdi context invalid | 
| -9 | libusb_get_device_descriptor() failed | 
| -10 | libusb_get_config_descriptor() failed | 
| -11 | libusb_detach_kernel_driver() failed | 
| -12 | libusb_get_configuration() failed | 
Definition at line 589 of file ftdi.c.
References AUTO_DETACH_REATACH_SIO_MODULE, AUTO_DETACH_SIO_MODULE, ftdi_error_return, ftdi_context::interface, ftdi_context::module_detach_mode, and ftdi_context::usb_dev.
Referenced by ftdi_usb_open_bus_addr(), ftdi_usb_open_string(), and Ftdi::Context::get_strings_and_reopen().
| int ftdi_usb_open_string | ( | struct ftdi_context * | ftdi, | 
| const char * | description | ||
| ) | 
Opens the ftdi-device described by a description-string. Intended to be used for parsing a device-description given as commandline argument.
| ftdi | pointer to ftdi_context | 
| description | NULL-terminated description-string, using this format: 
  | 
| 0 | all fine | 
| -2 | libusb_get_device_list() failed | 
| -3 | usb device not found | 
| -4 | unable to open device | 
| -5 | unable to claim device | 
| -6 | reset failed | 
| -7 | set baudrate failed | 
| -8 | get product description failed | 
| -9 | get serial number failed | 
| -10 | unable to close device | 
| -11 | illegal description format | 
| -12 | ftdi context invalid | 
Definition at line 910 of file ftdi.c.
References ftdi_error_return, ftdi_error_return_free_device_list, ftdi_usb_open_desc_index(), ftdi_usb_open_dev(), and ftdi_context::usb_ctx.
Referenced by Ftdi::Context::open().
| int ftdi_usb_close | ( | struct ftdi_context * | ftdi | ) | 
Closes the ftdi device. Call ftdi_deinit() if you're cleaning up.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | usb_release failed | 
| -3 | ftdi context invalid | 
Definition at line 1197 of file ftdi.c.
References ftdi_error_return, ftdi_context::interface, and ftdi_context::usb_dev.
Referenced by Ftdi::Context::close(), and Ftdi::Context::Private::~Private().
| int ftdi_usb_reset | ( | struct ftdi_context * | ftdi | ) | 
Resets the ftdi device.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | FTDI reset failed | 
| -2 | USB device unavailable | 
Definition at line 1003 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, ftdi_context::readbuffer_offset, ftdi_context::readbuffer_remaining, SIO_RESET_REQUEST, SIO_RESET_SIO, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by ftdi_write_eeprom(), and Ftdi::Context::reset().
| int ftdi_tciflush | ( | struct ftdi_context * | ftdi | ) | 
Clears the read buffer on the chip and the internal read buffer. This is the correct behavior for an RX flush.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | read buffer purge failed | 
| -2 | USB device unavailable | 
Definition at line 1030 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, ftdi_context::readbuffer_offset, ftdi_context::readbuffer_remaining, SIO_RESET_REQUEST, SIO_TCIFLUSH, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by ftdi_tcioflush(), and Ftdi::Context::tcflush().
| int ftdi_tcoflush | ( | struct ftdi_context * | ftdi | ) | 
Clears the write buffer on the chip. This is correct behavior for a TX flush.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | write buffer purge failed | 
| -2 | USB device unavailable | 
Definition at line 1087 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_RESET_REQUEST, SIO_TCOFLUSH, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by ftdi_tcioflush(), and Ftdi::Context::tcflush().
| int ftdi_tcioflush | ( | struct ftdi_context * | ftdi | ) | 
Clears the RX and TX FIFOs on the chip and the internal read buffer. This is correct behavior for both RX and TX flush.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | read buffer purge failed | 
| -2 | write buffer purge failed | 
| -3 | USB device unavailable | 
Definition at line 1137 of file ftdi.c.
References ftdi_error_return, ftdi_tciflush(), ftdi_tcoflush(), and ftdi_context::usb_dev.
Referenced by ftdi_readstream(), and Ftdi::Context::tcflush().
| int DEPRECATED | ( | ftdi_usb_purge_rx_buffer(struct ftdi_context *ftdi) | ) | 
| int DEPRECATED | ( | ftdi_usb_purge_tx_buffer(struct ftdi_context *ftdi) | ) | 
| int DEPRECATED | ( | ftdi_usb_purge_buffers(struct ftdi_context *ftdi) | ) | 
| int ftdi_set_baudrate | ( | struct ftdi_context * | ftdi, | 
| int | baudrate | ||
| ) | 
Sets the chip baud rate
| ftdi | pointer to ftdi_context | 
| baudrate | baud rate to set | 
| 0 | all fine | 
| -1 | invalid baudrate | 
| -2 | setting baudrate failed | 
| -3 | USB device unavailable | 
Definition at line 1448 of file ftdi.c.
References ftdi_context::bitbang_enabled, ftdi_error_return, and ftdi_context::usb_dev.
Referenced by Ftdi::Context::set_baud_rate().
| int ftdi_set_line_property | ( | struct ftdi_context * | ftdi, | 
| enum ftdi_bits_type | bits, | ||
| enum ftdi_stopbits_type | sbit, | ||
| enum ftdi_parity_type | parity | ||
| ) | 
Set (RS232) line characteristics. The break type can only be set via ftdi_set_line_property2() and defaults to "off".
| ftdi | pointer to ftdi_context | 
| bits | Number of bits | 
| sbit | Number of stop bits | 
| parity | Parity mode | 
| 0 | all fine | 
| -1 | Setting line property failed | 
Definition at line 1494 of file ftdi.c.
References BREAK_OFF, and ftdi_set_line_property2().
Referenced by Ftdi::Context::set_line_property().
| 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 | ||
| ) | 
Set (RS232) line characteristics
| ftdi | pointer to ftdi_context | 
| bits | Number of bits | 
| sbit | Number of stop bits | 
| parity | Parity mode | 
| break_type | Break type | 
| 0 | all fine | 
| -1 | Setting line property failed | 
| -2 | USB device unavailable | 
Definition at line 1513 of file ftdi.c.
References BREAK_OFF, BREAK_ON, EVEN, FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, MARK, NONE, ODD, SIO_SET_DATA_REQUEST, SPACE, STOP_BIT_1, STOP_BIT_15, STOP_BIT_2, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by ftdi_set_line_property(), and Ftdi::Context::set_line_property().
| int ftdi_read_data | ( | struct ftdi_context * | ftdi, | 
| unsigned char * | buf, | ||
| int | size | ||
| ) | 
Reads data in chunks (see ftdi_read_data_set_chunksize()) from the chip.
Automatically strips the two modem status bytes transferred during every read.
| ftdi | pointer to ftdi_context | 
| buf | Buffer to store data in | 
| size | Size of the buffer | 
| -666 | USB device unavailable | 
| <0 | error code from libusb_bulk_transfer() | 
| 0 | no data was available | 
| >0 | number of bytes read | 
Definition at line 2007 of file ftdi.c.
References ftdi_error_return, ftdi_context::max_packet_size, ftdi_context::out_ep, ftdi_context::readbuffer, ftdi_context::readbuffer_chunksize, ftdi_context::readbuffer_offset, ftdi_context::readbuffer_remaining, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by Ftdi::Context::read().
| int ftdi_read_data_set_chunksize | ( | struct ftdi_context * | ftdi, | 
| unsigned int | chunksize | ||
| ) | 
Configure read buffer chunk size. Default is 4096.
Automatically reallocates the buffer.
| ftdi | pointer to ftdi_context | 
| chunksize | Chunk size | 
| 0 | all fine | 
| -1 | ftdi context invalid | 
Definition at line 2133 of file ftdi.c.
References ftdi_error_return, ftdi_context::readbuffer, ftdi_context::readbuffer_chunksize, ftdi_context::readbuffer_offset, and ftdi_context::readbuffer_remaining.
Referenced by ftdi_init(), and Ftdi::Context::set_read_chunk_size().
| int ftdi_read_data_get_chunksize | ( | struct ftdi_context * | ftdi, | 
| unsigned int * | chunksize | ||
| ) | 
Get read buffer chunk size.
| ftdi | pointer to ftdi_context | 
| chunksize | Pointer to store chunk size in | 
| 0 | all fine | 
| -1 | FTDI context invalid | 
Definition at line 2170 of file ftdi.c.
References ftdi_error_return, and ftdi_context::readbuffer_chunksize.
Referenced by Ftdi::Context::read_chunk_size().
| int ftdi_write_data | ( | struct ftdi_context * | ftdi, | 
| const unsigned char * | buf, | ||
| int | size | ||
| ) | 
Writes data in chunks (see ftdi_write_data_set_chunksize()) to the chip
| ftdi | pointer to ftdi_context | 
| buf | Buffer with the data | 
| size | Size of the buffer | 
| -666 | USB device unavailable | 
| <0 | error code from usb_bulk_write() | 
| >0 | number of bytes written | 
Definition at line 1583 of file ftdi.c.
References ftdi_error_return, ftdi_context::in_ep, ftdi_context::usb_dev, ftdi_context::usb_write_timeout, and ftdi_context::writebuffer_chunksize.
Referenced by Ftdi::Context::write().
| int ftdi_write_data_set_chunksize | ( | struct ftdi_context * | ftdi, | 
| unsigned int | chunksize | ||
| ) | 
Configure write buffer chunk size. Default is 4096.
| ftdi | pointer to ftdi_context | 
| chunksize | Chunk size | 
| 0 | all fine | 
| -1 | ftdi context invalid | 
Definition at line 1965 of file ftdi.c.
References ftdi_error_return, and ftdi_context::writebuffer_chunksize.
Referenced by Ftdi::Context::set_write_chunk_size().
| int ftdi_write_data_get_chunksize | ( | struct ftdi_context * | ftdi, | 
| unsigned int * | chunksize | ||
| ) | 
Get write buffer chunk size.
| ftdi | pointer to ftdi_context | 
| chunksize | Pointer to store chunk size in | 
| 0 | all fine | 
| -1 | ftdi context invalid | 
Definition at line 1983 of file ftdi.c.
References ftdi_error_return, and ftdi_context::writebuffer_chunksize.
Referenced by Ftdi::Context::write_chunk_size().
| 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.
| 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 151 of file ftdi_stream.c.
References BITMODE_RESET, ftdi_set_bitmode(), ftdi_tcioflush(), ftdi_context::max_packet_size, ftdi_context::out_ep, ftdi_context::type, TYPE_2232H, TYPE_232H, and ftdi_context::usb_dev.
| struct ftdi_transfer_control* ftdi_write_data_submit | ( | struct ftdi_context * | ftdi, | 
| unsigned char * | buf, | ||
| int | size | ||
| ) | 
Writes data to the chip. Does not wait for completion of the transfer nor does it make sure that the transfer was successful.
Use libusb 1.0 asynchronous API.
| ftdi | pointer to ftdi_context | 
| buf | Buffer with the data | 
| size | Size of the buffer | 
| NULL | Some error happens when submit transfer | 
| !NULL | Pointer to a ftdi_transfer_control | 
Definition at line 1743 of file ftdi.c.
References ftdi_transfer_control::buf, ftdi_transfer_control::completed, ftdi_transfer_control::ftdi, ftdi_context::in_ep, ftdi_transfer_control::offset, ftdi_transfer_control::size, ftdi_transfer_control::transfer, ftdi_context::usb_dev, and ftdi_context::writebuffer_chunksize.
| struct ftdi_transfer_control* ftdi_read_data_submit | ( | struct ftdi_context * | ftdi, | 
| unsigned char * | buf, | ||
| int | size | ||
| ) | 
Reads data from the chip. Does not wait for completion of the transfer nor does it make sure that the transfer was successful.
Use libusb 1.0 asynchronous API.
| ftdi | pointer to ftdi_context | 
| buf | Buffer with the data | 
| size | Size of the buffer | 
| NULL | Some error happens when submit transfer | 
| !NULL | Pointer to a ftdi_transfer_control | 
Definition at line 1805 of file ftdi.c.
References ftdi_transfer_control::buf, ftdi_transfer_control::completed, ftdi_transfer_control::ftdi, ftdi_transfer_control::offset, ftdi_context::out_ep, ftdi_context::readbuffer, ftdi_context::readbuffer_chunksize, ftdi_context::readbuffer_offset, ftdi_context::readbuffer_remaining, ftdi_transfer_control::size, ftdi_transfer_control::transfer, and ftdi_context::usb_dev.
| int ftdi_transfer_data_done | ( | struct ftdi_transfer_control * | tc | ) | 
Wait for completion of the transfer.
Use libusb 1.0 asynchronous API.
| tc | pointer to ftdi_transfer_control | 
| < | 0: Some error happens | 
| >= | 0: Data size transferred | 
tc->transfer could be NULL if "(size <= ftdi->readbuffer_remaining)" at ftdi_read_data_submit(). Therefore, we need to check it here.
Definition at line 1884 of file ftdi.c.
References ftdi_transfer_control::completed, ftdi_transfer_control::ftdi, ftdi_transfer_control::offset, ftdi_transfer_control::transfer, and ftdi_context::usb_ctx.
| void ftdi_transfer_data_cancel | ( | struct ftdi_transfer_control * | tc, | 
| struct timeval * | to | ||
| ) | 
Cancel transfer and wait for completion.
Use libusb 1.0 asynchronous API.
| tc | pointer to ftdi_transfer_control | 
| to | pointer to timeout value or NULL for infinite | 
Definition at line 1931 of file ftdi.c.
References ftdi_transfer_control::completed, ftdi_transfer_control::ftdi, ftdi_transfer_control::transfer, and ftdi_context::usb_ctx.
| int ftdi_set_bitmode | ( | struct ftdi_context * | ftdi, | 
| unsigned char | bitmask, | ||
| unsigned char | mode | ||
| ) | 
Enable/disable bitbang modes.
| ftdi | pointer to ftdi_context | 
| bitmask | Bitmask to configure lines. HIGH/ON value configures a line as output. | 
| mode | Bitbang mode: use the values defined in ftdi_mpsse_mode | 
| 0 | all fine | 
| -1 | can't enable bitbang mode | 
| -2 | USB device unavailable | 
Definition at line 2191 of file ftdi.c.
References ftdi_context::bitbang_enabled, ftdi_context::bitbang_mode, BITMODE_RESET, FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_BITMODE_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by ftdi_readstream(), and Ftdi::Context::set_bitmode().
| int ftdi_disable_bitbang | ( | struct ftdi_context * | ftdi | ) | 
Disable bitbang mode.
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | can't disable bitbang mode | 
| -2 | USB device unavailable | 
Definition at line 2217 of file ftdi.c.
References ftdi_context::bitbang_enabled, FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_BITMODE_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::bitbang_disable().
| int ftdi_read_pins | ( | struct ftdi_context * | ftdi, | 
| unsigned char * | pins | ||
| ) | 
Directly read pin state, circumventing the read buffer. Useful for bitbang mode.
| ftdi | pointer to ftdi_context | 
| pins | Pointer to store pins into | 
| 0 | all fine | 
| -1 | read pins failed | 
| -2 | USB device unavailable | 
Definition at line 2240 of file ftdi.c.
References FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_READ_PINS_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by Ftdi::Context::read_pins().
| int ftdi_set_latency_timer | ( | struct ftdi_context * | ftdi, | 
| unsigned char | latency | ||
| ) | 
Set latency timer
The FTDI chip keeps data in the internal buffer for a specific amount of time if the buffer is not full yet to decrease load on the usb bus.
| ftdi | pointer to ftdi_context | 
| latency | Value between 1 and 255 | 
| 0 | all fine | 
| -1 | latency out of range | 
| -2 | unable to set latency timer | 
| -3 | USB device unavailable | 
Definition at line 2266 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_LATENCY_TIMER_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by ftdi_write_eeprom(), and Ftdi::Context::set_latency().
| int ftdi_get_latency_timer | ( | struct ftdi_context * | ftdi, | 
| unsigned char * | latency | ||
| ) | 
Get latency timer
| ftdi | pointer to ftdi_context | 
| latency | Pointer to store latency value in | 
| 0 | all fine | 
| -1 | unable to get latency timer | 
| -2 | USB device unavailable | 
Definition at line 2293 of file ftdi.c.
References FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_GET_LATENCY_TIMER_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by Ftdi::Context::latency().
| int ftdi_poll_modem_status | ( | struct ftdi_context * | ftdi, | 
| unsigned short * | status | ||
| ) | 
Poll modem status information
This function allows the retrieve the two status bytes of the device. The device sends these bytes also as a header for each read access where they are discarded by ftdi_read_data(). The chip generates the two stripped status bytes in the absence of data every 40 ms.
Layout of the first byte:
Layout of the second byte:
| ftdi | pointer to ftdi_context | 
| status | Pointer to store status information in. Must be two bytes. | 
| 0 | all fine | 
| -1 | unable to retrieve status information | 
| -2 | USB device unavailable | 
Definition at line 2347 of file ftdi.c.
References FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_POLL_MODEM_STATUS_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by ftdi_write_eeprom(), and Ftdi::Context::poll_modem_status().
| int ftdi_setflowctrl | ( | struct ftdi_context * | ftdi, | 
| int | flowctrl | ||
| ) | 
Set flowcontrol for ftdi chip
Note: Do not use this function to enable XON/XOFF mode, use ftdi_setflowctrl_xonxoff() instead.
| ftdi | pointer to ftdi_context | 
| flowctrl | flow control to use. should be SIO_DISABLE_FLOW_CTRL, SIO_RTS_CTS_HS, SIO_DTR_DSR_HS | 
| 0 | all fine | 
| -1 | set flow control failed | 
| -2 | USB device unavailable | 
Definition at line 2375 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_FLOW_CTRL_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::set_flow_control().
| int ftdi_setflowctrl_xonxoff | ( | struct ftdi_context * | ftdi, | 
| unsigned char | xon, | ||
| unsigned char | xoff | ||
| ) | 
Set XON/XOFF flowcontrol for ftdi chip
| ftdi | pointer to ftdi_context | 
| xon | character code used to resume transmission | 
| xoff | character code used to pause transmission | 
| 0 | all fine | 
| -1 | set flow control failed | 
| -2 | USB device unavailable | 
Definition at line 2399 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_FLOW_CTRL_REQUEST, SIO_XON_XOFF_HS, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
| int ftdi_setdtr_rts | ( | struct ftdi_context * | ftdi, | 
| int | dtr, | ||
| int | rts | ||
| ) | 
Set dtr and rts line in one pass
| ftdi | pointer to ftdi_context | 
| dtr | DTR state to set line to (1 or 0) | 
| rts | RTS state to set line to (1 or 0) | 
| 0 | all fine | 
| -1 | set dtr/rts failed | 
| -2 | USB device unavailable | 
Definition at line 2484 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_DTR_HIGH, SIO_SET_DTR_LOW, SIO_SET_MODEM_CTRL_REQUEST, SIO_SET_RTS_HIGH, SIO_SET_RTS_LOW, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::set_modem_control().
| int ftdi_setdtr | ( | struct ftdi_context * | ftdi, | 
| int | state | ||
| ) | 
Set dtr line
| ftdi | pointer to ftdi_context | 
| state | state to set line to (1 or 0) | 
| 0 | all fine | 
| -1 | set dtr failed | 
| -2 | USB device unavailable | 
Definition at line 2423 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_DTR_HIGH, SIO_SET_DTR_LOW, SIO_SET_MODEM_CTRL_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::set_dtr().
| int ftdi_setrts | ( | struct ftdi_context * | ftdi, | 
| int | state | ||
| ) | 
Set rts line
| ftdi | pointer to ftdi_context | 
| state | state to set line to (1 or 0) | 
| 0 | all fine | 
| -1 | set rts failed | 
| -2 | USB device unavailable | 
Definition at line 2453 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_MODEM_CTRL_REQUEST, SIO_SET_RTS_HIGH, SIO_SET_RTS_LOW, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::set_rts().
| int ftdi_set_event_char | ( | struct ftdi_context * | ftdi, | 
| unsigned char | eventch, | ||
| unsigned char | enable | ||
| ) | 
Set the special event character
| ftdi | pointer to ftdi_context | 
| eventch | Event character | 
| enable | 0 to disable the event character, non-zero otherwise | 
| 0 | all fine | 
| -1 | unable to set event character | 
| -2 | USB device unavailable | 
Definition at line 2520 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_EVENT_CHAR_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::set_event_char().
| int ftdi_set_error_char | ( | struct ftdi_context * | ftdi, | 
| unsigned char | errorch, | ||
| unsigned char | enable | ||
| ) | 
Set error character
| ftdi | pointer to ftdi_context | 
| errorch | Error character | 
| enable | 0 to disable the error character, non-zero otherwise | 
| 0 | all fine | 
| -1 | unable to set error character | 
| -2 | USB device unavailable | 
Definition at line 2549 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_context::index, SIO_SET_ERROR_CHAR_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Context::set_error_char().
| int ftdi_eeprom_initdefaults | ( | struct ftdi_context * | ftdi, | 
| char * | manufacturer, | ||
| char * | product, | ||
| char * | serial | ||
| ) | 
Init eeprom with default values for the connected device
| ftdi | pointer to ftdi_context | 
| manufacturer | String to use as Manufacturer | 
| product | String to use as Product description | 
| serial | String to use as Serial number description | 
| 0 | all fine | 
| -1 | No struct ftdi_context | 
| -2 | No struct ftdi_eeprom | 
| -3 | No connected device or device not yet opened | 
Definition at line 2579 of file ftdi.c.
References ftdi_eeprom::cbus_function, CBUS_PWREN, CBUS_RXLED, CBUS_SLEEP, CBUS_TXDEN, CBUS_TXLED, CBUSH_TRISTATE, CBUSX_RXLED, CBUSX_SLEEP, CBUSX_TXDEN, CBUSX_TXLED, ftdi_context::eeprom, ftdi_error_return, ftdi_eeprom::manufacturer, ftdi_eeprom::max_power, ftdi_eeprom::product, ftdi_eeprom::product_id, ftdi_eeprom::release_number, ftdi_eeprom::serial, ftdi_eeprom::size, ftdi_context::type, TYPE_2232C, TYPE_2232H, TYPE_230X, TYPE_232H, TYPE_4232H, TYPE_AM, TYPE_BM, TYPE_R, ftdi_context::usb_dev, ftdi_eeprom::usb_version, ftdi_eeprom::use_serial, and ftdi_eeprom::vendor_id.
Referenced by Ftdi::Eeprom::init_defaults().
| int ftdi_eeprom_build | ( | struct ftdi_context * | ftdi | ) | 
Build binary buffer from ftdi_eeprom structure. Output is suitable for ftdi_write_eeprom().
| ftdi | pointer to ftdi_context | 
| >=0 | size of eeprom user area in bytes | 
| -1 | eeprom size (128 bytes) exceeded by custom strings | 
| -2 | Invalid eeprom or ftdi pointer | 
| -3 | Invalid cbus function setting (FIXME: Not in the code?) | 
| -4 | Chip doesn't support invert (FIXME: Not in the code?) | 
| -5 | Chip doesn't support high current drive (FIXME: Not in the code?) | 
| -6 | No connected EEPROM or EEPROM Type unknown | 
Definition at line 2910 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_eeprom::chip, ftdi_context::eeprom, ftdi_error_return, FTDI_MAX_EEPROM_SIZE, ftdi_eeprom::in_is_isochronous, ftdi_eeprom::is_not_pnp, ftdi_eeprom::manufacturer, ftdi_eeprom::max_power, MAX_POWER_MILLIAMP_PER_UNIT, ftdi_eeprom::out_is_isochronous, ftdi_eeprom::product, ftdi_eeprom::product_id, ftdi_eeprom::release_number, ftdi_eeprom::remote_wakeup, ftdi_eeprom::self_powered, ftdi_eeprom::serial, ftdi_eeprom::size, ftdi_context::type, TYPE_2232C, TYPE_2232H, TYPE_230X, TYPE_232H, TYPE_4232H, TYPE_AM, TYPE_BM, TYPE_R, ftdi_eeprom::usb_version, ftdi_eeprom::use_serial, USE_SERIAL_NUM, ftdi_eeprom::use_usb_version, USE_USB_VERSION_BIT, and ftdi_eeprom::vendor_id.
Referenced by Ftdi::Eeprom::build().
| int ftdi_eeprom_decode | ( | struct ftdi_context * | ftdi, | 
| int | verbose | ||
| ) | 
Decode binary EEPROM image into an ftdi_eeprom structure.
For FT-X devices use AN_201 FT-X MTP memory Configuration to decode.
| ftdi | pointer to ftdi_context | 
| verbose | Decode EEPROM on stdout | 
| 0 | all fine | 
| -1 | something went wrong | 
FIXME: How to pass size? How to handle size field in ftdi_eeprom? FIXME: Strings are malloc'ed here and should be freed somewhere
Definition at line 3548 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_eeprom::channel_a_type, ftdi_eeprom::chip, ftdi_context::eeprom, ftdi_error_return, ftdi_eeprom::in_is_isochronous, ftdi_eeprom::manufacturer, ftdi_eeprom::max_power, MAX_POWER_MILLIAMP_PER_UNIT, ftdi_eeprom::out_is_isochronous, ftdi_eeprom::product, ftdi_eeprom::product_id, ftdi_eeprom::release_number, ftdi_eeprom::remote_wakeup, ftdi_eeprom::self_powered, ftdi_eeprom::serial, ftdi_eeprom::size, ftdi_eeprom::suspend_pull_downs, ftdi_context::type, TYPE_2232C, TYPE_230X, TYPE_AM, TYPE_BM, ftdi_eeprom::usb_version, ftdi_eeprom::use_serial, USE_SERIAL_NUM, ftdi_eeprom::use_usb_version, USE_USB_VERSION_BIT, and ftdi_eeprom::vendor_id.
| int ftdi_get_eeprom_value | ( | struct ftdi_context * | ftdi, | 
| enum ftdi_eeprom_value | value_name, | ||
| int * | value | ||
| ) | 
Get a value from the decoded EEPROM structure
| ftdi | pointer to ftdi_context | 
| value_name | Enum of the value to query | 
| value | Pointer to store read value | 
| 0 | all fine | 
| -1 | Value doesn't exist | 
Definition at line 3978 of file ftdi.c.
References ftdi_eeprom::cbus_function, 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, ftdi_eeprom::channel_a_driver, CHANNEL_A_DRIVER, CHANNEL_A_RS485, ftdi_eeprom::channel_a_rs485enable, ftdi_eeprom::channel_a_type, CHANNEL_A_TYPE, ftdi_eeprom::channel_b_driver, CHANNEL_B_DRIVER, CHANNEL_B_RS485, ftdi_eeprom::channel_b_rs485enable, ftdi_eeprom::channel_b_type, CHANNEL_B_TYPE, ftdi_eeprom::channel_c_driver, CHANNEL_C_DRIVER, CHANNEL_C_RS485, ftdi_eeprom::channel_c_rs485enable, ftdi_eeprom::channel_d_driver, CHANNEL_D_DRIVER, CHANNEL_D_RS485, ftdi_eeprom::channel_d_rs485enable, ftdi_eeprom::chip, CHIP_SIZE, CHIP_TYPE, ftdi_eeprom::clock_polarity, CLOCK_POLARITY, ftdi_eeprom::data_order, DATA_ORDER, ftdi_context::eeprom, ftdi_eeprom::external_oscillator, EXTERNAL_OSCILLATOR, ftdi_eeprom::flow_control, FLOW_CONTROL, ftdi_error_return, ftdi_eeprom::group0_drive, GROUP0_DRIVE, ftdi_eeprom::group0_schmitt, GROUP0_SCHMITT, ftdi_eeprom::group0_slew, GROUP0_SLEW, ftdi_eeprom::group1_drive, GROUP1_DRIVE, ftdi_eeprom::group1_schmitt, GROUP1_SCHMITT, ftdi_eeprom::group1_slew, GROUP1_SLEW, ftdi_eeprom::group2_drive, GROUP2_DRIVE, ftdi_eeprom::group2_schmitt, GROUP2_SCHMITT, ftdi_eeprom::group2_slew, GROUP2_SLEW, ftdi_eeprom::group3_drive, GROUP3_DRIVE, ftdi_eeprom::group3_schmitt, GROUP3_SCHMITT, ftdi_eeprom::group3_slew, GROUP3_SLEW, ftdi_eeprom::high_current, HIGH_CURRENT, ftdi_eeprom::high_current_a, HIGH_CURRENT_A, ftdi_eeprom::high_current_b, HIGH_CURRENT_B, ftdi_eeprom::in_is_isochronous, IN_IS_ISOCHRONOUS, ftdi_eeprom::invert, INVERT, ftdi_eeprom::is_not_pnp, IS_NOT_PNP, ftdi_eeprom::max_power, MAX_POWER, ftdi_eeprom::out_is_isochronous, OUT_IS_ISOCHRONOUS, POWER_SAVE, ftdi_eeprom::powersave, ftdi_eeprom::product_id, PRODUCT_ID, ftdi_eeprom::release_number, RELEASE_NUMBER, ftdi_eeprom::remote_wakeup, REMOTE_WAKEUP, ftdi_eeprom::self_powered, SELF_POWERED, ftdi_eeprom::size, ftdi_eeprom::suspend_dbus7, SUSPEND_DBUS7, ftdi_eeprom::suspend_pull_downs, SUSPEND_PULL_DOWNS, ftdi_eeprom::usb_version, USB_VERSION, ftdi_eeprom::use_serial, USE_SERIAL, ftdi_eeprom::use_usb_version, USE_USB_VERSION, ftdi_eeprom::vendor_id, and VENDOR_ID.
| int ftdi_set_eeprom_value | ( | struct ftdi_context * | ftdi, | 
| enum ftdi_eeprom_value | value_name, | ||
| int | value | ||
| ) | 
Set a value in the decoded EEPROM Structure No parameter checking is performed
| ftdi | pointer to ftdi_context | 
| value_name | Enum of the value to set | 
| value | to set | 
| 0 | all fine | 
| -1 | Value doesn't exist | 
| -2 | Value not user settable | 
Definition at line 4171 of file ftdi.c.
References ftdi_eeprom::cbus_function, 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, ftdi_eeprom::channel_a_driver, CHANNEL_A_DRIVER, CHANNEL_A_RS485, ftdi_eeprom::channel_a_rs485enable, ftdi_eeprom::channel_a_type, CHANNEL_A_TYPE, ftdi_eeprom::channel_b_driver, CHANNEL_B_DRIVER, CHANNEL_B_RS485, ftdi_eeprom::channel_b_rs485enable, ftdi_eeprom::channel_b_type, CHANNEL_B_TYPE, ftdi_eeprom::channel_c_driver, CHANNEL_C_DRIVER, CHANNEL_C_RS485, ftdi_eeprom::channel_c_rs485enable, ftdi_eeprom::channel_d_driver, CHANNEL_D_DRIVER, CHANNEL_D_RS485, ftdi_eeprom::channel_d_rs485enable, ftdi_eeprom::chip, CHIP_SIZE, CHIP_TYPE, ftdi_eeprom::clock_polarity, CLOCK_POLARITY, ftdi_eeprom::data_order, DATA_ORDER, ftdi_context::eeprom, ftdi_eeprom::external_oscillator, EXTERNAL_OSCILLATOR, ftdi_eeprom::flow_control, FLOW_CONTROL, ftdi_error_return, ftdi_eeprom::group0_drive, GROUP0_DRIVE, ftdi_eeprom::group0_schmitt, GROUP0_SCHMITT, ftdi_eeprom::group0_slew, GROUP0_SLEW, ftdi_eeprom::group1_drive, GROUP1_DRIVE, ftdi_eeprom::group1_schmitt, GROUP1_SCHMITT, ftdi_eeprom::group1_slew, GROUP1_SLEW, ftdi_eeprom::group2_drive, GROUP2_DRIVE, ftdi_eeprom::group2_schmitt, GROUP2_SCHMITT, ftdi_eeprom::group2_slew, GROUP2_SLEW, ftdi_eeprom::group3_drive, GROUP3_DRIVE, ftdi_eeprom::group3_schmitt, GROUP3_SCHMITT, ftdi_eeprom::group3_slew, GROUP3_SLEW, ftdi_eeprom::high_current, HIGH_CURRENT, ftdi_eeprom::high_current_a, HIGH_CURRENT_A, ftdi_eeprom::high_current_b, HIGH_CURRENT_B, ftdi_eeprom::in_is_isochronous, IN_IS_ISOCHRONOUS, ftdi_eeprom::initialized_for_connected_device, ftdi_eeprom::invert, INVERT, ftdi_eeprom::is_not_pnp, IS_NOT_PNP, ftdi_eeprom::max_power, MAX_POWER, ftdi_eeprom::out_is_isochronous, OUT_IS_ISOCHRONOUS, POWER_SAVE, ftdi_eeprom::powersave, ftdi_eeprom::product_id, PRODUCT_ID, ftdi_eeprom::release_number, RELEASE_NUMBER, ftdi_eeprom::remote_wakeup, REMOTE_WAKEUP, ftdi_eeprom::self_powered, SELF_POWERED, ftdi_eeprom::suspend_dbus7, SUSPEND_DBUS7, ftdi_eeprom::suspend_pull_downs, SUSPEND_PULL_DOWNS, ftdi_eeprom::usb_version, USB_VERSION, ftdi_eeprom::use_serial, USE_SERIAL, ftdi_eeprom::use_usb_version, USE_USB_VERSION, ftdi_eeprom::user_data_addr, USER_DATA_ADDR, ftdi_eeprom::vendor_id, and VENDOR_ID.
| int ftdi_get_eeprom_buf | ( | struct ftdi_context * | ftdi, | 
| unsigned char * | buf, | ||
| int | size | ||
| ) | 
Get the read-only buffer to the binary EEPROM content
| ftdi | pointer to ftdi_context | 
| buf | buffer to receive EEPROM content | 
| size | Size of receiving buffer | 
| 0 | All fine | 
| -1 | struct ftdi_contxt or ftdi_eeprom missing | 
| -2 | Not enough room to store eeprom | 
Definition at line 4367 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_context::eeprom, ftdi_error_return, FTDI_MAX_EEPROM_SIZE, and ftdi_eeprom::size.
| int ftdi_set_eeprom_buf | ( | struct ftdi_context * | ftdi, | 
| const unsigned char * | buf, | ||
| int | size | ||
| ) | 
Set the EEPROM content from the user-supplied prefilled buffer
| ftdi | pointer to ftdi_context | 
| buf | buffer to read EEPROM content | 
| size | Size of buffer | 
| 0 | All fine | 
| -1 | struct ftdi_context or ftdi_eeprom or buf missing | 
Definition at line 4393 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_context::eeprom, ftdi_error_return, FTDI_MAX_EEPROM_SIZE, and ftdi_eeprom::size.
| int ftdi_set_eeprom_user_data | ( | struct ftdi_context * | ftdi, | 
| const char * | buf, | ||
| int | size | ||
| ) | 
Set the EEPROM user data content from the user-supplied prefilled buffer
| ftdi | pointer to ftdi_context | 
| buf | buffer to read EEPROM user data content | 
| size | Size of buffer | 
| 0 | All fine | 
| -1 | struct ftdi_context or ftdi_eeprom or buf missing | 
Definition at line 4416 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_context::eeprom, ftdi_error_return, ftdi_eeprom::size, ftdi_eeprom::user_data, and ftdi_eeprom::user_data_size.
| int ftdi_read_eeprom | ( | struct ftdi_context * | ftdi | ) | 
Read eeprom
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | read failed | 
| -2 | USB device unavailable | 
Definition at line 4461 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_context::eeprom, FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, FTDI_MAX_EEPROM_SIZE, SIO_READ_EEPROM_REQUEST, ftdi_eeprom::size, ftdi_context::type, TYPE_R, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by Ftdi::Eeprom::read().
| int ftdi_read_chipid | ( | struct ftdi_context * | ftdi, | 
| unsigned int * | chipid | ||
| ) | 
Read the FTDIChip-ID from R-type devices
| ftdi | pointer to ftdi_context | 
| chipid | Pointer to store FTDIChip-ID | 
| 0 | all fine | 
| -1 | read failed | 
| -2 | USB device unavailable | 
Definition at line 4520 of file ftdi.c.
References FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, SIO_READ_EEPROM_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by Ftdi::Eeprom::chip_id().
| int ftdi_write_eeprom | ( | struct ftdi_context * | ftdi | ) | 
Write eeprom
| ftdi | pointer to ftdi_context | 
| 0 | all fine | 
| -1 | read failed | 
| -2 | USB device unavailable | 
| -3 | EEPROM not initialized for the connected device; | 
Definition at line 4614 of file ftdi.c.
References ftdi_eeprom::buf, ftdi_context::eeprom, FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_poll_modem_status(), ftdi_set_latency_timer(), ftdi_usb_reset(), ftdi_eeprom::initialized_for_connected_device, SIO_WRITE_EEPROM_REQUEST, ftdi_eeprom::size, ftdi_context::type, TYPE_230X, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Eeprom::write().
| int ftdi_erase_eeprom | ( | struct ftdi_context * | ftdi | ) | 
Definition at line 4669 of file ftdi.c.
References ftdi_eeprom::chip, ftdi_context::eeprom, FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_read_eeprom_location(), MAGIC, SIO_ERASE_EEPROM_REQUEST, SIO_WRITE_EEPROM_REQUEST, ftdi_context::type, TYPE_230X, TYPE_R, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Eeprom::erase().
| int ftdi_read_eeprom_location | ( | struct ftdi_context * | ftdi, | 
| int | eeprom_addr, | ||
| unsigned short * | eeprom_val | ||
| ) | 
Read eeprom location
| ftdi | pointer to ftdi_context | 
| eeprom_addr | Address of eeprom location to be read | 
| eeprom_val | Pointer to store read eeprom location | 
| 0 | all fine | 
| -1 | read failed | 
| -2 | USB device unavailable | 
Definition at line 4437 of file ftdi.c.
References ftdi_eeprom::buf, FTDI_DEVICE_IN_REQTYPE, ftdi_error_return, SIO_READ_EEPROM_REQUEST, ftdi_context::usb_dev, and ftdi_context::usb_read_timeout.
Referenced by ftdi_erase_eeprom(), ftdi_write_eeprom_location(), and Ftdi::Eeprom::read_location().
| int ftdi_write_eeprom_location | ( | struct ftdi_context * | ftdi, | 
| int | eeprom_addr, | ||
| unsigned short | eeprom_val | ||
| ) | 
Write eeprom location
| ftdi | pointer to ftdi_context | 
| eeprom_addr | Address of eeprom location to be written | 
| eeprom_val | Value to be written | 
| 0 | all fine | 
| -1 | write failed | 
| -2 | USB device unavailable | 
| -3 | Invalid access to checksum protected area below 0x80 | 
| -4 | Device can't access unprotected area | 
| -5 | Reading chip type failed | 
Definition at line 4558 of file ftdi.c.
References FTDI_DEVICE_OUT_REQTYPE, ftdi_error_return, ftdi_read_eeprom_location(), SIO_WRITE_EEPROM_REQUEST, ftdi_context::type, TYPE_2232C, TYPE_2232H, TYPE_232H, TYPE_4232H, TYPE_BM, ftdi_context::usb_dev, and ftdi_context::usb_write_timeout.
Referenced by Ftdi::Eeprom::write_location().
| const char* ftdi_get_error_string | ( | struct ftdi_context * | ftdi | ) | 
Get string representation for last error code
| ftdi | pointer to ftdi_context | 
| Pointer | to error string | 
Definition at line 4731 of file ftdi.c.
References ftdi_context::error_str.
Referenced by Ftdi::Context::error_string().
 1.8.17
© Intra2net AG 2025
 | Legal | Contact