annotate autocal/vcxomain.c @ 68:3ec82dc1dbda

fc-cmu200d: implemented reading and parsing of cable config files (-c arg)
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 Jul 2017 04:34:15 +0000
parents 6e8f2728c7f5
children 7ad5836d3b87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the main() function for fc-rfcal-vcxo.
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
27
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
5 #include <math.h>
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
28
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
7 #include <stdint.h>
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
30
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
9 #include <endian.h>
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <rvinterf/l1tm.h>
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <rvinterf/exitcodes.h>
28
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
12 #include "afcparams.h"
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "stdband.h"
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #define VCXOCAL_BAND 900
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define VCXOCAL_BAND_RFPW RFPW_STD_BAND(6, 0)
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #define VCXOCAL_ARFCN 40
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
24
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
19 extern float vcxo_freq_meas();
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
20
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
21 static float freq_max_neg, freq_max_pos;
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
22 static float lin_a, lin_b, lin_a2, lin_b2;
26
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
23 static int zero_search_dac1, zero_search_dac2, zero_search_incr;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
24 static float zero_search_freq1, zero_search_freq2;
27
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
25 static float dac_min, dac_max, dac_init;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
26 static int dac_init_int;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
27 static float Psi_sta, Psi_st;
24
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
28
28
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
29 struct afcparams afcparams_host, afcparams_arm;
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
30
23
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
31 prepare_rf_test_system()
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
32 {
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
33 char cmd[80];
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
34
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
35 printf("Preparing RF test system for VCXO calibration\n");
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
36 sprintf(cmd, "vcxo-cal-setup %d %d\n", VCXOCAL_BAND, VCXOCAL_ARFCN);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
37 tsid_command(cmd);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
38 return(0);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
39 }
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
40
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 main(argc, argv)
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 char **argv;
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 {
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 socket_pathname_options(argc, argv);
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 connect_rvinterf_socket();
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 connect_tsid_socket();
31
6e8f2728c7f5 fc-rfcal-vcxo: added setlinebuf(stdout) to allow easier logging with tee
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
47 setlinebuf(stdout); /* to allow logging with tee */
23
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
48 prepare_rf_test_system();
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
49
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
50 printf("Putting the DUT into Test Mode\n");
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
51 do_tms(1);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
52 do_rfpw(STD_BAND_FLAG, VCXOCAL_BAND_RFPW);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
53 do_rfpw(TCH_ARFCN, VCXOCAL_ARFCN);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
54 do_rfpw(AFC_ENA_FLAG, 0);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
55 do_txpw(TX_PWR_LEVEL, 12);
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
56 printf("Starting RF Tx on the DUT\n");
9a9fd9ebe799 autocal/vcxomain.c: coming along
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
57 do_rfe(RX_TX_TCH);
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
24
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
59 /* initial measurements at the DAC extremes */
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
60 freq_max_neg = vcxo_freq_meas(-2048, "max-neg");
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
61 freq_max_pos = vcxo_freq_meas(2048, "max-pos");
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
62 lin_a = (freq_max_pos - freq_max_neg) / 4096.0f;
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
63 lin_b = freq_max_pos - lin_a * 2048.0f;
26
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
64 zero_search_dac1 = -lin_b / lin_a;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
65 zero_search_freq1 = vcxo_freq_meas(zero_search_dac1, "zero-search");
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
66
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
67 /* search for zero crossing */
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
68 if (zero_search_freq1 < 0)
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
69 zero_search_incr = 100;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
70 else
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
71 zero_search_incr = -100;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
72 for (;;) {
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
73 zero_search_dac2 = zero_search_dac1 + zero_search_incr;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
74 zero_search_freq2 = vcxo_freq_meas(zero_search_dac2,
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
75 "zero-search");
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
76 if (zero_search_incr > 0 && zero_search_freq2 >= 0)
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
77 break;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
78 if (zero_search_incr < 0 && zero_search_freq2 < 0)
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
79 break;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
80 zero_search_dac1 = zero_search_dac2;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
81 zero_search_freq1 = zero_search_freq2;
a2e4da9d85cc fc-rfcal-vcxo: search for zero crossing implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 24
diff changeset
82 }
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83
27
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
84 /* second linear approximation */
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
85 lin_a2 = (zero_search_freq2 - zero_search_freq1) /
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
86 (float)(zero_search_dac2 - zero_search_dac1);
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
87 lin_b2 = zero_search_freq2 - lin_a2 * zero_search_dac2;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
88
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
89 /* DAC settings */
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
90 dac_min = (-13500.0f - lin_b) / lin_a;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
91 dac_max = (13500.0f - lin_b) / lin_a;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
92 dac_init = -lin_b2 / lin_a2;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
93 dac_init_int = (int) dac_init;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
94
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
95 /* check the frequency offset at the final DAC value */
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
96 vcxo_freq_meas(dac_init_int, "zero-check");
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
97
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
98 /* done with the measurements and the Tx */
24
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
99 printf("Stopping RF Tx on the DUT\n");
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
100 do_rfe(STOP_ALL);
27
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
101
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
102 /* Psi computations */
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
103 Psi_sta = 2.0f * (float)M_PI * lin_a / 270833.0f;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
104 Psi_st = Psi_sta * 0.8f;
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
105
28
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
106 /* compute and fill afcparams */
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
107 afcparams_host.psi_sta_inv = (unsigned)(1.0f / Psi_sta);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
108 afcparams_host.psi_st = (unsigned)(Psi_st * 65536.0f);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
109 afcparams_host.psi_st_32 = (unsigned)(Psi_st * 65536.0f * 65536.0f);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
110 afcparams_host.psi_st_inv = (unsigned)(1.0f / Psi_st);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
111 afcparams_host.dac_center = (int)(dac_init * 8.0f);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
112 afcparams_host.dac_min = (int)(dac_min * 8.0f);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
113 afcparams_host.dac_max = (int)(dac_max * 8.0f);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
114 afcparams_host.snr_thr = 2560;
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
115
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
116 /* print them out */
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
117 printf("afcparams Psi_sta_inv: %u\n", afcparams_host.psi_sta_inv);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
118 printf("afcparams Psi_st: %u\n", afcparams_host.psi_st);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
119 printf("afcparams Psi_st_32: %u\n", afcparams_host.psi_st_32);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
120 printf("afcparams Psi_st_inv: %u\n", afcparams_host.psi_st_inv);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
121 printf("afcparams DAC_INIT*8: %d\n", afcparams_host.dac_center);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
122 printf("afcparams DAC_MIN*8: %d\n", afcparams_host.dac_min);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
123 printf("afcparams DAC_MAX*8: %d\n", afcparams_host.dac_max);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
124 printf("afcparams snr_thr: %d\n", afcparams_host.snr_thr);
ba4b6877e227 fc-rfcal-vcxo: afcparams computation implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
125
30
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
126 /* convert to LE for upload to the DUT */
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
127 afcparams_arm.psi_sta_inv = htole32(afcparams_host.psi_sta_inv);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
128 afcparams_arm.psi_st = htole32(afcparams_host.psi_st);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
129 afcparams_arm.psi_st_32 = htole32(afcparams_host.psi_st_32);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
130 afcparams_arm.psi_st_inv = htole32(afcparams_host.psi_st_inv);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
131 afcparams_arm.dac_center = htole16(afcparams_host.dac_center);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
132 afcparams_arm.dac_min = htole16(afcparams_host.dac_min);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
133 afcparams_arm.dac_max = htole16(afcparams_host.dac_max);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
134 afcparams_arm.snr_thr = htole16(afcparams_host.snr_thr);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
135
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
136 /* send them up */
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
137 printf("Uploading afcparams and INITIAL_AFC_DAC to the DUT\n");
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
138 do_rftw(AFC_PARAMS, &afcparams_arm, sizeof(struct afcparams));
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
139 do_rfpw(INITIAL_AFC_DAC, dac_init_int);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
140 printf("Saving rf-cal and rf-cfg in FFS\n");
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
141 misc_enable(CFG_WRITE_RF_CAL);
4cd55371d3e4 fc-rfcal-vcxo: upload and FFS save implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
142 misc_enable(CFG_WRITE_RF_CFG);
27
841dd03d5c85 fc-rfcal-vcxo: almost done
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
143
24
0b6881281d86 fc-rfcal-vcxo ready for first test
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
144 exit(0);
21
a3f48378658d autocal: beginning of fc-rfcal-vcxo
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 }