# memberdef

refid: af6c6f42c9f6c10ff960e5163f0a052c6
name: open
definition: int Ftdi::Context::open
type: int
scope: Ftdi::Context
argsstring:
(int vendor, int product, const std::string &description, const std::string &serial=std::string(), unsigned int index=0)


refid: a2ba24f72d62c853538f0844259a98c4f
name: set_line_property
definition: int Ftdi::Context::set_line_property
type: int
scope: Ftdi::Context
argsstring:
(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity, enum ftdi_break_type break_type)


refid: a6d45e714bee4069f7f44e184d6f5ce60
name: size
definition: int ftdi_eeprom::size
type: int
scope: ftdi_eeprom
detaileddescription:
eeprom size in bytes. This doesn't get stored in the eeprom
but is the only way to pass it to ftdi_eeprom_build.  


refid: a800f8c1061eda755de332f61d53c474d
name: rbegin
definition: List::const_reverse_iterator Ftdi::List::rbegin
type: const_reverse_iterator
argsstring: () const
scope: Ftdi::List
detaileddescription:
Return begin reverse iterator for accessing the contained list elements
@return Const reverse iterator


refid: a80e0fdf70716da822af2c55e93a855fd
name: rend
definition: List::const_reverse_iterator Ftdi::List::rend
type: const_reverse_iterator
argsstring: () const
scope: Ftdi::List
detaileddescription:
Return end reverse iterator for accessing the contained list elements
@return Const reverse iterator


refid: a3e518597e7e1d8cce072fbf0c75a9d32
name: clear
definition: void Ftdi::List::clear
type: void
argsstring: ()
scope: Ftdi::List
detaileddescription:
Removes all elements. Invalidates all iterators.
Do it in a non-throwing way and also make
sure we really free the allocated memory.


refid: a608e4633a7bac3a39ac51fd67f190a89
name: erase
definition: List::iterator Ftdi::List::erase
type: iterator
argsstring: (iterator pos)
scope: Ftdi::List
detaileddescription:
Erase one element pointed by iterator
@param pos Element to erase
@return Position of the following element (or end())


refid: a318bc7283fa5ae8ad4c102a4aec7af27
name: erase
definition: List::iterator Ftdi::List::erase
type: iterator
argsstring: (iterator beg, iterator end)
scope: Ftdi::List
detaileddescription:
Erase a range of elements
@param beg Begin of range
@param end End of range
@return Position of the element after the erased range (or end())


refid: ga885116a371f8fe4f6d03d1f943d8529b
name: ftdi_error_return
initializer:
do {  \
        if ( ftdi )                        \
            ftdi->error_str = str;         \
        else                               \
            fprintf(stderr, str);          \
        return code;                       \
   } while(0);


refid: ga4ceb56112022b39be216a40ab52cd9a8
name: ftdi_error_return_free_device_list
initializer:
do {    \
        libusb_free_device_list(devs,1);   \
        ftdi->error_str = str;             \
        return code;                       \
   } while(0);


refid: ga94630370ae389fb1189282fa0742f310
name: MAGIC
initializer: 0x55aa
detaileddescription:
Erase eeprom

This is not supported on FT232R/FT245R according to the MProg manual from FTDI.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: erase failed
\retval -2: USB device unavailable
\retval -3: Writing magic failed
\retval -4: Read EEPROM failed
\retval -5: Unexpected EEPROM value


refid: ga21e2ed53cad4fa8242022afe1e12d2ee
name: ftdi_init
definition: int ftdi_init
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Initializes a ftdi_context.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: couldn't allocate read buffer
\retval -2: couldn't allocate struct  buffer
\retval -3: libusb_init() failed

\remark This should be called before all functions


refid: gafd46c6784367fd95c5f852d3b38949a8
name: ftdi_new
definition: struct ftdi_context* ftdi_new
type: struct ftdi_context *
argsstring: (void)
detaileddescription:
Allocate and initialize a new ftdi_context

\return a pointer to a new ftdi_context, or NULL on failure


refid: ga6dc886d709eced377a33dc975fa6e771
name: ftdi_set_interface
definition: int ftdi_set_interface
type: int
argsstring: (struct ftdi_context *ftdi, enum ftdi_interface interface)
detaileddescription:
Open selected channels on a chip, otherwise use first channel.

\param ftdi pointer to ftdi_context
\param interface Interface to use for FT2232C/2232H/4232H chips.

\retval  0: all fine
\retval -1: unknown interface
\retval -2: USB device unavailable
\retval -3: Device already open, interface can't be set in that state


