libgpiodJtagBitbang: add support for XVC server

This commit is contained in:
Marcus Comstedt
2025-03-10 15:29:06 +01:00
parent 3cf558ebe2
commit a39aa2d43e
3 changed files with 34 additions and 0 deletions
+24
View File
@@ -343,3 +343,27 @@ int LibgpiodJtagBitbang::toggleClk(uint8_t tms, uint8_t tdi, uint32_t clk_len)
return clk_len;
}
bool LibgpiodJtagBitbang::writeTMSTDI(const uint8_t *tms, const uint8_t *tdi, uint8_t *tdo,
uint32_t len)
{
memset(tdo, 0, (len+7) / 8);
for (uint32_t i = 0; i < len; i++) {
#ifdef GPIOD_APIV2
gpiod_line_value tdix = (tdi[i >> 3] & (1 << (i & 7))) ? GPIOD_LINE_VALUE_ACTIVE : GPIOD_LINE_VALUE_INACTIVE;
gpiod_line_value tmsx = (tms[i >> 3] & (1 << (i & 7))) ? GPIOD_LINE_VALUE_ACTIVE : GPIOD_LINE_VALUE_INACTIVE;
update_pins(tmsx, tdix);
#else
int tdix = (tdi[i >> 3] & (1 << (i & 7))) ? 1 : 0;
int tmsx = (tms[i >> 3] & (1 << (i & 7))) ? 1 : 0;
update_pins(0, tmsx, tdix);
update_pins(1, tmsx, tdix);
#endif
if (read_tdo() > 0)
tdo[i >> 3] |= 1 << (i & 7);
}
return true;
}