Added partial support for FT230X
[libftdi] / src / ftdi.h
index 03a7d52..8f03679 100644 (file)
@@ -2,7 +2,7 @@
                           ftdi.h  -  description
                              -------------------
     begin                : Fri Apr 4 2003
-    copyright            : (C) 2003-2011 by Intra2net AG and the libftdi developers
+    copyright            : (C) 2003-2013 by Intra2net AG and the libftdi developers
     email                : opensource@intra2net.com
  ***************************************************************************/
 
 #ifndef __libftdi_h__
 #define __libftdi_h__
 
-#include <libusb.h>
+#include <stdint.h>
+#include <sys/time.h>
 
 /** FTDI chip type */
-enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3, TYPE_2232H=4, TYPE_4232H=5, TYPE_232H=6 };
+enum ftdi_chip_type {
+    TYPE_AM=0,
+    TYPE_BM=1,
+    TYPE_2232C=2,
+    TYPE_R=3,
+    TYPE_2232H=4,
+    TYPE_4232H=5,
+    TYPE_232H=6,
+    TYPE_230X=7,
+};
 /** Parity mode for ftdi_set_line_property() */
 enum ftdi_parity_type { NONE=0, ODD=1, EVEN=2, MARK=3, SPACE=4 };
 /** Number of stop bits for ftdi_set_line_property() */
@@ -301,7 +311,14 @@ enum ftdi_eeprom_value
     POWER_SAVE         = 45,
     CLOCK_POLARITY     = 46,
     DATA_ORDER         = 47,
-    FLOW_CONTROL       = 48
+    FLOW_CONTROL       = 48,
+    CHANNEL_C_DRIVER   = 49,
+    CHANNEL_D_DRIVER   = 50,
+    CHANNEL_A_RS485    = 51,
+    CHANNEL_B_RS485    = 52,
+    CHANNEL_C_RS485    = 53,
+    CHANNEL_D_RS485    = 54,
+    RELEASE_NUMBER     = 55,
 };
 
 /**
@@ -328,7 +345,9 @@ enum ftdi_cbus_func {/* FIXME: Recheck value, especially the last */
 enum ftdi_cbush_func {/* FIXME: Recheck value, especially the last */
     CBUSH_TRISTATE = 0, CBUSH_RXLED = 1, CBUSH_TXLED = 2, CBUSH_TXRXLED = 3, CBUSH_PWREN = 4,
     CBUSH_SLEEP = 5, CBUSH_DRIVE_0 = 6, CBUSG_DRIVE1 = 7, CBUSH_IOMODE = 8, CBUSH_TXDEN =  9,
-    CBUSH_CLK30 = 0xa, CBUSH_CLK15 = 0xb, CBUSH_CLK7_5 = 0xc};
+    CBUSH_CLK30 = 10, CBUSH_CLK15 = 11, CBUSH_CLK7_5 = 12, CBUSH_BAT_DETECT = 13,
+    CBUSH_BAT_DETECT_NEG = 14, CBUSH_I2C_TXE = 15, CBUSH_I2C_RXF = 16, CBUSH_VBUS_SENSE = 17,
+    CBUSH_BB_WR = 18, CBUSH_BB_RD = 19, CBUSH_TIME_STAMP = 20, CBUSH_AWAKE = 21,};
 
 /** Invert TXD# */
 #define INVERT_TXD 0x01
@@ -354,6 +373,8 @@ enum ftdi_cbush_func {/* FIXME: Recheck value, especially the last */
 #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
@@ -436,6 +457,8 @@ extern "C"
                              char * manufacturer, int mnf_len,
                              char * description, int desc_len,
                              char * serial, int serial_len);
+    int ftdi_eeprom_set_strings(struct ftdi_context *ftdi, char * manufacturer,
+                             char * product, char * serial);
 
     int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product);
     int ftdi_usb_open_desc(struct ftdi_context *ftdi, int vendor, int product,
@@ -466,17 +489,15 @@ extern "C"
     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, 
+    int ftdi_readstream(struct ftdi_context *ftdi, FTDIStreamCallback *callback,
                         void *userdata, int packetsPerTransfer, int numTransfers);
-    int ftdi_write_data_async(struct ftdi_context *ftdi, unsigned char *buf, int size);
-    void ftdi_async_complete(struct ftdi_context *ftdi, int wait_for_more);
+    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);
 
-    int DEPRECATED(ftdi_enable_bitbang(struct ftdi_context *ftdi, unsigned char bitmask));
-    int ftdi_disable_bitbang(struct ftdi_context *ftdi);
     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);