jlink: suport writeTDI() with tx=NULL

fixes crash and is consistent with other jtag cables
This commit is contained in:
Andrew Dennison 2023-05-29 11:19:12 +10:00
parent d2f7040527
commit bddfe97997
1 changed files with 4 additions and 1 deletions

View File

@ -137,7 +137,10 @@ int Jlink::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
xfer_len = len - rest; // reduce xfer len
uint16_t tt = (xfer_len + 7) >> 3; // convert to Byte
memset(_tms, tms, tt); // fill tms buffer
memcpy(_tdi, tx_ptr, tt); // fill tdi buffer
if (tx)
memcpy(_tdi, tx_ptr, tt); // fill tdi buffer
else
memset(_tdi, 0, tt); // clear tdi buffer
_num_bits = xfer_len; // set buffer size in bit
if (end && xfer_len + rest == len) { // last sequence: set tms 1
_last_tms = 1;