comparison autocal/txchkmain.c @ 53:bc2397f62bdb

rf-cal-txcheck started
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 15:41:54 +0000
parents
children 21f6dba5c4df
comparison
equal deleted inserted replaced
52:e93b5e727230 53:bc2397f62bdb
1 /*
2 * This module contains the main() function for fc-rfcal-txcheck.
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <strings.h>
9 #include <rvinterf/l1tm.h>
10 #include <rvinterf/exitcodes.h>
11 #include "stdband.h"
12
13 static struct band {
14 char *name;
15 unsigned rfpw_std_band;
16 unsigned default_arfcn;
17 unsigned start_plnum;
18 unsigned end_plnum;
19 } bands[] = {
20 {"850", RFPW_STD_BAND_850, 190, 5, 19},
21 {"900", RFPW_STD_BAND_900, 40, 5, 19},
22 {"1800", RFPW_STD_BAND_1800, 700, 0, 15},
23 {"1900", RFPW_STD_BAND_1900, 660, 0, 15},
24 {0, 0, 0}
25 };
26 static struct band *selected_band;
27 static unsigned arfcn;
28
29 finish_cmdline(argc, argv)
30 char **argv;
31 {
32 extern int optind;
33 struct band *band;
34
35 if (argc - optind < 1 || argc - optind > 2) {
36 fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]);
37 exit(ERROR_USAGE);
38 }
39 for (band = bands; band->name; band++)
40 if (!strcmp(band->name, argv[optind]))
41 break;
42 if (!band->name) {
43 fprintf(stderr, "error: \"%s\" is not a known band\n",
44 argv[optind]);
45 exit(ERROR_USAGE);
46 }
47 selected_band = band;
48 if (argv[optind+1])
49 arfcn = atoi(argv[optind+1]);
50 else
51 arfcn = band->default_arfcn;
52 return(0);
53 }
54
55 prepare_rf_test_system()
56 {
57 char cmd[80];
58
59 printf("Preparing RF test system for %s MHz Tx calibration\n",
60 selected_band->name);
61 sprintf(cmd, "txpwr-cal-setup %s %u\n", selected_band->name, arfcn);
62 tsid_command(cmd);
63 return(0);
64 }
65
66 main(argc, argv)
67 char **argv;
68 {
69 socket_pathname_options(argc, argv);
70 finish_cmdline(argc, argv);
71 connect_rvinterf_socket();
72 connect_tsid_socket();
73 setlinebuf(stdout); /* to allow logging with tee */
74 prepare_rf_test_system();
75
76 printf("Putting the DUT into Test Mode\n");
77 do_tms(1);
78 do_rfpw(STD_BAND_FLAG, selected_band->rfpw_std_band);
79
80
81 }