ftdiJtagMPSSE: restructure SIPEED firmware test to uses strncomp only once with SIPEED keyword

This commit is contained in:
Gwenhael Goavec-Merou 2026-02-11 08:02:45 +01:00
parent a7af6e13ae
commit 68b4d7d654
1 changed files with 12 additions and 14 deletions

View File

@ -74,16 +74,14 @@ void FtdiJtagMPSSE::init_internal(const mpsse_bit_config &cable)
_ch552WA = true; _ch552WA = true;
} }
// This Sipeed firmware does not support MPSEE 0x8E, 0x8F commands properly // Sipeed cable Work around
if ( (!strncmp((const char *)_imanufacturer, "SIPEED", 6)) if (!strncmp((const char *)_imanufacturer, "SIPEED", 6)) {
&& (!strncmp((const char *)_iserialnumber, "2023112818", 10)) ) { // This Sipeed firmware does not support MPSEE 0x8E, 0x8F commands properly
_cmd8EWA = true; if (!strncmp((const char *)_iserialnumber, "2023112818", 10))
} _cmd8EWA true;
// This Sipeed firmware is incredibly slow in LSB first mode
// This Sipeed firmware is incredibly slow in LSB first mode if (!strncmp((const char *)_iserialnumber, "2025041420", 10))
if ( (!strncmp((const char *)_imanufacturer, "SIPEED", 6)) _msb_first = true;
&& (!strncmp((const char *)_iserialnumber, "2025041420", 10)) ) {
_msb_first = true;
} }
@ -227,10 +225,10 @@ int FtdiJtagMPSSE::flush()
} }
static unsigned char bit_reverse(unsigned char b) { static unsigned char bit_reverse(unsigned char b) {
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
b = (b & 0xCC) >> 2 | (b & 0x33) << 2; b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
b = (b & 0xAA) >> 1 | (b & 0x55) << 1; b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
return b; return b;
} }
int FtdiJtagMPSSE::writeTDI(const uint8_t *tdi, uint8_t *tdo, uint32_t len, bool last) int FtdiJtagMPSSE::writeTDI(const uint8_t *tdi, uint8_t *tdo, uint32_t len, bool last)