changeset 30:4cd55371d3e4

fc-rfcal-vcxo: upload and FFS save implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2017 00:05:33 +0000
parents d6ef94518117
children 6e8f2728c7f5
files autocal/vcxomain.c
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/vcxomain.c	Mon May 22 23:50:32 2017 +0000
+++ b/autocal/vcxomain.c	Tue May 23 00:05:33 2017 +0000
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <endian.h>
 #include <rvinterf/l1tm.h>
 #include <rvinterf/exitcodes.h>
 #include "afcparams.h"
@@ -121,7 +122,23 @@
 	printf("afcparams DAC_MAX*8: %d\n", afcparams_host.dac_max);
 	printf("afcparams snr_thr: %d\n", afcparams_host.snr_thr);
 
-	/* conversion to LE and sending to L1 remain to be implemented */
+	/* convert to LE for upload to the DUT */
+	afcparams_arm.psi_sta_inv = htole32(afcparams_host.psi_sta_inv);
+	afcparams_arm.psi_st      = htole32(afcparams_host.psi_st);
+	afcparams_arm.psi_st_32   = htole32(afcparams_host.psi_st_32);
+	afcparams_arm.psi_st_inv  = htole32(afcparams_host.psi_st_inv);
+	afcparams_arm.dac_center  = htole16(afcparams_host.dac_center);
+	afcparams_arm.dac_min     = htole16(afcparams_host.dac_min);
+	afcparams_arm.dac_max     = htole16(afcparams_host.dac_max);
+	afcparams_arm.snr_thr     = htole16(afcparams_host.snr_thr);
+
+	/* send them up */
+	printf("Uploading afcparams and INITIAL_AFC_DAC to the DUT\n");
+	do_rftw(AFC_PARAMS, &afcparams_arm, sizeof(struct afcparams));
+	do_rfpw(INITIAL_AFC_DAC, dac_init_int);
+	printf("Saving rf-cal and rf-cfg in FFS\n");
+	misc_enable(CFG_WRITE_RF_CAL);
+	misc_enable(CFG_WRITE_RF_CFG);
 
 	exit(0);
 }