diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 374bf85f..b8b50426 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,9 +1,12 @@ 2008-02-21 Arnim Laeuger + * src/tap/parport/ftdi.c (ftdi_mpsse_open): set latency timer to 16ms + * src/tap/parport/ftd2xx.c (ftd2xx_mpsse_open): set latency timer to 16ms + * src/tap/cable/ft2232.c (send_and_receive): issue SEND_IMMEDIATE command + when receive bytes were scheduled * src/bsdl/bsdl_bison.y, src/bsdl/bsdl.h, src/bsdl/bsdl_flex.l, src/bsdl/bsdl.c: push mode and debug through init tree to avoid error message from scanner in simple test mode. - * src/bus/fjmem.c: merged branches/jmem to trunk -> added fjmem bus driver diff --git a/jtag/src/tap/cable/ft2232.c b/jtag/src/tap/cable/ft2232.c index a622a286..60b0c481 100644 --- a/jtag/src/tap/cable/ft2232.c +++ b/jtag/src/tap/cable/ft2232.c @@ -73,6 +73,7 @@ #define LOOPBACK_START 0x84 #define LOOPBACK_END 0x85 #define TCK_DIVISOR 0x86 +#define SEND_IMMEDIATE 0x87 /* bit and bitmask definitions for GPIO commands */ @@ -257,6 +258,11 @@ send_and_receive( cable_t *cable ) bytes_sent++; } + /* the SEND_IMMEDIATE command will trigger the ft2232 to send + its bytes immediately without waiting for the latency timeout */ + if (bytes_to_recv) + parport_set_data( p, SEND_IMMEDIATE ); + /* Step 2: flush parport */ parport_set_control( p, 1 ); // flush parport_set_control( p, 0 ); // noflush diff --git a/jtag/src/tap/parport/ftd2xx.c b/jtag/src/tap/parport/ftd2xx.c index 691f10d2..064cba49 100644 --- a/jtag/src/tap/parport/ftd2xx.c +++ b/jtag/src/tap/parport/ftd2xx.c @@ -292,6 +292,14 @@ ftd2xx_mpsse_open( parport_t *parport ) FT_Close(fc); return -1; } + /* set a reasonnable latency timer value + if this value is too low then the chip will send intermediate result data + in short packets (suboptimal performance) */ + if ((status = FT_SetLatencyTimer(fc, 16)) != FT_OK) { + fprintf(stderr, "Can't set target latency timer: %li\n", status); + FT_Close(fc); + return -1; + } if ((status = FT_SetBitMode( fc, 0x00, 0x00 )) != FT_OK) { fprintf(stderr, "Can't disable bitmode: %li\n", status); FT_Close(fc); @@ -312,11 +320,6 @@ ftd2xx_mpsse_open( parport_t *parport ) FT_Close(fc); return -1; } - if ((status = FT_SetLatencyTimer(fc, 1)) != FT_OK) { - fprintf(stderr, "Can't set latency timer: %li\n", status); - FT_Close(fc); - return -1; - } return 0; } diff --git a/jtag/src/tap/parport/ftdi.c b/jtag/src/tap/parport/ftdi.c index 7d13c82f..2d52bf5c 100644 --- a/jtag/src/tap/parport/ftdi.c +++ b/jtag/src/tap/parport/ftdi.c @@ -322,6 +322,17 @@ ftdi_mpsse_open( parport_t *parport ) ftdi_deinit(fc); return -1; } + /* set a reasonnable latency timer value + if this value is too low then the chip will send intermediate result data + in short packets (suboptimal performance) */ + if(ftdi_set_latency_timer(fc, 16) < 0) + { + fprintf (stderr, "Can't set target latency: %s\n", + ftdi_get_error_string (fc)); + ftdi_usb_close(fc); + ftdi_deinit(fc); + return -1; + } if (ftdi_set_bitmode(fc, 0x0b, BITMODE_RESET) < 0) { @@ -330,7 +341,7 @@ ftdi_mpsse_open( parport_t *parport ) ftdi_usb_close(fc); ftdi_deinit(fc); return -1; - }; + } if (ftdi_set_bitmode(fc, 0x0b, BITMODE_MPSSE) < 0) { fprintf (stderr, "Can't set mpsse mode: %s\n", @@ -338,7 +349,7 @@ ftdi_mpsse_open( parport_t *parport ) ftdi_usb_close(fc); ftdi_deinit(fc); return -1; - }; + } if (ftdi_usb_reset(fc) < 0) { @@ -357,14 +368,6 @@ ftdi_mpsse_open( parport_t *parport ) return -1; } - if(ftdi_set_latency_timer(fc, 1) < 0) - { - fprintf (stderr, "Can't set minimum latency: %s\n", - ftdi_get_error_string (fc)); - ftdi_usb_close(fc); - ftdi_deinit(fc); - return -1; - }; return 0; }