annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * In this module we are going to implement commands which send requests
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * to ETM_CORE and the handling of responses from that target module.
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <sys/types.h>
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdio.h>
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <strings.h>
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <stdlib.h>
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "../pktmux.h"
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include "../limits.h"
189
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
13 #include "localtypes.h"
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "etm.h"
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 extern u_char rvi_msg[];
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 extern int rvi_msg_len;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 static void
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
20 rw8_response()
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 char buf[MAX_PKT_FROM_TARGET*3+80], *dp;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 int num, i;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 if (rvi_msg[3]) {
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
26 print_etm_pkt_raw("rw8 error");
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 num = rvi_msg_len - 7;
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
30 if (!num) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
31 async_msg_output("w8 OK");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
32 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
33 }
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 strcpy(buf, "r8:");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 dp = buf + 3;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 for (i = 0; i < num; i++) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 sprintf(dp, " %02X", rvi_msg[i+6]);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 dp += 3;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 async_msg_output(buf);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 static void
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
44 rw16_response()
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 char buf[MAX_PKT_FROM_TARGET*3+80], *dp;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 int num, i, d, off;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 if (rvi_msg[3]) {
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
50 print_etm_pkt_raw("rw16 error");
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 num = rvi_msg_len - 7;
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
54 if (!num) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
55 async_msg_output("w16 OK");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
56 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
57 }
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 if (num & 1) {
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
59 print_etm_pkt_raw("rw16 malformed resp");
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 num >>= 1;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 strcpy(buf, "r16:");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 dp = buf + 4;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 off = 6;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 for (i = 0; i < num; i++) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 d = rvi_msg[off] | rvi_msg[off+1] << 8;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 off += 2;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 sprintf(dp, " %04X", d);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 dp += 5;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 async_msg_output(buf);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 static void
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
76 rw32_response()
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 char buf[MAX_PKT_FROM_TARGET*3+80], *dp;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 int num, i, d, off;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 if (rvi_msg[3]) {
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
82 print_etm_pkt_raw("rw32 error");
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 num = rvi_msg_len - 7;
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
86 if (!num) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
87 async_msg_output("w32 OK");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
88 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
89 }
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 if (num & 3) {
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
91 print_etm_pkt_raw("rw32 malformed resp");
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 num >>= 2;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 strcpy(buf, "r32:");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 dp = buf + 4;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 off = 6;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 for (i = 0; i < num; i++) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 d = rvi_msg[off] | rvi_msg[off+1] << 8 | rvi_msg[off+2] << 16
190
405f5b46cdc4 fc-tmsh: some buglets fixed
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 189
diff changeset
100 | rvi_msg[off+3] << 24;
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 off += 4;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 sprintf(dp, " %08X", d);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 dp += 9;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 async_msg_output(buf);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 static void
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 dieid_response()
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 char buf[MAX_PKT_FROM_TARGET*3+80], *dp;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 int num, i;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 if (rvi_msg[3]) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 print_etm_pkt_raw("dieid error");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 num = rvi_msg_len - 6;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 strcpy(buf, "dieid resp:");
190
405f5b46cdc4 fc-tmsh: some buglets fixed
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 189
diff changeset
120 dp = buf + 11;
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 for (i = 0; i < num; i++) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 sprintf(dp, " %02X", rvi_msg[i+5]);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 dp += 3;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 async_msg_output(buf);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 static void
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 echo_response()
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 if (rvi_msg[3])
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 print_etm_pkt_raw("echo error");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 else
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 print_etm_pkt_raw("echo resp");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 static void
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 version_response()
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140 char buf[80];
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 if (rvi_msg[3]) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 print_etm_pkt_raw("version error");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 if (rvi_msg_len != 10) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 print_etm_pkt_raw("version malformed resp");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 sprintf(buf, "version resp: %02X%02X%02X%02X", rvi_msg[8], rvi_msg[7],
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 rvi_msg[6], rvi_msg[5]);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 async_msg_output(buf);
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 void
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 tmcore_msg_rx()
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 switch (rvi_msg[4]) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 case TMCORE_OPC_MEM:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 if (rvi_msg_len < 7)
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 goto unknown;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 switch (rvi_msg[5]) {
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 case 0x00:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 case 0x04:
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
165 rw32_response();
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 case 0x01:
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
168 rw8_response();
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 case 0x02:
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
171 rw16_response();
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 default:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 goto unknown;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 case TMCORE_OPC_ECHO:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 echo_response();
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 case TMCORE_OPC_VERSION:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 version_response();
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 case TMCORE_OPC_CODEC_RD:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 case TMCORE_OPC_CODEC_WR:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 /* not yet implemented */
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 goto unknown;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 case TMCORE_OPC_DIEID:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 dieid_response();
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 default:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 unknown:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 print_etm_pkt_raw("ETM_CORE resp");
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 }
189
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
194
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
195 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
196 cmd_r8(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
197 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
198 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
199 u32 addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
200 int count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
201 u_char cmdpkt[10];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
202
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
203 addr = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
204 if (argv[2])
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
205 count = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
206 else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
207 count = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
208 if (count < 1 || count > 253) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
209 printf("error: count argument outside valid range\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
210 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
211 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
212 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
213 cmdpkt[2] = TMCORE_OPC_MEM;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
214 cmdpkt[3] = 0x01;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
215 cmdpkt[4] = count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
216 cmdpkt[5] = addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
217 cmdpkt[6] = addr >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
218 cmdpkt[7] = addr >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
219 cmdpkt[8] = addr >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
220 send_etm_cmd(cmdpkt, 8);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
221 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
222
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
223 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
224 cmd_r16(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
225 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
226 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
227 u32 addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
228 int count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
229 u_char cmdpkt[10];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
230
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
231 addr = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
232 if (argv[2])
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
233 count = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
234 else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
235 count = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
236 if (addr & 1) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
237 printf("error: address not aligned\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
238 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
239 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
240 if (count < 1 || count > 126) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
241 printf("error: count argument outside valid range\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
242 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
243 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
244 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
245 cmdpkt[2] = TMCORE_OPC_MEM;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
246 cmdpkt[3] = 0x02;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
247 cmdpkt[4] = count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
248 cmdpkt[5] = addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
249 cmdpkt[6] = addr >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
250 cmdpkt[7] = addr >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
251 cmdpkt[8] = addr >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
252 send_etm_cmd(cmdpkt, 8);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
253 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
254
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
255 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
256 cmd_r32(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
257 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
258 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
259 u32 addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
260 int count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
261 u_char cmdpkt[10];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
262
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
263 addr = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
264 if (argv[2])
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
265 count = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
266 else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
267 count = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
268 if (addr & 3) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
269 printf("error: address not aligned\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
270 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
271 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
272 if (count < 1 || count > 63) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
273 printf("error: count argument outside valid range\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
274 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
275 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
276 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
277 cmdpkt[2] = TMCORE_OPC_MEM;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
278 cmdpkt[3] = 0x04;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
279 cmdpkt[4] = count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
280 cmdpkt[5] = addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
281 cmdpkt[6] = addr >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
282 cmdpkt[7] = addr >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
283 cmdpkt[8] = addr >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
284 send_etm_cmd(cmdpkt, 8);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
285 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
286
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
287 void
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
288 cmd_w8(argc, argv)
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
289 char **argv;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
290 {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
291 u32 addr, v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
292 u_char cmdpkt[MAX_PKT_TO_TARGET];
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
293 int di;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
294 char **ap;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
295
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
296 addr = strtoul(argv[1], 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
297 cmdpkt[1] = ETM_CORE;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
298 cmdpkt[2] = TMCORE_OPC_MEM;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
299 cmdpkt[3] = 0x11;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
300 cmdpkt[4] = argc - 2;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
301 cmdpkt[5] = addr;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
302 cmdpkt[6] = addr >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
303 cmdpkt[7] = addr >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
304 cmdpkt[8] = addr >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
305 di = 9;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
306 for (ap = argv + 2; *ap; ap++) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
307 v = strtoul(*ap, 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
308 cmdpkt[di++] = v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
309 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
310 send_etm_cmd(cmdpkt, di - 1);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
311 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
312
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
313 void
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
314 cmd_w16(argc, argv)
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
315 char **argv;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
316 {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
317 u32 addr, v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
318 u_char cmdpkt[MAX_PKT_TO_TARGET];
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
319 int di;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
320 char **ap;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
321
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
322 addr = strtoul(argv[1], 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
323 if (addr & 1) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
324 printf("error: address not aligned\n");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
325 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
326 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
327 cmdpkt[1] = ETM_CORE;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
328 cmdpkt[2] = TMCORE_OPC_MEM;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
329 cmdpkt[3] = 0x12;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
330 cmdpkt[4] = argc - 2;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
331 cmdpkt[5] = addr;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
332 cmdpkt[6] = addr >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
333 cmdpkt[7] = addr >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
334 cmdpkt[8] = addr >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
335 di = 9;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
336 for (ap = argv + 2; *ap; ap++) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
337 v = strtoul(*ap, 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
338 cmdpkt[di++] = v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
339 cmdpkt[di++] = v >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
340 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
341 send_etm_cmd(cmdpkt, di - 1);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
342 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
343
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
344 void
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
345 cmd_w32(argc, argv)
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
346 char **argv;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
347 {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
348 u32 addr, v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
349 u_char cmdpkt[MAX_PKT_TO_TARGET];
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
350 int di;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
351 char **ap;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
352
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
353 addr = strtoul(argv[1], 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
354 if (addr & 3) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
355 printf("error: address not aligned\n");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
356 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
357 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
358 cmdpkt[1] = ETM_CORE;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
359 cmdpkt[2] = TMCORE_OPC_MEM;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
360 cmdpkt[3] = 0x14;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
361 cmdpkt[4] = argc - 2;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
362 cmdpkt[5] = addr;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
363 cmdpkt[6] = addr >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
364 cmdpkt[7] = addr >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
365 cmdpkt[8] = addr >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
366 di = 9;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
367 for (ap = argv + 2; *ap; ap++) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
368 v = strtoul(*ap, 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
369 cmdpkt[di++] = v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
370 cmdpkt[di++] = v >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
371 cmdpkt[di++] = v >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
372 cmdpkt[di++] = v >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
373 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
374 send_etm_cmd(cmdpkt, di - 1);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
375 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
376
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
377 void
189
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
378 cmd_dieid(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
379 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
380 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
381 u_char cmdpkt[4];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
382
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
383 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
384 cmdpkt[2] = TMCORE_OPC_DIEID;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
385 send_etm_cmd(cmdpkt, 2);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
386 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
387
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
388 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
389 cmd_ping(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
390 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
391 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
392 int delay, size;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
393 u_char cmdpkt[8];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
394
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
395 if (argc > 1) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
396 delay = strtoul(argv[1], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
397 if (delay > 65535) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
398 printf("error: ping delay argument too big\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
399 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
400 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
401 } else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
402 delay = 0;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
403 if (argc > 2) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
404 size = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
405 if (size > 240) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
406 printf("error: ping size argument too big\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
407 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
408 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
409 } else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
410 size = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
411 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
412 cmdpkt[2] = TMCORE_OPC_ECHO;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
413 cmdpkt[3] = delay;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
414 cmdpkt[4] = delay >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
415 cmdpkt[5] = size;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
416 cmdpkt[6] = size >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
417 send_etm_cmd(cmdpkt, 6);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
418 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
419
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
420 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
421 cmd_tgtreset(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
422 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
423 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
424 u_char cmdpkt[4];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
425
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
426 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
427 cmdpkt[2] = TMCORE_OPC_RESET;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
428 send_etm_cmd(cmdpkt, 2);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
429 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
430
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
431 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
432 cmd_version(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
433 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
434 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
435 u32 arg;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
436 u_char cmdpkt[8];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
437
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
438 arg = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
439 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
440 cmdpkt[2] = TMCORE_OPC_VERSION;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
441 cmdpkt[3] = arg;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
442 cmdpkt[4] = arg >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
443 cmdpkt[5] = arg >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
444 cmdpkt[6] = arg >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
445 send_etm_cmd(cmdpkt, 6);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
446 }