changeset 75:93653fe9b4ef

fc-rfcal-txband started
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Jul 2017 19:22:30 +0000
parents d388732c2f73
children 5c3574f8c8c1
files .hgignore autocal/Makefile autocal/txband.h autocal/txbandmain.c
diffstat 4 files changed, 127 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sat Jul 15 18:20:48 2017 +0000
+++ b/.hgignore	Sat Jul 15 19:22:30 2017 +0000
@@ -4,6 +4,7 @@
 
 ^autocal/fc-rfcal-gmagic$
 ^autocal/fc-rfcal-rxband$
+^autocal/fc-rfcal-txband$
 ^autocal/fc-rfcal-txbasis$
 ^autocal/fc-rfcal-txcheck$
 ^autocal/fc-rfcal-vcxo$
--- a/autocal/Makefile	Sat Jul 15 18:20:48 2017 +0000
+++ b/autocal/Makefile	Sat Jul 15 19:22:30 2017 +0000
@@ -1,7 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2 -I/opt/freecalypso/include
-PROGS=	fc-rfcal-gmagic fc-rfcal-rxband fc-rfcal-txbasis fc-rfcal-txcheck \
-	fc-rfcal-vcxo
+PROGS=	fc-rfcal-gmagic fc-rfcal-rxband fc-rfcal-txband fc-rfcal-txbasis \
+	fc-rfcal-txcheck fc-rfcal-vcxo
 INSTBIN=/opt/freecalypso/bin
 
 GMAGIC_OBJS=	gmagicstand.o l1meas.o l1tmops.o rvinterf.o rxcommon.o \
@@ -10,6 +10,9 @@
 RXBAND_OBJS=	l1meas.o l1tmops.o rvinterf.o rxbandmain.o rxcommon.o \
 		rxupload.o sockopts.o tsidsock.o
 
+TXBAND_OBJS=	l1tmops.o rvinterf.o sockopts.o tsidsock.o txbandmain.o \
+		txpwrmeas.o
+
 TXBASIS_OBJS=	l1tmops.o rvinterf.o tsidsock.o txpwrmeas.o txstandbas.o
 
 TXCHECK_OBJS=	l1tmops.o rvinterf.o sockopts.o tsidsock.o txpwrmeas.o \
@@ -25,6 +28,9 @@
 fc-rfcal-rxband:	${RXBAND_OBJS}
 	${CC} -o $@ ${RXBAND_OBJS}
 
+fc-rfcal-txband:	${TXBAND_OBJS}
+	${CC} -o $@ ${TXBAND_OBJS}
+
 fc-rfcal-txbasis:	${TXBASIS_OBJS}
 	${CC} -o $@ ${TXBASIS_OBJS}
 
--- a/autocal/txband.h	Sat Jul 15 18:20:48 2017 +0000
+++ b/autocal/txband.h	Sat Jul 15 19:22:30 2017 +0000
@@ -13,6 +13,7 @@
 	unsigned	start_plnum;
 	unsigned	end_plnum;
 	struct tx_calchan_range *calchan_ranges;
+	unsigned	ref_subband;
 };
 
 #define	MAX_BASIS_POINTS	15
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/txbandmain.c	Sat Jul 15 19:22:30 2017 +0000
@@ -0,0 +1,117 @@
+/*
+ * 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);
+	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);
+
+
+}