comparison autocal/rxband.c @ 58:46c72323182a

autocal/rxband.c: do_gmagic() factored out of main()
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 23:17:14 +0000
parents 2588f9eed11a
children 81e8f7e99d89
comparison
equal deleted inserted replaced
57:2588f9eed11a 58:46c72323182a
102 } 102 }
103 103
104 main(argc, argv) 104 main(argc, argv)
105 char **argv; 105 char **argv;
106 { 106 {
107 int pm, Gmagic;
108 char Gmagic_db[64];
109
110 socket_pathname_options(argc, argv); 107 socket_pathname_options(argc, argv);
111 finish_cmdline(argc, argv); 108 finish_cmdline(argc, argv);
112 connect_rvinterf_socket(); 109 connect_rvinterf_socket();
113 connect_tsid_socket(); 110 connect_tsid_socket();
114 setlinebuf(stdout); /* to allow logging with tee */ 111 setlinebuf(stdout); /* to allow logging with tee */
117 printf("Putting the DUT into Test Mode\n"); 114 printf("Putting the DUT into Test Mode\n");
118 do_tms(1); 115 do_tms(1);
119 do_rfpw(STD_BAND_FLAG, rxcal_band->rfpw_std_band); 116 do_rfpw(STD_BAND_FLAG, rxcal_band->rfpw_std_band);
120 l1tm_setup_for_rxcal(); 117 l1tm_setup_for_rxcal();
121 118
119 do_gmagic();
120 exit(0);
121 }
122
123 do_gmagic()
124 {
125 int pm, Gmagic;
126 char Gmagic_db[64];
127
128 printf("Calibrating GMagic\n");
122 pm = rx_measure(rxcal_band->main_arfcn); 129 pm = rx_measure(rxcal_band->main_arfcn);
123 Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2; 130 Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2;
124 halfdb_to_string(Gmagic, Gmagic_db); 131 halfdb_to_string(Gmagic, Gmagic_db);
125 printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db); 132 printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db);
126 exit(0); 133 return(0);
127 } 134 }