libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v0.16rc2-2-gc7c487c

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 6 May 2009 17:45:35 +0200 (CEST)
The branch, master has been updated
       via  c7c487c1e7169be609683fea4f88660e6902062a (commit)
       via  f9d69895e66cff6db384ffc915924ab950620b65 (commit)
      from  2458ef34bce90d88f19cb8d741969f9d4bf7cf29 (commit)


- Log -----------------------------------------------------------------
commit c7c487c1e7169be609683fea4f88660e6902062a
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date:   Wed May 6 17:42:24 2009 +0200

    Update README file with latest changes

commit f9d69895e66cff6db384ffc915924ab950620b65
Author: Alex Harford <harford@xxxxxxxxx>
Date:   Wed May 6 17:40:29 2009 +0200

    Allow C/D interfaces to be used on the 4232H, initialize the default 
interface for 2232H/4232H

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

Summary of changes:
 AUTHORS    |    1 +
 ChangeLog  |    4 ++--
 README     |    6 ++++--
 src/ftdi.c |   31 ++++++++++++++++++++++++++-----
 src/ftdi.h |    4 +++-
 5 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 1f89dc0..f325f05 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -6,6 +6,7 @@ Contributors in alphabetical order,
 see Changelog for full details:
 
   Alain Abbas <aa@xxxxxxxxxxxx>
+  Alex Harford <harford@xxxxxxxxx>
   Andrew John Rogers <andrew@xxxxxxxxxxxxxxxx>
   Arnim Läuger <arnim.laeuger@xxxxxxx>
   Daniel Kirkham <d.kirkham@xxxxxxxxxxx>
diff --git a/ChangeLog b/ChangeLog
index 28d8a6f..2181ff8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,9 @@
-New in 0.16 - 2009-05-04
+New in 0.16 - 2009-05-06
 ------------------------
 * C++ wrapper: Reopen the device after calling get_strings() in 
Context::open() (Marek Vavruša and Intra2net)
 * C++ wrapper: Fixed an inheritance problem (Marek Vavruša and Intra2net)
 * C++ wrapper: Relicensed under GPLv2 + linking exception (Marek Vavruša and 
Intra2net)
-* Support for FT2232H and FT4232H (David Challis and Intra2net)
+* Support for FT2232H and FT4232H (David Challis, Alex Harford and Intra2net)
 * Support for mingw cross compile (Uwe Bonnes)
 * Python bindings and minor autoconf cleanup (Tarek Heiland)
 * Code cleanup in various places (Intra2net)
diff --git a/README b/README
index 11348d2..c85517e 100644
--- a/README
+++ b/README
@@ -20,8 +20,10 @@ the initial C++ wrapper implementation.
 
 Changes
 -------
-* Relicensed C++ wrapper under GPLv2 + linking exception (Marek Vavruša and 
Intra2net)
-* Support for FT2232H and FT4232H (David Challis and Intra2net)
+* C++ wrapper: Reopen the device after calling get_strings() in 
Context::open() (Marek Vavruša and Intra2net)
+* C++ wrapper: Fixed an inheritance problem (Marek Vavruša and Intra2net)
+* C++ wrapper: Relicensed under GPLv2 + linking exception (Marek Vavruša and 
Intra2net)
+* Support for FT2232H and FT4232H (David Challis, Alex Harford and Intra2net)
 * Support for mingw cross compile (Uwe Bonnes)
 * Python bindings and minor autoconf cleanup (Tarek Heiland)
 * Code cleanup in various places (Intra2net)
diff --git a/src/ftdi.c b/src/ftdi.c
index 27600d6..c417f70 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -132,7 +132,7 @@ struct ftdi_context *ftdi_new()
     Open selected channels on a chip, otherwise use first channel.
 
     \param ftdi pointer to ftdi_context
-    \param interface Interface to use for FT2232C chips.
+    \param interface Interface to use for FT2232C/2232H/4232H chips.
 
     \retval  0: all fine
     \retval -1: unknown interface
@@ -151,6 +151,18 @@ int ftdi_set_interface(struct ftdi_context *ftdi, enum 
ftdi_interface interface)
             ftdi->in_ep     = 0x04;
             ftdi->out_ep    = 0x83;
             break;
+        case INTERFACE_C:
+            ftdi->interface = 2;
+            ftdi->index     = INTERFACE_C;
+            ftdi->in_ep     = 0x06;
+            ftdi->out_ep    = 0x85;
+            break;
+        case INTERFACE_D:
+            ftdi->interface = 3;
+            ftdi->index     = INTERFACE_D;
+            ftdi->in_ep     = 0x08;
+            ftdi->out_ep    = 0x87;
+            break;
         default:
             ftdi_error_return(-1, "Unknown interface");
     }
@@ -431,11 +443,7 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct 
usb_device *dev)
     else if (dev->descriptor.bcdDevice == 0x200)
         ftdi->type = TYPE_AM;
     else if (dev->descriptor.bcdDevice == 0x500)
-    {
         ftdi->type = TYPE_2232C;
-        if (!ftdi->index)
-            ftdi->index = INTERFACE_A;
-    }
     else if (dev->descriptor.bcdDevice == 0x600)
         ftdi->type = TYPE_R;
     else if (dev->descriptor.bcdDevice == 0x700)
@@ -443,6 +451,19 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct 
usb_device *dev)
     else if (dev->descriptor.bcdDevice == 0x800)
         ftdi->type = TYPE_4232H;
 
+    // Set default interface on dual/quad type chips
+    switch(ftdi->type)
+    {
+        case TYPE_2232C:
+        case TYPE_2232H:
+        case TYPE_4232H:
+            if (!ftdi->index)
+                ftdi->index = INTERFACE_A;
+            break;
+        default:
+            break;
+    }
+
     ftdi_error_return(0, "all fine");
 }
 
diff --git a/src/ftdi.h b/src/ftdi.h
index e02c32b..45fb907 100644
--- a/src/ftdi.h
+++ b/src/ftdi.h
@@ -50,7 +50,9 @@ enum ftdi_interface
 {
     INTERFACE_ANY = 0,
     INTERFACE_A   = 1,
-    INTERFACE_B   = 2
+    INTERFACE_B   = 2,
+    INTERFACE_C   = 3,
+    INTERFACE_D   = 4
 };
 
 /* Shifting commands IN MPSSE Mode*/


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.16rc2-2-gc7c487c, libftdi-git <=