[app][mdebug] protocol version to 1.1, adjust SWO_DATA packet format

This commit is contained in:
Brian Swetland
2015-08-09 16:43:12 -07:00
parent bd6a163d85
commit 8bf440f6bc
3 changed files with 18 additions and 7 deletions

View File

@@ -34,8 +34,6 @@ unsigned swdp_trace = 0;
// indicates host knows about v1.0 protocol features // indicates host knows about v1.0 protocol features
unsigned host_version = 0; unsigned host_version = 0;
#define VERSION_1_0 0x0100
static u8 optable[16] = { static u8 optable[16] = {
[OP_RD | OP_DP | OP_X0] = RD_IDCODE, [OP_RD | OP_DP | OP_X0] = RD_IDCODE,
[OP_RD | OP_DP | OP_X4] = RD_DPCTRL, [OP_RD | OP_DP | OP_X4] = RD_DPCTRL,
@@ -143,7 +141,7 @@ void process_txn(u32 txnid, u32 *rx, int rxc, u32 *tx) {
case CMD_SET_CLOCK: case CMD_SET_CLOCK:
n = swd_set_clock(n); n = swd_set_clock(n);
printf("swdp clock is now %d KHz\n", n); printf("swdp clock is now %d KHz\n", n);
if (host_version >= VERSION_1_0) { if (host_version >= RSWD_VERSION_1_0) {
tx[txc++] = RSWD_MSG(CMD_CLOCK_KHZ, 0, n); tx[txc++] = RSWD_MSG(CMD_CLOCK_KHZ, 0, n);
} }
continue; continue;
@@ -153,7 +151,7 @@ void process_txn(u32 txnid, u32 *rx, int rxc, u32 *tx) {
continue; continue;
case CMD_VERSION: case CMD_VERSION:
host_version = n; host_version = n;
tx[txc++] = RSWD_MSG(CMD_VERSION, 0, VERSION_1_0); tx[txc++] = RSWD_MSG(CMD_VERSION, 0, RSWD_VERSION);
n = strlen(board_str); n = strlen(board_str);
memcpy(tx + txc + 1, board_str, n + 1); memcpy(tx + txc + 1, board_str, n + 1);

View File

@@ -61,7 +61,7 @@
/* valid: target to host */ /* valid: target to host */
#define CMD_STATUS 0x10 /* op=errorcode, arg=commands since last TXN_START */ #define CMD_STATUS 0x10 /* op=errorcode, arg=commands since last TXN_START */
#define CMD_SWD_DATA 0x11 /* op=0 arg=count, payload: data x count */ #define CMD_SWD_DATA 0x11 /* op=0 arg=count, payload: data x count */
#define CMD_SWO_DATA 0x12 /* op=0 arg=count, payload: count * 4 bytes */ #define CMD_SWO_DATA 0x12 /* op=0 arg=bytecount, payload: ((arg + 3) / 4) words*/
/* valid: target to host async */ /* valid: target to host async */
#define CMD_DEBUG_PRINT 0x20 /* arg*4 bytes of ascii debug output */ #define CMD_DEBUG_PRINT 0x20 /* arg*4 bytes of ascii debug output */
@@ -80,7 +80,20 @@
#define ERR_IO 3 #define ERR_IO 3
#define ERR_PARITY 4 #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 */ /* CMD_SWD_OP operations - combine for direct AP/DP io */
#define OP_RD 0x00 #define OP_RD 0x00

View File

@@ -92,7 +92,7 @@ void swo_init(udc_endpoint_t *_txept) {
TXN[n].busy = 0; TXN[n].busy = 0;
TXN[n].next = TXN + (n + 1); TXN[n].next = TXN + (n + 1);
TXN[n].buf[0] = RSWD_TXN_ASYNC; TXN[n].buf[0] = RSWD_TXN_ASYNC;
TXN[n].buf[1] = RSWD_MSG(CMD_SWO_DATA, 0, TXNSIZE / 4); TXN[n].buf[1] = RSWD_MSG(CMD_SWO_DATA, 0, TXNSIZE);
} }
TXN[n-1].next = TXN; TXN[n-1].next = TXN;