commit 65a9720cdc71c73d3053eced4190dda2f135ba28
parent 4ca6d0abf71401c5e418442307ff71b3a2ae1a13
Author: Brian Swetland <swetland@frotz.net>
Date: Sun, 9 Aug 2015 16:43:47 -0700
debugger: protocol version to 1.1, support new SWO_DATA format
Diffstat:
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/include/protocol/rswdp.h b/include/protocol/rswdp.h
@@ -80,7 +80,20 @@
#define ERR_IO 3
#define ERR_PARITY 4
-#define RSWD_VERSION 0x0100
+#define RSWD_VERSION 0x0101
+
+#define RSWD_VERSION_1_0 0x0100
+#define RSWD_VERSION_1_1 0x0101
+
+// Pre-1.0
+// - max packet size fixed at 2048 bytes
+//
+// Version 1.0
+// - CMD_VERSION, CMD_BUILD_STR, CMD_BOARD_STR, CMD_RX_MAXDATA,
+// CMD_CLOCK_KHZ added
+//
+// Version 1.1
+// - CMD_SWO_DATA arg is now byte count, not word count
/* CMD_SWD_OP operations - combine for direct AP/DP io */
#define OP_RD 0x00
diff --git a/tools/rswdp.c b/tools/rswdp.c
@@ -115,12 +115,20 @@ static void process_async(u32 *data, unsigned count) {
break;
case CMD_SWO_DATA:
n = RSWD_MSG_ARG(msg);
- if (n > count)
+ if (swd_version < RSWD_VERSION_1_1) {
+ // arg is wordcount
+ tmp = n;
+ n *= 4;
+ } else {
+ // arg is bytecount
+ tmp = (n + 3) / 4;
+ }
+ if (tmp > count)
return;
- process_swo_data(data, n * 4);
- transmit_swo_data(data, n * 4);
- data += n;
- count -= n;
+ process_swo_data(data, n);
+ transmit_swo_data(data, n);
+ data += tmp;
+ count -= tmp;
default:
return;
}