diff autocal/txbasis.c @ 80:b0da2db4e36b

fc-rfcal-txband: basis run implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Jul 2017 21:22:38 +0000
parents
children 83b24a1dfd4a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/txbasis.c	Sat Jul 15 21:22:38 2017 +0000
@@ -0,0 +1,39 @@
+/*
+ * The basis steps of Tx power level calibration are implemented here.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <rvinterf/l1tm.h>
+#include <rvinterf/exitcodes.h>
+#include "txband.h"
+
+extern double tx_power_meas();
+extern vout_t dbm_to_vout();
+
+extern struct txcal_band *txcal_band;
+extern struct tx_basis_point tx_basis[MAX_BASIS_POINTS];
+extern unsigned num_basis_points;
+
+txcal_basis_run()
+{
+	unsigned n;
+	double meas;
+
+	printf("Performing the calibration basis run\n");
+	do_txpw(TX_PWR_LEVEL, txcal_band->start_plnum);
+	printf("Starting RF Tx on the DUT\n");
+	do_rfe(RX_TX_TCH);
+
+	for (n = 0; n < num_basis_points; n++) {
+		do_txpw(TX_APC_DAC, tx_basis[n].apc);
+		usleep(20000);
+		meas = tx_power_meas();
+		printf("APC DAC=%d: %.2f dBm\n", tx_basis[n].apc, meas);
+		tx_basis[n].vout = dbm_to_vout(meas);
+	}
+
+	printf("Stopping RF Tx on the DUT\n");
+	do_rfe(STOP_ALL);
+	return(0);
+}