refid: ga1eb46e0bb208b64f88169b5452cf6e94
name: ftdi_set_usbdev
definition: void ftdi_set_usbdev
type: void
argsstring: (struct ftdi_context *ftdi, libusb_device_handle *usb)
detaileddescription:
Use an already open libusb device.

\param ftdi pointer to ftdi_context
\param usb libusb libusb_device_handle to use


refid: ga2845a0c63809747c9c7b1ea404453bc4
name: ftdi_usb_find_all
definition: int ftdi_usb_find_all
type: int
argsstring: (struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product)
detaileddescription:
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)

\param ftdi pointer to ftdi_context
\param devlist Pointer where to store list of found devices
\param vendor Vendor ID to search for
\param product Product ID to search for

\retval >0: number of devices found
\retval -3: out of memory
\retval -5: libusb_get_device_list() failed
\retval -6: libusb_get_device_descriptor() failed


refid: ga17e8eae09e58bd3bfeeab8decfce7fd9
name: ftdi_usb_get_strings
definition: int ftdi_usb_get_strings
type: int
argsstring:
(struct ftdi_context *ftdi, struct libusb_device *dev, char *manufacturer, int mnf_len, char *description, int desc_len, char *serial, int serial_len)

detaileddescription:
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.

\note Use this function only in combination with ftdi_usb_find_all()
      as it closes the internal "usb_dev" after use.

\param ftdi pointer to ftdi_context
\param dev libusb usb_dev to use
\param manufacturer Store manufacturer string here if not NULL
\param mnf_len Buffer size of manufacturer string
\param description Store product description string here if not NULL
\param desc_len Buffer size of product description string
\param serial Store serial string here if not NULL
\param serial_len Buffer size of serial string

\retval   0: all fine
\retval  -1: wrong arguments
\retval  -4: unable to open device
\retval  -7: get product manufacturer failed
\retval  -8: get product description failed
\retval  -9: get serial number failed
\retval -11: libusb_get_device_descriptor() failed


refid: gad2de9ec013131d1a49038cb3c28c6415
name: ftdi_usb_get_strings2
definition: int ftdi_usb_get_strings2
type: int
argsstring:
(struct ftdi_context *ftdi, struct libusb_device *dev, char *manufacturer, int mnf_len, char *description, int desc_len, char *serial, int serial_len)

detaileddescription:
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.

\note The old function ftdi_usb_get_strings() always closes the device.
      This version only closes the device if it was opened by it.

\param ftdi pointer to ftdi_context
\param dev libusb usb_dev to use
\param manufacturer Store manufacturer string here if not NULL
\param mnf_len Buffer size of manufacturer string
\param description Store product description string here if not NULL
\param desc_len Buffer size of product description string
\param serial Store serial string here if not NULL
\param serial_len Buffer size of serial string

\retval   0: all fine
\retval  -1: wrong arguments
\retval  -4: unable to open device
\retval  -7: get product manufacturer failed
\retval  -8: get product description failed
\retval  -9: get serial number failed
\retval -11: libusb_get_device_descriptor() failed


refid: ga048332b2b47c4ece5bb88e96c21ad705
name: _ftdi_determine_max_packet_size
definition: static unsigned int _ftdi_determine_max_packet_size
type: unsigned int
argsstring: (struct ftdi_context *ftdi, libusb_device *dev)
detaileddescription:
Internal function to determine the maximum packet size.
\param ftdi pointer to ftdi_context
\param dev libusb usb_dev to use
\retval Maximum packet size for this device


refid: ga07d90df83e677ad08fe551de17fd7a41
name: ftdi_usb_open_dev
definition: int ftdi_usb_open_dev
type: int
argsstring: (struct ftdi_context *ftdi, libusb_device *dev)
detaileddescription:
Opens a ftdi device given by an usb_device.

\param ftdi pointer to ftdi_context
\param dev libusb usb_dev to use

\retval  0: all fine
\retval -3: unable to config device
\retval -4: unable to open device
\retval -5: unable to claim device
\retval -6: reset failed
\retval -7: set baudrate failed
\retval -8: ftdi context invalid
\retval -9: libusb_get_device_descriptor() failed
\retval -10: libusb_get_config_descriptor() failed
\retval -11: libusb_detach_kernel_driver() failed
\retval -12: libusb_get_configuration() failed


refid: ga95d4689db18fc1fd70011f6504ab8c40
name: ftdi_usb_open
definition: int ftdi_usb_open
type: int
argsstring: (struct ftdi_context *ftdi, int vendor, int product)
detaileddescription:
Opens the first device with a given vendor and product ids.

