Skip to content

Commit 097e236

Browse files
committed
dirtyJtag: writeTMS: honour tdi method parameter (required by gowin GW5A family)
1 parent 936fe64 commit 097e236

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/dirtyJtag.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,20 @@ int DirtyJtag::setClkFreq(uint32_t clkHZ)
174174

175175
int DirtyJtag::writeTMS(const uint8_t *tms, uint32_t len,
176176
__attribute__((unused)) bool flush_buffer,
177-
__attribute__((unused)) const uint8_t tdi)
177+
const uint8_t tdi)
178178
{
179179
int actual_length;
180180

181181
if (len == 0)
182182
return 0;
183183

184-
uint8_t mask = SIG_TCK | SIG_TMS;
184+
uint8_t mask = SIG_TCK | SIG_TMS | SIG_TDI;
185185
uint8_t buf[64];
186186
u_int buffer_idx = 0;
187187
for (uint32_t i = 0; i < len; i++)
188188
{
189189
uint8_t val = (tms[i >> 3] & (1 << (i & 0x07))) ? SIG_TMS : 0;
190+
val |= tdi ? SIG_TDI : 0;
190191
buf[buffer_idx++] = CMD_SETSIG;
191192
buf[buffer_idx++] = mask;
192193
buf[buffer_idx++] = val;
@@ -205,8 +206,7 @@ int DirtyJtag::writeTMS(const uint8_t *tms, uint32_t len,
205206
int ret = libusb_bulk_transfer(dev_handle, DIRTYJTAG_WRITE_EP,
206207
buf, buffer_idx, &actual_length,
207208
DIRTYJTAG_TIMEOUT);
208-
if (ret < 0)
209-
{
209+
if (ret < 0) {
210210
cerr << "writeTMS: usb bulk write failed " << ret << endl;
211211
return -EXIT_FAILURE;
212212
}

0 commit comments

Comments
 (0)