diff autocal/rxupload.c @ 61:0bf853d1b68e

fc-rfcal-rxband: almost finished
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 28 May 2017 00:10:16 +0000
parents 81e8f7e99d89
children
line wrap: on
line diff
--- a/autocal/rxupload.c	Sat May 27 23:35:06 2017 +0000
+++ b/autocal/rxupload.c	Sun May 28 00:10:16 2017 +0000
@@ -12,9 +12,9 @@
 #include "rxtables.h"
 
 extern struct rxcal_band *rxcal_band;
+extern int Gmagic, rx_calchan_values[];
 
-upload_gmagic(Gmagic)
-	unsigned Gmagic;
+upload_gmagic()
 {
 	struct rx_agc_params agcparams;
 
@@ -23,3 +23,21 @@
 	do_rftw(RX_AGC_PARAMS, &agcparams, sizeof agcparams);
 	return(0);
 }
+
+upload_rx_calchan()
+{
+	unsigned n;
+	struct rx_calchan_entry calchan_table[RX_CALCHAN_ENTRIES];
+
+	for (n = 0; n < rxcal_band->num_calchan_ranges; n++) {
+		calchan_table[n].upper_bound =
+			htole16(rxcal_band->calchan_ranges[n].upper_bound);
+		calchan_table[n].agc_calib = htole16(rx_calchan_values[n]);
+	}
+	for (; n < RX_CALCHAN_ENTRIES; n++) {
+		calchan_table[n].upper_bound = 0;
+		calchan_table[n].agc_calib = 0;
+	}
+	do_rftw(RX_CAL_CHAN, calchan_table, sizeof calchan_table);
+	return(0);
+}