From e0c2e30660bef422744e885ab32c26c58978a8a1 Mon Sep 17 00:00:00 2001 From: drath Date: Tue, 20 Feb 2007 13:47:32 +0000 Subject: [PATCH] - fixed libftdi initialization git-svn-id: svn://svn.berlios.de/openocd/trunk@131 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/jtag/ft2232.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 386da249a..4a705b5e2 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -1346,12 +1346,18 @@ int ft2232_init(void) return ERROR_JTAG_INIT_FAILED; /* context, vendor id, product id */ - if (ftdi_usb_open(&ftdic, ft2232_vid, ft2232_pid) < 0) + if (ftdi_usb_open_desc(&ftdic, ft2232_vid, ft2232_pid, ft2232_device_desc, ft2232_serial) < 0) { ERROR("unable to open ftdi device: %s", ftdic.error_str); return ERROR_JTAG_INIT_FAILED; } + if (ftdi_set_interface(&ftdic, INTERFACE_A) < 0) + { + ERROR("unable to select FT2232 channel A: %s", ftdic.error_str); + return ERROR_JTAG_INIT_FAILED; + } + if (ftdi_usb_reset(&ftdic) < 0) { ERROR("unable to reset ftdi device"); @@ -1374,11 +1380,7 @@ int ft2232_init(void) DEBUG("current latency timer: %i", latency_timer); } - ftdic.bitbang_mode = 0; /* Reset controller */ - ftdi_enable_bitbang(&ftdic, 0x0b); /* ctx, JTAG I/O mask */ - - ftdic.bitbang_mode = 2; /* MPSSE mode */ - ftdi_enable_bitbang(&ftdic, 0x0b); /* ctx, JTAG I/O mask */ + ftdi_set_bitmode(&ftdic, 0x0b, 2); /* ctx, JTAG I/O mask */ #endif ft2232_buffer_size = 0;