Skip to content

Commit

Permalink
remote: Refactored the handling for REMOTE_TDITDO_{NO,}TMS
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmux committed Aug 14, 2022
1 parent e46412d commit 42bf625
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ static void remote_packet_process_swd(unsigned i, char *packet)
static void remote_packet_process_jtag(unsigned i, char *packet)
{
uint32_t MS;
uint64_t DO;
uint64_t DO = 0;
size_t ticks;
uint64_t DI;
uint64_t DI = 0;
jtag_dev_t jtag_dev;
switch (packet[1]) {
case REMOTE_INIT: /* JS = initialise ============================= */
Expand Down Expand Up @@ -218,11 +218,9 @@ static void remote_packet_process_jtag(unsigned i, char *packet)
} else {
ticks = remotehston(2, &packet[2]);
DI = remotehston(-1, &packet[4]);
jtag_proc.jtagtap_tdi_tdo_seq((void *)&DO, (packet[1] == REMOTE_TDITDO_TMS), (void *)&DI, ticks);

/* Mask extra bits on return value... */
if (ticks < 64)
DO &= (1LL << ticks) - 1;
const uint8_t *const data_in = (uint8_t *)&DI;
uint8_t *data_out = (uint8_t *)&DO;
jtag_proc.jtagtap_tdi_tdo_seq(data_out, packet[1] == REMOTE_TDITDO_TMS, data_in, ticks);

remote_respond(REMOTE_RESP_OK, DO);
}
Expand Down

0 comments on commit 42bf625

Please sign in to comment.