# 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 {  \
        ftdi->error_str = str;             \
        return code;                       \
   } while(0);


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

\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


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

\param ftdi pointer to ftdi_context
\param usb libusb usb_dev_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 on the usb bus. Creates a new ftdi_device_list which
needs to be deallocated by ftdi_list_free() after use.

\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 -1: usb_find_busses() failed
\retval -2: usb_find_devices() failed
\retval -3: out of memory


refid: gabeca5642c95141e11b6936175ce08b3b
name: ftdi_usb_get_strings
definition: int ftdi_usb_get_strings
type: int
argsstring:
(struct ftdi_context *ftdi, struct usb_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 -10: unable to close device


refid: ga56bfea20e35a944f3f668ff417123d2b
name: _ftdi_determine_max_packet_size
definition: static unsigned int _ftdi_determine_max_packet_size
type: unsigned int
argsstring: (struct ftdi_context *ftdi, struct usb_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: gaa03eb28a2ec02db4e923e3949854a30d
name: ftdi_usb_open_dev
definition: int ftdi_usb_open_dev
type: int
argsstring: (struct ftdi_context *ftdi, struct usb_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


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 -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


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


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 -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: 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 -2: usb_close 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: 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: gaa79550f209ce3327a5df03f2bd1e80f0
name: ftdi_write_data
definition: int ftdi_write_data
type: int
argsstring: (struct ftdi_context *ftdi, 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: ga388d2925e1f4092548bac18a872b2289
name: _usb_async_cleanup
definition: static void _usb_async_cleanup
type: void
argsstring: (struct ftdi_context *ftdi, int wait_for_more, int timeout_msec)
detaileddescription:
Wait until one or more async URBs are completed by the kernel and mark their
positions in the async-buffer as unused

\param ftdi pointer to ftdi_context
\param wait_for_more if != 0 wait for more than one write to complete
\param timeout_msec max milliseconds to wait


refid: ga76f20e683a65c0c2b368e983b315eb04
name: ftdi_async_complete
definition: void ftdi_async_complete
type: void
argsstring: (struct ftdi_context *ftdi, int wait_for_more)
detaileddescription:
Wait until one or more async URBs are completed by the kernel and mark their
positions in the async-buffer as unused.

\param ftdi pointer to ftdi_context
\param wait_for_more if != 0 wait for more than one write to complete (until write timeout)


refid: ga5599e10611947b915e8419ef28a35860
name: _usb_bulk_write_async
definition: static int _usb_bulk_write_async
type: int
argsstring: (struct ftdi_context *ftdi, int ep, char *bytes, int size)
detaileddescription:
Stupid libusb does not offer async writes nor does it allow
access to its fd - so we need some hacks here.


refid: gae08ef89d23158590fa2d9e397b686d4b
name: ftdi_write_data_async
definition: int ftdi_write_data_async
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *buf, int size)
detaileddescription:
Writes data in chunks (see ftdi_write_data_set_chunksize()) to the chip.
Does not wait for completion of the transfer nor does it make sure that
the transfer was successful.

This function could be extended to use signals and callbacks to inform the
caller of completion or error - but this is not done yet, volunteers welcome.

Works around libusb and directly accesses functions only available on Linux.
Only available if compiled with &ndash;with-async-mode.

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

Returns when at least one byte is available or when the latency timer has elapsed
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 usb_bulk_read()
\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: ga73127091e1d4d50b2b7c0e005c4900f7
name: ftdi_enable_bitbang
definition: int ftdi_enable_bitbang
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char bitmask)
detaileddescription:
Enable bitbang mode.

\xrefitem deprecated 1.

\param ftdi pointer to ftdi_context
\param bitmask Bitmask to configure lines.
       HIGH/ON value configures a line as output.

\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: 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: 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: gaf2ce1365f476463d01d02d5aba5fa818
name: ftdi_eeprom_setsize
definition: void ftdi_eeprom_setsize
type: void
argsstring: (struct ftdi_context *ftdi, struct ftdi_eeprom *eeprom, int size)
detaileddescription:
Set the eeprom size

\param ftdi pointer to ftdi_context
\param eeprom Pointer to ftdi_eeprom
\param size


refid: ga6e80677242c262c58169ea5565ae9163
name: ftdi_eeprom_build
definition: int ftdi_eeprom_build
type: int
argsstring: (struct ftdi_eeprom *eeprom, unsigned char *output)
detaileddescription:
Build binary output from ftdi_eeprom structure.
Output is suitable for ftdi_write_eeprom().

\note This function doesn't handle FT2232x devices. Only FT232x.
\param eeprom Pointer to ftdi_eeprom
\param output Buffer of 128 bytes to store eeprom image to

\retval >0: free eeprom size
\retval -1: eeprom size (128 bytes) exceeded by custom strings
\retval -2: Invalid eeprom pointer
\retval -3: Invalid cbus function setting
\retval -4: Chip doesn't support invert
\retval -5: Chip doesn't support high current drive


refid: ga03beffe9080d466d70c90ce75fec26c9
name: ftdi_eeprom_decode
definition: int ftdi_eeprom_decode
type: int
argsstring: (struct ftdi_eeprom *eeprom, unsigned char *buf, int size)
detaileddescription:
Decode binary EEPROM image into an ftdi_eeprom structure.

\param eeprom Pointer to ftdi_eeprom which will be filled in.
\param buf Buffer of \a size bytes of raw eeprom data
\param size size size of eeprom data in bytes

\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: 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: gac2607b0a26dd8d78431d30a3fd01c052
name: ftdi_read_eeprom
definition: int ftdi_read_eeprom
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *eeprom)
detaileddescription:
Read eeprom

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

\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: gaf9fc6da50167f7160024aca768c8dccc
name: ftdi_read_eeprom_getsize
definition: int ftdi_read_eeprom_getsize
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *eeprom, int maxsize)
detaileddescription:
Guesses size of eeprom by reading eeprom and comparing halves - will not work with blank eeprom
Call this function then do a write then call again to see if size changes, if so write again.

\param ftdi pointer to ftdi_context
\param eeprom Pointer to store eeprom into
\param maxsize the size of the buffer to read into

\retval -1: eeprom read failed
\retval -2: USB device unavailable
\retval >=0: size of eeprom


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: read failed
\retval -2: USB device unavailable


refid: ga28e530f10b046bcc353aa75938bddb31
name: ftdi_write_eeprom
definition: int ftdi_write_eeprom
type: int
argsstring: (struct ftdi_context *ftdi, unsigned char *eeprom)
detaileddescription:
Write eeprom

\param ftdi pointer to ftdi_context
\param eeprom Pointer to read eeprom from

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


refid: ga25eb9a83a925065b6c3b61b8f0565951
name: ftdi_erase_eeprom
definition: int ftdi_erase_eeprom
type: int
argsstring: (struct ftdi_context *ftdi)
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


refid: ga28c84d963760d7396e5a2992e63a9354
name: ftdi_get_error_string
definition: char* ftdi_get_error_string
type: 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


