FreeCalypso > hg > freecalypso-sw
annotate rvinterf/lowlevel/format.c @ 866:3adb4154f02f
power cycle crash bug found: see the changes in gsm-fw/gpf/osl/os_mem_fl.c
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 16 May 2015 01:38:49 +0000 |
parents | d527ac304ad5 |
children | 136fa1ccd591 |
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 |
856
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
124 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
|
125 { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
126 int i, c; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
127 char *dp; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
128 |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
129 dp = fmtbuf; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
130 strcpy(dp, "LLD: "); |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
131 dp += 5; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
132 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
|
133 c = rxpkt[i]; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
134 if (c & 0x80) { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
135 *dp++ = 'M'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
136 *dp++ = '-'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
137 c &= 0x7F; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
138 } |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
139 if (c < 0x20) { |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
140 *dp++ = '^'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
141 *dp++ = c + '@'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
142 } 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
|
143 *dp++ = '^'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
144 *dp++ = '?'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
145 } else |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
146 *dp++ = c; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
147 } |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
148 *dp = '\0'; |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
149 output_line(fmtbuf); |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
150 } |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
151 |
d527ac304ad5
rvinterf & rvtdump: handle low level debug messages from FC firmwares
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
333
diff
changeset
|
152 void |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
153 print_unknown_packet() |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
154 { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
155 int i; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
156 char *dp; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
157 |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
158 dp = fmtbuf; |
133
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
159 strcpy(dp, "UNK:"); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
160 dp += 4; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
161 for (i = 0; i < rxpkt_len; i++) { |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
162 sprintf(dp, " %02X", rxpkt[i]); |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
163 dp += 3; |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
164 } |
56b53c289785
rvtdump: some restructuring
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
127
diff
changeset
|
165 *dp = '\0'; |
327
05874f1ddacb
rvinterf & rvtdump: new decoding of G23/GPF packets
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
256
diff
changeset
|
166 output_line(fmtbuf); |
127
f4f0c8738dcb
rvtdump: satisfactory handling of output from Pirelli's fw
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
126
diff
changeset
|
167 } |