# HG changeset patch # User Mychaela Falconia # Date 1500142489 0 # Node ID c9bd1f75029f11385905adebc99034e07208a11f # Parent 2db97ef5e169bea23b335f5ee18b232d689a425d autocal: C main modules for standalone programs renamed more sensibly diff -r 2db97ef5e169 -r c9bd1f75029f autocal/Makefile --- a/autocal/Makefile Sat Jul 15 17:58:14 2017 +0000 +++ b/autocal/Makefile Sat Jul 15 18:14:49 2017 +0000 @@ -4,16 +4,16 @@ fc-rfcal-vcxo INSTBIN=/opt/freecalypso/bin -GMAGIC_OBJS= gmagicmain.o l1meas.o l1tmops.o rvinterf.o rxcommon.o \ +GMAGIC_OBJS= gmagicstand.o l1meas.o l1tmops.o rvinterf.o rxcommon.o \ sockopts.o tsidsock.o RXBAND_OBJS= l1meas.o l1tmops.o rvinterf.o rxband.o rxcommon.o rxupload.o \ sockopts.o tsidsock.o -TXBASIS_OBJS= l1tmops.o rvinterf.o tsidsock.o txbasis.o txpwrmeas.o +TXBASIS_OBJS= l1tmops.o rvinterf.o tsidsock.o txpwrmeas.o txstandbas.o -TXCHECK_OBJS= l1tmops.o rvinterf.o sockopts.o tsidsock.o txchkmain.o \ - txpwrmeas.o +TXCHECK_OBJS= l1tmops.o rvinterf.o sockopts.o tsidsock.o txpwrmeas.o \ + txstandchk.o VCXO_OBJS= l1tmops.o rvinterf.o sockopts.o tsidsock.o vcxomain.o vcxomeas.o diff -r 2db97ef5e169 -r c9bd1f75029f autocal/gmagicmain.c --- a/autocal/gmagicmain.c Sat Jul 15 17:58:14 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * This module contains the main() function for fc-rfcal-gmagic. - */ - -#include -#include -#include -#include -#include -#include -#include "rxcaldefs.h" -#include "stdband.h" - -static struct band { - char *name; - unsigned rfpw_std_band; - unsigned default_arfcn; -} bands[] = { - {"850", RFPW_STD_BAND_850, 189}, - {"900", RFPW_STD_BAND_900, 37}, - {"1800", RFPW_STD_BAND_1800, 698}, - {"1900", RFPW_STD_BAND_1900, 661}, - {0, 0, 0} -}; -static struct band *selected_band; -static unsigned arfcn; - -finish_cmdline(argc, argv) - char **argv; -{ - extern int optind; - struct band *band; - - if (argc - optind < 1 || argc - optind > 2) { - fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]); - exit(ERROR_USAGE); - } - for (band = bands; band->name; band++) - if (!strcmp(band->name, argv[optind])) - break; - if (!band->name) { - fprintf(stderr, "error: \"%s\" is not a known band\n", - argv[optind]); - exit(ERROR_USAGE); - } - selected_band = band; - if (argv[optind+1]) - arfcn = atoi(argv[optind+1]); - else - arfcn = band->default_arfcn; - return(0); -} - -prepare_rf_test_system() -{ - char cmd[80]; - - printf("Preparing RF test system for %s MHz Rx calibration\n", - selected_band->name); - sprintf(cmd, "signal-gen-setup %s\n", selected_band->name); - tsid_command(cmd); - return(0); -} - -main(argc, argv) - char **argv; -{ - int pm, Gmagic; - char Gmagic_db[64]; - - socket_pathname_options(argc, argv); - finish_cmdline(argc, argv); - connect_rvinterf_socket(); - connect_tsid_socket(); - setlinebuf(stdout); /* to allow logging with tee */ - prepare_rf_test_system(); - - printf("Putting the DUT into Test Mode\n"); - do_tms(1); - do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band); - l1tm_setup_for_rxcal(); - pm = rx_measure(arfcn); - Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2; - halfdb_to_string(Gmagic, Gmagic_db); - printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db); - exit(0); -} diff -r 2db97ef5e169 -r c9bd1f75029f autocal/gmagicstand.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autocal/gmagicstand.c Sat Jul 15 18:14:49 2017 +0000 @@ -0,0 +1,89 @@ +/* + * fc-rfcal-gmagic is a debug utility implementing just one part + * of the fc-rfcal-rxband process in a standalone manner; + * this module contains the main() function for this standalone utlity. + */ + +#include +#include +#include +#include +#include +#include +#include "rxcaldefs.h" +#include "stdband.h" + +static struct band { + char *name; + unsigned rfpw_std_band; + unsigned default_arfcn; +} bands[] = { + {"850", RFPW_STD_BAND_850, 189}, + {"900", RFPW_STD_BAND_900, 37}, + {"1800", RFPW_STD_BAND_1800, 698}, + {"1900", RFPW_STD_BAND_1900, 661}, + {0, 0, 0} +}; +static struct band *selected_band; +static unsigned arfcn; + +finish_cmdline(argc, argv) + char **argv; +{ + extern int optind; + struct band *band; + + if (argc - optind < 1 || argc - optind > 2) { + fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]); + exit(ERROR_USAGE); + } + for (band = bands; band->name; band++) + if (!strcmp(band->name, argv[optind])) + break; + if (!band->name) { + fprintf(stderr, "error: \"%s\" is not a known band\n", + argv[optind]); + exit(ERROR_USAGE); + } + selected_band = band; + if (argv[optind+1]) + arfcn = atoi(argv[optind+1]); + else + arfcn = band->default_arfcn; + return(0); +} + +prepare_rf_test_system() +{ + char cmd[80]; + + printf("Preparing RF test system for %s MHz Rx calibration\n", + selected_band->name); + sprintf(cmd, "signal-gen-setup %s\n", selected_band->name); + tsid_command(cmd); + return(0); +} + +main(argc, argv) + char **argv; +{ + int pm, Gmagic; + char Gmagic_db[64]; + + socket_pathname_options(argc, argv); + finish_cmdline(argc, argv); + connect_rvinterf_socket(); + connect_tsid_socket(); + setlinebuf(stdout); /* to allow logging with tee */ + prepare_rf_test_system(); + + printf("Putting the DUT into Test Mode\n"); + do_tms(1); + do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band); + l1tm_setup_for_rxcal(); + pm = rx_measure(arfcn); + Gmagic = pm - RXCAL_SIGGEN_LEVEL - RXCAL_AGC_DB * 2; + halfdb_to_string(Gmagic, Gmagic_db); + printf("GMagic=%d (%s dB)\n", Gmagic, Gmagic_db); + exit(0); +} diff -r 2db97ef5e169 -r c9bd1f75029f autocal/txbasis.c --- a/autocal/txbasis.c Sat Jul 15 17:58:14 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* - * This module contains the main() function for fc-rfcal-txbasis. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "stdband.h" - -extern char *rvif_socket_pathname, *tsid_socket_pathname; - -extern double tx_power_meas(); - -static struct band { - char *name; - unsigned rfpw_std_band; - unsigned default_arfcn; -} bands[] = { - {"850", RFPW_STD_BAND_850, 190}, - {"900", RFPW_STD_BAND_900, 40}, - {"1800", RFPW_STD_BAND_1800, 700}, - {"1900", RFPW_STD_BAND_1900, 660}, - {0, 0, 0} -}; -static struct band *selected_band; -static unsigned arfcn, arfcn_set; - -cmdline_options(argc, argv) - char **argv; -{ - extern char *optarg; - int c; - - while ((c = getopt(argc, argv, "a:s:t:")) != EOF) { - switch (c) { - case 'a': - arfcn = atoi(optarg); - arfcn_set = 1; - continue; - case 's': - rvif_socket_pathname = optarg; - continue; - case 't': - tsid_socket_pathname = optarg; - continue; - case '?': - default: - /* error msg already printed */ - exit(ERROR_USAGE); - } - } - return(0); -} - -select_band(bandname) - char *bandname; -{ - struct band *band; - - for (band = bands; band->name; band++) - if (!strcmp(band->name, bandname)) - break; - if (!band->name) { - fprintf(stderr, "error: \"%s\" is not a known band\n", - bandname); - exit(ERROR_USAGE); - } - selected_band = band; - if (!arfcn_set) - arfcn = band->default_arfcn; - return(0); -} - -main(argc, argv) - char **argv; -{ - extern int optind; - int apc; - double meas; - - cmdline_options(argc, argv); - if (argc - optind < 2) { - fprintf(stderr, "usage: %s band apc...\n", argv[0]); - exit(ERROR_USAGE); - } - select_band(argv[optind++]); - - connect_rvinterf_socket(); - connect_tsid_socket(); - setlinebuf(stdout); /* to allow logging with tee */ - printf("Preparing RF test system for %s MHz Tx calibration\n", - selected_band->name); - do_txpwr_cal_setup(selected_band->name, arfcn); - - printf("Putting the DUT into Test Mode\n"); - do_tms(1); - do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band); - do_rfpw(TCH_ARFCN, arfcn); - do_rfpw(AFC_ENA_FLAG, 0); - printf("Starting RF Tx on the DUT\n"); - do_rfe(RX_TX_TCH); - - for (; optind < argc; optind++) { - apc = atoi(argv[optind]); - do_txpw(TX_APC_DAC, apc); - usleep(20000); - meas = tx_power_meas(); - printf("APC DAC=%d: %.2f dBm\n", apc, meas); - } - - printf("Stopping RF Tx on the DUT\n"); - do_rfe(STOP_ALL); - exit(0); -} diff -r 2db97ef5e169 -r c9bd1f75029f autocal/txchkmain.c --- a/autocal/txchkmain.c Sat Jul 15 17:58:14 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * This module contains the main() function for fc-rfcal-txcheck. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "stdband.h" - -extern double tx_power_meas(); - -static struct band { - char *name; - unsigned rfpw_std_band; - unsigned default_arfcn; - unsigned start_plnum; - unsigned end_plnum; - int spec_max_dbm; -} bands[] = { - {"850", RFPW_STD_BAND_850, 190, 5, 19, 33}, - {"900", RFPW_STD_BAND_900, 40, 5, 19, 33}, - {"1800", RFPW_STD_BAND_1800, 700, 0, 15, 30}, - {"1900", RFPW_STD_BAND_1900, 660, 0, 15, 30}, - {0, 0, 0} -}; -static struct band *selected_band; -static unsigned arfcn; - -finish_cmdline(argc, argv) - char **argv; -{ - extern int optind; - struct band *band; - - if (argc - optind < 1 || argc - optind > 2) { - fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]); - exit(ERROR_USAGE); - } - for (band = bands; band->name; band++) - if (!strcmp(band->name, argv[optind])) - break; - if (!band->name) { - fprintf(stderr, "error: \"%s\" is not a known band\n", - argv[optind]); - exit(ERROR_USAGE); - } - selected_band = band; - if (argv[optind+1]) - arfcn = atoi(argv[optind+1]); - else - arfcn = band->default_arfcn; - return(0); -} - -main(argc, argv) - char **argv; -{ - unsigned plnum; - double meas; - int spec_dbm; - - socket_pathname_options(argc, argv); - finish_cmdline(argc, argv); - connect_rvinterf_socket(); - connect_tsid_socket(); - setlinebuf(stdout); /* to allow logging with tee */ - printf("Preparing RF test system for %s MHz Tx calibration\n", - selected_band->name); - do_txpwr_cal_setup(selected_band->name, arfcn); - - printf("Putting the DUT into Test Mode\n"); - do_tms(1); - do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band); - do_rfpw(TCH_ARFCN, arfcn); - do_rfpw(AFC_ENA_FLAG, 0); - printf("Starting RF Tx on the DUT\n"); - do_rfe(RX_TX_TCH); - - spec_dbm = selected_band->spec_max_dbm; - for (plnum = selected_band->start_plnum; - plnum <= selected_band->end_plnum; plnum++, spec_dbm -= 2) { - do_txpw(TX_PWR_LEVEL, plnum); - usleep(20000); - meas = tx_power_meas(); - printf( - "Tx power level #%u: spec %d dBm, meas %.2f dBm (%+.2f)\n", - plnum, spec_dbm, meas, meas - spec_dbm); - } - - printf("Stopping RF Tx on the DUT\n"); - do_rfe(STOP_ALL); - exit(0); -} diff -r 2db97ef5e169 -r c9bd1f75029f autocal/txstandbas.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autocal/txstandbas.c Sat Jul 15 18:14:49 2017 +0000 @@ -0,0 +1,120 @@ +/* + * fc-rfcal-txbasis is a debug utility implementing just one part + * of the fc-rfcal-txband process in a standalone manner; + * this module contains the main() function for this standalone utlity. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "stdband.h" + +extern char *rvif_socket_pathname, *tsid_socket_pathname; + +extern double tx_power_meas(); + +static struct band { + char *name; + unsigned rfpw_std_band; + unsigned default_arfcn; +} bands[] = { + {"850", RFPW_STD_BAND_850, 190}, + {"900", RFPW_STD_BAND_900, 40}, + {"1800", RFPW_STD_BAND_1800, 700}, + {"1900", RFPW_STD_BAND_1900, 660}, + {0, 0, 0} +}; +static struct band *selected_band; +static unsigned arfcn, arfcn_set; + +cmdline_options(argc, argv) + char **argv; +{ + extern char *optarg; + int c; + + while ((c = getopt(argc, argv, "a:s:t:")) != EOF) { + switch (c) { + case 'a': + arfcn = atoi(optarg); + arfcn_set = 1; + continue; + case 's': + rvif_socket_pathname = optarg; + continue; + case 't': + tsid_socket_pathname = optarg; + continue; + case '?': + default: + /* error msg already printed */ + exit(ERROR_USAGE); + } + } + return(0); +} + +select_band(bandname) + char *bandname; +{ + struct band *band; + + for (band = bands; band->name; band++) + if (!strcmp(band->name, bandname)) + break; + if (!band->name) { + fprintf(stderr, "error: \"%s\" is not a known band\n", + bandname); + exit(ERROR_USAGE); + } + selected_band = band; + if (!arfcn_set) + arfcn = band->default_arfcn; + return(0); +} + +main(argc, argv) + char **argv; +{ + extern int optind; + int apc; + double meas; + + cmdline_options(argc, argv); + if (argc - optind < 2) { + fprintf(stderr, "usage: %s band apc...\n", argv[0]); + exit(ERROR_USAGE); + } + select_band(argv[optind++]); + + connect_rvinterf_socket(); + connect_tsid_socket(); + setlinebuf(stdout); /* to allow logging with tee */ + printf("Preparing RF test system for %s MHz Tx calibration\n", + selected_band->name); + do_txpwr_cal_setup(selected_band->name, arfcn); + + printf("Putting the DUT into Test Mode\n"); + do_tms(1); + do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band); + do_rfpw(TCH_ARFCN, arfcn); + do_rfpw(AFC_ENA_FLAG, 0); + printf("Starting RF Tx on the DUT\n"); + do_rfe(RX_TX_TCH); + + for (; optind < argc; optind++) { + apc = atoi(argv[optind]); + do_txpw(TX_APC_DAC, apc); + usleep(20000); + meas = tx_power_meas(); + printf("APC DAC=%d: %.2f dBm\n", apc, meas); + } + + printf("Stopping RF Tx on the DUT\n"); + do_rfe(STOP_ALL); + exit(0); +} diff -r 2db97ef5e169 -r c9bd1f75029f autocal/txstandchk.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autocal/txstandchk.c Sat Jul 15 18:14:49 2017 +0000 @@ -0,0 +1,99 @@ +/* + * fc-rfcal-txcheck is a debug utility implementing just one part + * of the fc-rfcal-txband process in a standalone manner; + * this module contains the main() function for this standalone utlity. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "stdband.h" + +extern double tx_power_meas(); + +static struct band { + char *name; + unsigned rfpw_std_band; + unsigned default_arfcn; + unsigned start_plnum; + unsigned end_plnum; + int spec_max_dbm; +} bands[] = { + {"850", RFPW_STD_BAND_850, 190, 5, 19, 33}, + {"900", RFPW_STD_BAND_900, 40, 5, 19, 33}, + {"1800", RFPW_STD_BAND_1800, 700, 0, 15, 30}, + {"1900", RFPW_STD_BAND_1900, 660, 0, 15, 30}, + {0, 0, 0} +}; +static struct band *selected_band; +static unsigned arfcn; + +finish_cmdline(argc, argv) + char **argv; +{ + extern int optind; + struct band *band; + + if (argc - optind < 1 || argc - optind > 2) { + fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]); + exit(ERROR_USAGE); + } + for (band = bands; band->name; band++) + if (!strcmp(band->name, argv[optind])) + break; + if (!band->name) { + fprintf(stderr, "error: \"%s\" is not a known band\n", + argv[optind]); + exit(ERROR_USAGE); + } + selected_band = band; + if (argv[optind+1]) + arfcn = atoi(argv[optind+1]); + else + arfcn = band->default_arfcn; + return(0); +} + +main(argc, argv) + char **argv; +{ + unsigned plnum; + double meas; + int spec_dbm; + + socket_pathname_options(argc, argv); + finish_cmdline(argc, argv); + connect_rvinterf_socket(); + connect_tsid_socket(); + setlinebuf(stdout); /* to allow logging with tee */ + printf("Preparing RF test system for %s MHz Tx calibration\n", + selected_band->name); + do_txpwr_cal_setup(selected_band->name, arfcn); + + printf("Putting the DUT into Test Mode\n"); + do_tms(1); + do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band); + do_rfpw(TCH_ARFCN, arfcn); + do_rfpw(AFC_ENA_FLAG, 0); + printf("Starting RF Tx on the DUT\n"); + do_rfe(RX_TX_TCH); + + spec_dbm = selected_band->spec_max_dbm; + for (plnum = selected_band->start_plnum; + plnum <= selected_band->end_plnum; plnum++, spec_dbm -= 2) { + do_txpw(TX_PWR_LEVEL, plnum); + usleep(20000); + meas = tx_power_meas(); + printf( + "Tx power level #%u: spec %d dBm, meas %.2f dBm (%+.2f)\n", + plnum, spec_dbm, meas, meas - spec_dbm); + } + + printf("Stopping RF Tx on the DUT\n"); + do_rfe(STOP_ALL); + exit(0); +}