view trau-decode/parse-data.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 729dbac9df82
children
line wrap: on
line source

/*
 * This module contains a bit of code that has been factored out of
 * trau-parse program; it handles data frames.
 */

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

static unsigned
bits_to_num(bits, nbits)
	uint8_t *bits;
	unsigned nbits;
{
	unsigned accum;
	unsigned n;

	accum = 0;
	for (n = 0; n < nbits; n++) {
		accum <<= 1;
		if (*bits)
			accum |= 1;
		bits++;
	}
	return accum;
}

static void
print_data_subframe(nf, bits)
	uint8_t *bits;
{
	unsigned nb;

	printf("  Data frame %d:", nf);
	for (nb = 0; nb < 9; nb++) {
		printf(" %02X", bits_to_num(bits, 8));
		bits += 8;
	}
	putchar('\n');
}

void
print_data_frame(frame_bits)
	uint8_t *frame_bits;
{
	printf("  C6-C15: %u%u%u%u%u%u%u%u%u%u\n", frame_bits[22],
		frame_bits[23], frame_bits[24], frame_bits[25],
		frame_bits[26], frame_bits[27], frame_bits[28],
		frame_bits[29], frame_bits[30], frame_bits[31]);
	print_data_subframe(0, frame_bits + 4 * 8);
	print_data_subframe(1, frame_bits + 13 * 8);
	print_data_subframe(2, frame_bits + 22 * 8);
	print_data_subframe(3, frame_bits + 31 * 8);
}

void
print_edata_frame(frame_bits)
	uint8_t *frame_bits;
{
	printf("  C6-C13: %u%u%u%u%u%u%u%u\n", frame_bits[22],
		frame_bits[23], frame_bits[24], frame_bits[25],
		frame_bits[26], frame_bits[27], frame_bits[28],
		frame_bits[29]);
	printf("  M1=%u M2=%u\n", frame_bits[30], frame_bits[31]);
}