FreeCalypso > hg > fc-rfcal-tools
annotate cmu200/rfanalyzer.c @ 132:94e8a410d6bd
fc-rfcal-txcheck: pass PCL to tester (txpwr-cal-pcl)
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 Dec 2021 03:52:01 +0000 |
parents | 634995d55601 |
children |
rev | line source |
---|---|
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
40
2fb9768fc1e2
fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
39
diff
changeset
|
2 * This module implements the RF analyzer functionality |
2fb9768fc1e2
fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
39
diff
changeset
|
3 * for VCXO and Tx power level calibration support. |
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "mode.h" |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "band.h" |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
39
34c6fbe38daa
fc-cmu200d: implemented RF1/RF2 port selection
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
13 extern int cmu200_rf_port; |
34c6fbe38daa
fc-cmu200d: implemented RF1/RF2 port selection
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
14 |
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 extern char *client_cmd_fields[]; |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern int client_cmd_nfields; |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 extern int current_mode; |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 extern struct band *current_band; |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
8
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
21 extern char instrument_response[]; |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
22 |
40
2fb9768fc1e2
fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
39
diff
changeset
|
23 cmd_rfan_setup() |
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 { |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 int rc; |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 unsigned arfcn; |
70
e35da125c937
fc-cmu200d: CMU200 external att setting implemented in RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
41
diff
changeset
|
27 char cmdstr[80]; |
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 if (client_cmd_nfields != 3) { |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 send_socket_response("-Wrong number of arguments\n"); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 return(0); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 } |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 stop_signal_gen(); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 current_mode = OP_MODE_UNDEF; |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 rc = find_named_band(client_cmd_fields[1]); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (rc < 0) { |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 send_socket_response("-Invalid band argument\n"); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 return(0); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 arfcn = atoi(client_cmd_fields[2]); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 if (verify_arfcn(arfcn, 0, 0) < 0) { |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 send_socket_response("-Invalid ARFCN\n"); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 return(0); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 } |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 sprintf(cmdstr, "*SEC %d\n", current_band->secaddr); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 send_scpi_cmd(cmdstr); |
39
34c6fbe38daa
fc-cmu200d: implemented RF1/RF2 port selection
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
47 sprintf(cmdstr, "INP RF%d\n", cmu200_rf_port); |
34c6fbe38daa
fc-cmu200d: implemented RF1/RF2 port selection
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
48 send_scpi_cmd(cmdstr); |
70
e35da125c937
fc-cmu200d: CMU200 external att setting implemented in RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
41
diff
changeset
|
49 sprintf(cmdstr, "CORR:LOSS:INP%d %u.%u\n", cmu200_rf_port, |
e35da125c937
fc-cmu200d: CMU200 external att setting implemented in RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
41
diff
changeset
|
50 current_band->ul_cable_loss / 10, |
e35da125c937
fc-cmu200d: CMU200 external att setting implemented in RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
41
diff
changeset
|
51 current_band->ul_cable_loss % 10); |
e35da125c937
fc-cmu200d: CMU200 external att setting implemented in RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
41
diff
changeset
|
52 send_scpi_cmd(cmdstr); |
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 sprintf(cmdstr, "RFAN:CHAN %uCH\n", arfcn); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 send_scpi_cmd(cmdstr); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 send_scpi_cmd("RFAN:TSEQ GSM5\n"); |
40
2fb9768fc1e2
fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
39
diff
changeset
|
56 current_mode = OP_MODE_GSM_RFAN; |
7
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 send_socket_response("+OK\n"); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 return(0); |
948031e6de50
fc-cmu200d: vcxo-cal-setup implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 } |
8
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
60 |
112
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
61 cmd_rfan_channel() |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
62 { |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
63 unsigned arfcn; |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
64 char cmdstr[80]; |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
65 |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
66 if (current_mode != OP_MODE_GSM_RFAN) { |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
67 send_socket_response("-Wrong mode\n"); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
68 return(0); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
69 } |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
70 if (client_cmd_nfields != 2) { |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
71 send_socket_response("-Wrong number of arguments\n"); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
72 return(0); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
73 } |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
74 arfcn = atoi(client_cmd_fields[1]); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
75 if (verify_arfcn(arfcn, 0, 0) < 0) { |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
76 send_socket_response("-Invalid ARFCN\n"); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
77 return(0); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
78 } |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
79 sprintf(cmdstr, "RFAN:CHAN %uCH\n", arfcn); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
80 send_scpi_cmd(cmdstr); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
81 send_socket_response("+OK\n"); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
82 return(0); |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
83 } |
fbfbd813c9b4
fc-cmu200d: implemented channel switching in Tx power calibration
Mychaela Falconia <falcon@freecalypso.org>
parents:
70
diff
changeset
|
84 |
129
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
85 cmd_rfan_tpcl() |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
86 { |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
87 unsigned pcl; |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
88 char cmdstr[80]; |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
89 |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
90 if (current_mode != OP_MODE_GSM_RFAN) { |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
91 send_socket_response("-Wrong mode\n"); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
92 return(0); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
93 } |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
94 if (client_cmd_nfields != 2) { |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
95 send_socket_response("-Wrong number of arguments\n"); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
96 return(0); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
97 } |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
98 pcl = atoi(client_cmd_fields[1]); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
99 if (pcl > 31) { |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
100 send_socket_response("-Invalid PCL\n"); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
101 return(0); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
102 } |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
103 sprintf(cmdstr, "CONF:RFAN:TPCL %u\n", pcl); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
104 send_scpi_cmd(cmdstr); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
105 send_socket_response("+OK\n"); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
106 return(0); |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
107 } |
6cccdafcd64d
fc-cmu200d RF analyzer: implement command to set template PCL
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
108 |
8
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
109 cmd_freq_meas() |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
110 { |
11
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
111 char *resp_fields[11]; |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
112 char client_resp[128]; |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
113 |
40
2fb9768fc1e2
fc-cmu200d: VCXO calibration mode generalized into RF analyzer mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
39
diff
changeset
|
114 if (current_mode != OP_MODE_GSM_RFAN) { |
8
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
115 send_socket_response("-Wrong mode\n"); |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
116 return(0); |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
117 } |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
118 send_scpi_cmd("READ:MOD?\n"); |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
119 collect_instr_response(); |
11
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
120 if (parse_commasep_response(resp_fields, 11) < 0) { |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
121 send_socket_response |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
122 ("-CMU200 response has wrong number of fields\n"); |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
123 return(0); |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
124 } |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
125 sprintf(client_resp, "+ %s\n", resp_fields[7]); |
aeffe53e110d
fc-cmu200d: freq-meas works
Mychaela Falconia <falcon@freecalypso.org>
parents:
8
diff
changeset
|
126 send_socket_response(client_resp); |
8
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
127 return(0); |
c873a36a16e6
fc-cmu200d: freq-meas implemented without response parsing
Mychaela Falconia <falcon@freecalypso.org>
parents:
7
diff
changeset
|
128 } |
41
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
129 |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
130 cmd_power_meas() |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
131 { |
130
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
132 char *resp_fields[5], *ramp_status; |
41
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
133 char client_resp[128]; |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
134 |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
135 if (current_mode != OP_MODE_GSM_RFAN) { |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
136 send_socket_response("-Wrong mode\n"); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
137 return(0); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
138 } |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
139 send_scpi_cmd("READ:POW?\n"); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
140 collect_instr_response(); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
141 if (parse_commasep_response(resp_fields, 5) < 0) { |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
142 send_socket_response |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
143 ("-CMU200 response has wrong number of fields\n"); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
144 return(0); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
145 } |
130
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
146 if (!strcasecmp(resp_fields[3], "MATC")) |
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
147 ramp_status = "OK"; |
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
148 else if (!strcasecmp(resp_fields[3], "NMAT")) |
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
149 ramp_status = "BAD"; |
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
150 else |
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
151 ramp_status = resp_fields[3]; |
634995d55601
fc-cmu200d power-meas: propagate ramp status from the instrument
Mychaela Falconia <falcon@freecalypso.org>
parents:
129
diff
changeset
|
152 sprintf(client_resp, "+ %s %s\n", resp_fields[4], ramp_status); |
41
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
153 send_socket_response(client_resp); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
154 return(0); |
3f4221ef916a
fc-cmu200d: power-meas implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
40
diff
changeset
|
155 } |