view d144/edata-input-decomp.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 8deebf9c410a
children
line wrap: on
line source

/*
 * This program reads an E-data compiled binary file (the kind intended
 * as input to itt-ater-16) and converts it into ASCII form.  The ASCII
 * output from this program is not in the same format as input to
 * edata-input-compile, but it is a more compact ASCII-based format
 * that will be useful for unit tests on the future sw implementation
 * of RAA' function.
 */

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

main(argc, argv)
	char **argv;
{
	FILE *binf, *outf;
	uint8_t frame[38];
	int rc;
	unsigned n;

	if (argc < 2 || argc > 3) {
		fprintf(stderr, "usage: %s input.bin [output.asc]\n", argv[0]);
		exit(1);
	}
	binf = fopen(argv[1], "r");
	if (!binf) {
		perror(argv[1]);
		exit(1);
	}
	if (argc > 2) {
		outf = fopen(argv[2], "w");
		if (!outf) {
			perror(argv[2]);
			exit(1);
		}
	} else
		outf = stdout;
	for (;;) {
		rc = fread(frame, 1, 38, binf);
		if (!rc)
			break;
		if (rc != 38) {
inv_input:		fprintf(stderr, "error: %s is not in expected format\n",
				argv[1]);
			exit(1);
		}
		if (frame[0] != 0xD4)
			goto inv_input;
		fprintf(outf, "%u%u ", (frame[1] & 2) >> 1, frame[1] & 1);
		for (n = 0; n < 36; n++)
			fprintf(outf, "%02x", frame[n+2]);
		putc('\n', outf);
	}
	exit(0);
}