\param ftdi pointer to ftdi_context
\param vendor Vendor ID
\param product Product ID

\retval same as ftdi_usb_open_desc()


refid: ga93c2c5f546f5968ae497c099d319ff32
name: ftdi_usb_open_desc
definition: int ftdi_usb_open_desc
type: int
argsstring: (struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial)
detaileddescription:
Opens the first device with a given, vendor id, product id,
description and serial.

\param ftdi pointer to ftdi_context
\param vendor Vendor ID
\param product Product ID
\param description Description to search for. Use NULL if not needed.
\param serial Serial to search for. Use NULL if not needed.

\retval  0: all fine
\retval -3: usb device not found
\retval -4: unable to open device
\retval -5: unable to claim device
\retval -6: reset failed
\retval -7: set baudrate failed
\retval -8: get product description failed
\retval -9: get serial number failed
\retval -12: libusb_get_device_list() failed
\retval -13: libusb_get_device_descriptor() failed


refid: ga3c5ccb0678b0e268b4081ea978e8eb78
name: ftdi_usb_open_desc_index
definition: int ftdi_usb_open_desc_index
type: int
argsstring:
(struct ftdi_context *ftdi, int vendor, int product, const char *description, const char *serial, unsigned int index)

detaileddescription:
Opens the index-th device with a given, vendor id, product id,
description and serial.

\param ftdi pointer to ftdi_context
\param vendor Vendor ID
\param product Product ID
\param description Description to search for. Use NULL if not needed.
\param serial Serial to search for. Use NULL if not needed.
\param index Number of matching device to open if there are more than one, starts with 0.

\retval  0: all fine
\retval -1: usb_find_busses() failed
\retval -2: usb_find_devices() failed
\retval -3: usb device not found
\retval -4: unable to open device
\retval -5: unable to claim device
\retval -6: reset failed
\retval -7: set baudrate failed
\retval -8: get product description failed
\retval -9: get serial number failed
\retval -10: unable to close device
\retval -11: ftdi context invalid
\retval -12: libusb_get_device_list() failed


refid: gaac0c0e390c351db64bd42a86cb9d8d31
name: ftdi_usb_open_bus_addr
definition: int ftdi_usb_open_bus_addr
type: int
argsstring: (struct ftdi_context *ftdi, uint8_t bus, uint8_t addr)
detaileddescription:
Opens the device at a given USB bus and device address.

\param ftdi pointer to ftdi_context
\param bus Bus number
\param addr Device address

\retval  0: all fine
\retval -1: usb_find_busses() failed
\retval -2: usb_find_devices() failed
\retval -3: usb device not found
\retval -4: unable to open device
\retval -5: unable to claim device
\retval -6: reset failed
\retval -7: set baudrate failed
\retval -8: get product description failed
\retval -9: get serial number failed
\retval -10: unable to close device
\retval -11: ftdi context invalid
\retval -12: libusb_get_device_list() failed


refid: gaae805b82251a61dae46b98345cd84d5c
name: ftdi_usb_open_string
definition: int ftdi_usb_open_string
type: int
argsstring: (struct ftdi_context *ftdi, const char *description)
detaileddescription:
Opens the ftdi-device described by a description-string.
Intended to be used for parsing a device-description given as commandline argument.

\param ftdi pointer to ftdi_context
\param description NULL-terminated description-string, using this format:
    \li <tt>d:\<devicenode></tt> path of bus and device-node (e.g. "003/001") within usb device tree (usually at /proc/bus/usb/)
    \li <tt>i:\<vendor>:\<product></tt> first device with given vendor and product id, ids can be decimal, octal (preceded by "0") or hex (preceded by "0x")
    \li <tt>i:\<vendor>:\<product>:\<index></tt> as above with index being the number of the device (starting with 0) if there are more than one
    \li <tt>s:\<vendor>:\<product>:\<serial></tt> first device with given vendor id, product id and serial string

\note The description format may be extended in later versions.

\retval  0: all fine
\retval -2: libusb_get_device_list() failed
\retval -3: usb device not found
\retval -4: unable to open device
\retval -5: unable to claim device
\retval -6: reset failed
\retval -7: set baudrate failed
\retval -8: get product description failed
\retval -9: get serial number failed
\retval -10: unable to close device
\retval -11: illegal description format
\retval -12: ftdi context invalid


refid: ga266ccc351ea31289022063a8ae29edf4
name: ftdi_usb_reset
definition: int ftdi_usb_reset
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Resets the ftdi device.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: FTDI reset failed
\retval -2: USB device unavailable


