libftdi: Allow more flexible Swd Read/Write Switching.

This commit is contained in:
Uwe Bonnes 2018-05-30 18:55:50 +02:00
parent df05d7ce7b
commit 2657aa6fbb
3 changed files with 10 additions and 2 deletions

View File

@ -83,6 +83,7 @@ cable_desc_t cable_desc[] = {
.cbus_ddr = 0x02,
.bitbang_tms_in_port_cmd = GET_BITS_LOW,
.bitbang_tms_in_pin = MPSSE_TDO, /* keep bit 5 low*/
.bitbang_swd_dbus_read_data = 0x02,
.name = "ftdiswd"
},
{

View File

@ -58,6 +58,9 @@ typedef struct cable_desc_s {
uint8_t cbus_ddr;
uint8_t bitbang_tms_in_port_cmd;
uint8_t bitbang_tms_in_pin;
uint8_t bitbang_swd_dbus_read_data;
/* bitbang_swd_dbus_read_data is same as dbus_data,
* as long as CBUS is not involved.*/
char *description;
char * name;
}cable_desc_t;

View File

@ -84,8 +84,12 @@ static void swdptap_turnaround(uint8_t dir)
if(dir) { /* SWDIO goes to input */
cmd[index++] = SET_BITS_LOW;
cmd[index++] = active_cable->dbus_data | MPSSE_MASK;
cmd[index++] = active_cable->dbus_ddr & ~MPSSE_MASK;
if (active_cable->bitbang_swd_dbus_read_data)
cmd[index] = active_cable->bitbang_swd_dbus_read_data;
else
cmd[index] = active_cable->dbus_data;
index++;
cmd[index++] = active_cable->dbus_ddr & ~MPSSE_MASK;
}
/* One clock cycle */
cmd[index++] = MPSSE_TMS_SHIFT;