FreeCalypso > hg > gsm-net-reveng
annotate trau-decode/parse-main.c @ 54:8deebf9c410a
d144: "decompile" binary input format into ASCII
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 25 Sep 2024 04:32:32 +0000 |
parents | f77a48a01ff0 |
children |
rev | line source |
---|---|
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program reads a 64 kbit/s timeslot recording file, examines one |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * of the four 16 kbit/s subslots (selected), looks for GSM 08.60 TRAU |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * frames, and dumps whatever it finds. |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdint.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <string.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <strings.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 static unsigned file_offset; |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
14 static int include_raw; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 static enum { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 HUNT_FOR_0, |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 HUNT_FOUND_0, |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 GOT_8_ZEROS, |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 SYNCED |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 } state; |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
22 static enum { |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
23 NOT_D144, |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
24 D144_SYNC, |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
25 D144_EDATA, |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
26 } d144_state; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 static unsigned hunt_for_0_count, frame_pos_count; |
2
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
28 static uint8_t in_frame_2bit[160], frame_bits[320], d_bits[260]; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 static void |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 unpack_dibits() |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 int i, inb; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 uint8_t *op; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 op = frame_bits; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 for (i = 0; i < 160; i++) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 inb = in_frame_2bit[i]; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 if (inb & 2) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 *op++ = 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 else |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 *op++ = 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 if (inb & 1) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 *op++ = 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 else |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 *op++ = 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 static unsigned |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 bits_to_num(bits, nbits) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 uint8_t *bits; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 unsigned nbits; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 unsigned accum; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 unsigned n; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 accum = 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 for (n = 0; n < nbits; n++) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 accum <<= 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 if (*bits) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 accum |= 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 bits++; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 return accum; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 static void |
2
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
69 collect_d_bits() |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
70 { |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
71 bcopy(frame_bits + 33, d_bits, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
72 bcopy(frame_bits + 49, d_bits + 15, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
73 bcopy(frame_bits + 65, d_bits + 30, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
74 bcopy(frame_bits + 81, d_bits + 45, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
75 bcopy(frame_bits + 97, d_bits + 60, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
76 bcopy(frame_bits + 113, d_bits + 75, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
77 bcopy(frame_bits + 129, d_bits + 90, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
78 bcopy(frame_bits + 145, d_bits + 105, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
79 bcopy(frame_bits + 161, d_bits + 120, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
80 bcopy(frame_bits + 177, d_bits + 135, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
81 bcopy(frame_bits + 193, d_bits + 150, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
82 bcopy(frame_bits + 209, d_bits + 165, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
83 bcopy(frame_bits + 225, d_bits + 180, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
84 bcopy(frame_bits + 241, d_bits + 195, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
85 bcopy(frame_bits + 257, d_bits + 210, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
86 bcopy(frame_bits + 273, d_bits + 225, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
87 bcopy(frame_bits + 289, d_bits + 240, 15); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
88 bcopy(frame_bits + 305, d_bits + 255, 5); |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
89 } |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
90 |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
91 static void |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
92 print_fr_efr_frame(c1_5) |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
93 unsigned c1_5; |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
94 { |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
95 switch (c1_5) { |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
96 case 0x02: |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
97 case 0x1C: |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
98 collect_d_bits(); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
99 print_fr_frame(d_bits); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
100 break; |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
101 case 0x1A: |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
102 collect_d_bits(); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
103 check_efr_crc(d_bits); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
104 print_efr_frame(d_bits); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
105 break; |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
106 } |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
107 } |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
108 |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
109 static void |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
110 print_data_subframe(nf, bits) |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
111 uint8_t *bits; |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
112 { |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
113 unsigned nb; |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
114 |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
115 printf(" Data frame %d:", nf); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
116 for (nb = 0; nb < 9; nb++) { |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
117 printf(" %02X", bits_to_num(bits, 8)); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
118 bits += 8; |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
119 } |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
120 putchar('\n'); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
121 } |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
122 |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
123 static void |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
124 print_data_frame() |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
125 { |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
126 print_data_subframe(0, frame_bits + 4 * 8); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
127 print_data_subframe(1, frame_bits + 13 * 8); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
128 print_data_subframe(2, frame_bits + 22 * 8); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
129 print_data_subframe(3, frame_bits + 31 * 8); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
130 } |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
131 |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
132 static void |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
133 dump_raw_frame() |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
134 { |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
135 uint8_t *sp = frame_bits; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
136 unsigned n, m, d; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
137 |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
138 for (n = 0; n < 80; n++) { |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
139 d = 0; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
140 for (m = 0; m < 4; m++) { |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
141 d <<= 1; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
142 d |= *sp++; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
143 } |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
144 printf("%x", d); |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
145 } |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
146 putchar('\n'); |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
147 } |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
148 |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
149 static void |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 process_frame() |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 unsigned c1_5, c6_11; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 |
10
4d1732e4a143
trau-parse: frame offsets were reported off by one byte
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
154 printf("Frame at 0x%x:\n", file_offset - 159); |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
155 if (include_raw) |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
156 dump_raw_frame(); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 printf(" C1-C5: %u%u%u%u%u", frame_bits[17], frame_bits[18], |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 frame_bits[19], frame_bits[20], frame_bits[21]); |
1
b0dcd48a1c8a
trau-parse: initial bugfixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
159 c1_5 = bits_to_num(frame_bits + 17, 5); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 switch (c1_5) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 case 0x02: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 fputs(" (FR UL)", stdout); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 break; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 case 0x1C: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 fputs(" (FR DL)", stdout); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 break; |
1
b0dcd48a1c8a
trau-parse: initial bugfixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
167 case 0x1A: |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 fputs(" (EFR)", stdout); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 break; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 case 0x10: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 fputs(" (idle UL)", stdout); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 break; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 case 0x0E: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 fputs(" (idle DL)", stdout); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 break; |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
176 case 0x08: |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
177 fputs(" (data UL)", stdout); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
178 break; |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
179 case 0x16: |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
180 fputs(" (data DL)", stdout); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
181 break; |
43
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
182 case 0x09: |
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
183 fputs(" (HR data UL)", stdout); |
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
184 break; |
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
185 case 0x17: |
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
186 fputs(" (HR data DL)", stdout); |
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
187 break; |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
188 case 0x14: |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
189 fputs(" (D144 sync)", stdout); |
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
190 break; |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
191 case 0x1F: |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
192 fputs(" (E-TRAU)", stdout); |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
193 break; |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
194 case 0x06: |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
195 fputs(" (AMR)", stdout); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
196 break; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 putchar('\n'); |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
199 if (c1_5 == 0x14) |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
200 d144_state = D144_SYNC; |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
201 else if (c1_5 == 0x1F && |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
202 (d144_state == D144_SYNC || d144_state == D144_EDATA)) |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
203 d144_state = D144_EDATA; |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
204 else |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
205 d144_state = NOT_D144; |
2
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
206 switch (c1_5) { |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
207 case 0x02: |
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
208 case 0x1C: |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
209 case 0x1A: |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
210 case 0x10: |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
211 case 0x0E: |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
212 c6_11 = bits_to_num(frame_bits + 22, 6); |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
213 printf(" C6-C11: %u\n", c6_11); |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
214 printf(" C12=%u C13=%u C14=%u C15=%u\n", frame_bits[28], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
215 frame_bits[29], frame_bits[30], frame_bits[31]); |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
216 print_fr_efr_frame(c1_5); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
217 printf(" C16=%u C17=%u C18=%u C19=%u C20=%u C21=%u\n", |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
218 frame_bits[310], frame_bits[311], frame_bits[312], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
219 frame_bits[313], frame_bits[314], frame_bits[315]); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
220 printf(" T1=%u T2=%u T3=%u T4=%u\n", frame_bits[316], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
221 frame_bits[317], frame_bits[318], frame_bits[319]); |
4
d9c095357c32
trau-parse: check and report EFR CRC
Mychaela Falconia <falcon@freecalypso.org>
parents:
2
diff
changeset
|
222 break; |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
223 case 0x08: |
43
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
224 case 0x09: |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
225 case 0x16: |
43
95acde708ce2
trau-parse: add knowledge of HR-data frame types
Mychaela Falconia <falcon@freecalypso.org>
parents:
38
diff
changeset
|
226 case 0x17: |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
227 case 0x14: |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
228 printf(" C6-C15: %u%u%u%u%u%u%u%u%u%u\n", frame_bits[22], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
229 frame_bits[23], frame_bits[24], frame_bits[25], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
230 frame_bits[26], frame_bits[27], frame_bits[28], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
231 frame_bits[29], frame_bits[30], frame_bits[31]); |
38
d7674c80426c
trau-parse: add decoding of data frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
232 print_data_frame(); |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
233 break; |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
234 case 0x1F: |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
235 printf(" C6-C13: %u%u%u%u%u%u%u%u\n", frame_bits[22], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
236 frame_bits[23], frame_bits[24], frame_bits[25], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
237 frame_bits[26], frame_bits[27], frame_bits[28], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
238 frame_bits[29]); |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
239 printf(" M1=%u M2=%u\n", frame_bits[30], frame_bits[31]); |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
240 break; |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
241 case 0x06: |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
242 c6_11 = bits_to_num(frame_bits + 22, 6); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
243 printf(" C6-C11: %u\n", c6_11); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
244 printf(" RIF=%u C13=%u Config_Prot=%u%u%u Msg_No=%u%u\n", |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
245 frame_bits[28], frame_bits[29], frame_bits[30], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
246 frame_bits[31], frame_bits[33], frame_bits[34], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
247 frame_bits[35]); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
248 printf(" DTXd=%u TFOE=%u FClass=%u%u CMI/CMR=%u%u%u\n", |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
249 frame_bits[36], frame_bits[37], frame_bits[38], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
250 frame_bits[39], frame_bits[40], frame_bits[41], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
251 frame_bits[42]); |
48
3d8cb2631812
trau-parse: show more info from AMR No_Speech frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
252 if (!frame_bits[38] && !frame_bits[39]) |
3d8cb2631812
trau-parse: show more info from AMR No_Speech frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
253 printf(" No_Spch_Class=%u%u%u CMI=%u%u%u CMR=%u%u%u\n", |
3d8cb2631812
trau-parse: show more info from AMR No_Speech frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
254 frame_bits[76], frame_bits[77], frame_bits[78], |
3d8cb2631812
trau-parse: show more info from AMR No_Speech frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
255 frame_bits[79], frame_bits[81], frame_bits[82], |
3d8cb2631812
trau-parse: show more info from AMR No_Speech frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
47
diff
changeset
|
256 frame_bits[83], frame_bits[84], frame_bits[85]); |
47
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
257 printf(" T1=%u T2=%u T3=%u T4=%u\n", frame_bits[316], |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
258 frame_bits[317], frame_bits[318], frame_bits[319]); |
7119884f6afe
trau-parse: rudimentary AMR decoding (C-bits)
Mychaela Falconia <falcon@freecalypso.org>
parents:
46
diff
changeset
|
259 break; |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
260 default: |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
261 printf(" C6-C15: %u%u%u%u%u%u%u%u%u%u\n", frame_bits[22], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
262 frame_bits[23], frame_bits[24], frame_bits[25], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
263 frame_bits[26], frame_bits[27], frame_bits[28], |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
264 frame_bits[29], frame_bits[30], frame_bits[31]); |
49
e579784e5578
trau-parse: restore FR-like display for unknown frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
48
diff
changeset
|
265 printf(" C16=%u C17=%u C18=%u C19=%u C20=%u C21=%u\n", |
e579784e5578
trau-parse: restore FR-like display for unknown frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
48
diff
changeset
|
266 frame_bits[310], frame_bits[311], frame_bits[312], |
e579784e5578
trau-parse: restore FR-like display for unknown frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
48
diff
changeset
|
267 frame_bits[313], frame_bits[314], frame_bits[315]); |
e579784e5578
trau-parse: restore FR-like display for unknown frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
48
diff
changeset
|
268 printf(" T1=%u T2=%u T3=%u T4=%u\n", frame_bits[316], |
e579784e5578
trau-parse: restore FR-like display for unknown frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
48
diff
changeset
|
269 frame_bits[317], frame_bits[318], frame_bits[319]); |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
270 } |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 static int |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 check_sync_zeros() |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 int i; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 for (i = 0; i < 16; i++) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 if (frame_bits[i]) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 return 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 return 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 static int |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 check_sync_ones() |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 int i; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 for (i = 1; i < 20; i++) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 if (!frame_bits[i*16]) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 return 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 return 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 static void |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 check_sync() |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 { |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
300 int sync_res; |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
301 |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
302 if (d144_state == D144_EDATA) |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
303 sync_res = check_sync_zeros() && frame_bits[16]; |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
304 else |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
305 sync_res = check_sync_zeros() && check_sync_ones(); |
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
306 if (sync_res) |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 printf("Bad frame sync, returning to hunt state\n"); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 state = HUNT_FOR_0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 static void |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 byte_input(inb) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 switch (state) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 case HUNT_FOR_0: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 if (inb != 0) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 state = HUNT_FOUND_0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 hunt_for_0_count = 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 case HUNT_FOUND_0: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 if (inb != 0) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 state = HUNT_FOR_0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 hunt_for_0_count++; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 if (hunt_for_0_count >= 8) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 state = GOT_8_ZEROS; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 case GOT_8_ZEROS: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 if (inb & 2) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 printf("Found frame sync at file offset 0x%x\n", |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 file_offset - 8); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 bzero(in_frame_2bit, 8); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 in_frame_2bit[8] = inb; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 frame_pos_count = 9; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 state = SYNCED; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 if (inb != 0) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 state = HUNT_FOR_0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 case SYNCED: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 in_frame_2bit[frame_pos_count++] = inb; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 if (frame_pos_count < 160) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 frame_pos_count = 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 unpack_dibits(); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 process_frame(); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 check_sync(); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 return; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 default: |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 fprintf(stderr, "BUG: bad sync state\n"); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 abort(); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 main(argc, argv) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 char **argv; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 { |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
362 char *filename, *subslot_arg; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 FILE *inf; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 int subslot, right_shift; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 int inb; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
367 switch (argc) { |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
368 case 3: |
50
f77a48a01ff0
trau-parse command line: parse -r more robustly
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
369 if (argv[1][0] == '-') |
f77a48a01ff0
trau-parse command line: parse -r more robustly
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
370 goto usage; |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
371 filename = argv[1]; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
372 subslot_arg = argv[2]; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
373 include_raw = 0; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
374 break; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
375 case 4: |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
376 if (strcmp(argv[1], "-r")) |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
377 goto usage; |
50
f77a48a01ff0
trau-parse command line: parse -r more robustly
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
378 if (argv[2][0] == '-') |
f77a48a01ff0
trau-parse command line: parse -r more robustly
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
379 goto usage; |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
380 filename = argv[2]; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
381 subslot_arg = argv[3]; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
382 include_raw = 1; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
383 break; |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
384 default: |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
385 usage: |
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
386 fprintf(stderr, "usage: %s [-r] binfile subslot\n", argv[0]); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 exit(1); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 } |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
389 inf = fopen(filename, "r"); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 if (!inf) { |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
391 perror(filename); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 exit(1); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 } |
45
59d1d15b6f7e
trau-parse: add -r option for raw frame output
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
394 subslot = atoi(subslot_arg); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 if (subslot < 0 || subslot > 3) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 fprintf(stderr, "error: invalid subslot argument\n"); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 exit(1); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 right_shift = (3 - subslot) * 2; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 state = HUNT_FOR_0; |
46
f977027774cb
trau-parse: add support for D144 decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
401 d144_state = NOT_D144; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 for (file_offset = 0; ; file_offset++) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 inb = getc(inf); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 if (inb < 0) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 break; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 inb >>= right_shift; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 inb &= 3; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 byte_input(inb); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 exit(0); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 } |