diff autocal/txcalchan.c @ 77:3f63e71b6422

fc-rfcal-txband: implemented initial calchan clearing
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Jul 2017 20:25:31 +0000
parents
children 4ce87a30383f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/txcalchan.c	Sat Jul 15 20:25:31 2017 +0000
@@ -0,0 +1,43 @@
+/*
+ * This module contains the code for handling Tx calchan tables.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <endian.h>
+#include <rvinterf/l1tm.h>
+#include <rvinterf/exitcodes.h>
+#include "txband.h"
+#include "txcalchan.h"
+
+extern struct txcal_band *txcal_band;
+
+unsigned tx_calchan_values[TX_CALCHAN_TABLES][TX_CALCHAN_ENTRIES];
+
+init_tx_calchan()
+{
+	unsigned i, j;
+
+	for (i = 0; i < TX_CALCHAN_TABLES; i++)
+		for (j = 0; j < TX_CALCHAN_ENTRIES; j++)
+			tx_calchan_values[i][j] = 128;
+	return(0);
+}
+
+upload_tx_calchan()
+{
+	unsigned i, j;
+	struct tx_calchan_entry l1_table[TX_CALCHAN_TABLES][TX_CALCHAN_ENTRIES];
+
+	for (i = 0; i < TX_CALCHAN_TABLES; i++) {
+		for (j = 0; j < TX_CALCHAN_ENTRIES; j++) {
+			l1_table[i][j].arfcn_limit =
+			    htole16(txcal_band->calchan_ranges[j].upper_bound);
+			l1_table[i][j].chan_cal =
+				htole16(tx_calchan_values[i][j]);
+		}
+	}
+	do_rftw(TX_CAL_CHAN, l1_table, sizeof l1_table);
+	return(0);
+}