refid: ga25a6d4766e30bd47602ed0c0ecf53476
name: ftdi_usb_purge_rx_buffer
definition: int ftdi_usb_purge_rx_buffer
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Clears the read buffer on the chip and the internal read buffer.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: read buffer purge failed
\retval -2: USB device unavailable


refid: ga1eab1dfd17068c46775a86496fee8bec
name: ftdi_usb_purge_tx_buffer
definition: int ftdi_usb_purge_tx_buffer
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Clears the write buffer on the chip.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: write buffer purge failed
\retval -2: USB device unavailable


refid: ga3089d7ceafad896c007111b8e5c02906
name: ftdi_usb_purge_buffers
definition: int ftdi_usb_purge_buffers
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Clears the buffers on the chip and the internal read buffer.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: read buffer purge failed
\retval -2: write buffer purge failed
\retval -3: USB device unavailable


refid: ga9536eff48c7ae9313b2a97320743ee3b
name: ftdi_usb_close
definition: int ftdi_usb_close
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Closes the ftdi device. Call ftdi_deinit() if you're cleaning up.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: usb_release failed
\retval -3: ftdi context invalid


refid: ga584697533494b60422b6cce5b8c68b6e
name: ftdi_convert_baudrate
definition: static int ftdi_convert_baudrate
type: int
argsstring: (int baudrate, struct ftdi_context *ftdi, unsigned short *value, unsigned short *index)
detaileddescription:
ftdi_convert_baudrate returns nearest supported baud rate to that requested.
Function is only used internally


refid: ga90fbdaa0bbee4c6d0d0ccd7225b2c843
name: convert_baudrate_UT_export
definition: int convert_baudrate_UT_export
type: int
argsstring: (int baudrate, struct ftdi_context *ftdi, unsigned short *value, unsigned short *index)
briefdescription:
Wrapper function to export ftdi_convert_baudrate() to the unit test
Do not use, it's only for the unit test framework.


refid: gae80f1dc38f5c80946a56ec34a329e7f5
name: ftdi_set_baudrate
definition: int ftdi_set_baudrate
type: int
argsstring: (struct ftdi_context *ftdi, int baudrate)
detaileddescription:
Sets the chip baud rate

\param ftdi pointer to ftdi_context
\param baudrate baud rate to set

\retval  0: all fine
\retval -1: invalid baudrate
\retval -2: setting baudrate failed
\retval -3: USB device unavailable


refid: ga044fdde91eaa3f557b545172622ee460
name: ftdi_set_line_property
definition: int ftdi_set_line_property
type: int
argsstring:
(struct ftdi_context *ftdi, enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity)

detaileddescription:
Set (RS232) line characteristics.
The break type can only be set via ftdi_set_line_property2()
and defaults to "off".

\param ftdi pointer to ftdi_context
\param bits Number of bits
\param sbit Number of stop bits
\param parity Parity mode

\retval  0: all fine
\retval -1: Setting line property failed


refid: ga481d055a35dd9042c1c23e2214d2655c
name: ftdi_set_line_property2
definition: int ftdi_set_line_property2
type: int
argsstring:
(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)

detaileddescription:
Set (RS232) line characteristics

\param ftdi pointer to ftdi_context
\param bits Number of bits
\param sbit Number of stop bits
\param parity Parity mode
\param break_type Break type

\retval  0: all fine
\retval -1: Setting line property failed
\retval -2: USB device unavailable


refid: ga01199788c36ba93352f155a79ea295e8
name: ftdi_write_data
definition: int ftdi_write_data
type: int
argsstring: (struct ftdi_context *ftdi, const unsigned char *buf, int size)
detaileddescription:
Writes data in chunks (see ftdi_write_data_set_chunksize()) to the chip

\param ftdi pointer to ftdi_context
\param buf Buffer with the data
\param size Size of the buffer

\retval -666: USB device unavailable
\retval <0: error code from usb_bulk_write()
\retval >0: number of bytes written


refid: ga90c2133a195fc7ebf229205c2755fc67
name: ftdi_write_data_submit
definition: struct ftdi_transfer_control* ftdi_write_data_submit
type: struct ftdi_transfer_control *
argsstring: (struct ftdi_context *ftdi, unsigned char *buf, int size)
detaileddescription:
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.

\param ftdi pointer to ftdi_context
\param buf Buffer with the data
\param size Size of the buffer

\retval NULL: Some error happens when submit transfer
\retval !NULL: Pointer to a ftdi_transfer_control


refid: gab4dd69a3332c544dfdcbf4da85bd8801
name: ftdi_read_data_submit
definition: struct ftdi_transfer_control* ftdi_read_data_submit
type: struct ftdi_transfer_control *
argsstring: (struct ftdi_context *ftdi, unsigned char *buf, int size)
detaileddescription:
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.

