changeset 74:d388732c2f73

autocal: rxband.c renamed to rxbandmain.c for consistency
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Jul 2017 18:20:48 +0000
parents c9bd1f75029f
children 93653fe9b4ef
files autocal/Makefile autocal/rxband.c autocal/rxbandmain.c
diffstat 3 files changed, 161 insertions(+), 161 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/Makefile	Sat Jul 15 18:14:49 2017 +0000
+++ b/autocal/Makefile	Sat Jul 15 18:20:48 2017 +0000
@@ -7,8 +7,8 @@
 GMAGIC_OBJS=	gmagicstand.o l1meas.o l1tmops.o rvinterf.o rxcommon.o \
 		sockopts.o tsidsock.o
 
-RXBAND_OBJS=	l1meas.o l1tmops.o rvinterf.o rxband.o rxcommon.o rxupload.o \
-		sockopts.o tsidsock.o
+RXBAND_OBJS=	l1meas.o l1tmops.o rvinterf.o rxbandmain.o rxcommon.o \
+		rxupload.o sockopts.o tsidsock.o
 
 TXBASIS_OBJS=	l1tmops.o rvinterf.o tsidsock.o txpwrmeas.o txstandbas.o
 
--- a/autocal/rxband.c	Sat Jul 15 18:14:49 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * This module contains the main() function for fc-rfcal-rxband.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <rvinterf/l1tm.h>
-#include <rvinterf/exitcodes.h>
-#include "rxband.h"
-#include "rxcaldefs.h"
-#include "stdband.h"
-
-struct rx_calchan_range rx_calchan_850[] = {
-	{128, 138, 128},
-	{139, 157, 148},
-	{158, 178, 168},
-	{179, 199, 189},
-	{200, 217, 208},
-	{218, 239, 228},
-	{240, 251, 251}
-};
-
-struct rx_calchan_range rx_calchan_900[] = {
-	{   0,   10,    1},
-	{  11,   30,   20},
-	{  31,   51,   37},
-	{  52,   71,   62},
-	{  72,   90,   80},
-	{  91,  112,  100},
-	{ 113,  124,  124},
-	{ 975,  991,  975},
-	{ 992, 1009, 1000},
-	{1010, 1023, 1017}
-};
-
-struct rx_calchan_range rx_calchan_1800[] = {
-	{512, 548, 512},
-	{549, 622, 585},
-	{623, 680, 660},
-	{681, 745, 698},
-	{746, 812, 790},
-	{813, 860, 835},
-	{861, 885, 885}
-};
-
-struct rx_calchan_range rx_calchan_1900[] = {
-	{512, 548, 512},
-	{549, 622, 585},
-	{623, 680, 661},
-	{681, 745, 700},
-	{746, 795, 790},
-	{796, 810, 805}
-};
-
-struct rxcal_band rxcal_band_list[] = {
-	{"850",  RFPW_STD_BAND_850,  189, rx_calchan_850,
-		sizeof(rx_calchan_850) / sizeof(struct rx_calchan_range)},
-	{"900",  RFPW_STD_BAND_900,   37, rx_calchan_900,
-		sizeof(rx_calchan_900) / sizeof(struct rx_calchan_range)},
-	{"1800", RFPW_STD_BAND_1800, 698, rx_calchan_1800,
-		sizeof(rx_calchan_1800) / sizeof(struct rx_calchan_range)},
-	{"1900", RFPW_STD_BAND_1900, 661, rx_calchan_1900,
-		sizeof(rx_calchan_1900) / sizeof(struct rx_calchan_range)},
-	{0,	 0,		     0,   0, 0}
-};
-
-struct rxcal_band *rxcal_band;
-int Gmagic, rx_calchan_values[10];
-
-finish_cmdline(argc, argv)
-	char **argv;
-{
-	extern int optind;
-	struct rxcal_band *band;
-
-	if (argc - optind != 1) {
-		fprintf(stderr, "usage: %s band\n", argv[0]);
-		exit(ERROR_USAGE);
-	}
-	for (band = rxcal_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);
-	}
-	rxcal_band = band;
-	return(0);
-}
-
-prepare_rf_test_system()
-{
-	char cmd[80];
-
-	printf("Preparing RF test system for %s MHz Rx calibration\n",
-		rxcal_band->name);
-	sprintf(cmd, "signal-gen-setup %s\n", rxcal_band->name);
-	tsid_command(cmd);
-	return(0);
-}
-
-main(argc, argv)
-	char **argv;
-{
-	socket_pathname_options(argc, argv);
-	finish_cmdline(argc, argv);
-	connect_rvinterf_socket();
-	connect_tsid_socket();
-	setlinebuf(stdout);	/* to allow logging with tee */
-	prepare_rf_test_system();
-
-	printf("Putting the DUT into Test Mode\n");
-	do_tms(1);
-	do_rfpw(STD_BAND_FLAG, rxcal_band->rfpw_std_band);
-	l1tm_setup_for_rxcal();
-	do_gmagic();
-	do_rx_calchan();
-
-	printf("Saving calibrated values in FFS\n");
-	misc_enable(CFG_WRITE_RX_CAL);
-	exit(0);
-}
-
-do_gmagic()
-{
-	int pm;
-	char Gmagic_db[64];
-
-	printf("Calibrating GMagic\n");
-	pm = rx_measure(rxcal_band->main_arfcn);
-	Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2;
-	halfdb_to_string(Gmagic, Gmagic_db);
-	printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db);
-	upload_gmagic();
-	return(0);
-}
-
-do_rx_calchan()
-{
-	unsigned n;
-	int pm;
-
-	printf("Calibrating RSSI channel compensation\n");
-	for (n = 0; n < rxcal_band->num_calchan_ranges; n++) {
-		pm = rx_measure(rxcal_band->calchan_ranges[n].test_arfcn);
-		rx_calchan_values[n] = RXCAL_SIGGEN_LEVEL - pm +
-					RXCAL_AGC_DB * 2 + Gmagic;
-	}
-	for (n = 0; n < rxcal_band->num_calchan_ranges; n++)
-		printf("ARFCN %u-%u: correction=%d\n",
-			rxcal_band->calchan_ranges[n].lower_bound,
-			rxcal_band->calchan_ranges[n].upper_bound,
-			rx_calchan_values[n]);
-	upload_rx_calchan();
-	return(0);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/rxbandmain.c	Sat Jul 15 18:20:48 2017 +0000
@@ -0,0 +1,159 @@
+/*
+ * This module contains the main() function for fc-rfcal-rxband.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <rvinterf/l1tm.h>
+#include <rvinterf/exitcodes.h>
+#include "rxband.h"
+#include "rxcaldefs.h"
+#include "stdband.h"
+
+struct rx_calchan_range rx_calchan_850[] = {
+	{128, 138, 128},
+	{139, 157, 148},
+	{158, 178, 168},
+	{179, 199, 189},
+	{200, 217, 208},
+	{218, 239, 228},
+	{240, 251, 251}
+};
+
+struct rx_calchan_range rx_calchan_900[] = {
+	{   0,   10,    1},
+	{  11,   30,   20},
+	{  31,   51,   37},
+	{  52,   71,   62},
+	{  72,   90,   80},
+	{  91,  112,  100},
+	{ 113,  124,  124},
+	{ 975,  991,  975},
+	{ 992, 1009, 1000},
+	{1010, 1023, 1017}
+};
+
+struct rx_calchan_range rx_calchan_1800[] = {
+	{512, 548, 512},
+	{549, 622, 585},
+	{623, 680, 660},
+	{681, 745, 698},
+	{746, 812, 790},
+	{813, 860, 835},
+	{861, 885, 885}
+};
+
+struct rx_calchan_range rx_calchan_1900[] = {
+	{512, 548, 512},
+	{549, 622, 585},
+	{623, 680, 661},
+	{681, 745, 700},
+	{746, 795, 790},
+	{796, 810, 805}
+};
+
+struct rxcal_band rxcal_band_list[] = {
+	{"850",  RFPW_STD_BAND_850,  189, rx_calchan_850,
+		sizeof(rx_calchan_850) / sizeof(struct rx_calchan_range)},
+	{"900",  RFPW_STD_BAND_900,   37, rx_calchan_900,
+		sizeof(rx_calchan_900) / sizeof(struct rx_calchan_range)},
+	{"1800", RFPW_STD_BAND_1800, 698, rx_calchan_1800,
+		sizeof(rx_calchan_1800) / sizeof(struct rx_calchan_range)},
+	{"1900", RFPW_STD_BAND_1900, 661, rx_calchan_1900,
+		sizeof(rx_calchan_1900) / sizeof(struct rx_calchan_range)},
+	{0,	 0,		     0,   0, 0}
+};
+
+struct rxcal_band *rxcal_band;
+int Gmagic, rx_calchan_values[10];
+
+finish_cmdline(argc, argv)
+	char **argv;
+{
+	extern int optind;
+	struct rxcal_band *band;
+
+	if (argc - optind != 1) {
+		fprintf(stderr, "usage: %s band\n", argv[0]);
+		exit(ERROR_USAGE);
+	}
+	for (band = rxcal_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);
+	}
+	rxcal_band = band;
+	return(0);
+}
+
+prepare_rf_test_system()
+{
+	char cmd[80];
+
+	printf("Preparing RF test system for %s MHz Rx calibration\n",
+		rxcal_band->name);
+	sprintf(cmd, "signal-gen-setup %s\n", rxcal_band->name);
+	tsid_command(cmd);
+	return(0);
+}
+
+main(argc, argv)
+	char **argv;
+{
+	socket_pathname_options(argc, argv);
+	finish_cmdline(argc, argv);
+	connect_rvinterf_socket();
+	connect_tsid_socket();
+	setlinebuf(stdout);	/* to allow logging with tee */
+	prepare_rf_test_system();
+
+	printf("Putting the DUT into Test Mode\n");
+	do_tms(1);
+	do_rfpw(STD_BAND_FLAG, rxcal_band->rfpw_std_band);
+	l1tm_setup_for_rxcal();
+	do_gmagic();
+	do_rx_calchan();
+
+	printf("Saving calibrated values in FFS\n");
+	misc_enable(CFG_WRITE_RX_CAL);
+	exit(0);
+}
+
+do_gmagic()
+{
+	int pm;
+	char Gmagic_db[64];
+
+	printf("Calibrating GMagic\n");
+	pm = rx_measure(rxcal_band->main_arfcn);
+	Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2;
+	halfdb_to_string(Gmagic, Gmagic_db);
+	printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db);
+	upload_gmagic();
+	return(0);
+}
+
+do_rx_calchan()
+{
+	unsigned n;
+	int pm;
+
+	printf("Calibrating RSSI channel compensation\n");
+	for (n = 0; n < rxcal_band->num_calchan_ranges; n++) {
+		pm = rx_measure(rxcal_band->calchan_ranges[n].test_arfcn);
+		rx_calchan_values[n] = RXCAL_SIGGEN_LEVEL - pm +
+					RXCAL_AGC_DB * 2 + Gmagic;
+	}
+	for (n = 0; n < rxcal_band->num_calchan_ranges; n++)
+		printf("ARFCN %u-%u: correction=%d\n",
+			rxcal_band->calchan_ranges[n].lower_bound,
+			rxcal_band->calchan_ranges[n].upper_bound,
+			rx_calchan_values[n]);
+	upload_rx_calchan();
+	return(0);
+}