FreeCalypso > hg > fc-rfcal-tools
changeset 28:ba4b6877e227
fc-rfcal-vcxo: afcparams computation implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 22 May 2017 23:36:14 +0000 |
parents | 841dd03d5c85 |
children | d6ef94518117 |
files | autocal/afcparams.h autocal/vcxomain.c |
diffstat | 2 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autocal/afcparams.h Mon May 22 23:36:14 2017 +0000 @@ -0,0 +1,13 @@ +/* definition of the afcparams structure */ + +struct afcparams { + uint32_t psi_sta_inv; + uint32_t psi_st; + uint32_t psi_st_32; + uint32_t psi_st_inv; + + int16_t dac_center; + int16_t dac_min; + int16_t dac_max; + int16_t snr_thr; +};
--- a/autocal/vcxomain.c Mon May 22 23:10:34 2017 +0000 +++ b/autocal/vcxomain.c Mon May 22 23:36:14 2017 +0000 @@ -4,9 +4,11 @@ #include <math.h> #include <stdio.h> +#include <stdint.h> #include <stdlib.h> #include <rvinterf/l1tm.h> #include <rvinterf/exitcodes.h> +#include "afcparams.h" #include "stdband.h" #define VCXOCAL_BAND 900 @@ -23,6 +25,8 @@ static int dac_init_int; static float Psi_sta, Psi_st; +struct afcparams afcparams_host, afcparams_arm; + prepare_rf_test_system() { char cmd[80]; @@ -97,7 +101,27 @@ Psi_sta = 2.0f * (float)M_PI * lin_a / 270833.0f; Psi_st = Psi_sta * 0.8f; - /* afcparams output TBD */ + /* compute and fill afcparams */ + afcparams_host.psi_sta_inv = (unsigned)(1.0f / Psi_sta); + afcparams_host.psi_st = (unsigned)(Psi_st * 65536.0f); + afcparams_host.psi_st_32 = (unsigned)(Psi_st * 65536.0f * 65536.0f); + afcparams_host.psi_st_inv = (unsigned)(1.0f / Psi_st); + afcparams_host.dac_center = (int)(dac_init * 8.0f); + afcparams_host.dac_min = (int)(dac_min * 8.0f); + afcparams_host.dac_max = (int)(dac_max * 8.0f); + afcparams_host.snr_thr = 2560; + + /* print them out */ + printf("afcparams Psi_sta_inv: %u\n", afcparams_host.psi_sta_inv); + printf("afcparams Psi_st: %u\n", afcparams_host.psi_st); + printf("afcparams Psi_st_32: %u\n", afcparams_host.psi_st_32); + printf("afcparams Psi_st_inv: %u\n", afcparams_host.psi_st_inv); + printf("afcparams DAC_INIT*8: %d\n", afcparams_host.dac_center); + printf("afcparams DAC_MIN*8: %d\n", afcparams_host.dac_min); + 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 */ exit(0); }