view autocal/txbandmain.c @ 76:5c3574f8c8c1

fc-rfcal-txband: reading of basis & targets setting files implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Jul 2017 20:08:55 +0000
parents 93653fe9b4ef
children 3f63e71b6422
line wrap: on
line source

/*
 * This module contains the main() function for fc-rfcal-txband.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <rvinterf/l1tm.h>
#include <rvinterf/exitcodes.h>
#include "txband.h"
#include "stdband.h"

struct tx_calchan_range tx_calchan_850[] = {
	{128, 134, 131},
	{135, 150, 143},
	{151, 166, 159},
	{167, 182, 175},
	{183, 197, 190},
	{198, 213, 206},
	{214, 229, 222},
	{230, 251, 241}
};

struct tx_calchan_range tx_calchan_900[] = {
	{   0,   27,   14},
	{  28,   47,   40},
	{  48,   66,   57},
	{  67,   85,   76},
	{  86,  104,   95},
	{ 105,  124,  114},
	{ 975,  994,  985},
	{ 995, 1023, 1009}
};

struct tx_calchan_range tx_calchan_1800[] = {
	{512, 553, 533},
	{554, 594, 574},
	{595, 636, 615},
	{637, 677, 657},
	{678, 720, 700},
	{721, 760, 740},
	{761, 802, 781},
	{803, 885, 844}
};

struct tx_calchan_range tx_calchan_1900[] = {
	{512, 549, 531},
	{550, 586, 568},
	{587, 623, 605},
	{624, 697, 660},
	{698, 726, 712},
	{727, 754, 740},
	{755, 782, 768},
	{783, 810, 796}
};

struct txcal_band txcal_band_list[] = {
	{"850",  RFPW_STD_BAND_850,  190, 5, 19, tx_calchan_850,  4},
	{"900",  RFPW_STD_BAND_900,   40, 5, 19, tx_calchan_900,  1},
	{"1800", RFPW_STD_BAND_1800, 700, 0, 15, tx_calchan_1800, 4},
	{"1900", RFPW_STD_BAND_1900, 660, 0, 15, tx_calchan_1900, 3},
	{0,	 0,		     0,   0, 0,  0,               0}
};

struct txcal_band *txcal_band;
char *txlevels_profile;

struct tx_basis_point tx_basis[MAX_BASIS_POINTS];
unsigned num_basis_points;

struct tx_level tx_levels[MAX_TX_LEVELS];

finish_cmdline(argc, argv)
	char **argv;
{
	extern int optind;
	struct txcal_band *band;

	if (argc - optind != 2) {
		fprintf(stderr, "usage: %s band txlevels-profile\n", argv[0]);
		exit(ERROR_USAGE);
	}
	for (band = txcal_band_list; band->name; band++)
		if (!strcmp(band->name, argv[optind]))
			break;
	if (!band->name) {
		fprintf(stderr, "error: \"%s\" is not a known band\n",
			argv[optind]);
		exit(ERROR_USAGE);
	}
	txcal_band = band;
	txlevels_profile = argv[optind+1];
	return(0);
}

main(argc, argv)
	char **argv;
{
	socket_pathname_options(argc, argv);
	finish_cmdline(argc, argv);
	read_tx_cal_profile();
	connect_rvinterf_socket();
	connect_tsid_socket();
	setlinebuf(stdout);	/* to allow logging with tee */
	printf("Preparing RF test system for %s MHz Tx calibration\n",
		txcal_band->name);
	do_txpwr_cal_setup(txcal_band->name, txcal_band->main_arfcn);

	printf("Putting the DUT into Test Mode\n");
	do_tms(1);
	do_rfpw(STD_BAND_FLAG, txcal_band->rfpw_std_band);
	do_rfpw(TCH_ARFCN, txcal_band->main_arfcn);
	do_rfpw(AFC_ENA_FLAG, 0);


}