view miscutil/ti2arfcn.c @ 1014:961efadd530a default tip

fc-shell TCH DL handler: add support for CSD modes TCH DL capture mechanism in FC Tourmaline firmware has been extended to support CSD modes in addition to speech - add the necessary support on the host tools side. It needs to be noted that this mechanism in its present state does NOT provide the debug utility value that was sought: as we learned only after the code was implemented, TI's DSP has a misfeature in that the buffer we are reading (a_dd_0[]) is zeroed out when the IDS block is enabled, i.e., we are reading all zeros and not the real DL bits we were after. But since the code has already been written, we are keeping it - perhaps we can do some tests with IDS disabled.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Nov 2024 06:27:43 +0000
parents d2fccd82a83e
children
line wrap: on
line source

/*
 * TI's TCS211 L1 does not use standard ARFCNs internally, instead it uses
 * its own non-standard radio_freq numbers in their place.  Other firmware
 * components and all external interfaces do use standard ARFCNs, thus
 * conversion functions are invoked at appropriate points in the firmware.
 * However, L1-internal radio_freq numbers are emitted in L1 debug traces,
 * thus anyone looking at these traces needs to be able to convert between
 * standard ARFCNs and L1-internal radio_freq.
 *
 * The present utility converts TI's radio_freq numbers as seen in L1 traces
 * into standard ARFCNs.
 */

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

main(argc, argv)
	char **argv;
{
	int ti_num;

	if (argc != 3) {
usage:		fprintf(stderr, "usage: %s {eu|us} L1_radio_freq\n", argv[0]);
		exit(1);
	}
	ti_num = atoi(argv[2]);
	if (!strcmp(argv[1], "eu"))
		ti2arfcn_eu(ti_num);
	else if (!strcmp(argv[1], "us"))
		ti2arfcn_us(ti_num);
	else
		goto usage;
	exit(0);
}

ti2arfcn_eu(radio_freq)
{
	int arfcn;

	if (radio_freq < 1 || radio_freq > 548) {
		fprintf(stderr,
		"error: specified radio_freq is out of range for dual-EU\n");
		exit(1);
	}
	if (radio_freq < 175) {
		if (radio_freq <= 124)
			arfcn = radio_freq;
		else if (radio_freq < 174)
			arfcn = radio_freq - 125 + 975;
		else
			arfcn = 0;
	} else
		arfcn = radio_freq - 175 + 512;
	printf("%d\n", arfcn);
}

ti2arfcn_us(radio_freq)
{
	int arfcn;

	if (radio_freq < 1 || radio_freq > 423) {
		fprintf(stderr,
		"error: specified radio_freq is out of range for dual-US\n");
		exit(1);
	}
	if (radio_freq < 125)
		arfcn = radio_freq - 1 + 128;
	else
		arfcn = radio_freq - 125 + 512;
	printf("%d\n", arfcn);
}