From 08bb4d577562d7c478cb01f752417034a9ab2558 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Mon, 27 Apr 2020 20:03:50 +0200 Subject: [PATCH] pc-hosted: Make JTAG work. --- src/platforms/pc-hosted/jtagtap.c | 6 +++--- src/remote.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platforms/pc-hosted/jtagtap.c b/src/platforms/pc-hosted/jtagtap.c index cce1c71..86e068d 100644 --- a/src/platforms/pc-hosted/jtagtap.c +++ b/src/platforms/pc-hosted/jtagtap.c @@ -98,7 +98,7 @@ void jtagtap_tdi_tdo_seq(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI if(!ticks || !DI) return; /* Reduce the length of DI according to the bits we're transmitting */ - DIl&=(1L<<(ticks+1))-1; + DIl &= (1LL << (ticks + 1)) - 1; s=snprintf((char *)construct,PLATFORM_MAX_MSG_SIZE,REMOTE_JTAG_TDIDO_STR,final_tms?REMOTE_TDITDO_TMS:REMOTE_TDITDO_NOTMS,ticks,DIl); platform_buffer_write(construct,s); @@ -111,8 +111,8 @@ void jtagtap_tdi_tdo_seq(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI } if (DO) { - for (unsigned int i = 1; i*8 <= (unsigned int)ticks; i++) - DO[i - 1] = remotehston(2 , (char *)&construct[s - (i * 2)]); + uint64_t DOl = remotehston(-1, (char *)&construct[1]); + *(uint64_t *)DO = DOl; } } diff --git a/src/remote.c b/src/remote.c index d54f0e2..dc44ff7 100644 --- a/src/remote.c +++ b/src/remote.c @@ -61,7 +61,7 @@ static void _respond(char respCode, uint64_t param) /* Send response to far end */ { - char buf[34]; + char buf[35]; /*Response, code, EOM and 2*16 hex nibbles*/ char *p=buf; gdb_if_putchar(REMOTE_RESP,0); @@ -185,7 +185,7 @@ void remotePacketProcessJTAG(uint8_t i, char *packet) jtagtap_tdi_tdo_seq((void *)&DO, (packet[1]==REMOTE_TDITDO_TMS), (void *)&DI, ticks); /* Mask extra bits on return value... */ - DO&=(1<<(ticks+1))-1; + DO &= (1LL << (ticks + 1)) - 1; _respond(REMOTE_RESP_OK, DO); }