changeset 46:751f8d9efed0

Rx cal: started the single measurement code
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 06:25:59 +0000
parents 98abe6bd2042
children e86779d5445c
files autocal/rxcaldefs.h autocal/rxcommon.c
diffstat 2 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/rxcaldefs.h	Sat May 27 05:48:04 2017 +0000
+++ b/autocal/rxcaldefs.h	Sat May 27 06:25:59 2017 +0000
@@ -1,6 +1,6 @@
 /* some definitions for the Rx calibration process */
 
-#define	RXCAL_SIGGEN_LEVEL	149	/* -74.5 dBm */
+#define	RXCAL_SIGGEN_LEVEL	-149	/* -74.5 dBm */
 #define	RXCAL_AGC_DB		34
 
 #define	RXCAL_LOOP_COUNT	50
--- a/autocal/rxcommon.c	Sat May 27 05:48:04 2017 +0000
+++ b/autocal/rxcommon.c	Sat May 27 06:25:59 2017 +0000
@@ -21,3 +21,34 @@
 	do_scw(STAT_BITMASK, DSP_PM);
 	return(0);
 }
+
+halfdb_to_string(halfdb, strbuf)
+	int halfdb;
+	char *strbuf;
+{
+	int sign;
+
+	if (halfdb < 0) {
+		sign = 1;
+		halfdb = -halfdb;
+	} else
+		sign = 0;
+	sprintf(strbuf, "%s%d.%c", sign ? "-" : "", halfdb >> 1,
+		halfdb & 1 ? '5' : '0');
+	return(0);
+}
+
+rx_single_offset_meas(arfcn, offset)
+	unsigned arfcn;
+	char *offset;
+{
+	char dbm[64], tsid_cmd[128];
+
+	halfdb_to_string(RXCAL_SIGGEN_LEVEL, dbm);
+	printf("Rx meas at ARFCN %u offset %s kHz, TL=%s dBm, AGC=%d dB\n",
+		arfcn, offset, dbm, RXCAL_AGC_DB);
+	sprintf(tsid_cmd, "signal-gen-sine %u %s %s\n", arfcn, offset, dbm);
+	tsid_command(tsid_cmd);
+
+
+}