comparison trau-decode/parse-main.c @ 38:d7674c80426c

trau-parse: add decoding of data frames
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 12 Sep 2024 19:50:29 +0000
parents 4d1732e4a143
children 95acde708ce2
comparison
equal deleted inserted replaced
37:4ab7cc414ed2 38:d7674c80426c
81 bcopy(frame_bits + 289, d_bits + 240, 15); 81 bcopy(frame_bits + 289, d_bits + 240, 15);
82 bcopy(frame_bits + 305, d_bits + 255, 5); 82 bcopy(frame_bits + 305, d_bits + 255, 5);
83 } 83 }
84 84
85 static void 85 static void
86 print_data_subframe(nf, bits)
87 uint8_t *bits;
88 {
89 unsigned nb;
90
91 printf(" Data frame %d:", nf);
92 for (nb = 0; nb < 9; nb++) {
93 printf(" %02X", bits_to_num(bits, 8));
94 bits += 8;
95 }
96 putchar('\n');
97 }
98
99 static void
100 print_data_frame()
101 {
102 print_data_subframe(0, frame_bits + 4 * 8);
103 print_data_subframe(1, frame_bits + 13 * 8);
104 print_data_subframe(2, frame_bits + 22 * 8);
105 print_data_subframe(3, frame_bits + 31 * 8);
106 }
107
108 static void
86 process_frame() 109 process_frame()
87 { 110 {
88 unsigned c1_5, c6_11; 111 unsigned c1_5, c6_11;
89 112
90 printf("Frame at 0x%x:\n", file_offset - 159); 113 printf("Frame at 0x%x:\n", file_offset - 159);
104 case 0x10: 127 case 0x10:
105 fputs(" (idle UL)", stdout); 128 fputs(" (idle UL)", stdout);
106 break; 129 break;
107 case 0x0E: 130 case 0x0E:
108 fputs(" (idle DL)", stdout); 131 fputs(" (idle DL)", stdout);
132 break;
133 case 0x08:
134 fputs(" (data UL)", stdout);
135 break;
136 case 0x16:
137 fputs(" (data DL)", stdout);
138 break;
139 case 0x14:
140 fputs(" (D144 sync)", stdout);
109 break; 141 break;
110 } 142 }
111 putchar('\n'); 143 putchar('\n');
112 c6_11 = bits_to_num(frame_bits + 22, 6); 144 c6_11 = bits_to_num(frame_bits + 22, 6);
113 printf(" C6-C11: %u\n", c6_11); 145 printf(" C6-C11: %u\n", c6_11);
122 case 0x1A: 154 case 0x1A:
123 collect_d_bits(); 155 collect_d_bits();
124 check_efr_crc(d_bits); 156 check_efr_crc(d_bits);
125 print_efr_frame(d_bits); 157 print_efr_frame(d_bits);
126 break; 158 break;
159 case 0x08:
160 case 0x16:
161 case 0x14:
162 print_data_frame();
163 return;
127 } 164 }
128 printf(" C16=%u C17=%u C18=%u C19=%u C20=%u C21=%u\n", 165 printf(" C16=%u C17=%u C18=%u C19=%u C20=%u C21=%u\n",
129 frame_bits[310], frame_bits[311], frame_bits[312], 166 frame_bits[310], frame_bits[311], frame_bits[312],
130 frame_bits[313], frame_bits[314], frame_bits[315]); 167 frame_bits[313], frame_bits[314], frame_bits[315]);
131 printf(" T1=%u T2=%u T3=%u T4=%u\n", frame_bits[316], frame_bits[317], 168 printf(" T1=%u T2=%u T3=%u T4=%u\n", frame_bits[316], frame_bits[317],