FreeCalypso > hg > gsm-codec-lib
annotate miscutil/tw5a-dump.c @ 545:b07dba7b8a4f
doc/EFR-library-API: document RTP input wrapper
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 03 Oct 2024 09:26:04 +0000 |
parents | 86d4ec69b36c |
children |
rev | line source |
---|---|
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
2 * This program reads a TW-TS-005 Annex A hexadecimal file |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * and dumps all frames in human-readable form. |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdint.h> |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
471
b5f8ea41362b
gsmrec-dump: report DHF matches
Mychaela Falconia <falcon@freecalypso.org>
parents:
293
diff
changeset
|
9 #include <string.h> |
b5f8ea41362b
gsmrec-dump: report DHF matches
Mychaela Falconia <falcon@freecalypso.org>
parents:
293
diff
changeset
|
10 #include <strings.h> |
281
3816ba89a5a0
gsmrec-dump: use libgsmfr2 instead of old libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
128
diff
changeset
|
11 #include "../libgsmfr2/tw_gsmfr.h" |
46
edd2e20e7090
gsmrec-dump: decode EFR frames
Mychaela Falconia <falcon@freecalypso.org>
parents:
23
diff
changeset
|
12 #include "../libgsmefr/gsm_efr.h" |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
13 #include "../libtest/tw5reader.h" |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
14 |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
15 static void |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
16 dump_fr_frame(frame) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
17 uint8_t *frame; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
18 { |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
19 int16_t params[GSMFR_NUM_PARAMS]; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
20 int i, j, n; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
21 |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
22 printf(" SID=%d LARc", gsmfr_preproc_sid_classify(frame)); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
23 gsmfr_unpack_to_array(frame, params); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
24 n = 0; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
25 for (i = 0; i < 8; i++) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
26 printf(" %d", params[n++]); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
27 if (!bcmp(frame, gsmfr_decoder_homing_frame, GSMFR_RTP_FRAME_LEN)) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
28 fputs(" (DHF)", stdout); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
29 putchar('\n'); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
30 for (i = 0; i < 4; i++) { |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
31 putchar(' '); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
32 for (j = 0; j < 17; j++) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
33 printf(" %d", params[n++]); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
34 putchar('\n'); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
35 } |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
36 } |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
37 |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
38 static void |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
39 dump_efr_frame(frame) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
40 uint8_t *frame; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
41 { |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
42 int16_t params[EFR_NUM_PARAMS]; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
43 int i, j, n; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
44 |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
45 printf(" SID=%d LPC", EFR_sid_classify(frame)); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
46 EFR_frame2params(frame, params); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
47 n = 0; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
48 for (i = 0; i < 5; i++) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
49 printf(" %d", params[n++]); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
50 if (!bcmp(frame, EFR_decoder_homing_frame, EFR_RTP_FRAME_LEN)) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
51 fputs(" (DHF)", stdout); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
52 putchar('\n'); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
53 for (i = 0; i < 4; i++) { |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
54 putchar(' '); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
55 for (j = 0; j < 13; j++) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
56 printf(" %d", params[n++]); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
57 putchar('\n'); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
58 } |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
59 } |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 main(argc, argv) |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 char **argv; |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 { |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
64 FILE *hexf; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
65 unsigned lineno; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
66 uint8_t frame[TWTS005_MAX_FRAME]; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
67 unsigned frame_len, bfi; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
68 int rc; |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 if (argc != 2) { |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
71 fprintf(stderr, "usage: %s hex-file\n", argv[0]); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 exit(1); |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 } |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
74 hexf = fopen(argv[1], "r"); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
75 if (!hexf) { |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 perror(argv[1]); |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 exit(1); |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 } |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
79 lineno = 0; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
80 for (;;) { |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
81 rc = twts005_read_frame(hexf, &lineno, frame, &frame_len); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 if (rc < 0) { |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
83 fprintf(stderr, "%s line %u: not valid TW-TS-005\n", |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
84 argv[1], lineno); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 exit(1); |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 } |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 if (!rc) |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 break; |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
89 switch (frame_len) { |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
90 case 0: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
91 printf("line %u: NULL frame\n", lineno); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
92 break; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
93 case 1: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
94 if ((frame[0] & 0xF6) != 0xE6) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
95 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
96 printf("line %u: No_Data frame\n", lineno); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
97 printf(" TEH=%02X (DTXd=%u TAF=%u)\n", frame[0], |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
98 (frame[0] >> 3) & 1, frame[0] & 1); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
99 break; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
100 case GSMFR_RTP_FRAME_LEN: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
101 if ((frame[0] & 0xF0) != 0xD0) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
102 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
103 printf("line %u: FR basic frame\n", lineno); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
104 dump_fr_frame(frame); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 break; |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
106 case GSMFR_RTP_FRAME_LEN+1: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
107 if ((frame[0] & 0xF4) != 0xE0) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
108 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
109 if ((frame[1] & 0xF0) != 0xD0) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
110 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
111 bfi = (frame[0] >> 1) & 1; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
112 printf("line %u: FR %s frame\n", lineno, |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
113 bfi ? "bad" : "extended"); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
114 printf(" TEH=%02X (DTXd=%u BFI=%u TAF=%u)\n", frame[0], |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
115 (frame[0] >> 3) & 1, bfi, frame[0] & 1); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
116 dump_fr_frame(frame + 1); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
117 break; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
118 case EFR_RTP_FRAME_LEN: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
119 if ((frame[0] & 0xF0) != 0xC0) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
120 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
121 printf("line %u: EFR basic frame\n", lineno); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
122 dump_efr_frame(frame); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 break; |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
124 case EFR_RTP_FRAME_LEN+1: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
125 if ((frame[0] & 0xF4) != 0xE0) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
126 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
127 if ((frame[1] & 0xF0) != 0xC0) |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
128 goto invalid; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
129 bfi = (frame[0] >> 1) & 1; |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
130 printf("line %u: EFR %s frame\n", lineno, |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
131 bfi ? "bad" : "extended"); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
132 printf(" TEH=%02X (DTXd=%u BFI=%u TAF=%u)\n", frame[0], |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
133 (frame[0] >> 3) & 1, bfi, frame[0] & 1); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
134 dump_efr_frame(frame + 1); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 break; |
523
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
136 default: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
137 invalid: |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
138 fprintf(stderr, |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
139 "%s line %u: not a valid FR or EFR frame\n", |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
140 argv[1], lineno); |
86d4ec69b36c
miscutil: new program tw5a-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
471
diff
changeset
|
141 exit(1); |
23
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 } |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 } |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 exit(0); |
baadb1cb744d
new debug utility gsmrec-dump
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 } |