view 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
line wrap: on
line source

/*
 * This program reads a 64 kbit/s timeslot recording file, focuses on one
 * bit out of the eight (a single 8 kbit/s subslot) and prints a dump
 * that shows just this one bit out of each byte.  It is an aid for
 * development and debugging of frame sync tools for 8 kbit/s submultiplexing.
 */

#include <stdio.h>
#include <stdlib.h>

main(argc, argv)
	char **argv;
{
	FILE *inf;
	int subslot, right_shift;
	unsigned file_offset, mod16;
	int inb;

	if (argc != 3) {
		fprintf(stderr, "usage: %s binfile subslot\n", argv[0]);
		exit(1);
	}
	inf = fopen(argv[1], "r");
	if (!inf) {
		perror(argv[1]);
		exit(1);
	}
	subslot = atoi(argv[2]);
	if (subslot < 0 || subslot > 7) {
		fprintf(stderr, "error: invalid subslot argument\n");
		exit(1);
	}
	right_shift = 7 - subslot;
	for (file_offset = 0; ; file_offset++) {
		inb = getc(inf);
		if (inb < 0)
			break;
		mod16 = file_offset & 15;
		if (mod16 == 0)
			printf("%08X:", file_offset);
		if (mod16 == 0 || mod16 == 4 || mod16 == 8 || mod16 == 12)
			putchar(' ');
		printf(" %u", (inb >> right_shift) & 1);
		if (mod16 == 15)
			putchar('\n');
	}
}