annotate autocal/txpwrmeas.c @ 133:c99b1dce04ec default tip

fc-rfcal-txcheck: check and report ramp tolerance
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 20 Dec 2021 04:22:19 +0000
parents 94e8a410d6bd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the Tx power measurement function.
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
133
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
5 #include <ctype.h>
54
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
133
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
8 #include <rvinterf/exitcodes.h>
54
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 extern char tsid_response[];
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
55
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
12 do_txpwr_cal_setup(band, arfcn)
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
13 char *band;
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
14 unsigned arfcn;
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
15 {
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
16 char cmd[80];
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
17
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
18 sprintf(cmd, "txpwr-cal-setup %s %u\n", band, arfcn);
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
19 tsid_command(cmd);
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
20 return(0);
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
21 }
b313884c79fd autocal Tx: txpwr-cal-setup factored out of fc-rfcal-txcheck
Mychaela Falconia <falcon@freecalypso.org>
parents: 54
diff changeset
22
132
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
23 pass_pcl_to_tester(pcl)
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
24 unsigned pcl;
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
25 {
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
26 char cmd[80];
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
27
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
28 sprintf(cmd, "txpwr-cal-pcl %u\n", pcl);
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
29 tsid_command(cmd);
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
30 return(0);
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
31 }
94e8a410d6bd fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
32
54
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 double
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 tx_power_meas()
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 {
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 double meas;
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 tsid_command("power-meas\n");
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 meas = atof(tsid_response + 1);
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 return(meas);
21f6dba5c4df fc-rfcal-txcheck ready to test
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 }
133
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
42
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
43 double
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
44 tx_power_meas_ramp(rstat)
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
45 char **rstat;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
46 {
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
47 double meas;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
48 char *cp;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
49
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
50 tsid_command("power-meas ramp\n");
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
51 for (cp = tsid_response + 1; isspace(*cp); cp++)
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
52 ;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
53 if (!*cp) {
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
54 inv: fprintf(stderr,
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
55 "error: bad TSID response to power-meas ramp\n");
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
56 exit(ERROR_RFTEST);
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
57 }
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
58 meas = atof(cp);
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
59 while (*cp && !isspace(*cp))
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
60 cp++;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
61 if (!*cp)
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
62 goto inv;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
63 while (isspace(*cp))
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
64 cp++;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
65 if (!*cp)
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
66 goto inv;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
67 *rstat = cp;
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
68 return(meas);
c99b1dce04ec fc-rfcal-txcheck: check and report ramp tolerance
Mychaela Falconia <falcon@freecalypso.org>
parents: 132
diff changeset
69 }