changeset 60:81e8f7e99d89

fc-rfcal-rxband: upload of GMagic to DUT implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 23:35:06 +0000
parents c87067884da7
children 0bf853d1b68e
files autocal/Makefile autocal/l1tmops.c autocal/rxband.c autocal/rxupload.c
diffstat 4 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/Makefile	Sat May 27 23:23:35 2017 +0000
+++ b/autocal/Makefile	Sat May 27 23:35:06 2017 +0000
@@ -7,8 +7,8 @@
 GMAGIC_OBJS=	gmagicmain.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 sockopts.o \
-		tsidsock.o
+RXBAND_OBJS=	l1meas.o l1tmops.o rvinterf.o rxband.o rxcommon.o rxupload.o \
+		sockopts.o tsidsock.o
 
 TXBASIS_OBJS=	l1tmops.o rvinterf.o tsidsock.o txbasis.o txpwrmeas.o
 
--- a/autocal/l1tmops.c	Sat May 27 23:23:35 2017 +0000
+++ b/autocal/l1tmops.c	Sat May 27 23:35:06 2017 +0000
@@ -210,8 +210,8 @@
 			rvi_msg[3]);
 		exit(ERROR_TARGET);
 	}
-	if (rvi_msg_len != size + 6) {
-		fprintf(stderr, "DUT error: rftr response wrong length\n");
+	if (rvi_msg_len < size + 6) {
+		fprintf(stderr, "DUT error: rftr response too short\n");
 		exit(ERROR_TARGET);
 	}
 	if (rvi_msg[4] != index) {
--- a/autocal/rxband.c	Sat May 27 23:23:35 2017 +0000
+++ b/autocal/rxband.c	Sat May 27 23:35:06 2017 +0000
@@ -130,5 +130,6 @@
 	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(Gmagic);
 	return(0);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/rxupload.c	Sat May 27 23:35:06 2017 +0000
@@ -0,0 +1,25 @@
+/*
+ * This module contains the RF table upload code for fc-rfcal-rxband.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <endian.h>
+#include <rvinterf/l1tm.h>
+#include <rvinterf/exitcodes.h>
+#include "rxband.h"
+#include "rxtables.h"
+
+extern struct rxcal_band *rxcal_band;
+
+upload_gmagic(Gmagic)
+	unsigned Gmagic;
+{
+	struct rx_agc_params agcparams;
+
+	do_rftr(RX_AGC_PARAMS, &agcparams, sizeof agcparams);
+	agcparams.g_magic = htole16(Gmagic);
+	do_rftw(RX_AGC_PARAMS, &agcparams, sizeof agcparams);
+	return(0);
+}