FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/etmbasic.c @ 134:4c78649101f1
fc-tmsh: l1tm stats response display
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 Feb 2017 01:30:10 +0000 |
parents | 4aa1c18c7a2f |
children | 40807eb35ffe |
rev | line source |
---|---|
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Basic ETM interaction |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "pktmux.h" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "limits.h" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "etm.h" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "tm3.h" |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
68
diff
changeset
|
14 #include "exitcodes.h" |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern u_char rvi_msg[]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 extern int rvi_msg_len; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 print_etm_pkt_raw(err) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 char *err; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 char buf[MAX_PKT_FROM_TARGET*3+80], *dp; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 int i; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 sprintf(buf, "%s:", err); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 dp = index(buf, '\0'); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 for (i = 2; i < rvi_msg_len; i++) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 sprintf(dp, " %02X", rvi_msg[i]); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 dp += 3; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 async_msg_output(buf); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 etm_packet_rx() |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 int i, c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 if (rvi_msg_len < 4) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 runt: print_etm_pkt_raw("TM runt"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 c = 0; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 for (i = 2; i < rvi_msg_len; i++) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 c ^= rvi_msg[i]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 if (c) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 print_etm_pkt_raw("BAD CKSUM"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 switch (rvi_msg[2]) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 case ETM_CORE: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 if (rvi_msg_len < 6) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 goto runt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 tmcore_msg_rx(); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 case ETM_FFS1: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 print_etm_pkt_raw("FFS1"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 case ETM_FFS2: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 if (rvi_msg_len < 5) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 goto runt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 handle_ffs2_response(); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 /* TM3 */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 case MEM_READ: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 if (rvi_msg_len < 5) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 goto runt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 handle_omr_response(); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 return; |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
71 /* L1TM */ |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
72 case TM_INIT: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
73 l1tm_response_nodata("tminit"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
74 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
75 case TM_MODE_SET: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
76 l1tm_response_nodata("tms"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
77 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
78 case VERSION_GET: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
79 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
80 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
81 l1tm_response_index_val("tm3ver"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
82 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
83 case RF_ENABLE: |
133
4aa1c18c7a2f
fc-tmsh: RF_ENABLE response handled intelligently
Mychaela Falconia <falcon@freecalypso.org>
parents:
132
diff
changeset
|
84 l1tm_rfe_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
85 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
86 case STATS_READ: |
134
4c78649101f1
fc-tmsh: l1tm stats response display
Mychaela Falconia <falcon@freecalypso.org>
parents:
133
diff
changeset
|
87 l1tm_stats_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
88 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
89 case STATS_CONFIG_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
90 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
91 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
92 l1tm_response_index("scw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
93 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
94 case STATS_CONFIG_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
95 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
96 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
97 l1tm_response_index_val("scr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
98 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
99 case RF_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
100 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
101 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
102 l1tm_response_index("rfpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
103 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
104 case RF_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
105 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
106 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
107 l1tm_response_index_val("rfpr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
108 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
109 case RF_TABLE_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
110 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
111 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
112 l1tm_response_index("rftw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
113 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
114 case RF_TABLE_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
115 print_etm_pkt_raw("RF_TABLE_READ response"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
116 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
117 case RX_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
118 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
119 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
120 l1tm_response_index("rxpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
121 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
122 case RX_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
123 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
124 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
125 l1tm_response_index_val("rxpr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
126 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
127 case TX_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
128 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
129 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
130 l1tm_response_index("txpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
131 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
132 case TX_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
133 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
134 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
135 l1tm_response_index_val("txpr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
136 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
137 case TX_TEMPLATE_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
138 print_etm_pkt_raw("TX_TEMPLATE_WRITE response"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
139 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
140 case TX_TEMPLATE_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
141 print_etm_pkt_raw("TX_TEMPLATE_READ response"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
142 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
143 case MISC_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
144 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
145 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
146 l1tm_response_index("mpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
147 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
148 case MISC_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
149 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
150 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
151 l1tm_response_index_val("mpr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
152 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
153 case MISC_ENABLE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
154 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
155 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
156 l1tm_response_index("me"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
157 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 default: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 print_etm_pkt_raw("TM unknown"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 |
68
585f63e5bca6
fc-tmsh: etmpkt command renamed to tmpkt, etmpkt retained as alias
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
163 cmd_tmpkt(argc, argv) |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 char **argv; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 u_char pkt[MAX_PKT_TO_TARGET]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 int di, c, b; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 char **ap; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 pkt[0] = RVT_TM_HEADER; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 di = 1; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 c = 0; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 for (ap = argv + 1; *ap; ap++) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 b = strtoul(*ap, 0, 16); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 pkt[di++] = b; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 c ^= b; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 pkt[di++] = c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 send_pkt_to_target(pkt, di); |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
68
diff
changeset
|
180 return(0); |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 send_etm_cmd(buf, len) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 u_char *buf; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 int i, c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 buf[0] = RVT_TM_HEADER; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 c = 0; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 for (i = 1; i <= len; i++) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 c ^= buf[i]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 buf[i] = c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 send_pkt_to_target(buf, len + 2); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 } |