libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v0.19-1-gb72a7e1

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 21 Jun 2011 09:57:11 +0200 (CEST)
The branch, master has been updated
       via  b72a7e174724e08977bc124a3b6a81cab4c3571f (commit)
      from  9329cd7df34db42cb23c4e3210e51a435d350637 (commit)


- Log -----------------------------------------------------------------
commit b72a7e174724e08977bc124a3b6a81cab4c3571f
Author: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date:   Fri Jun 17 21:46:05 2011 +0200

    Add FT232H support

-----------------------------------------------------------------------

Summary of changes:
 src/ftdi.c |   25 +++++++++++++++++++++++--
 src/ftdi.h |    2 +-
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/ftdi.c b/src/ftdi.c
index 1816ecb..980622d 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -414,7 +414,7 @@ static unsigned int _ftdi_determine_max_packet_size(struct 
ftdi_context *ftdi, s
     // Determine maximum packet size. Init with default value.
     // New hi-speed devices from FTDI use a packet size of 512 bytes
     // but could be connected to a normal speed USB hub -> 64 bytes packet 
size.
-    if (ftdi->type == TYPE_2232H || ftdi->type == TYPE_4232H)
+    if (ftdi->type == TYPE_2232H || ftdi->type == TYPE_4232H || ftdi->type == 
TYPE_232H)
         packet_size = 512;
     else
         packet_size = 64;
@@ -541,6 +541,8 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct 
usb_device *dev)
         ftdi->type = TYPE_2232H;
     else if (dev->descriptor.bcdDevice == 0x800)
         ftdi->type = TYPE_4232H;
+    else if (dev->descriptor.bcdDevice == 0x900)
+        ftdi->type = TYPE_232H;
 
     // Set default interface on dual/quad type chips
     switch(ftdi->type)
@@ -1072,7 +1074,8 @@ static int ftdi_convert_baudrate(int baudrate, struct 
ftdi_context *ftdi,
     }
     // Split into "value" and "index" values
     *value = (unsigned short)(encoded_divisor & 0xFFFF);
-    if (ftdi->type == TYPE_2232C || ftdi->type == TYPE_2232H || ftdi->type == 
TYPE_4232H)
+    if (ftdi->type == TYPE_2232C || ftdi->type == TYPE_2232H || ftdi->type == 
TYPE_4232H
+        || ftdi->type == TYPE_232H)
     {
         *index = (unsigned short)(encoded_divisor >> 8);
         *index &= 0xFF00;
@@ -2264,6 +2267,15 @@ int ftdi_eeprom_build(struct ftdi_eeprom *eeprom, 
unsigned char *output)
         case TYPE_R:
             output[0x07] = 0x06;
             break;
+        case TYPE_2232H:
+            output[0x07] = 0x07;
+            break;
+         case TYPE_4232H:
+            output[0x07] = 0x08;
+            break;
+        case TYPE_232H:
+            output[0x07] = 0x09;
+            break;
         default:
             output[0x07] = 0x00;
     }
@@ -2453,6 +2465,15 @@ int ftdi_eeprom_decode(struct ftdi_eeprom *eeprom, 
unsigned char *buf, int size)
     value = buf[0x06] + (buf[0x07]<<8);
     switch (value)
     {
+        case 0x0900:
+            eeprom->chip_type = TYPE_232H;
+            break;
+        case 0x0800:
+            eeprom->chip_type = TYPE_4232H;
+            break;
+        case 0x0700:
+            eeprom->chip_type = TYPE_2232H;
+            break;
         case 0x0600:
             eeprom->chip_type = TYPE_R;
             break;
diff --git a/src/ftdi.h b/src/ftdi.h
index 3e7d43d..e617c43 100644
--- a/src/ftdi.h
+++ b/src/ftdi.h
@@ -22,7 +22,7 @@
 #define FTDI_DEFAULT_EEPROM_SIZE 128
 
 /** 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 };
+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 };
 /** 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() */


hooks/post-receive
-- 
A library to talk to FTDI chips

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v0.19-1-gb72a7e1, libftdi-git <=