annotate trau-decode/dump-1bit.c @ 94:f9ef582c199c

tfo-ut: check in tfo-fr.bin and tfo-efr.bin Each of these binary files is an extract from MSC-side E1 timeslot recording in a Nokia TCSM2 TFO session involving a cross-connect between two TRAU channels. The extracts have been chosen to begin at the point where the TRAU starts emitting TFO frames, thereby beginning with a series of TFO frames that contain an embedded TFO_TRANS message. In each experiment, one of the two cross-connected TRAU channels emitted two "plain" TFO frames (not containing embedded TFO messages) in between the initial embedded TFO_TRANS and the subsequent embedded TFO_REQ_L; this channel was chosen for the present extracts. Each extract is thus 2560 PCM samples, containing 16 aligned TFO frames: 5 carrying TFO_TRANS, 2 plain, 9 carrying TFO_REQ_L.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 18 Mar 2025 22:56:23 +0000
parents f508dacf2cf9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program reads a 64 kbit/s timeslot recording file, focuses on one
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * bit out of the eight (a single 8 kbit/s subslot) and prints a dump
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * that shows just this one bit out of each byte. It is an aid for
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * development and debugging of frame sync tools for 8 kbit/s submultiplexing.
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 */
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdlib.h>
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 main(argc, argv)
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 char **argv;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 {
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 FILE *inf;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 int subslot, right_shift;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 unsigned file_offset, mod16;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 int inb;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (argc != 3) {
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 fprintf(stderr, "usage: %s binfile subslot\n", argv[0]);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 exit(1);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 }
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 inf = fopen(argv[1], "r");
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if (!inf) {
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 perror(argv[1]);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 exit(1);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 subslot = atoi(argv[2]);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 if (subslot < 0 || subslot > 7) {
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 fprintf(stderr, "error: invalid subslot argument\n");
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 exit(1);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 right_shift = 7 - subslot;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 for (file_offset = 0; ; file_offset++) {
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 inb = getc(inf);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 if (inb < 0)
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 break;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 mod16 = file_offset & 15;
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 if (mod16 == 0)
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 printf("%08X:", file_offset);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 if (mod16 == 0 || mod16 == 4 || mod16 == 8 || mod16 == 12)
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 putchar(' ');
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 printf(" %u", (inb >> right_shift) & 1);
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 if (mod16 == 15)
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 putchar('\n');
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }
f508dacf2cf9 trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 }