\param ftdi pointer to ftdi_context
\param buf Buffer with the data
\param size Size of the buffer

\retval NULL: Some error happens when submit transfer
\retval !NULL: Pointer to a ftdi_transfer_control


refid: gaf580b6263d15746d1f5d3759f9c3ac02
name: ftdi_transfer_data_done
definition: int ftdi_transfer_data_done
type: int
argsstring: (struct ftdi_transfer_control *tc)
detaileddescription:
Wait for completion of the transfer.

Use libusb 1.0 asynchronous API.

\param tc pointer to ftdi_transfer_control

\retval < 0: Some error happens
\retval >= 0: Data size transferred

inbodydescription:
tc->transfer could be NULL if "(size <= ftdi->readbuffer_remaining)"
at ftdi_read_data_submit(). Therefore, we need to check it here.
 


refid: gaccb36ed9571b5a1955479d50b2e1d91e
name: ftdi_transfer_data_cancel
definition: void ftdi_transfer_data_cancel
type: void
argsstring: (struct ftdi_transfer_control *tc, struct timeval *to)
detaileddescription:
Cancel transfer and wait for completion.

Use libusb 1.0 asynchronous API.

\param tc pointer to ftdi_transfer_control
\param to pointer to timeout value or NULL for infinite


refid: ga85e22717c3315a09219b03a1862c0c46
name: ftdi_write_data_set_chunksize
definition: int ftdi_write_data_set_chunksize
type: int
argsstring: (struct ftdi_context *ftdi, unsigned int chunksize)
detaileddescription:
Configure write buffer chunk size.
Default is 4096.

\param ftdi pointer to ftdi_context
\param chunksize Chunk size

\retval 0: all fine
\retval -1: ftdi context invalid


refid: ga5944f14ffd11faa113515ff29dc769ed
name: ftdi_write_data_get_chunksize
definition: int ftdi_write_data_get_chunksize
type: int
argsstring: (struct ftdi_context *ftdi, unsigned int *chunksize)
detaileddescription:
Get write buffer chunk size.

\param ftdi pointer to ftdi_context
\param chunksize Pointer to store chunk size in

\retval 0: all fine
\retval -1: ftdi context invalid


refid: ga72d87e30015c98bd0be22e7c8c873345
name: ftdi_read_data
definition: int ftdi_read_data
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *buf, int size)
detaileddescription:
Reads data in chunks (see ftdi_read_data_set_chunksize()) from the chip.

Automatically strips the two modem status bytes transfered during every read.

\param ftdi pointer to ftdi_context
\param buf Buffer to store data in
\param size Size of the buffer

\retval -666: USB device unavailable
\retval <0: error code from libusb_bulk_transfer()
\retval  0: no data was available
\retval >0: number of bytes read


refid: ga65783703baf0828d519ef597bb2855c1
name: ftdi_read_data_set_chunksize
definition: int ftdi_read_data_set_chunksize
type: int
argsstring: (struct ftdi_context *ftdi, unsigned int chunksize)
detaileddescription:
Configure read buffer chunk size.
Default is 4096.

Automatically reallocates the buffer.

\param ftdi pointer to ftdi_context
\param chunksize Chunk size

\retval 0: all fine
\retval -1: ftdi context invalid


refid: gab42b05f26b6a6545ae3ae1b4edc28e5c
name: ftdi_read_data_get_chunksize
definition: int ftdi_read_data_get_chunksize
type: int
argsstring: (struct ftdi_context *ftdi, unsigned int *chunksize)
detaileddescription:
Get read buffer chunk size.

\param ftdi pointer to ftdi_context
\param chunksize Pointer to store chunk size in

\retval 0: all fine
\retval -1: FTDI context invalid


refid: ga83b41e900a1faf2ecc0546ce48ec7e70
name: ftdi_set_bitmode
definition: int ftdi_set_bitmode
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char bitmask, unsigned char mode)
detaileddescription:
Enable/disable bitbang modes.

\param ftdi pointer to ftdi_context
\param bitmask Bitmask to configure lines.
       HIGH/ON value configures a line as output.
\param mode Bitbang mode: use the values defined in \ref ftdi_mpsse_mode

\retval  0: all fine
\retval -1: can't enable bitbang mode
\retval -2: USB device unavailable


refid: ga42b4776b91c6b14d2d1008b160b78efa
name: ftdi_disable_bitbang
definition: int ftdi_disable_bitbang
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Disable bitbang mode.

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: can't disable bitbang mode
\retval -2: USB device unavailable


