annotate rvinterf/tmsh/etmbasic.c @ 589:4ccd4dd1edb6

CHANGES: target boot control instead of GTA02 AP special case
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 03 Feb 2020 08:53:16 +0000
parents 8fac4aaec230
children 9706832b740b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
159
8fac4aaec230 fc-tmsh: beginning of intelligent ETM_AUDIO response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 156
diff changeset
66 if (rvi_msg_len < 6)
8fac4aaec230 fc-tmsh: beginning of intelligent ETM_AUDIO response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 156
diff changeset
67 goto runt;
8fac4aaec230 fc-tmsh: beginning of intelligent ETM_AUDIO response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 156
diff changeset
68 etm_audio_msg_rx();
156
01230ff7cef3 fc-tmsh: stub handling of ETM_AUDIO responses
Mychaela Falconia <falcon@freecalypso.org>
parents: 151
diff changeset
69 return;
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 /* TM3 */
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 case MEM_READ:
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 if (rvi_msg_len < 5)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 goto runt;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 handle_omr_response();
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 return;
149
c81d0e9ac3b4 fc-tmsh: omw command and response handling added
Mychaela Falconia <falcon@freecalypso.org>
parents: 137
diff changeset
76 case MEM_WRITE:
c81d0e9ac3b4 fc-tmsh: omw command and response handling added
Mychaela Falconia <falcon@freecalypso.org>
parents: 137
diff changeset
77 l1tm_response_nodata("omw");
c81d0e9ac3b4 fc-tmsh: omw command and response handling added
Mychaela Falconia <falcon@freecalypso.org>
parents: 137
diff changeset
78 return;
151
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
79 case CODEC_READ:
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
80 if (rvi_msg_len < 5)
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
81 goto runt;
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
82 handle_oabbr_response();
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
83 return;
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
84 case CODEC_WRITE:
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
85 l1tm_response_nodata("oabbw");
74b9aeb25d79 fc-tmsh: oabbr and oabbw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 149
diff changeset
86 return;
132
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
87 /* L1TM */
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
88 case TM_INIT:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
89 l1tm_response_nodata("tminit");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
90 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
91 case TM_MODE_SET:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
92 l1tm_response_nodata("tms");
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 VERSION_GET:
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("tm3ver");
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_ENABLE:
133
4aa1c18c7a2f fc-tmsh: RF_ENABLE response handled intelligently
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
100 l1tm_rfe_response();
132
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
101 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
102 case STATS_READ:
134
4c78649101f1 fc-tmsh: l1tm stats response display
Mychaela Falconia <falcon@freecalypso.org>
parents: 133
diff changeset
103 l1tm_stats_response();
132
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
104 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
105 case STATS_CONFIG_WRITE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
106 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
107 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
108 l1tm_response_index("scw");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
109 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
110 case STATS_CONFIG_READ:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
111 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
112 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
113 l1tm_response_index_val("scr");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
114 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
115 case RF_PARAM_WRITE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
116 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
117 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
118 l1tm_response_index("rfpw");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
119 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
120 case RF_PARAM_READ:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
121 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
122 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
123 l1tm_response_index_val("rfpr");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
124 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
125 case RF_TABLE_WRITE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
126 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
127 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
128 l1tm_response_index("rftw");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
129 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
130 case RF_TABLE_READ:
135
40807eb35ffe fc-tmsh: rftr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 134
diff changeset
131 if (rvi_msg_len < 5)
40807eb35ffe fc-tmsh: rftr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 134
diff changeset
132 goto runt;
40807eb35ffe fc-tmsh: rftr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 134
diff changeset
133 l1tm_rftr_response();
132
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
134 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
135 case RX_PARAM_WRITE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
136 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
137 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
138 l1tm_response_index("rxpw");
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 RX_PARAM_READ:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
141 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
142 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
143 l1tm_response_index_val("rxpr");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
144 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
145 case TX_PARAM_WRITE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
146 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
147 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
148 l1tm_response_index("txpw");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
149 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
150 case TX_PARAM_READ:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
151 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
152 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
153 l1tm_response_index_val("txpr");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
154 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
155 case TX_TEMPLATE_WRITE:
136
da4d4af80fdd fc-tmsh: ttw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 135
diff changeset
156 if (rvi_msg_len < 5)
da4d4af80fdd fc-tmsh: ttw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 135
diff changeset
157 goto runt;
da4d4af80fdd fc-tmsh: ttw response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 135
diff changeset
158 l1tm_ttw_response();
132
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
159 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
160 case TX_TEMPLATE_READ:
137
79e71354ba7b fc-tmsh: ttr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 136
diff changeset
161 if (rvi_msg_len < 5)
79e71354ba7b fc-tmsh: ttr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 136
diff changeset
162 goto runt;
79e71354ba7b fc-tmsh: ttr response handling implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 136
diff changeset
163 l1tm_ttr_response();
132
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
164 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
165 case MISC_PARAM_WRITE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
166 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
167 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
168 l1tm_response_index("mpw");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
169 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
170 case MISC_PARAM_READ:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
171 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
172 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
173 l1tm_response_index_val("mpr");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
174 return;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
175 case MISC_ENABLE:
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
176 if (rvi_msg_len < 5)
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
177 goto runt;
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
178 l1tm_response_index("me");
5380872923a6 fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents: 69
diff changeset
179 return;
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 default:
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 print_etm_pkt_raw("TM unknown");
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 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184
68
585f63e5bca6 fc-tmsh: etmpkt command renamed to tmpkt, etmpkt retained as alias
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
185 cmd_tmpkt(argc, argv)
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 char **argv;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 u_char pkt[MAX_PKT_TO_TARGET];
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 int di, c, b;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 char **ap;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 pkt[0] = RVT_TM_HEADER;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 di = 1;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 c = 0;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 for (ap = argv + 1; *ap; ap++) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 b = strtoul(*ap, 0, 16);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 pkt[di++] = b;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 c ^= b;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 pkt[di++] = c;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 send_pkt_to_target(pkt, di);
69
2159f260ed13 fc-tmsh: all commands internally return values
Mychaela Falconia <falcon@freecalypso.org>
parents: 68
diff changeset
202 return(0);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 void
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 send_etm_cmd(buf, len)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 u_char *buf;
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 int i, c;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 buf[0] = RVT_TM_HEADER;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 c = 0;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 for (i = 1; i <= len; i++)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 c ^= buf[i];
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 buf[i] = c;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 send_pkt_to_target(buf, len + 2);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 }