[app][mdebug] protocol version to 1.1, adjust SWO_DATA packet format
This commit is contained in:
@@ -34,8 +34,6 @@ unsigned swdp_trace = 0;
|
||||
// indicates host knows about v1.0 protocol features
|
||||
unsigned host_version = 0;
|
||||
|
||||
#define VERSION_1_0 0x0100
|
||||
|
||||
static u8 optable[16] = {
|
||||
[OP_RD | OP_DP | OP_X0] = RD_IDCODE,
|
||||
[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:
|
||||
n = swd_set_clock(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);
|
||||
}
|
||||
continue;
|
||||
@@ -153,7 +151,7 @@ void process_txn(u32 txnid, u32 *rx, int rxc, u32 *tx) {
|
||||
continue;
|
||||
case CMD_VERSION:
|
||||
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);
|
||||
memcpy(tx + txc + 1, board_str, n + 1);
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
/* valid: target to host */
|
||||
#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_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 */
|
||||
#define CMD_DEBUG_PRINT 0x20 /* arg*4 bytes of ascii debug output */
|
||||
@@ -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
|
||||
|
||||
@@ -92,7 +92,7 @@ void swo_init(udc_endpoint_t *_txept) {
|
||||
TXN[n].busy = 0;
|
||||
TXN[n].next = TXN + (n + 1);
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user