FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/etmbasic.c @ 157:f78d696ffb81
fc-tmsh: aul and aus commands added like in TI's original
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 17 Mar 2017 06:02:17 +0000 |
parents | 01230ff7cef3 |
children | 8fac4aaec230 |
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; |
156
01230ff7cef3
fc-tmsh: stub handling of ETM_AUDIO responses
Mychaela Falconia <falcon@freecalypso.org>
parents:
151
diff
changeset
|
65 case ETM_AUDIO: |
01230ff7cef3
fc-tmsh: stub handling of ETM_AUDIO responses
Mychaela Falconia <falcon@freecalypso.org>
parents:
151
diff
changeset
|
66 print_etm_pkt_raw("ETM_AUDIO"); |
01230ff7cef3
fc-tmsh: stub handling of ETM_AUDIO responses
Mychaela Falconia <falcon@freecalypso.org>
parents:
151
diff
changeset
|
67 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 /* TM3 */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 case MEM_READ: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 if (rvi_msg_len < 5) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 goto runt; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 handle_omr_response(); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 return; |
149
c81d0e9ac3b4
fc-tmsh: omw command and response handling added
Mychaela Falconia <falcon@freecalypso.org>
parents:
137
diff
changeset
|
74 case MEM_WRITE: |
c81d0e9ac3b4
fc-tmsh: omw command and response handling added
Mychaela Falconia <falcon@freecalypso.org>
parents:
137
diff
changeset
|
75 l1tm_response_nodata("omw"); |
c81d0e9ac3b4
fc-tmsh: omw command and response handling added
Mychaela Falconia <falcon@freecalypso.org>
parents:
137
diff
changeset
|
76 return; |
151
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
77 case CODEC_READ: |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
78 if (rvi_msg_len < 5) |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
79 goto runt; |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
80 handle_oabbr_response(); |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
81 return; |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
82 case CODEC_WRITE: |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
83 l1tm_response_nodata("oabbw"); |
74b9aeb25d79
fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
149
diff
changeset
|
84 return; |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
85 /* L1TM */ |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
86 case TM_INIT: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
87 l1tm_response_nodata("tminit"); |
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 TM_MODE_SET: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
90 l1tm_response_nodata("tms"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
91 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
92 case VERSION_GET: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
93 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
94 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
95 l1tm_response_index_val("tm3ver"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
96 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
97 case RF_ENABLE: |
133
4aa1c18c7a2f
fc-tmsh: RF_ENABLE response handled intelligently
Mychaela Falconia <falcon@freecalypso.org>
parents:
132
diff
changeset
|
98 l1tm_rfe_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
99 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
100 case STATS_READ: |
134
4c78649101f1
fc-tmsh: l1tm stats response display
Mychaela Falconia <falcon@freecalypso.org>
parents:
133
diff
changeset
|
101 l1tm_stats_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
102 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
103 case STATS_CONFIG_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
104 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
105 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
106 l1tm_response_index("scw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
107 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
108 case STATS_CONFIG_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
109 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
110 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
111 l1tm_response_index_val("scr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
112 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
113 case RF_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
114 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
115 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
116 l1tm_response_index("rfpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
117 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
118 case RF_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
119 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
120 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
121 l1tm_response_index_val("rfpr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
122 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
123 case RF_TABLE_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
124 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
125 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
126 l1tm_response_index("rftw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
127 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
128 case RF_TABLE_READ: |
135
40807eb35ffe
fc-tmsh: rftr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
134
diff
changeset
|
129 if (rvi_msg_len < 5) |
40807eb35ffe
fc-tmsh: rftr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
134
diff
changeset
|
130 goto runt; |
40807eb35ffe
fc-tmsh: rftr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
134
diff
changeset
|
131 l1tm_rftr_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
132 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
133 case RX_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
134 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
135 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
136 l1tm_response_index("rxpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
137 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
138 case RX_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
139 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
140 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
141 l1tm_response_index_val("rxpr"); |
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 TX_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("txpw"); |
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 TX_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("txpr"); |
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 TX_TEMPLATE_WRITE: |
136
da4d4af80fdd
fc-tmsh: ttw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
135
diff
changeset
|
154 if (rvi_msg_len < 5) |
da4d4af80fdd
fc-tmsh: ttw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
135
diff
changeset
|
155 goto runt; |
da4d4af80fdd
fc-tmsh: ttw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
135
diff
changeset
|
156 l1tm_ttw_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
157 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
158 case TX_TEMPLATE_READ: |
137
79e71354ba7b
fc-tmsh: ttr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
159 if (rvi_msg_len < 5) |
79e71354ba7b
fc-tmsh: ttr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
160 goto runt; |
79e71354ba7b
fc-tmsh: ttr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
136
diff
changeset
|
161 l1tm_ttr_response(); |
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
162 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
163 case MISC_PARAM_WRITE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
164 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
165 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
166 l1tm_response_index("mpw"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
167 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
168 case MISC_PARAM_READ: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
169 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
170 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
171 l1tm_response_index_val("mpr"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
172 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
173 case MISC_ENABLE: |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
174 if (rvi_msg_len < 5) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
175 goto runt; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
176 l1tm_response_index("me"); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
69
diff
changeset
|
177 return; |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 default: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 print_etm_pkt_raw("TM unknown"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 } |
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 |
68
585f63e5bca6
fc-tmsh: etmpkt command renamed to tmpkt, etmpkt retained as alias
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
183 cmd_tmpkt(argc, argv) |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 char **argv; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 u_char pkt[MAX_PKT_TO_TARGET]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 int di, c, b; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 char **ap; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 pkt[0] = RVT_TM_HEADER; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 di = 1; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 c = 0; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 for (ap = argv + 1; *ap; ap++) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 b = strtoul(*ap, 0, 16); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 pkt[di++] = b; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 c ^= b; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 pkt[di++] = c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 send_pkt_to_target(pkt, di); |
69
2159f260ed13
fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents:
68
diff
changeset
|
200 return(0); |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 send_etm_cmd(buf, len) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 u_char *buf; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 int i, c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 buf[0] = RVT_TM_HEADER; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 c = 0; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 for (i = 1; i <= len; i++) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 c ^= buf[i]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 buf[i] = c; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 send_pkt_to_target(buf, len + 2); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 } |