annotate rvinterf/tmsh/tmcore.c @ 626:d1df7544f102

L1: reverting malicious LoCosto change that disables all useful L1 traces
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 31 Aug 2014 05:04:56 +0000
parents c146f38d2b5f
children
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>
260
c146f38d2b5f rvinterf subdir structure made a little more sensible
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 256
diff changeset
11 #include "pktmux.h"
c146f38d2b5f rvinterf subdir structure made a little more sensible
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 256
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:
198
c9ea2f7441a5 fc-tmsh: abb[rw] commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 192
diff changeset
183 abbr_response();
c9ea2f7441a5 fc-tmsh: abb[rw] commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 192
diff changeset
184 return;
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 case TMCORE_OPC_CODEC_WR:
198
c9ea2f7441a5 fc-tmsh: abb[rw] commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 192
diff changeset
186 abbw_response();
c9ea2f7441a5 fc-tmsh: abb[rw] commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 192
diff changeset
187 return;
188
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 case TMCORE_OPC_DIEID:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 dieid_response();
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 return;
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 default:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 unknown:
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 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
194 }
9f4f331ac24d fc-tmsh: implemented handling of ETM_CORE responses
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 }
189
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
196
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
197 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
198 cmd_r8(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
199 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
200 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
201 u32 addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
202 int count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
203 u_char cmdpkt[10];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
204
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
205 addr = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
206 if (argv[2])
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
207 count = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
208 else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
209 count = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
210 if (count < 1 || count > 253) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
211 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
212 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
213 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
214 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
215 cmdpkt[2] = TMCORE_OPC_MEM;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
216 cmdpkt[3] = 0x01;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
217 cmdpkt[4] = count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
218 cmdpkt[5] = addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
219 cmdpkt[6] = addr >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
220 cmdpkt[7] = addr >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
221 cmdpkt[8] = addr >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
222 send_etm_cmd(cmdpkt, 8);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
223 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
224
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
225 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
226 cmd_r16(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
227 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
228 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
229 u32 addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
230 int count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
231 u_char cmdpkt[10];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
232
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
233 addr = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
234 if (argv[2])
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
235 count = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
236 else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
237 count = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
238 if (addr & 1) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
239 printf("error: address not aligned\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
240 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
241 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
242 if (count < 1 || count > 126) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
243 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
244 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
245 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
246 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
247 cmdpkt[2] = TMCORE_OPC_MEM;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
248 cmdpkt[3] = 0x02;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
249 cmdpkt[4] = count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
250 cmdpkt[5] = addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
251 cmdpkt[6] = addr >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
252 cmdpkt[7] = addr >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
253 cmdpkt[8] = addr >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
254 send_etm_cmd(cmdpkt, 8);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
255 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
256
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
257 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
258 cmd_r32(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
259 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
260 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
261 u32 addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
262 int count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
263 u_char cmdpkt[10];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
264
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
265 addr = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
266 if (argv[2])
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
267 count = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
268 else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
269 count = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
270 if (addr & 3) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
271 printf("error: address not aligned\n");
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
272 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
273 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
274 if (count < 1 || count > 63) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
275 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
276 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
277 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
278 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
279 cmdpkt[2] = TMCORE_OPC_MEM;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
280 cmdpkt[3] = 0x04;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
281 cmdpkt[4] = count;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
282 cmdpkt[5] = addr;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
283 cmdpkt[6] = addr >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
284 cmdpkt[7] = addr >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
285 cmdpkt[8] = addr >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
286 send_etm_cmd(cmdpkt, 8);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
287 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
288
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
289 void
192
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
290 cmd_w8(argc, argv)
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
291 char **argv;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
292 {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
293 u32 addr, v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
294 u_char cmdpkt[MAX_PKT_TO_TARGET];
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
295 int di;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
296 char **ap;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
297
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
298 addr = strtoul(argv[1], 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
299 cmdpkt[1] = ETM_CORE;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
300 cmdpkt[2] = TMCORE_OPC_MEM;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
301 cmdpkt[3] = 0x11;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
302 cmdpkt[4] = argc - 2;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
303 cmdpkt[5] = addr;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
304 cmdpkt[6] = addr >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
305 cmdpkt[7] = addr >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
306 cmdpkt[8] = addr >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
307 di = 9;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
308 for (ap = argv + 2; *ap; ap++) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
309 v = strtoul(*ap, 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
310 cmdpkt[di++] = v;
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 send_etm_cmd(cmdpkt, di - 1);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
313 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
314
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
315 void
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
316 cmd_w16(argc, argv)
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
317 char **argv;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
318 {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
319 u32 addr, v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
320 u_char cmdpkt[MAX_PKT_TO_TARGET];
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
321 int di;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
322 char **ap;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
323
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
324 addr = strtoul(argv[1], 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
325 if (addr & 1) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
326 printf("error: address not aligned\n");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
327 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
328 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
329 cmdpkt[1] = ETM_CORE;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
330 cmdpkt[2] = TMCORE_OPC_MEM;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
331 cmdpkt[3] = 0x12;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
332 cmdpkt[4] = argc - 2;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
333 cmdpkt[5] = addr;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
334 cmdpkt[6] = addr >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
335 cmdpkt[7] = addr >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
336 cmdpkt[8] = addr >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
337 di = 9;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
338 for (ap = argv + 2; *ap; ap++) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
339 v = strtoul(*ap, 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
340 cmdpkt[di++] = v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
341 cmdpkt[di++] = v >> 8;
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 send_etm_cmd(cmdpkt, di - 1);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
344 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
345
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
346 void
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
347 cmd_w32(argc, argv)
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
348 char **argv;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
349 {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
350 u32 addr, v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
351 u_char cmdpkt[MAX_PKT_TO_TARGET];
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
352 int di;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
353 char **ap;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
354
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
355 addr = strtoul(argv[1], 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
356 if (addr & 3) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
357 printf("error: address not aligned\n");
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
358 return;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
359 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
360 cmdpkt[1] = ETM_CORE;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
361 cmdpkt[2] = TMCORE_OPC_MEM;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
362 cmdpkt[3] = 0x14;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
363 cmdpkt[4] = argc - 2;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
364 cmdpkt[5] = addr;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
365 cmdpkt[6] = addr >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
366 cmdpkt[7] = addr >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
367 cmdpkt[8] = addr >> 24;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
368 di = 9;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
369 for (ap = argv + 2; *ap; ap++) {
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
370 v = strtoul(*ap, 0, 16);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
371 cmdpkt[di++] = v;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
372 cmdpkt[di++] = v >> 8;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
373 cmdpkt[di++] = v >> 16;
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
374 cmdpkt[di++] = v >> 24;
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 send_etm_cmd(cmdpkt, di - 1);
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
377 }
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
378
707aa640b2dc fc-tmsh: w8/w16/w32 implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 190
diff changeset
379 void
189
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
380 cmd_dieid(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
381 char **argv;
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 u_char cmdpkt[4];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
384
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
385 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
386 cmdpkt[2] = TMCORE_OPC_DIEID;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
387 send_etm_cmd(cmdpkt, 2);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
388 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
389
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
390 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
391 cmd_ping(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
392 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
393 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
394 int delay, size;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
395 u_char cmdpkt[8];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
396
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
397 if (argc > 1) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
398 delay = strtoul(argv[1], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
399 if (delay > 65535) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
400 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
401 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
402 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
403 } else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
404 delay = 0;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
405 if (argc > 2) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
406 size = strtoul(argv[2], 0, 0);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
407 if (size > 240) {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
408 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
409 return;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
410 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
411 } else
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
412 size = 1;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
413 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
414 cmdpkt[2] = TMCORE_OPC_ECHO;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
415 cmdpkt[3] = delay;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
416 cmdpkt[4] = delay >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
417 cmdpkt[5] = size;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
418 cmdpkt[6] = size >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
419 send_etm_cmd(cmdpkt, 6);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
420 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
421
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
422 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
423 cmd_tgtreset(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
424 char **argv;
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 u_char cmdpkt[4];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
427
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
428 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
429 cmdpkt[2] = TMCORE_OPC_RESET;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
430 send_etm_cmd(cmdpkt, 2);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
431 }
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
432
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
433 void
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
434 cmd_version(argc, argv)
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
435 char **argv;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
436 {
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
437 u32 arg;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
438 u_char cmdpkt[8];
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
439
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
440 arg = strtoul(argv[1], 0, 16);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
441 cmdpkt[1] = ETM_CORE;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
442 cmdpkt[2] = TMCORE_OPC_VERSION;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
443 cmdpkt[3] = arg;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
444 cmdpkt[4] = arg >> 8;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
445 cmdpkt[5] = arg >> 16;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
446 cmdpkt[6] = arg >> 24;
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
447 send_etm_cmd(cmdpkt, 6);
a95d253ef952 fc-tmsh: some basic tmcore commands implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 188
diff changeset
448 }