remote: Refactored the handling for REMOTE_TDITDO_{NO,}TMS

This commit is contained in:
dragonmux 2022-08-14 12:05:23 +01:00 committed by Piotr Esden-Tempski
parent 800a2a8f12
commit 37a6a2a274
1 changed files with 5 additions and 7 deletions

View File

@ -171,9 +171,9 @@ static void remote_packet_process_swd(unsigned i, char *packet)
static void remote_packet_process_jtag(unsigned i, char *packet) static void remote_packet_process_jtag(unsigned i, char *packet)
{ {
uint32_t MS; uint32_t MS;
uint64_t DO; uint64_t DO = 0;
size_t ticks; size_t ticks;
uint64_t DI; uint64_t DI = 0;
jtag_dev_t jtag_dev; jtag_dev_t jtag_dev;
switch (packet[1]) { switch (packet[1]) {
case REMOTE_INIT: /* JS = initialise ============================= */ case REMOTE_INIT: /* JS = initialise ============================= */
@ -218,11 +218,9 @@ static void remote_packet_process_jtag(unsigned i, char *packet)
} else { } else {
ticks = remotehston(2, &packet[2]); ticks = remotehston(2, &packet[2]);
DI = remotehston(-1, &packet[4]); DI = remotehston(-1, &packet[4]);
jtag_proc.jtagtap_tdi_tdo_seq((void *)&DO, (packet[1] == REMOTE_TDITDO_TMS), (void *)&DI, ticks); const uint8_t *const data_in = (uint8_t *)&DI;
uint8_t *data_out = (uint8_t *)&DO;
/* Mask extra bits on return value... */ jtag_proc.jtagtap_tdi_tdo_seq(data_out, packet[1] == REMOTE_TDITDO_TMS, data_in, ticks);
if (ticks < 64)
DO &= (1LL << ticks) - 1;
remote_respond(REMOTE_RESP_OK, DO); remote_respond(REMOTE_RESP_OK, DO);
} }