Attempt to fix 2456024 - FTD2XX fails with certain SVF file - by limiting number of bytes to send per cmd buf

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1409 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 16 years ago
parent 2ba54802da
commit 779c04eb55

@ -1,5 +1,10 @@
2008-12-21 Kolja Waschk <kawk>
* src/tap/cable/ft2232.c, src/tap/cable/cmd_xfer.c,
src/tap/cable/cmd_xfer.h: limit maximum number of bytes queued
into one cmd buffer. Should fix problems with high clocks count for
SVF runtest execution (Bug 2456024 - FTD2XX fails with certain SVF file)
* configure.ac, src/tap/parport/direct.c: added detection of InpOut32
library and support for using it for I/O port access even under Vista

@ -61,6 +61,38 @@ extend_cmd_buffer( cx_cmd_t *cmd )
}
/*****************************************************************************
* cx_cmd_space( cmd, max_len )
*
* Return the difference between actually allocated bytes in the buffer of
* the current last command and max_len. If there are already more bytes
* allocated than max_len, this function will return zero.
*
* cmd : pointer to cx_cmd_t struct
* max_len : upper limit for the space to allocate
*
* Return value:
* 0 : No space left
* >0: Number of bytes left
*
****************************************************************************/
int
cx_cmd_space( cx_cmd_root_t *cmd_root, int max_len )
{
int n;
cx_cmd_t *cmd = cmd_root->last;
if (!cmd)
return max_len;
n = max_len - cmd->buf_pos;
if (n < 0)
return 0;
return n;
}
/*****************************************************************************
* cx_cmd_push( cmd, d )
*

@ -47,6 +47,7 @@ struct cx_cmd_root {
};
typedef struct cx_cmd_root cx_cmd_root_t;
int cx_cmd_space( cx_cmd_root_t *cmd_root, int max_len );
int cx_cmd_push( cx_cmd_root_t *cmd_root, uint8_t d);
cx_cmd_t *cx_cmd_dequeue( cx_cmd_root_t *cmd_root );
void cx_cmd_free( cx_cmd_t *cmd );

@ -931,6 +931,12 @@ ft2232_clock_schedule( cable_t *cable, int tms, int tdi, int n )
cx_cmd_queue( cmd_root, 0 );
while (n > 0)
{
if (cx_cmd_space( cmd_root, 4096 ) < 3)
{
cx_xfer( cmd_root, &imm_cmd, cable, COMPLETELY );
cx_cmd_queue( cmd_root, 0 );
}
/* Clock Data to TMS/CS Pin (no Read) */
cx_cmd_push( cmd_root, MPSSE_WRITE_TMS |
MPSSE_LSB | MPSSE_BITMODE | MPSSE_WRITE_NEG );

Loading…
Cancel
Save