FreeCalypso > hg > freecalypso-sw
diff rvinterf/etm/tmcore.c @ 192:707aa640b2dc
fc-tmsh: w8/w16/w32 implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 25 Nov 2013 05:37:46 +0000 |
parents | 405f5b46cdc4 |
children | c9ea2f7441a5 |
line wrap: on
line diff
--- a/rvinterf/etm/tmcore.c Mon Nov 25 04:41:36 2013 +0000 +++ b/rvinterf/etm/tmcore.c Mon Nov 25 05:37:46 2013 +0000 @@ -17,16 +17,20 @@ extern int rvi_msg_len; static void -r8_response() +rw8_response() { char buf[MAX_PKT_FROM_TARGET*3+80], *dp; int num, i; if (rvi_msg[3]) { - print_etm_pkt_raw("r8 error"); + print_etm_pkt_raw("rw8 error"); return; } num = rvi_msg_len - 7; + if (!num) { + async_msg_output("w8 OK"); + return; + } strcpy(buf, "r8:"); dp = buf + 3; for (i = 0; i < num; i++) { @@ -37,18 +41,22 @@ } static void -r16_response() +rw16_response() { char buf[MAX_PKT_FROM_TARGET*3+80], *dp; int num, i, d, off; if (rvi_msg[3]) { - print_etm_pkt_raw("r16 error"); + print_etm_pkt_raw("rw16 error"); return; } num = rvi_msg_len - 7; + if (!num) { + async_msg_output("w16 OK"); + return; + } if (num & 1) { - print_etm_pkt_raw("r16 malformed resp"); + print_etm_pkt_raw("rw16 malformed resp"); return; } num >>= 1; @@ -65,18 +73,22 @@ } static void -r32_response() +rw32_response() { char buf[MAX_PKT_FROM_TARGET*3+80], *dp; int num, i, d, off; if (rvi_msg[3]) { - print_etm_pkt_raw("r32 error"); + print_etm_pkt_raw("rw32 error"); return; } num = rvi_msg_len - 7; + if (!num) { + async_msg_output("w32 OK"); + return; + } if (num & 3) { - print_etm_pkt_raw("r32 malformed resp"); + print_etm_pkt_raw("rw32 malformed resp"); return; } num >>= 2; @@ -150,13 +162,13 @@ switch (rvi_msg[5]) { case 0x00: case 0x04: - r32_response(); + rw32_response(); return; case 0x01: - r8_response(); + rw8_response(); return; case 0x02: - r16_response(); + rw16_response(); return; default: goto unknown; @@ -273,6 +285,96 @@ } void +cmd_w8(argc, argv) + char **argv; +{ + u32 addr, v; + u_char cmdpkt[MAX_PKT_TO_TARGET]; + int di; + char **ap; + + addr = strtoul(argv[1], 0, 16); + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_MEM; + cmdpkt[3] = 0x11; + cmdpkt[4] = argc - 2; + cmdpkt[5] = addr; + cmdpkt[6] = addr >> 8; + cmdpkt[7] = addr >> 16; + cmdpkt[8] = addr >> 24; + di = 9; + for (ap = argv + 2; *ap; ap++) { + v = strtoul(*ap, 0, 16); + cmdpkt[di++] = v; + } + send_etm_cmd(cmdpkt, di - 1); +} + +void +cmd_w16(argc, argv) + char **argv; +{ + u32 addr, v; + u_char cmdpkt[MAX_PKT_TO_TARGET]; + int di; + char **ap; + + addr = strtoul(argv[1], 0, 16); + if (addr & 1) { + printf("error: address not aligned\n"); + return; + } + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_MEM; + cmdpkt[3] = 0x12; + cmdpkt[4] = argc - 2; + cmdpkt[5] = addr; + cmdpkt[6] = addr >> 8; + cmdpkt[7] = addr >> 16; + cmdpkt[8] = addr >> 24; + di = 9; + for (ap = argv + 2; *ap; ap++) { + v = strtoul(*ap, 0, 16); + cmdpkt[di++] = v; + cmdpkt[di++] = v >> 8; + } + send_etm_cmd(cmdpkt, di - 1); +} + +void +cmd_w32(argc, argv) + char **argv; +{ + u32 addr, v; + u_char cmdpkt[MAX_PKT_TO_TARGET]; + int di; + char **ap; + + addr = strtoul(argv[1], 0, 16); + if (addr & 3) { + printf("error: address not aligned\n"); + return; + } + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_MEM; + cmdpkt[3] = 0x14; + cmdpkt[4] = argc - 2; + cmdpkt[5] = addr; + cmdpkt[6] = addr >> 8; + cmdpkt[7] = addr >> 16; + cmdpkt[8] = addr >> 24; + di = 9; + for (ap = argv + 2; *ap; ap++) { + v = strtoul(*ap, 0, 16); + cmdpkt[di++] = v; + cmdpkt[di++] = v >> 8; + cmdpkt[di++] = v >> 16; + cmdpkt[di++] = v >> 24; + } + send_etm_cmd(cmdpkt, di - 1); +} + +void cmd_dieid(argc, argv) char **argv; {