FreeCalypso > hg > fc-rfcal-tools
comparison autocal/vcxomain.c @ 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 | 4cd55371d3e4 |
comparison
equal
deleted
inserted
replaced
27:841dd03d5c85 | 28:ba4b6877e227 |
---|---|
2 * This module contains the main() function for fc-rfcal-vcxo. | 2 * This module contains the main() function for fc-rfcal-vcxo. |
3 */ | 3 */ |
4 | 4 |
5 #include <math.h> | 5 #include <math.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <stdint.h> | |
7 #include <stdlib.h> | 8 #include <stdlib.h> |
8 #include <rvinterf/l1tm.h> | 9 #include <rvinterf/l1tm.h> |
9 #include <rvinterf/exitcodes.h> | 10 #include <rvinterf/exitcodes.h> |
11 #include "afcparams.h" | |
10 #include "stdband.h" | 12 #include "stdband.h" |
11 | 13 |
12 #define VCXOCAL_BAND 900 | 14 #define VCXOCAL_BAND 900 |
13 #define VCXOCAL_BAND_RFPW RFPW_STD_BAND(6, 0) | 15 #define VCXOCAL_BAND_RFPW RFPW_STD_BAND(6, 0) |
14 #define VCXOCAL_ARFCN 40 | 16 #define VCXOCAL_ARFCN 40 |
20 static int zero_search_dac1, zero_search_dac2, zero_search_incr; | 22 static int zero_search_dac1, zero_search_dac2, zero_search_incr; |
21 static float zero_search_freq1, zero_search_freq2; | 23 static float zero_search_freq1, zero_search_freq2; |
22 static float dac_min, dac_max, dac_init; | 24 static float dac_min, dac_max, dac_init; |
23 static int dac_init_int; | 25 static int dac_init_int; |
24 static float Psi_sta, Psi_st; | 26 static float Psi_sta, Psi_st; |
27 | |
28 struct afcparams afcparams_host, afcparams_arm; | |
25 | 29 |
26 prepare_rf_test_system() | 30 prepare_rf_test_system() |
27 { | 31 { |
28 char cmd[80]; | 32 char cmd[80]; |
29 | 33 |
95 | 99 |
96 /* Psi computations */ | 100 /* Psi computations */ |
97 Psi_sta = 2.0f * (float)M_PI * lin_a / 270833.0f; | 101 Psi_sta = 2.0f * (float)M_PI * lin_a / 270833.0f; |
98 Psi_st = Psi_sta * 0.8f; | 102 Psi_st = Psi_sta * 0.8f; |
99 | 103 |
100 /* afcparams output TBD */ | 104 /* compute and fill afcparams */ |
105 afcparams_host.psi_sta_inv = (unsigned)(1.0f / Psi_sta); | |
106 afcparams_host.psi_st = (unsigned)(Psi_st * 65536.0f); | |
107 afcparams_host.psi_st_32 = (unsigned)(Psi_st * 65536.0f * 65536.0f); | |
108 afcparams_host.psi_st_inv = (unsigned)(1.0f / Psi_st); | |
109 afcparams_host.dac_center = (int)(dac_init * 8.0f); | |
110 afcparams_host.dac_min = (int)(dac_min * 8.0f); | |
111 afcparams_host.dac_max = (int)(dac_max * 8.0f); | |
112 afcparams_host.snr_thr = 2560; | |
113 | |
114 /* print them out */ | |
115 printf("afcparams Psi_sta_inv: %u\n", afcparams_host.psi_sta_inv); | |
116 printf("afcparams Psi_st: %u\n", afcparams_host.psi_st); | |
117 printf("afcparams Psi_st_32: %u\n", afcparams_host.psi_st_32); | |
118 printf("afcparams Psi_st_inv: %u\n", afcparams_host.psi_st_inv); | |
119 printf("afcparams DAC_INIT*8: %d\n", afcparams_host.dac_center); | |
120 printf("afcparams DAC_MIN*8: %d\n", afcparams_host.dac_min); | |
121 printf("afcparams DAC_MAX*8: %d\n", afcparams_host.dac_max); | |
122 printf("afcparams snr_thr: %d\n", afcparams_host.snr_thr); | |
123 | |
124 /* conversion to LE and sending to L1 remain to be implemented */ | |
101 | 125 |
102 exit(0); | 126 exit(0); |
103 } | 127 } |