FreeCalypso > hg > fc-rfcal-tools
annotate autocal/rxbandmain.c @ 124:9f09a7c3607a
fc-rfcal-txband: level error tolerance tightened to 0.75 dB
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 12 Jan 2019 20:15:17 +0000 |
parents | d388732c2f73 |
children |
rev | line source |
---|---|
57
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the main() function for fc-rfcal-rxband. |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdlib.h> |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <rvinterf/l1tm.h> |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <rvinterf/exitcodes.h> |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "rxband.h" |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "rxcaldefs.h" |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "stdband.h" |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 struct rx_calchan_range rx_calchan_850[] = { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 {128, 138, 128}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 {139, 157, 148}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 {158, 178, 168}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 {179, 199, 189}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 {200, 217, 208}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 {218, 239, 228}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 {240, 251, 251} |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 }; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 struct rx_calchan_range rx_calchan_900[] = { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 { 0, 10, 1}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 { 11, 30, 20}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 { 31, 51, 37}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 { 52, 71, 62}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 { 72, 90, 80}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 { 91, 112, 100}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 { 113, 124, 124}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 { 975, 991, 975}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 { 992, 1009, 1000}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 {1010, 1023, 1017} |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 }; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 struct rx_calchan_range rx_calchan_1800[] = { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 {512, 548, 512}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 {549, 622, 585}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 {623, 680, 660}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 {681, 745, 698}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 {746, 812, 790}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 {813, 860, 835}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 {861, 885, 885} |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 }; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 struct rx_calchan_range rx_calchan_1900[] = { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 {512, 548, 512}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 {549, 622, 585}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 {623, 680, 661}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 {681, 745, 700}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 {746, 795, 790}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 {796, 810, 805} |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 }; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 struct rxcal_band rxcal_band_list[] = { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 {"850", RFPW_STD_BAND_850, 189, rx_calchan_850, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 sizeof(rx_calchan_850) / sizeof(struct rx_calchan_range)}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 {"900", RFPW_STD_BAND_900, 37, rx_calchan_900, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 sizeof(rx_calchan_900) / sizeof(struct rx_calchan_range)}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 {"1800", RFPW_STD_BAND_1800, 698, rx_calchan_1800, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 sizeof(rx_calchan_1800) / sizeof(struct rx_calchan_range)}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 {"1900", RFPW_STD_BAND_1900, 661, rx_calchan_1900, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 sizeof(rx_calchan_1900) / sizeof(struct rx_calchan_range)}, |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 {0, 0, 0, 0, 0} |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 }; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 struct rxcal_band *rxcal_band; |
61
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
70 int Gmagic, rx_calchan_values[10]; |
57
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 finish_cmdline(argc, argv) |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 char **argv; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 extern int optind; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 struct rxcal_band *band; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 if (argc - optind != 1) { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 fprintf(stderr, "usage: %s band\n", argv[0]); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 exit(ERROR_USAGE); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 for (band = rxcal_band_list; band->name; band++) |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 if (!strcmp(band->name, argv[optind])) |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 break; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 if (!band->name) { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 fprintf(stderr, "error: \"%s\" is not a known band\n", |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 argv[optind]); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 exit(ERROR_USAGE); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 } |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 rxcal_band = band; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 return(0); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 } |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 prepare_rf_test_system() |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 char cmd[80]; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 printf("Preparing RF test system for %s MHz Rx calibration\n", |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 rxcal_band->name); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 sprintf(cmd, "signal-gen-setup %s\n", rxcal_band->name); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 tsid_command(cmd); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 return(0); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 } |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 main(argc, argv) |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 char **argv; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 { |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 socket_pathname_options(argc, argv); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 finish_cmdline(argc, argv); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 connect_rvinterf_socket(); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 connect_tsid_socket(); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 setlinebuf(stdout); /* to allow logging with tee */ |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 prepare_rf_test_system(); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 printf("Putting the DUT into Test Mode\n"); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 do_tms(1); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 do_rfpw(STD_BAND_FLAG, rxcal_band->rfpw_std_band); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 l1tm_setup_for_rxcal(); |
58
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
119 do_gmagic(); |
62
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
120 do_rx_calchan(); |
67
3f92d88fbb1c
fc-rfcal-rxband: FFS write implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
121 |
3f92d88fbb1c
fc-rfcal-rxband: FFS write implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
122 printf("Saving calibrated values in FFS\n"); |
3f92d88fbb1c
fc-rfcal-rxband: FFS write implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
62
diff
changeset
|
123 misc_enable(CFG_WRITE_RX_CAL); |
58
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
124 exit(0); |
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
125 } |
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
126 |
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
127 do_gmagic() |
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
128 { |
61
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
129 int pm; |
58
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
130 char Gmagic_db[64]; |
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
131 |
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
132 printf("Calibrating GMagic\n"); |
57
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 pm = rx_measure(rxcal_band->main_arfcn); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2; |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 halfdb_to_string(Gmagic, Gmagic_db); |
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db); |
61
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
137 upload_gmagic(); |
58
46c72323182a
autocal/rxband.c: do_gmagic() factored out of main()
Mychaela Falconia <falcon@freecalypso.org>
parents:
57
diff
changeset
|
138 return(0); |
57
2588f9eed11a
fc-rfcal-rxband started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 } |
62
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
140 |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
141 do_rx_calchan() |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
142 { |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
143 unsigned n; |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
144 int pm; |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
145 |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
146 printf("Calibrating RSSI channel compensation\n"); |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
147 for (n = 0; n < rxcal_band->num_calchan_ranges; n++) { |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
148 pm = rx_measure(rxcal_band->calchan_ranges[n].test_arfcn); |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
149 rx_calchan_values[n] = RXCAL_SIGGEN_LEVEL - pm + |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
150 RXCAL_AGC_DB * 2 + Gmagic; |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
151 } |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
152 for (n = 0; n < rxcal_band->num_calchan_ranges; n++) |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
153 printf("ARFCN %u-%u: correction=%d\n", |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
154 rxcal_band->calchan_ranges[n].lower_bound, |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
155 rxcal_band->calchan_ranges[n].upper_bound, |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
156 rx_calchan_values[n]); |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
157 upload_rx_calchan(); |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
158 return(0); |
a98873b713c3
fc-rfcal-rxband: channel calibration implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
61
diff
changeset
|
159 } |