refid: gab823dd90f2359612b1546ef0ceebdc0e
name: ftdi_read_pins
definition: int ftdi_read_pins
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *pins)
detaileddescription:
Directly read pin state, circumventing the read buffer. Useful for bitbang mode.

\param ftdi pointer to ftdi_context
\param pins Pointer to store pins into

\retval  0: all fine
\retval -1: read pins failed
\retval -2: USB device unavailable


refid: ga3e0227b0c7aa859d2d2afb5ffa4c8466
name: ftdi_set_latency_timer
definition: int ftdi_set_latency_timer
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char latency)
detaileddescription:
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.

\param ftdi pointer to ftdi_context
\param latency Value between 1 and 255

\retval  0: all fine
\retval -1: latency out of range
\retval -2: unable to set latency timer
\retval -3: USB device unavailable


refid: gacf7b6dcc4de33db2263ce8a421e18bfc
name: ftdi_get_latency_timer
definition: int ftdi_get_latency_timer
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *latency)
detaileddescription:
Get latency timer

\param ftdi pointer to ftdi_context
\param latency Pointer to store latency value in

\retval  0: all fine
\retval -1: unable to get latency timer
\retval -2: USB device unavailable


refid: ga396c3bf1435fb3317755868e28c47414
name: ftdi_poll_modem_status
definition: int ftdi_poll_modem_status
type: int
argsstring: (struct ftdi_context *ftdi, unsigned short *status)
detaileddescription:
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:
- B0..B3 - must be 0
- B4       Clear to send (CTS)
             0 = inactive
             1 = active
- B5       Data set ready (DTS)
             0 = inactive
             1 = active
- B6       Ring indicator (RI)
             0 = inactive
             1 = active
- B7       Receive line signal detect (RLSD)
             0 = inactive
             1 = active

Layout of the second byte:
- B0       Data ready (DR)
- B1       Overrun error (OE)
- B2       Parity error (PE)
- B3       Framing error (FE)
- B4       Break interrupt (BI)
- B5       Transmitter holding register (THRE)
- B6       Transmitter empty (TEMT)
- B7       Error in RCVR FIFO

\param ftdi pointer to ftdi_context
\param status Pointer to store status information in. Must be two bytes.

\retval  0: all fine
\retval -1: unable to retrieve status information
\retval -2: USB device unavailable


refid: gac3b3d2cc69edf567e653340f434c91e0
name: ftdi_setflowctrl
definition: int ftdi_setflowctrl
type: int
argsstring: (struct ftdi_context *ftdi, int flowctrl)
detaileddescription:
Set flowcontrol for ftdi chip

\param ftdi pointer to ftdi_context
\param flowctrl flow control to use. should be
       SIO_DISABLE_FLOW_CTRL, SIO_RTS_CTS_HS, SIO_DTR_DSR_HS or SIO_XON_XOFF_HS

\retval  0: all fine
\retval -1: set flow control failed
\retval -2: USB device unavailable


refid: ga47761f16762363288c55f5fff24620d5
name: ftdi_setdtr
definition: int ftdi_setdtr
type: int
argsstring: (struct ftdi_context *ftdi, int state)
detaileddescription:
Set dtr line

\param ftdi pointer to ftdi_context
\param state state to set line to (1 or 0)

\retval  0: all fine
\retval -1: set dtr failed
\retval -2: USB device unavailable


refid: ga5713ba73288b3e1ac1d45096c917c1ab
name: ftdi_setrts
definition: int ftdi_setrts
type: int
argsstring: (struct ftdi_context *ftdi, int state)
detaileddescription:
Set rts line

\param ftdi pointer to ftdi_context
\param state state to set line to (1 or 0)

\retval  0: all fine
\retval -1: set rts failed
\retval -2: USB device unavailable


refid: ga5a8f23c2e77c8b58c1f44a11e2f52aa9
name: ftdi_setdtr_rts
definition: int ftdi_setdtr_rts
type: int
argsstring: (struct ftdi_context *ftdi, int dtr, int rts)
detaileddescription:
Set dtr and rts line in one pass

\param ftdi pointer to ftdi_context
\param dtr  DTR state to set line to (1 or 0)
\param rts  RTS state to set line to (1 or 0)

\retval  0: all fine
\retval -1: set dtr/rts failed
\retval -2: USB device unavailable


refid: ga71eeabe2ee5474d5c0ceddc2e08766cd
name: ftdi_set_event_char
definition: int ftdi_set_event_char
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char eventch, unsigned char enable)
detaileddescription:
Set the special event character

