annotate rvinterf/lowlevel/rviftmode.c @ 935:d203a9c7c4e6

rvinterf TM log: beginning of TM/ETM classification
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 07:51:13 +0000
parents 0d6be90ae74f
children f4e6f6b6548e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module is for rvinterf only. Whenever we send or receive Test Mode
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * packets, we should be a little more intelligent about how we display and
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * log them. By default we only print a one-line summary, and in verbose mode
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * we also emit a full hex dump.
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 */
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <sys/types.h>
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdio.h>
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <string.h>
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <strings.h>
935
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
12 #include "../include/etm.h"
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
13 #include "../include/tm3.h"
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern u_char rxpkt[];
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 extern size_t rxpkt_len;
934
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
17
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 extern int verbose;
934
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
19 extern FILE *logF;
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
935
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
21 static int
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
22 verify_cksum(pkt, pktlen)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
23 u_char *pkt;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
24 unsigned pktlen;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
25 {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
26 int i, c;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
27
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
28 c = 0;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
29 for (i = 1; i < pktlen; i++)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
30 c ^= pkt[i];
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
31 if (c == 0)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
32 return(0);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
33 else
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
34 return(-1);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
35 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
36
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
37 static void
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
38 etm_core_classify(pkt, pktlen, outbuf)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
39 u_char *pkt;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
40 unsigned pktlen;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
41 char *outbuf;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
42 {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
43 /* classification code to be filled */
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
44 strcpy(outbuf, "ETM_CORE");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
45 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
46
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
47 static void
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
48 tmffs2_cmd_classify(pkt, pktlen, outbuf)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
49 u_char *pkt;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
50 unsigned pktlen;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
51 char *outbuf;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
52 {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
53 /* classification code to be filled */
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
54 strcpy(outbuf, "FFS2");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
55 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
56
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
57 static void
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
58 audio_cmd_classify(pkt, pktlen, outbuf)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
59 u_char *pkt;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
60 unsigned pktlen;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
61 char *outbuf;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
62 {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
63 /* classification code to be filled */
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
64 strcpy(outbuf, "ETM_AUDIO");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
65 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
66
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
67 static void
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
68 tm_classify(pkt, pktlen, is_cmd, outbuf)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
69 u_char *pkt;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
70 unsigned pktlen;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
71 char *outbuf;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
72 {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
73 if (pktlen < 3) {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
74 strcpy(outbuf, "RUNT");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
75 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
76 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
77 if (verify_cksum(pkt, pktlen) < 0) {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
78 strcpy(outbuf, "BAD CKSUM");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
79 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
80 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
81 switch (pkt[1]) {
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
82 case ETM_CORE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
83 if (is_cmd)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
84 etm_core_classify(pkt, pktlen, outbuf);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
85 else
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
86 strcpy(outbuf, "ETM_CORE");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
87 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
88 case ETM_FFS1:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
89 strcpy(outbuf, "FFS1");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
90 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
91 case ETM_FFS2:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
92 if (is_cmd)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
93 tmffs2_cmd_classify(pkt, pktlen, outbuf);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
94 else
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
95 strcpy(outbuf, "FFS2");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
96 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
97 case ETM_AUDIO:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
98 if (is_cmd)
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
99 audio_cmd_classify(pkt, pktlen, outbuf);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
100 else
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
101 strcpy(outbuf, "ETM_AUDIO");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
102 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
103 case ETM_BSIM:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
104 strcpy(outbuf, "BSIM");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
105 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
106 /* TM3 */
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
107 case MEM_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
108 strcpy(outbuf, "omr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
109 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
110 case MEM_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
111 strcpy(outbuf, "omw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
112 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
113 case CODEC_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
114 strcpy(outbuf, "oabbr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
115 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
116 case CODEC_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
117 strcpy(outbuf, "oabbw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
118 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
119 /* L1TM */
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
120 case TM_INIT:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
121 strcpy(outbuf, "tminit");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
122 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
123 case TM_MODE_SET:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
124 strcpy(outbuf, "tms");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
125 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
126 case VERSION_GET:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
127 strcpy(outbuf, "tm3ver");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
128 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
129 case RF_ENABLE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
130 strcpy(outbuf, "rfe");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
131 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
132 case STATS_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
133 strcpy(outbuf, "sr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
134 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
135 case STATS_CONFIG_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
136 strcpy(outbuf, "scw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
137 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
138 case STATS_CONFIG_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
139 strcpy(outbuf, "scr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
140 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
141 case RF_PARAM_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
142 strcpy(outbuf, "rfpw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
143 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
144 case RF_PARAM_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
145 strcpy(outbuf, "rfpr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
146 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
147 case RF_TABLE_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
148 strcpy(outbuf, "rftw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
149 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
150 case RF_TABLE_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
151 strcpy(outbuf, "rftr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
152 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
153 case RX_PARAM_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
154 strcpy(outbuf, "rxpw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
155 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
156 case RX_PARAM_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
157 strcpy(outbuf, "rxpr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
158 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
159 case TX_PARAM_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
160 strcpy(outbuf, "txpw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
161 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
162 case TX_PARAM_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
163 strcpy(outbuf, "txpr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
164 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
165 case TX_TEMPLATE_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
166 strcpy(outbuf, "ttw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
167 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
168 case TX_TEMPLATE_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
169 strcpy(outbuf, "ttr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
170 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
171 case MISC_PARAM_WRITE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
172 strcpy(outbuf, "mpw");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
173 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
174 case MISC_PARAM_READ:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
175 strcpy(outbuf, "mpr");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
176 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
177 case MISC_ENABLE:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
178 strcpy(outbuf, "me");
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
179 return;
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
180 default:
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
181 sprintf(outbuf, "mid 0x%02X", pkt[1]);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
182 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
183 }
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
184
934
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
185 static void
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
186 hexdump_out(line)
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
187 char *line;
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
188 {
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
189 if (logF)
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
190 fprintf(logF, "%s\n", line);
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
191 else
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
192 printf("%s\n", line);
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
193 }
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 void
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 log_sent_tm(pkt, pktlen)
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 u_char *pkt;
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 {
935
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
199 char summary[32], headline[80];
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
200
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
201 tm_classify(pkt, pktlen, 1, summary);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
202 sprintf(headline, "Sent Test Mode cmd (%s)", summary);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
203 output_line(headline);
933
bd6dd6120180 rvinterf: -v enables TM hex dump, -vv enables TCH hex dump
Mychaela Falconia <falcon@freecalypso.org>
parents: 932
diff changeset
204 if (verbose >= 1)
934
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
205 packet_hex_dump(pkt, pktlen, hexdump_out);
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 }
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 void
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 print_tm_output_new()
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 {
935
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
211 char summary[32], headline[80];
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
212
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
213 tm_classify(rxpkt, (unsigned) rxpkt_len, 0, summary);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
214 sprintf(headline, "Rx Test Mode resp (%s)", summary);
d203a9c7c4e6 rvinterf TM log: beginning of TM/ETM classification
Mychaela Falconia <falcon@freecalypso.org>
parents: 934
diff changeset
215 output_line(headline);
933
bd6dd6120180 rvinterf: -v enables TM hex dump, -vv enables TCH hex dump
Mychaela Falconia <falcon@freecalypso.org>
parents: 932
diff changeset
216 if (verbose >= 1)
934
0d6be90ae74f rvinterf -v TM: send hex dump only to log file if we have one
Mychaela Falconia <falcon@freecalypso.org>
parents: 933
diff changeset
217 packet_hex_dump(rxpkt, (unsigned) rxpkt_len, hexdump_out);
932
3d1abb9f05ef rvinterf proper: move TM logging to new module
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 }