FreeCalypso > hg > freecalypso-sw
annotate rvinterf/lowlevel/format.c @ 923:10b4bed10192
gsm-fw/L1: fix for the DSP patch corruption bug
The L1 code we got from the LoCosto fw contains a feature for DSP CPU load
measurement. This feature is a LoCosto-ism, i.e., not applicable to earlier
DBB chips (Calypso) with their respective earlier DSP ROMs. Most of the
code dealing with that feature is conditionalized as #if (DSP >= 38),
but one spot was missed, and the MCU code was writing into an API word
dealing with this feature. In TCS211 this DSP API word happens to be
used by the DSP code patch, hence that write was corrupting the patched
DSP code.
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 19 Oct 2015 17:13:56 +0000 |
parents | 4423039aeb4b |
children | 0d7cc054ef72 |
rev | line source |
---|---|
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
174
3256dc6e84ae
rvinterf: refactored rvtdump compiles and works
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
173
diff
changeset
|
2 * This module implements the decoding of Rx packets |
3256dc6e84ae
rvinterf: refactored rvtdump compiles and works
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
173
diff
changeset
|
3 * into human-readable form. |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <sys/types.h> |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
8 #include <string.h> |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
9 #include <strings.h> |
256
2f285f20d617
rvinterf: *.h moved into include subdir
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
175
diff
changeset
|
10 #include "../include/pktmux.h" |
2f285f20d617
rvinterf: *.h moved into include subdir
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
175
diff
changeset
|
11 #include "../include/limits.h" |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 extern u_char rxpkt[]; |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 extern size_t rxpkt_len; |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 |
333
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
16 static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
17 |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 void |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 print_rv_trace() |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 { |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
21 int i, c; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
22 char *dp; |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
24 dp = fmtbuf; |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
25 strcpy(dp, "RV "); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
26 dp += 3; |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 /* the SWE static ID is sent MSB first */ |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
28 for (i = 1; i <= 4; i++) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
29 sprintf(dp, "%02X", rxpkt[i]); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
30 dp += 2; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
31 } |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 /* severity level */ |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
33 sprintf(dp, " %d ", rxpkt[5]); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
34 dp = index(dp, '\0'); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
35 for (i = 6; i < rxpkt_len; i++) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
36 c = rxpkt[i]; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
37 if (c & 0x80) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
38 *dp++ = 'M'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
39 *dp++ = '-'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
40 c &= 0x7F; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
41 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
42 if (c < 0x20) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
43 *dp++ = '^'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
44 *dp++ = c + '@'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
45 } else if (c == 0x7F) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
46 *dp++ = '^'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
47 *dp++ = '?'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
48 } else |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
49 *dp++ = c; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
50 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
51 *dp = '\0'; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
52 output_line(fmtbuf); |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 } |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 void |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 print_l1_trace() |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 { |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
58 int i, c; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
59 char *dp; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
60 |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
61 dp = fmtbuf; |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
62 strcpy(dp, "L1: "); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
63 dp += 4; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
64 for (i = 1; i < rxpkt_len; i++) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
65 if ((i+1 < rxpkt_len) && |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
66 (rxpkt[i] == '\r' && rxpkt[i+1] == '\n' || |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
67 rxpkt[i] == '\n' && rxpkt[i+1] == '\r')) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
68 *dp = '\0'; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
69 output_line(fmtbuf); |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
70 if (i+2 == rxpkt_len) |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
71 return; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
72 dp = fmtbuf; |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
73 *dp++ = '+'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
74 *dp++ = ' '; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
75 i++; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
76 continue; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
77 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
78 c = rxpkt[i]; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
79 if (c & 0x80) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
80 *dp++ = 'M'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
81 *dp++ = '-'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
82 c &= 0x7F; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
83 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
84 if (c < 0x20) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
85 *dp++ = '^'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
86 *dp++ = c + '@'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
87 } else if (c == 0x7F) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
88 *dp++ = '^'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
89 *dp++ = '?'; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
90 } else |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
91 *dp++ = c; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
92 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
93 /* will get here only if no newline sequence at the end */ |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
94 *dp = '\0'; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
95 output_line(fmtbuf); |
126
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 } |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 |
811b138f1bed
rvtdump utility written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 void |
333
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
99 print_g23_trace() |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
100 { |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
101 /* messy logic factored out into libg23 */ |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
102 format_g23_packet(rxpkt, (int)rxpkt_len, fmtbuf); |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
103 output_line(fmtbuf); |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
104 } |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
105 |
2ac2f6d88bb2
rvinterf & rvtdump: use the new libg23 for G23 packet decoding
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
327
diff
changeset
|
106 void |
169
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
107 print_etm_output_raw() |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
108 { |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
109 int i; |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
110 char *dp; |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
111 |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
112 dp = fmtbuf; |
169
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
113 strcpy(dp, "ETM:"); |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
114 dp += 4; |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
115 for (i = 1; i < rxpkt_len; i++) { |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
116 sprintf(dp, " %02X", rxpkt[i]); |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
117 dp += 3; |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
118 } |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
119 *dp = '\0'; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
120 output_line(fmtbuf); |
169
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
121 } |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
122 |
e01e3a60c858
rvinterf: background mode implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
133
diff
changeset
|
123 void |
880
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
124 print_ati_output() |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
125 { |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
126 int i, c; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
127 char *dp; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
128 |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
129 dp = fmtbuf; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
130 strcpy(dp, "ATI: "); |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
131 dp += 5; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
132 for (i = 1; i < rxpkt_len; i++) { |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
133 c = rxpkt[i]; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
134 if (c & 0x80) { |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
135 *dp++ = 'M'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
136 *dp++ = '-'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
137 c &= 0x7F; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
138 } |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
139 if (c < 0x20) { |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
140 *dp++ = '^'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
141 *dp++ = c + '@'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
142 } else if (c == 0x7F) { |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
143 *dp++ = '^'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
144 *dp++ = '?'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
145 } else |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
146 *dp++ = c; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
147 } |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
148 *dp = '\0'; |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
149 output_line(fmtbuf); |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
150 } |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
151 |
136fa1ccd591
rvtdump & rvinterf: print and log ATI responses in ASCII
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
856
diff
changeset
|
152 void |
856
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
153 print_fc_lld_msg() |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
154 { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
155 int i, c; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
156 char *dp; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
157 |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
158 dp = fmtbuf; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
159 strcpy(dp, "LLD: "); |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
160 dp += 5; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
161 for (i = 1; i < rxpkt_len; i++) { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
162 c = rxpkt[i]; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
163 if (c & 0x80) { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
164 *dp++ = 'M'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
165 *dp++ = '-'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
166 c &= 0x7F; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
167 } |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
168 if (c < 0x20) { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
169 *dp++ = '^'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
170 *dp++ = c + '@'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
171 } else if (c == 0x7F) { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
172 *dp++ = '^'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
173 *dp++ = '?'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
174 } else |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
175 *dp++ = c; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
176 } |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
177 *dp = '\0'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
178 output_line(fmtbuf); |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
179 } |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
180 |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
181 void |
902
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
182 report_extui_packet() |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
183 { |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
184 sprintf(fmtbuf, "LCD OUT: row %u col %u-%u", rxpkt[1], rxpkt[2], |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
185 rxpkt[2] + (rxpkt_len - 3) / 2 - 1); |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
186 output_line(fmtbuf); |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
187 } |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
188 |
4423039aeb4b
rvtdump: report ext LCD output packets sanely
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
880
diff
changeset
|
189 void |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
190 print_unknown_packet() |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
191 { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
192 int i; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
193 char *dp; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
194 |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
195 dp = fmtbuf; |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
196 strcpy(dp, "UNK:"); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
197 dp += 4; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
198 for (i = 0; i < rxpkt_len; i++) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
199 sprintf(dp, " %02X", rxpkt[i]); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
200 dp += 3; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
201 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
202 *dp = '\0'; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
203 output_line(fmtbuf); |
127
f4f0c8738dcb
rvtdump: satisfactory handling of output from Pirelli's fw
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
126
diff
changeset
|
204 } |