\param ftdi pointer to ftdi_context
\param eventch Event character
\param enable 0 to disable the event character, non-zero otherwise

\retval  0: all fine
\retval -1: unable to set event character
\retval -2: USB device unavailable


refid: gaeb9510a61f6648eb1bd57f0f99a390e1
name: ftdi_set_error_char
definition: int ftdi_set_error_char
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char errorch, unsigned char enable)
detaileddescription:
Set error character

\param ftdi pointer to ftdi_context
\param errorch Error character
\param enable 0 to disable the error character, non-zero otherwise

\retval  0: all fine
\retval -1: unable to set error character
\retval -2: USB device unavailable


refid: ga0b04717765deb6706482a3f3124c0b4a
name: ftdi_eeprom_initdefaults
definition: int ftdi_eeprom_initdefaults
type: int
argsstring: (struct ftdi_context *ftdi, char *manufacturer, char *product, char *serial)
detaileddescription:
Init eeprom with default values for the connected device
\param ftdi pointer to ftdi_context
\param manufacturer String to use as Manufacturer
\param product String to use as Product description
\param serial String to use as Serial number description

\retval  0: all fine
\retval -1: No struct ftdi_context
\retval -2: No struct ftdi_eeprom
\retval -3: No connected device or device not yet opened


refid: gaefc3d12f7421030c63ad77b9af1d4a83
name: ftdi_eeprom_get_strings
definition: int ftdi_eeprom_get_strings
type: int
argsstring:
(struct ftdi_context *ftdi, char *manufacturer, int mnf_len, char *product, int prod_len, char *serial, int serial_len)

detaileddescription:
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.

\param ftdi pointer to ftdi_context
\param manufacturer Store manufacturer string here if not NULL
\param mnf_len Buffer size of manufacturer string
\param product Store product description string here if not NULL
\param prod_len Buffer size of product description string
\param serial Store serial string here if not NULL
\param serial_len Buffer size of serial string

\retval   0: all fine
\retval  -1: ftdi context invalid
\retval  -2: ftdi eeprom buffer invalid


refid: gaccf7f39923b4a9bbc626cca9f7ac40b1
name: ftdi_eeprom_build
definition: int ftdi_eeprom_build
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Build binary buffer from ftdi_eeprom structure.
Output is suitable for ftdi_write_eeprom().

\param ftdi pointer to ftdi_context

\retval >=0: size of eeprom user area in bytes
\retval -1: eeprom size (128 bytes) exceeded by custom strings
\retval -2: Invalid eeprom or ftdi pointer
\retval -3: Invalid cbus function setting     (FIXME: Not in the code?)
\retval -4: Chip doesn't support invert       (FIXME: Not in the code?)
\retval -5: Chip doesn't support high current drive         (FIXME: Not in the code?)
\retval -6: No connected EEPROM or EEPROM Type unknown


refid: gac91c95ae42ec1ba885dc54f39709c072
name: ftdi_eeprom_decode
definition: int ftdi_eeprom_decode
type: int
argsstring: (struct ftdi_context *ftdi, int verbose)
detaileddescription:
Decode binary EEPROM image into an ftdi_eeprom structure.

For FT-X devices use AN_201 FT-X MTP memory Configuration to decode.

\param ftdi pointer to ftdi_context
\param verbose Decode EEPROM on stdout

\retval 0: all fine
\retval -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


refid: ga6213209895e40153d103a72654d53b81
name: ftdi_get_eeprom_value
definition: int ftdi_get_eeprom_value
type: int
argsstring: (struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int *value)
detaileddescription:
Get a value from the decoded EEPROM structure

\param ftdi pointer to ftdi_context
\param value_name Enum of the value to query
\param value Pointer to store read value

\retval 0: all fine
\retval -1: Value doesn't exist


refid: ga8e120f60f65859c1976c2dba99e9d002
name: ftdi_set_eeprom_value
definition: int ftdi_set_eeprom_value
type: int
argsstring: (struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int value)
detaileddescription:
Set a value in the decoded EEPROM Structure
No parameter checking is performed

\param ftdi pointer to ftdi_context
\param value_name Enum of the value to set
\param value to set

\retval 0: all fine
\retval -1: Value doesn't exist
\retval -2: Value not user settable


refid: ga92a449af4a1becc70e80e49f3c937bbd
name: ftdi_get_eeprom_buf
definition: int ftdi_get_eeprom_buf
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *buf, int size)
detaileddescription:
Get the read-only buffer to the binary EEPROM content

\param ftdi pointer to ftdi_context
\param buf buffer to receive EEPROM content
\param size Size of receiving buffer

