hosted/dap: Partial revert of 5c8e277, taking into account that division may not be available on platforms 'hosted' might see itself built

This commit is contained in:
dragonmux 2022-01-21 21:31:59 -05:00 committed by Piotr Esden-Tempski
parent d1c9d94174
commit 54f577a970
1 changed files with 4 additions and 4 deletions

View File

@ -721,9 +721,9 @@ void dap_jtagtap_tdi_tdo_seq(uint8_t *DO, bool final_tms, const uint8_t *TMS,
*p++ = transfers; *p++ = transfers;
for (int i = 0; i < transfers; i++) { for (int i = 0; i < transfers; i++) {
*p++ = 1 | ((DO) ? DAP_JTAG_TDO_CAPTURE : 0) | *p++ = 1 | ((DO) ? DAP_JTAG_TDO_CAPTURE : 0) |
((TMS[i / 8] & (1 << (i & 7))) ? DAP_JTAG_TMS : 0); ((TMS[i >> 3] & (1 << (i & 7))) ? DAP_JTAG_TMS : 0);
if (DI) if (DI)
*p++ = (DI[i / 8] & (1 << (i & 7))) ? 1 : 0; *p++ = (DI[i >> 3] & (1 << (i & 7))) ? 1 : 0;
else else
*p++ = 1; *p++ = 1;
} }
@ -733,9 +733,9 @@ void dap_jtagtap_tdi_tdo_seq(uint8_t *DO, bool final_tms, const uint8_t *TMS,
if (DO) { if (DO) {
for (int i = 0; i < transfers; i++) { for (int i = 0; i < transfers; i++) {
if (buf[i + 1]) if (buf[i + 1])
DO[i / 8] |= (1 << (i & 7)); DO[i >> 3] |= (1 << (i & 7));
else else
DO[i / 8] &= ~(1 << (i & 7)); DO[i >> 3] &= ~(1 << (i & 7));
} }
} }
ticks -= transfers; ticks -= transfers;