From 021411540200588823f0c59b179f0c76bf97a9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Thu, 10 Jul 2008 20:26:21 +0000 Subject: [PATCH] perform device reset and RX purge git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1301 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 5 +++++ jtag/src/tap/usbconn/libftd2xx.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 8280791e..dfc3b0b5 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,8 @@ +2008-07-10 Arnim Laeuger + + * src/tap/usbconn/libftd2xx.c (usbconn_ftd2xx_open): perform device reset + and RX purge + 2008-07-09 Arnim Laeuger * src/tap/usbconn/libftd2xx.c: added some debugging messages diff --git a/jtag/src/tap/usbconn/libftd2xx.c b/jtag/src/tap/usbconn/libftd2xx.c index b36219f7..30bab9a8 100644 --- a/jtag/src/tap/usbconn/libftd2xx.c +++ b/jtag/src/tap/usbconn/libftd2xx.c @@ -330,7 +330,7 @@ usbconn_ftd2xx_common_open( usbconn_t *conn ) if ((status = FT_Open( 0, &(p->fc) )) != FT_OK) { - perror( "Unable to open FTDO device.\n" ); + perror( "Unable to open FTDI device.\n" ); /* mark ftd2xx layer as not initialized */ p->fc = NULL; return -1; @@ -353,7 +353,12 @@ usbconn_ftd2xx_open( usbconn_t *conn ) fc = p->fc; - if ((status = FT_SetBitMode( fc, 0x00, 0x00 )) != FT_OK) + if ((status = FT_ResetDevice( fc )) != FT_OK) + perror( _("Can't reset device.\n") ); + if (status == FT_OK) if ((status = FT_Purge( fc, FT_PURGE_RX )) != FT_OK) + perror( _("Can't purge RX buffer.\n") ); + + if (status == FT_OK) if ((status = FT_SetBitMode( fc, 0x00, 0x00 )) != FT_OK) perror( _("Can't disable bitmode.\n") ); if (status == FT_OK) if ((status = FT_SetLatencyTimer(fc, 2)) != FT_OK)