\retval 0: All fine
\retval -1: struct ftdi_contxt or ftdi_eeprom missing
\retval -2: Not enough room to store eeprom


refid: gaad29bea74f6ae02ed757d2a39c060969
name: ftdi_set_eeprom_buf
definition: int ftdi_set_eeprom_buf
type: int
argsstring: (struct ftdi_context *ftdi, const unsigned char *buf, int size)
detaileddescription:
Set the EEPROM content from the user-supplied prefilled buffer

\param ftdi pointer to ftdi_context
\param buf buffer to read EEPROM content
\param size Size of buffer

\retval 0: All fine
\retval -1: struct ftdi_context or ftdi_eeprom or buf missing


refid: ga1af4ea94a0cbe4d4b6364675eee0b4ef
name: ftdi_set_eeprom_user_data
definition: int ftdi_set_eeprom_user_data
type: int
argsstring: (struct ftdi_context *ftdi, const char *buf, int size)
detaileddescription:
Set the EEPROM user data content from the user-supplied prefilled buffer

\param ftdi pointer to ftdi_context
\param buf buffer to read EEPROM user data content
\param size Size of buffer

\retval 0: All fine
\retval -1: struct ftdi_context or ftdi_eeprom or buf missing


refid: ga650df1dc49ec78f0ee58b1c4f2644fd9
name: ftdi_read_eeprom_location
definition: int ftdi_read_eeprom_location
type: int
argsstring: (struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val)
detaileddescription:
Read eeprom location

\param ftdi pointer to ftdi_context
\param eeprom_addr Address of eeprom location to be read
\param eeprom_val Pointer to store read eeprom location

\retval  0: all fine
\retval -1: read failed
\retval -2: USB device unavailable


refid: gac157786fdf2e9c6b51dd9b4ddbb34d5f
name: ftdi_read_eeprom
definition: int ftdi_read_eeprom
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Read eeprom

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: read failed
\retval -2: USB device unavailable


refid: gab978a76c2cc0dbfbc1fd6350db848300
name: ftdi_read_chipid
definition: int ftdi_read_chipid
type: int
argsstring: (struct ftdi_context *ftdi, unsigned int *chipid)
detaileddescription:
Read the FTDIChip-ID from R-type devices

\param ftdi pointer to ftdi_context
\param chipid Pointer to store FTDIChip-ID

\retval  0: all fine
\retval -1: read failed
\retval -2: USB device unavailable


refid: ga5f2f678fc05cb8f92708fb1e5eb75100
name: ftdi_write_eeprom_location
definition: int ftdi_write_eeprom_location
type: int
argsstring: (struct ftdi_context *ftdi, int eeprom_addr, unsigned short eeprom_val)
detaileddescription:
Write eeprom location

\param ftdi pointer to ftdi_context
\param eeprom_addr Address of eeprom location to be written
\param eeprom_val Value to be written

\retval  0: all fine
\retval -1: write failed
\retval -2: USB device unavailable
\retval -3: Invalid access to checksum protected area below 0x80
\retval -4: Device can't access unprotected area
\retval -5: Reading chip type failed


refid: ga8cc9811660d1adfb4b30157c5ab26d5a
name: ftdi_write_eeprom
definition: int ftdi_write_eeprom
type: int
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Write eeprom

\param ftdi pointer to ftdi_context

\retval  0: all fine
\retval -1: read failed
\retval -2: USB device unavailable
\retval -3: EEPROM not initialized for the connected device;


refid: ga59bd8b3e806348db5e96f582e0fe10b8
name: ftdi_get_error_string
definition: const char* ftdi_get_error_string
type: const char *
argsstring: (struct ftdi_context *ftdi)
detaileddescription:
Get string representation for last error code

\param ftdi pointer to ftdi_context

\retval Pointer to error string


refid: ac40507f049c077d5bab6bf0e65c103cd
name: ftdi_eeprom_value
detaileddescription:
List all handled EEPROM values.
  Append future new values only at the end to provide API/ABI stability 


refid: aaebecac513598988595fe3fbbbdd3776
name: FTDIStreamCallback
type: int(
argsstring: )(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *userdata)
definition:
typedef int( FTDIStreamCallback)(uint8_t *buffer, int length, FTDIProgressInfo *progress, void *userdata)


refid: abffdbbc8e303b2e4e85551734682a0b4
name: ftdi_readstream
definition: int ftdi_readstream
type: int
argsstring:
(struct ftdi_context *ftdi, FTDIStreamCallback *callback, void *userdata, int packetsPerTransfer, int numTransfers)

detaileddescription:
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.

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


