diff --git a/src/remote.c b/src/remote.c index ebaf2e9..3a80cbe 100644 --- a/src/remote.c +++ b/src/remote.c @@ -184,7 +184,7 @@ static void remotePacketProcessJTAG(unsigned i, char *packet) { uint32_t MS; uint64_t DO; - uint8_t ticks; + size_t ticks; uint64_t DI; jtag_dev_t jtag_dev; switch (packet[1]) { @@ -213,8 +213,17 @@ static void remotePacketProcessJTAG(unsigned i, char *packet) } break; - case REMOTE_TDITDO_TMS: /* JD = TDI/TDO ========================================= */ - case REMOTE_TDITDO_NOTMS: + case REMOTE_CYCLE: { /* JC = clock cycle ============================ */ + ticks = remotehston(8, &packet[4]); + const bool tms = packet[2] != '0'; + const bool tdi = packet[3] != '0'; + jtag_proc.jtagtap_cycle(tms, tdi, ticks); + remote_respond(REMOTE_RESP_OK, 0); + break; + } + + case REMOTE_TDITDO_TMS: /* JD = TDI/TDO ========================================= */ + case REMOTE_TDITDO_NOTMS: if (i<5) { remote_respond(REMOTE_RESP_ERR,REMOTE_ERROR_WRONGLEN); @@ -235,8 +244,8 @@ static void remotePacketProcessJTAG(unsigned i, char *packet) if (i != 4) remote_respond(REMOTE_RESP_ERR, REMOTE_ERROR_WRONGLEN); else { - uint32_t dat = jtag_proc.jtagtap_next(packet[2] == '1', packet[3] == '1'); - remote_respond(REMOTE_RESP_OK, dat); + const bool tdo = jtag_proc.jtagtap_next(packet[2] == '1', packet[3] == '1'); + remote_respond(REMOTE_RESP_OK, tdo ? 1U : 0U); } break; diff --git a/src/remote.h b/src/remote.h index e1d9a54..26c4906 100644 --- a/src/remote.h +++ b/src/remote.h @@ -24,7 +24,7 @@ #include #include "general.h" -#define REMOTE_HL_VERSION 1 +#define REMOTE_HL_VERSION 2 /* * Commands to remote end, and responses @@ -65,6 +65,7 @@ #define REMOTE_START 'A' #define REMOTE_TDITDO_TMS 'D' #define REMOTE_TDITDO_NOTMS 'd' +#define REMOTE_CYCLE 'c' #define REMOTE_IN_PAR 'I' #define REMOTE_FREQ_SET 'F' #define REMOTE_FREQ_GET 'f' @@ -142,6 +143,9 @@ #define REMOTE_JTAG_TDIDO_STR (char []){ REMOTE_SOM, REMOTE_JTAG_PACKET, '%', 'c', \ '%','0','2','x','%','l', 'x', REMOTE_EOM, 0 } +#define REMOTE_JTAG_CYCLE_STR (char []){ REMOTE_SOM, REMOTE_JTAG_PACKET, REMOTE_CYCLE, '%', 'u', '%', 'u', \ + '%', '0', '8', 'x', REMOTE_EOM, 0 } + #define REMOTE_JTAG_NEXT (char []){ REMOTE_SOM, REMOTE_JTAG_PACKET, REMOTE_NEXT, \ '%','c','%','c',REMOTE_EOM, 0 } /* HL protocol elements */