]> sigrok.org Git - libsigrok.git/blame - src/hardware/scpi-pps/profiles.c
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / src / hardware / scpi-pps / profiles.c
CommitLineData
d4eabea8
BV
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
4ee1e2f3
AG
5 * Copyright (C) 2015 Google, Inc.
6 * (Written by Alexandru Gagniuc <mrnuke@google.com> for Google, Inc.)
7e66bf05 7 * Copyright (C) 2017,2019 Frank Stettner <frank-stettner@gmx.net>
d4eabea8
BV
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
6ec6c43b 23#include <config.h>
22c18b03 24#include <string.h>
ba464a12 25#include <strings.h>
d4eabea8
BV
26#include "protocol.h"
27
28#define CH_IDX(x) (1 << x)
6ed709fe 29#define FREQ_DC_ONLY {0, 0, 0, 0, 0}
49a468ed
FS
30#define NO_OVP_LIMITS {0, 0, 0, 0, 0}
31#define NO_OCP_LIMITS {0, 0, 0, 0, 0}
aec7d855 32#define NO_OCP_DELAY {0, 0, 0, 0, 0}
d4eabea8 33
5c9e56c9
AG
34/* Agilent/Keysight N5700A series */
35static const uint32_t agilent_n5700a_devopts[] = {
e91bb0a6 36 SR_CONF_CONTINUOUS,
88e4daa9
ML
37 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
38 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
5c9e56c9
AG
39};
40
41static const uint32_t agilent_n5700a_devopts_cg[] = {
42 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
43 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
44 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
da005885
UH
45 SR_CONF_VOLTAGE | SR_CONF_GET,
46 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
47 SR_CONF_CURRENT | SR_CONF_GET,
48 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
5c9e56c9
AG
49};
50
6cc93128 51static const struct channel_group_spec agilent_n5700a_cg[] = {
f2bbcc33 52 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
6cc93128
AG
53};
54
8cb5affe 55static const struct channel_spec agilent_n5767a_ch[] = {
aec7d855 56 { "1", { 0, 60, 0.0072, 3, 4 }, { 0, 25, 0.003, 3, 4 }, { 0, 1500 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
5c9e56c9
AG
57};
58
6cc93128 59static const struct channel_spec agilent_n5763a_ch[] = {
aec7d855 60 { "1", { 0, 12.5, 0.0015, 3, 4 }, { 0, 120, 0.0144, 3, 4 }, { 0, 1500 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
5c9e56c9
AG
61};
62
63/*
64 * TODO: OVER_CURRENT_PROTECTION_ACTIVE status can be determined by the OC bit
562a3490 65 * in STAT:QUES:EVEN?, but this is not implemented.
5c9e56c9 66 */
8cb5affe 67static const struct scpi_command agilent_n5700a_cmd[] = {
5c9e56c9
AG
68 { SCPI_CMD_REMOTE, "SYST:COMM:RLST REM" },
69 { SCPI_CMD_LOCAL, "SYST:COMM:RLST LOC" },
70 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
71 { SCPI_CMD_GET_MEAS_CURRENT, "MEAS:CURR?" },
72 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
73 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.6f" },
74 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
75 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
76 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP:STAT?" },
77 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP ON" },
78 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP OFF" },
79 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":VOLT:PROT?" },
80 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":VOLT:PROT %.6f" },
81 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, ":CURR:PROT:STAT?" },
82 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, ":CURR:PROT:STAT ON?"},
83 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, ":CURR:PROT:STAT OFF?"},
562a3490 84 /* Current limit (CC mode) and OCP are set using the same command. */
5c9e56c9
AG
85 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR?" },
86 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR %.6f" },
91ef511d 87 ALL_ZERO
5c9e56c9
AG
88};
89
c3bfb959
MW
90/* BK Precision 9130 series */
91static const uint32_t bk_9130_devopts[] = {
92 SR_CONF_CONTINUOUS,
93 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
94 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
95};
96
97static const uint32_t bk_9130_devopts_cg[] = {
98 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
99 SR_CONF_VOLTAGE | SR_CONF_GET,
100 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
101 SR_CONF_CURRENT | SR_CONF_GET,
102 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
103 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
104};
105
106static const struct channel_spec bk_9130_ch[] = {
aec7d855
MS
107 { "1", { 0, 30, 0.001, 3, 3 }, { 0, 3, 0.001, 3, 3 }, { 0, 90, 0, 3, 3 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
108 { "2", { 0, 30, 0.001, 3, 3 }, { 0, 3, 0.001, 3, 3 }, { 0, 90, 0, 3, 3 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
109 { "3", { 0, 5, 0.001, 3, 3 }, { 0, 3, 0.001, 3, 3 }, { 0, 15, 0, 3, 3 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
c3bfb959
MW
110};
111
112static const struct channel_group_spec bk_9130_cg[] = {
f2bbcc33
FS
113 { "1", CH_IDX(0), PPS_OVP, SR_MQFLAG_DC },
114 { "2", CH_IDX(1), PPS_OVP, SR_MQFLAG_DC },
115 { "3", CH_IDX(2), PPS_OVP, SR_MQFLAG_DC },
c3bfb959
MW
116};
117
118static const struct scpi_command bk_9130_cmd[] = {
119 { SCPI_CMD_REMOTE, "SYST:REMOTE" },
120 { SCPI_CMD_LOCAL, "SYST:LOCAL" },
121 { SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
122 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
123 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
124 { SCPI_CMD_GET_MEAS_POWER, ":MEAS:POWER?" },
125 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
126 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.6f" },
127 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
128 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
129 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP?" },
130 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP 1" },
131 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP 0" },
132 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT?" },
133 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT %.6f" },
134 ALL_ZERO
135};
136
4ee1e2f3
AG
137/* Chroma 61600 series AC source */
138static const uint32_t chroma_61604_devopts[] = {
e91bb0a6 139 SR_CONF_CONTINUOUS,
88e4daa9
ML
140 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
141 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
4ee1e2f3
AG
142};
143
144static const uint32_t chroma_61604_devopts_cg[] = {
145 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
146 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
da005885
UH
147 SR_CONF_VOLTAGE | SR_CONF_GET,
148 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
6c0c9dd2
AG
149 SR_CONF_OUTPUT_FREQUENCY | SR_CONF_GET,
150 SR_CONF_OUTPUT_FREQUENCY_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
da005885
UH
151 SR_CONF_CURRENT | SR_CONF_GET,
152 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
4ee1e2f3
AG
153};
154
8cb5affe 155static const struct channel_spec chroma_61604_ch[] = {
aec7d855 156 { "1", { 0, 300, 0.1, 1, 1 }, { 0, 16, 0.1, 2, 2 }, { 0, 2000, 0, 1, 1 }, { 1.0, 1000.0, 0.01 }, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
4ee1e2f3
AG
157};
158
8cb5affe 159static const struct channel_group_spec chroma_61604_cg[] = {
f2bbcc33 160 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_AC },
4ee1e2f3
AG
161};
162
8cb5affe 163static const struct scpi_command chroma_61604_cmd[] = {
4ee1e2f3
AG
164 { SCPI_CMD_REMOTE, "SYST:REM" },
165 { SCPI_CMD_LOCAL, "SYST:LOC" },
166 { SCPI_CMD_GET_MEAS_VOLTAGE, ":FETC:VOLT:ACDC?" },
6c0c9dd2 167 { SCPI_CMD_GET_MEAS_FREQUENCY, ":FETC:FREQ?" },
4ee1e2f3
AG
168 { SCPI_CMD_GET_MEAS_CURRENT, ":FETC:CURR:AC?" },
169 { SCPI_CMD_GET_MEAS_POWER, ":FETC:POW:AC?" },
170 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT:AC?" },
171 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT:AC %.1f" },
6c0c9dd2
AG
172 { SCPI_CMD_GET_FREQUENCY_TARGET, ":SOUR:FREQ?" },
173 { SCPI_CMD_SET_FREQUENCY_TARGET, ":SOUR:FREQ %.2f" },
4ee1e2f3
AG
174 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP?" },
175 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP ON" },
176 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP OFF" },
177 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:LIM:AC?" },
178 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:LIM:AC %.1f" },
562a3490 179 /* This is not a current limit mode. It is overcurrent protection. */
4ee1e2f3
AG
180 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR:LIM?" },
181 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR:LIM %.2f" },
91ef511d 182 ALL_ZERO
4ee1e2f3
AG
183};
184
5281993e 185/* Chroma 62000 series DC source */
5281993e 186static const uint32_t chroma_62000_devopts[] = {
e91bb0a6 187 SR_CONF_CONTINUOUS,
88e4daa9
ML
188 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
189 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
5281993e
AG
190};
191
192static const uint32_t chroma_62000_devopts_cg[] = {
193 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
194 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
195 SR_CONF_VOLTAGE | SR_CONF_GET,
196 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
197 SR_CONF_CURRENT | SR_CONF_GET,
198 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
199 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
200};
201
5281993e 202static const struct channel_group_spec chroma_62000_cg[] = {
f2bbcc33 203 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
5281993e
AG
204};
205
206static const struct scpi_command chroma_62000_cmd[] = {
207 { SCPI_CMD_REMOTE, ":CONF:REM ON" },
208 { SCPI_CMD_LOCAL, ":CONF:REM OFF" },
209 { SCPI_CMD_BEEPER, ":CONF:BEEP?" },
210 { SCPI_CMD_BEEPER_ENABLE, ":CONF:BEEP ON" },
211 { SCPI_CMD_BEEPER_DISABLE, ":CONF:BEEP OFF" },
212 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
213 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
214 { SCPI_CMD_GET_MEAS_POWER, ":MEAS:POW?" },
215 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
216 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.2f" },
217 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
218 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
219 { SCPI_CMD_GET_OUTPUT_ENABLED, ":CONF:OUTP?" },
220 { SCPI_CMD_SET_OUTPUT_ENABLE, ":CONF:OUTP ON" },
221 { SCPI_CMD_SET_OUTPUT_DISABLE, ":CONF:OUTP OFF" },
222 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT:HIGH?" },
223 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT:HIGH %.6f" },
224 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR:PROT:HIGH?" },
225 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR:PROT:HIGH %.6f" },
91ef511d 226 ALL_ZERO
5281993e
AG
227};
228
9a5185c7
AG
229static int chroma_62000p_probe_channels(struct sr_dev_inst *sdi,
230 struct sr_scpi_hw_info *hw_info,
231 struct channel_spec **channels, unsigned int *num_channels,
232 struct channel_group_spec **channel_groups,
233 unsigned int *num_channel_groups)
234{
6ed709fe 235 unsigned int volts, amps, watts;
9a5185c7
AG
236 struct channel_spec *channel;
237
238 (void)sdi;
239
6ed709fe
AJ
240 sscanf(hw_info->model, "620%uP-%u-%u", &watts, &volts, &amps);
241 watts *= 100;
242 sr_dbg("Found device rated for %d V, %d A and %d W", volts, amps, watts);
9a5185c7
AG
243
244 if (volts > 600) {
245 sr_err("Probed max voltage of %u V is out of spec.", volts);
246 return SR_ERR_BUG;
247 }
248
6ed709fe 249 if (amps > 120) {
9a5185c7
AG
250 sr_err("Probed max current of %u A is out of spec.", amps);
251 return SR_ERR_BUG;
252 }
253
6ed709fe
AJ
254 if (watts > 5000) {
255 sr_err("Probed max power of %u W is out of spec.", watts);
256 return SR_ERR_BUG;
257 }
258
9a5185c7
AG
259 channel = g_malloc0(sizeof(struct channel_spec));
260 channel->name = "1";
6ed709fe 261 channel->voltage[0] = channel->current[0] = channel->power[0] = 0.0;
bcee1299
UH
262 channel->voltage[1] = volts;
263 channel->current[1] = amps;
264 channel->power[1] = watts;
9a5185c7 265 channel->voltage[2] = channel->current[2] = 0.01;
6ed709fe
AJ
266 channel->voltage[3] = channel->voltage[4] = 3;
267 channel->current[3] = channel->current[4] = 4;
9a5185c7
AG
268 *channels = channel;
269 *num_channels = 1;
270
271 *channel_groups = g_malloc(sizeof(struct channel_group_spec));
272 **channel_groups = chroma_62000_cg[0];
273 *num_channel_groups = 1;
274
275 return SR_OK;
276}
277
22fdb67f
MA
278/* Envox EEZ PSU Series */
279static const uint32_t eez_psu_devopts[] = {
280 SR_CONF_CONTINUOUS,
281 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
282 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
283};
284
285static const uint32_t eez_psu_devopts_cg[] = {
286 SR_CONF_VOLTAGE | SR_CONF_GET,
287 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
288 SR_CONF_CURRENT | SR_CONF_GET,
289 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
290 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
291 SR_CONF_REGULATION | SR_CONF_GET,
292 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
293 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET,
294 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
295 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET,
296};
297
298static const struct scpi_command eez_psu_cmd[] = {
299 { SCPI_CMD_REMOTE, "SYST:REMOTE" },
300 { SCPI_CMD_LOCAL, "SYST:LOCAL" },
301 { SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
302 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
303 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
304 { SCPI_CMD_GET_MEAS_POWER, ":MEAS:POWER?" },
305 { SCPI_CMD_GET_OUTPUT_REGULATION, ":OUTP:MODE?" },
306 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
307 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.2f" },
308 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
309 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
310 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP?" },
311 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP ON" },
312 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP OFF" },
313 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":SOUR:CURR:PROT?" },
314 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT?" },
315 ALL_ZERO
316};
317
318/*
319 * The EEZ BB3 protocol currently specifies up to six channels. The older
320 * EEZ PSU design only has room for two in its enclosure design.
321 *
322 * If a future model's SCPI spec allows more than six models then we can
323 * extend this to support more.
324 */
325static const char *eez_psu_channel_names[] = { "1", "2", "3", "4", "5", "6", };
326
327static int eez_psu_probe_channels(struct sr_dev_inst *sdi,
328 struct sr_scpi_hw_info *hw_info,
329 struct channel_spec **channels, unsigned int *num_channels,
330 struct channel_group_spec **channel_groups,
331 unsigned int *num_channel_groups)
332{
333 struct sr_scpi_dev_inst *scpi;
334 int ret, intval;
335 size_t i, channel_count;
336 double limit_val;
337 const char *channel_name;
338
339 /*
340 * The EEZ PSU family is intended by the designer to be end-user
341 * customizable, so this is intentionally a little more dynamic
342 * than strictly necessary for the "stock" models, to make it
343 * more likely to automatically support end-user upgrades of the
344 * various ranges.
345 *
346 * The BB3 in particular supports various different modular
347 * power supply frontends that offer different voltage/current
348 * limits and different numbers of independent channels, such as
349 * three PSU modules that have two channels each for a total of
350 * six controllable channels.
351 *
352 * This currently supports both the original EEZ PSU design
353 * (H24005, when in its stock build configuration) and the
354 * successor EEZ BB3 design.
355 */
356
357 scpi = sdi->conn;
358 ret = sr_scpi_get_int(scpi, ":SYST:CHAN:COUN?", &intval);
359 if (ret != SR_OK) {
360 sr_err("Failed to probe EEZ PSU channel count.");
361 return ret;
362 }
363 if (intval < 0) {
364 sr_err("Suspicious channel count %d, ignoring.", intval);
365 return SR_ERR_DATA;
366 }
367 channel_count = intval;
368 if (channel_count > ARRAY_SIZE(eez_psu_channel_names)) {
369 /*
370 * No known EEZ PSU specifies more than six channels at
371 * the time of writing, so it would be weird to get here
372 * but we'll allow it to be robust.
373 */
374 sr_warn("Only using first %zu of %zu EEZ PSU channels.",
375 channel_count, ARRAY_SIZE(eez_psu_channel_names));
376 channel_count = ARRAY_SIZE(eez_psu_channel_names);
377 }
378
379 sr_spew("EEZ PSU (%s) has channel count %zu.",
380 hw_info->model, channel_count);
381
382 *channels = g_malloc0(sizeof(**channels) * channel_count);
383 *channel_groups = g_malloc0(sizeof(**channel_groups) * channel_count);
384 for (i = 0; i < channel_count; i++) {
385 channel_name = eez_psu_channel_names[i];
386
387 /*
388 * Select the channel to prepare for our various "get"
389 * calls below.
390 */
391 ret = sr_scpi_send(scpi, ":INST:NSEL %s", channel_name);
392 if (ret != SR_OK) {
393 sr_err("Failed to select %s to retrieve its limits.",
394 channel_name);
395 return ret;
396 }
397
398 (*channel_groups)[i].name = channel_name;
399 (*channel_groups)[i].channel_index_mask = CH_IDX(i);
400 (*channel_groups)[i].features = PPS_OVP | PPS_OCP;
401 (*channel_groups)[i].mqflags = SR_MQFLAG_DC;
402
403 (*channels)[i].name = channel_name;
404
405 ret = sr_scpi_get_double(scpi,
406 ":SYST:CHAN:INFO:CURR?", &limit_val);
407 if (ret != SR_OK) {
408 sr_err("Failed to read the current limit for %s.",
409 channel_name);
410 return ret;
411 }
412 (*channels)[i].current[0] = 0.0;
413 (*channels)[i].current[1] = limit_val;
414 (*channels)[i].current[2] = 0.01; /* Programming resolution. */
415 (*channels)[i].current[3] = 2; /* Spec digits. */
416 (*channels)[i].current[4] = 2; /* Encoding digits. */
417
418 ret = sr_scpi_get_double(scpi,
419 ":SYST:CHAN:INFO:VOLT?", &limit_val);
420 if (ret != SR_OK) {
421 sr_err("Failed to read the voltage limit for %s.",
422 channel_name);
423 return ret;
424 }
425 (*channels)[i].voltage[0] = 0.0;
426 (*channels)[i].voltage[1] = limit_val;
427 (*channels)[i].voltage[2] = 0.01; /* Programming resolution. */
428 (*channels)[i].voltage[3] = 2; /* Spec digits. */
429 (*channels)[i].voltage[4] = 2; /* Encoding digits. */
430
431 ret = sr_scpi_get_double(scpi,
432 ":SYST:CHAN:INFO:POW?", &limit_val);
433 if (ret != SR_OK) {
434 sr_err("Failed to read the power limit for %s.",
435 channel_name);
436 return ret;
437 }
438 (*channels)[i].power[0] = 0.0;
439 (*channels)[i].power[1] = limit_val;
440 (*channels)[i].power[2] = 0.01; /* Programming resolution. */
441 (*channels)[i].power[3] = 2; /* Spec digits. */
442 (*channels)[i].power[4] = 2; /* Encoding digits. */
443 }
444 *num_channels = *num_channel_groups = channel_count;
445
446 return SR_OK;
447}
448
319fe9ce
UH
449/* Rigol DP700 series */
450static const uint32_t rigol_dp700_devopts[] = {
451 SR_CONF_CONTINUOUS,
88e4daa9
ML
452 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
453 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
319fe9ce
UH
454};
455
456static const uint32_t rigol_dp700_devopts_cg[] = {
457 SR_CONF_REGULATION | SR_CONF_GET,
458 SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
459 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
d828b05e 460 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
319fe9ce
UH
461 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
462 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
d828b05e 463 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
319fe9ce
UH
464 SR_CONF_VOLTAGE | SR_CONF_GET,
465 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
466 SR_CONF_CURRENT | SR_CONF_GET,
467 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
468 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
469};
470
471static const struct channel_spec rigol_dp711_ch[] = {
aec7d855 472 { "1", { 0, 30, 0.01, 3, 3 }, { 0, 5, 0.01, 3, 3 }, { 0, 150, 0, 3, 3 }, FREQ_DC_ONLY, { 0.01, 33, 0.01}, { 0.01, 5.5, 0.01 }, NO_OCP_DELAY },
319fe9ce
UH
473};
474
475static const struct channel_spec rigol_dp712_ch[] = {
aec7d855 476 { "1", { 0, 50, 0.01, 3, 3 }, { 0, 3, 0.01, 3, 3 }, { 0, 150, 0, 3, 3 }, FREQ_DC_ONLY, { 0.01, 55, 0.01}, { 0.01, 3.3, 0.01 }, NO_OCP_DELAY },
319fe9ce
UH
477};
478
479static const struct channel_group_spec rigol_dp700_cg[] = {
f2bbcc33 480 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
319fe9ce
UH
481};
482
483/* Same as the DP800 series, except for the missing :SYST:OTP* commands. */
484static const struct scpi_command rigol_dp700_cmd[] = {
485 { SCPI_CMD_REMOTE, "SYST:REMOTE" },
486 { SCPI_CMD_LOCAL, "SYST:LOCAL" },
487 { SCPI_CMD_BEEPER, "SYST:BEEP:STAT?" },
488 { SCPI_CMD_BEEPER_ENABLE, "SYST:BEEP:STAT ON" },
489 { SCPI_CMD_BEEPER_DISABLE, "SYST:BEEP:STAT OFF" },
490 { SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
491 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
492 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
493 { SCPI_CMD_GET_MEAS_POWER, ":MEAS:POWE?" },
494 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
495 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.6f" },
496 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
497 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
498 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP?" },
499 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP ON" },
500 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP OFF" },
501 { SCPI_CMD_GET_OUTPUT_REGULATION, ":OUTP:MODE?" },
502 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ENABLED, ":OUTP:OVP?" },
503 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_ENABLE, ":OUTP:OVP ON" },
504 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_DISABLE, ":OUTP:OVP OFF" },
505 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, ":OUTP:OVP:QUES?" },
506 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":OUTP:OVP:VAL?" },
507 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":OUTP:OVP:VAL %.6f" },
508 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, ":OUTP:OCP?" },
509 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, ":OUTP:OCP:STAT ON" },
510 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, ":OUTP:OCP:STAT OFF" },
511 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, ":OUTP:OCP:QUES?" },
512 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":OUTP:OCP:VAL?" },
513 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, ":OUTP:OCP:VAL %.6f" },
514 ALL_ZERO
515};
516
d4eabea8 517/* Rigol DP800 series */
584560f1 518static const uint32_t rigol_dp800_devopts[] = {
e91bb0a6 519 SR_CONF_CONTINUOUS,
5827f61b 520 SR_CONF_OVER_TEMPERATURE_PROTECTION | SR_CONF_GET | SR_CONF_SET,
88e4daa9
ML
521 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
522 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
d4eabea8
BV
523};
524
584560f1 525static const uint32_t rigol_dp800_devopts_cg[] = {
7a0b98b5 526 SR_CONF_REGULATION | SR_CONF_GET,
5827f61b
BV
527 SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
528 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
529 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
530 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
531 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
532 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
7a0b98b5
AJ
533 SR_CONF_VOLTAGE | SR_CONF_GET,
534 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
535 SR_CONF_CURRENT | SR_CONF_GET,
536 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
537 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
d4eabea8
BV
538};
539
8cb5affe 540static const struct channel_spec rigol_dp821a_ch[] = {
aec7d855
MS
541 { "1", { 0, 60, 0.001, 3, 3 }, { 0, 1, 0.0001, 4, 4 }, { 0, 60, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
542 { "2", { 0, 8, 0.001, 3, 3 }, { 0, 10, 0.001, 3, 3 }, { 0, 80, 0, 3, 3 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
cfcdf576
ML
543};
544
8cb5affe 545static const struct channel_spec rigol_dp831_ch[] = {
aec7d855
MS
546 { "1", { 0, 8, 0.001, 3, 4 }, { 0, 5, 0.0003, 3, 4 }, { 0, 40, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
547 { "2", { 0, 30, 0.001, 3, 4 }, { 0, 2, 0.0001, 3, 4 }, { 0, 60, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
548 { "3", { 0, -30, 0.001, 3, 4 }, { 0, 2, 0.0001, 3, 4 }, { 0, 60, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
d4eabea8
BV
549};
550
8cb5affe 551static const struct channel_spec rigol_dp832_ch[] = {
aec7d855
MS
552 { "1", { 0, 30, 0.001, 3, 4 }, { 0, 3, 0.001, 3, 4 }, { 0, 90, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
553 { "2", { 0, 30, 0.001, 3, 4 }, { 0, 3, 0.001, 3, 4 }, { 0, 90, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
554 { "3", { 0, 5, 0.001, 3, 4 }, { 0, 3, 0.001, 3, 4 }, { 0, 90, 0, 3, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
3222ee10
BV
555};
556
8cb5affe 557static const struct channel_group_spec rigol_dp820_cg[] = {
f2bbcc33
FS
558 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
559 { "2", CH_IDX(1), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
cfcdf576
ML
560};
561
8cb5affe 562static const struct channel_group_spec rigol_dp830_cg[] = {
f2bbcc33
FS
563 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
564 { "2", CH_IDX(1), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
565 { "3", CH_IDX(2), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
d4eabea8
BV
566};
567
8cb5affe 568static const struct scpi_command rigol_dp800_cmd[] = {
60475cd7
BV
569 { SCPI_CMD_REMOTE, "SYST:REMOTE" },
570 { SCPI_CMD_LOCAL, "SYST:LOCAL" },
ee2860ee
BV
571 { SCPI_CMD_BEEPER, "SYST:BEEP:STAT?" },
572 { SCPI_CMD_BEEPER_ENABLE, "SYST:BEEP:STAT ON" },
573 { SCPI_CMD_BEEPER_DISABLE, "SYST:BEEP:STAT OFF" },
60475cd7
BV
574 { SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
575 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
576 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
577 { SCPI_CMD_GET_MEAS_POWER, ":MEAS:POWE?" },
578 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
579 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.6f" },
580 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
581 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
582 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP?" },
583 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP ON" },
584 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP OFF" },
585 { SCPI_CMD_GET_OUTPUT_REGULATION, ":OUTP:MODE?" },
d4eabea8 586 { SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION, ":SYST:OTP?" },
53a81803
BV
587 { SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_ENABLE, ":SYST:OTP ON" },
588 { SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_DISABLE, ":SYST:OTP OFF" },
60475cd7
BV
589 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ENABLED, ":OUTP:OVP?" },
590 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_ENABLE, ":OUTP:OVP ON" },
591 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_DISABLE, ":OUTP:OVP OFF" },
592 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, ":OUTP:OVP:QUES?" },
593 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":OUTP:OVP:VAL?" },
594 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":OUTP:OVP:VAL %.6f" },
595 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, ":OUTP:OCP?" },
596 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, ":OUTP:OCP:STAT ON" },
597 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, ":OUTP:OCP:STAT OFF" },
598 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, ":OUTP:OCP:QUES?" },
599 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":OUTP:OCP:VAL?" },
600 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, ":OUTP:OCP:VAL %.6f" },
91ef511d 601 ALL_ZERO
d4eabea8
BV
602};
603
dbc519f7 604/* HP 663xA series */
e76a3575
AG
605static const uint32_t hp_6630a_devopts[] = {
606 SR_CONF_CONTINUOUS,
88e4daa9
ML
607 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
608 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
7c517d02
FS
609};
610
611static const uint32_t hp_6630a_devopts_cg[] = {
e76a3575
AG
612 SR_CONF_ENABLED | SR_CONF_SET,
613 SR_CONF_VOLTAGE | SR_CONF_GET,
614 SR_CONF_CURRENT | SR_CONF_GET,
615 SR_CONF_VOLTAGE_TARGET | SR_CONF_SET | SR_CONF_LIST,
616 SR_CONF_CURRENT_LIMIT | SR_CONF_SET | SR_CONF_LIST,
f083ae63 617 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
49a468ed 618 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_SET | SR_CONF_LIST,
e76a3575 619 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_SET,
f083ae63
FS
620 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
621 SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET,
0ad7074c 622 SR_CONF_REGULATION | SR_CONF_GET,
e76a3575
AG
623};
624
5ce427c7 625static const struct channel_spec hp_6632a_ch[] = {
aec7d855 626 { "1", { 0, 20.475, 0.005, 3, 4 }, { 0, 5.1188, 0.00125, 4, 5 }, { 0, 104.80743 }, FREQ_DC_ONLY, { 0, 22, 0.1 }, NO_OCP_LIMITS, NO_OCP_DELAY },
5ce427c7
FS
627};
628
dbc519f7 629static const struct channel_spec hp_6633a_ch[] = {
aec7d855 630 { "1", { 0, 51.188, 0.0125, 3, 4 }, { 0, 2.0475, 0.0005, 4, 5 }, { 0, 104.80743 }, FREQ_DC_ONLY, { 0, 55, 0.25 }, NO_OCP_LIMITS, NO_OCP_DELAY },
dbc519f7
FS
631};
632
5ce427c7 633static const struct channel_spec hp_6634a_ch[] = {
aec7d855 634 { "1", { 0, 102.38, 0.025, 3, 4 }, { 0, 1.0238, 0.00025, 4, 5 }, { 0, 104.81664 }, FREQ_DC_ONLY, { 0, 110, 0.5 }, NO_OCP_LIMITS, NO_OCP_DELAY },
5ce427c7
FS
635};
636
dbc519f7
FS
637static const struct channel_group_spec hp_6630a_cg[] = {
638 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
639};
640
641static const struct scpi_command hp_6630a_cmd[] = {
642 { SCPI_CMD_SET_OUTPUT_ENABLE, "OUT 1" },
643 { SCPI_CMD_SET_OUTPUT_DISABLE, "OUT 0" },
644 { SCPI_CMD_GET_MEAS_VOLTAGE, "VOUT?" },
645 { SCPI_CMD_GET_MEAS_CURRENT, "IOUT?" },
646 { SCPI_CMD_SET_VOLTAGE_TARGET, "VSET %.4f" },
647 { SCPI_CMD_SET_CURRENT_LIMIT, "ISET %.4f" },
f083ae63
FS
648 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "STS?" },
649 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "OVSET %.4f" },
dbc519f7
FS
650 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, "OCP 1" },
651 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, "OCP 0" },
f083ae63
FS
652 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, "STS?" },
653 { SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE, "STS?" },
0ad7074c 654 { SCPI_CMD_GET_OUTPUT_REGULATION, "STS?" },
dbc519f7
FS
655 ALL_ZERO
656};
657
fd243315 658static int hp_6630a_init_acquisition(const struct sr_dev_inst *sdi)
fdf03652
FS
659{
660 struct sr_scpi_dev_inst *scpi;
fdf03652
FS
661
662 scpi = sdi->conn;
663
664 /*
665 * Monitor CV (1), CC+ (2), UR (4), OVP (8), OTP (16), OCP (64) and
666 * CC- (256) bits of the Status Register for the FAULT? query.
667 */
b89e6db9 668 return sr_scpi_send(scpi, "UNMASK 607");
fdf03652
FS
669}
670
671static int hp_6630a_update_status(const struct sr_dev_inst *sdi)
672{
673 struct sr_scpi_dev_inst *scpi;
674 int ret;
675 int fault;
676 gboolean cv, cc_pos, unreg, cc_neg;
677 gboolean regulation_changed;
678 char *regulation;
679
680 scpi = sdi->conn;
681
682 /*
683 * Use the FAULT register (only 0->1 transitions), this way multiple set
684 * regulation bits in the STS/ASTS registers are ignored. In rare cases
685 * we will miss some changes (1->0 transitions, e.g. no regulation at all),
686 * but SPS/ASPS doesn't work either, unless all states are stored and
687 * compared to the states in STS/ASTS.
688 * TODO: Use SPoll or SRQ when SCPI over GPIB is used.
689 */
690 ret = sr_scpi_get_int(scpi, "FAULT?", &fault);
691 if (ret != SR_OK)
692 return ret;
693
694 /* OVP */
695 if (fault & (1 << 3))
696 sr_session_send_meta(sdi, SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,
697 g_variant_new_boolean(fault & (1 << 3)));
698
699 /* OCP */
700 if (fault & (1 << 6))
701 sr_session_send_meta(sdi, SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE,
702 g_variant_new_boolean(fault & (1 << 6)));
703
704 /* OTP */
705 if (fault & (1 << 4))
706 sr_session_send_meta(sdi, SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE,
707 g_variant_new_boolean(fault & (1 << 4)));
708
709 /* CV */
710 cv = (fault & (1 << 0));
711 regulation_changed = (fault & (1 << 0));
712 /* CC+ */
713 cc_pos = (fault & (1 << 1));
714 regulation_changed = (fault & (1 << 1)) | regulation_changed;
715 /* UNREG */
716 unreg = (fault & (1 << 2));
717 regulation_changed = (fault & (1 << 2)) | regulation_changed;
718 /* CC- */
719 cc_neg = (fault & (1 << 9));
720 regulation_changed = (fault & (1 << 9)) | regulation_changed;
721
722 if (regulation_changed) {
b89e6db9 723 if (cv && !cc_pos && !cc_neg && !unreg)
fdf03652
FS
724 regulation = "CV";
725 else if (cc_pos && !cv && !cc_neg && !unreg)
726 regulation = "CC";
727 else if (cc_neg && !cv && !cc_pos && !unreg)
728 regulation = "CC-";
729 else if (unreg && !cv && !cc_pos && !cc_neg)
730 regulation = "UR";
b89e6db9 731 else if (!cv && !cc_pos && !cc_neg && !unreg)
fdf03652
FS
732 regulation = "";
733 else {
734 sr_dbg("Undefined regulation for HP 66xxA "
735 "(CV=%i, CC+=%i, CC-=%i, UR=%i).",
736 cv, cc_pos, cc_neg, unreg);
737 return FALSE;
738 }
739 sr_session_send_meta(sdi, SR_CONF_REGULATION,
740 g_variant_new_string(regulation));
741 }
742
743 return SR_OK;
744}
745
dbc519f7 746/* HP 663xB series */
a61c8cce 747static const uint32_t hp_6630b_devopts[] = {
e91bb0a6 748 SR_CONF_CONTINUOUS,
88e4daa9
ML
749 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
750 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
7c517d02
FS
751};
752
a61c8cce 753static const uint32_t hp_6630b_devopts_cg[] = {
7a0b98b5
AJ
754 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
755 SR_CONF_VOLTAGE | SR_CONF_GET,
756 SR_CONF_CURRENT | SR_CONF_GET,
757 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
758 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
8b5eadf4 759 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
49a468ed 760 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
7e381bfc 761 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
8b5eadf4
FS
762 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
763 SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET,
43ff1110 764 SR_CONF_REGULATION | SR_CONF_GET,
bc4a2a46
BV
765};
766
5ce427c7 767static const struct channel_spec hp_6611c_ch[] = {
aec7d855 768 { "1", { 0, 8.19, 0.002, 3, 4 }, { 0, 5.1188, 0.00125, 4, 5 }, { 0, 41.92297 }, FREQ_DC_ONLY, { 0, 12, 0.06 }, NO_OCP_LIMITS, NO_OCP_DELAY },
5ce427c7
FS
769};
770
771static const struct channel_spec hp_6612c_ch[] = {
aec7d855 772 { "1", { 0, 20.475, 0.005, 3, 4 }, { 0, 2.0475, 0.0005, 4, 5 }, { 0, 41.92256 }, FREQ_DC_ONLY, { 0, 22, 0.1 }, NO_OCP_LIMITS, NO_OCP_DELAY },
5ce427c7
FS
773};
774
775static const struct channel_spec hp_6613c_ch[] = {
aec7d855 776 { "1", { 0, 51.188, 0.0125, 3, 4 }, { 0, 1.0238, 0.00025, 4, 5 }, { 0, 52.40627 }, FREQ_DC_ONLY, { 0, 55, 0.25 }, NO_OCP_LIMITS, NO_OCP_DELAY },
5ce427c7
FS
777};
778
779static const struct channel_spec hp_6614c_ch[] = {
aec7d855 780 { "1", { 0, 102.38, 0.025, 3, 4 }, { 0, 0.5118, 0.000125, 4, 5 }, { 0, 52.39808 }, FREQ_DC_ONLY, { 0, 110, 0.5 }, NO_OCP_LIMITS, NO_OCP_DELAY },
5ce427c7
FS
781};
782
a61c8cce 783static const struct channel_spec hp_6631b_ch[] = {
aec7d855 784 { "1", { 0, 8.19, 0.002, 3, 4 }, { 0, 10.237, 0.00263, 4, 5 }, { 0, 83.84103 }, FREQ_DC_ONLY, { 0, 12, 0.06 }, NO_OCP_LIMITS, NO_OCP_DELAY },
a61c8cce
FS
785};
786
8cb5affe 787static const struct channel_spec hp_6632b_ch[] = {
aec7d855 788 { "1", { 0, 20.475, 0.005, 3, 4 }, { 0, 5.1188, 0.00132, 4, 5 }, { 0, 104.80743 }, FREQ_DC_ONLY, { 0, 22, 0.1 }, NO_OCP_LIMITS, NO_OCP_DELAY },
bc4a2a46
BV
789};
790
0b0f40d8 791static const struct channel_spec hp_66312a_ch[] = {
aec7d855 792 { "1", { 0, 20.475, 0.0001, 4, 5 }, { 0, 2.0475, 0.0001, 4, 5 }, { 0, 41.92256 }, FREQ_DC_ONLY, { 0, 22, 0.01 }, NO_OCP_LIMITS, NO_OCP_DELAY },
0b0f40d8
MW
793};
794
a61c8cce 795static const struct channel_spec hp_66332a_ch[] = {
aec7d855 796 { "1", { 0, 20.475, 0.005, 3, 4 }, { 0, 5.1188, 0.00132, 4, 5 }, { 0, 104.80743 }, FREQ_DC_ONLY, { 0, 22, 0.1 }, NO_OCP_LIMITS, NO_OCP_DELAY },
a61c8cce
FS
797};
798
799static const struct channel_spec hp_6633b_ch[] = {
aec7d855 800 { "1", { 0, 51.188, 0.0125, 3, 4 }, { 0, 2.0475, 0.000526, 4, 5 }, { 0, 104.80743 }, FREQ_DC_ONLY, { 0, 55, 0.25 }, NO_OCP_LIMITS, NO_OCP_DELAY },
a61c8cce
FS
801};
802
803static const struct channel_spec hp_6634b_ch[] = {
aec7d855 804 { "1", { 0, 102.38, 0.025, 3, 4 }, { 0, 1.0238, 0.000263, 4, 5 }, { 0, 104.81664 }, FREQ_DC_ONLY, { 0, 110, 0.5 }, NO_OCP_LIMITS, NO_OCP_DELAY },
a61c8cce
FS
805};
806
dbc519f7 807static const struct channel_group_spec hp_6630b_cg[] = {
3d1aa50f 808 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
bc4a2a46
BV
809};
810
a61c8cce 811static const struct scpi_command hp_6630b_cmd[] = {
26e96658
FS
812 /*
813 * SCPI_CMD_REMOTE and SCPI_CMD_LOCAL are not used when GPIB is used,
814 * otherwise the device will report (non critical) error 602.
815 */
7e381bfc
FS
816 { SCPI_CMD_REMOTE, "SYST:REM" },
817 { SCPI_CMD_LOCAL, "SYST:LOC" },
bc4a2a46 818 { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP:STAT?" },
53a81803
BV
819 { SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP:STAT ON" },
820 { SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP:STAT OFF" },
bc4a2a46
BV
821 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
822 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
ca95e90f
BV
823 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
824 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.6f" },
825 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
826 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
7e381bfc
FS
827 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, ":CURR:PROT:STAT?" },
828 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, ":CURR:PROT:STAT 1" },
829 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, ":CURR:PROT:STAT 0" },
8b5eadf4
FS
830 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, "STAT:QUES:COND?" },
831 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "STAT:QUES:COND?" },
7e381bfc
FS
832 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":VOLT:PROT?" },
833 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":VOLT:PROT %.6f" },
8b5eadf4 834 { SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE, "STAT:QUES:COND?" },
43ff1110 835 { SCPI_CMD_GET_OUTPUT_REGULATION, "STAT:OPER:COND?" },
91ef511d 836 ALL_ZERO
bc4a2a46
BV
837};
838
fd243315 839static int hp_6630b_init_acquisition(const struct sr_dev_inst *sdi)
fe4bb774
FS
840{
841 struct sr_scpi_dev_inst *scpi;
842 int ret;
843
844 scpi = sdi->conn;
845
846 /*
847 * Monitor CV (256), CC+ (1024) and CC- (2048) bits of the
848 * Operational Status Register.
849 * Use both positive and negative transitions of the status bits.
850 */
851 ret = sr_scpi_send(scpi, "STAT:OPER:PTR 3328;NTR 3328;ENAB 3328");
852 if (ret != SR_OK)
853 return ret;
854
855 /*
856 * Monitor OVP (1), OCP (2), OTP (16) and Unreg (1024) bits of the
857 * Questionable Status Register.
858 * Use both positive and negative transitions of the status bits.
859 */
860 ret = sr_scpi_send(scpi, "STAT:QUES:PTR 1043;NTR 1043;ENAB 1043");
861 if (ret != SR_OK)
862 return ret;
863
864 /*
865 * Service Request Enable Register set for Operational Status Register
866 * bits (128) and Questionable Status Register bits (8).
867 * This masks the Status Register generating a SRQ/RQS. Not implemented yet!
868 */
869 /*
870 ret = sr_scpi_send(scpi, "*SRE 136");
871 if (ret != SR_OK)
872 return ret;
873 */
874
875 return SR_OK;
876}
877
878static int hp_6630b_update_status(const struct sr_dev_inst *sdi)
879{
880 struct sr_scpi_dev_inst *scpi;
881 int ret;
882 int stb;
883 int ques_even, ques_cond;
884 int oper_even, oper_cond;
885 gboolean output_enabled;
886 gboolean unreg, cv, cc_pos, cc_neg;
887 gboolean regulation_changed;
888 char *regulation;
889
890 scpi = sdi->conn;
891
892 unreg = FALSE;
893 cv = FALSE;
894 cc_pos = FALSE;
895 cc_neg = FALSE;
896 regulation_changed = FALSE;
897
898 /*
899 * Use SPoll when SCPI uses GPIB as transport layer.
900 * SPoll is approx. twice as fast as a normal GPIB write + read would be!
901 */
902#ifdef HAVE_LIBGPIB
903 char spoll_buf;
904
905 if (scpi->transport == SCPI_TRANSPORT_LIBGPIB) {
906 ret = sr_scpi_gpib_spoll(scpi, &spoll_buf);
907 if (ret != SR_OK)
908 return ret;
909 stb = (uint8_t)spoll_buf;
910 }
911 else {
912#endif
913 ret = sr_scpi_get_int(scpi, "*STB?", &stb);
914 if (ret != SR_OK)
915 return ret;
916#ifdef HAVE_LIBGPIB
917 }
918#endif
919
920 /* Questionable status summary bit */
921 if (stb & (1 << 3)) {
922 /* Read the event register to clear it! */
923 ret = sr_scpi_get_int(scpi, "STAT:QUES:EVEN?", &ques_even);
924 if (ret != SR_OK)
925 return ret;
926 /* Now get the values. */
927 ret = sr_scpi_get_int(scpi, "STAT:QUES:COND?", &ques_cond);
928 if (ret != SR_OK)
929 return ret;
930
931 /* OVP */
932 if (ques_even & (1 << 0))
933 sr_session_send_meta(sdi, SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,
934 g_variant_new_boolean(ques_cond & (1 << 0)));
935
936 /* OCP */
937 if (ques_even & (1 << 1))
938 sr_session_send_meta(sdi, SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE,
939 g_variant_new_boolean(ques_cond & (1 << 1)));
940
941 /* OTP */
942 if (ques_even & (1 << 4))
943 sr_session_send_meta(sdi, SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE,
944 g_variant_new_boolean(ques_cond & (1 << 4)));
945
946 /* UNREG */
947 unreg = (ques_cond & (1 << 10));
948 regulation_changed = (ques_even & (1 << 10)) | regulation_changed;
949
950 /*
951 * Check if output state has changed, due to one of the
952 * questionable states changed.
b89e6db9
UH
953 * NOTE: The output state is sent even if it hasn't changed,
954 * but that only happens rarely.
fe4bb774
FS
955 */
956 ret = sr_scpi_get_bool(scpi, "OUTP:STAT?", &output_enabled);
957 if (ret != SR_OK)
958 return ret;
959 sr_session_send_meta(sdi, SR_CONF_ENABLED,
960 g_variant_new_boolean(output_enabled));
961 }
962
963 /* Operation status summary bit */
964 if (stb & (1 << 7)) {
965 /* Read the event register to clear it! */
966 ret = sr_scpi_get_int(scpi, "STAT:OPER:EVEN?", &oper_even);
967 if (ret != SR_OK)
968 return ret;
969 /* Now get the values. */
970 ret = sr_scpi_get_int(scpi, "STAT:OPER:COND?", &oper_cond);
971 if (ret != SR_OK)
972 return ret;
973
974 /* CV */
975 cv = (oper_cond & (1 << 8));
976 regulation_changed = (oper_even & (1 << 8)) | regulation_changed;
977 /* CC+ */
978 cc_pos = (oper_cond & (1 << 10));
979 regulation_changed = (oper_even & (1 << 10)) | regulation_changed;
980 /* CC- */
981 cc_neg = (oper_cond & (1 << 11));
982 regulation_changed = (oper_even & (1 << 11)) | regulation_changed;
983 }
984
985 if (regulation_changed) {
b89e6db9 986 if (cv && !cc_pos && !cc_neg && !unreg)
fe4bb774
FS
987 regulation = "CV";
988 else if (cc_pos && !cv && !cc_neg && !unreg)
989 regulation = "CC";
990 else if (cc_neg && !cv && !cc_pos && !unreg)
991 regulation = "CC-";
992 else if (unreg && !cv && !cc_pos && !cc_neg)
993 regulation = "UR";
b89e6db9
UH
994 else if (!cv && !cc_pos && !cc_neg && !unreg)
995 /* This happens in case of OCP active. */
fe4bb774
FS
996 regulation = "";
997 else {
b89e6db9 998 /* This happens from time to time (CV and CC+ active). */
fe4bb774
FS
999 sr_dbg("Undefined regulation for HP 66xxB "
1000 "(CV=%i, CC+=%i, CC-=%i, UR=%i).",
1001 cv, cc_pos, cc_neg, unreg);
1002 return FALSE;
1003 }
1004 sr_session_send_meta(sdi, SR_CONF_REGULATION,
1005 g_variant_new_string(regulation));
1006 }
1007
1008 return SR_OK;
1009}
1010
5433907e
PA
1011/* Owon P4000 series */
1012static const uint32_t owon_p4000_devopts[] = {
1013 SR_CONF_CONTINUOUS,
1014 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
1015 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET
1016};
1017
1018static const uint32_t owon_p4000_devopts_cg[] = {
1019 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
1020 SR_CONF_VOLTAGE | SR_CONF_GET,
1021 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1022 SR_CONF_CURRENT | SR_CONF_GET,
1023 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1024 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
1025 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
1026};
1027
1028static const struct channel_spec owon_p4603_ch[] = {
aec7d855 1029 { "1", { 0.01, 60, 0.001, 3, 3 }, { 0.001, 3, 0.001, 3, 3 }, { 0, 180, 0, 3, 3 }, FREQ_DC_ONLY, { 0.01, 61, 0.001}, { 0.001, 3.1, 0.001}, NO_OCP_DELAY },
5433907e
PA
1030};
1031
1032static const struct channel_spec owon_p4305_ch[] = {
aec7d855 1033 { "1", { 0.01, 30, 0.001, 3, 3 }, { 0.001, 5, 0.001, 3, 3 }, { 0, 180, 0, 3, 3 }, FREQ_DC_ONLY, { 0.01, 31, 0.001}, { 0.001, 3.1, 0.001}, NO_OCP_DELAY },
5433907e
PA
1034};
1035
1036static const struct channel_group_spec owon_p4000_cg[] = {
1037 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
1038};
1039
1040static const struct scpi_command owon_p4000_cmd[] = {
1041 { SCPI_CMD_GET_MEAS_VOLTAGE, "MEAS:VOLT?" },
1042 { SCPI_CMD_GET_MEAS_CURRENT, "MEAS:CURR?" },
1043 { SCPI_CMD_GET_MEAS_POWER, "MEAS:POW?" },
1044 { SCPI_CMD_GET_VOLTAGE_TARGET, "VOLT?" },
1045 { SCPI_CMD_SET_VOLTAGE_TARGET, "VOLT %.6f" },
1046 { SCPI_CMD_GET_CURRENT_LIMIT, "CURR?" },
1047 { SCPI_CMD_SET_CURRENT_LIMIT, "CURR %.6f" },
1048 { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP?" },
1049 { SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP 1" },
1050 { SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP 0" },
1051 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:LIM?" },
1052 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:LIM %.6f" },
1053 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, "CURR:LIM?" },
1054 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, "CURR:LIM %.6f" },
1055 ALL_ZERO
1056};
1057
20a28434
SS
1058/* Owon SPE series*/
1059
1060static const struct channel_spec owon_spe6103_ch[] = {
aec7d855 1061 { "1", { 0.01, 60, 0.01, 3, 3 }, { 0.001, 10, 0.001, 3, 3 }, { 0, 300, 0, 3, 3 }, FREQ_DC_ONLY, { 0.01, 61, 0.01}, { 0.001, 10.1, 0.001}, NO_OCP_DELAY },
20a28434
SS
1062};
1063
1064static const struct scpi_command owon_spe6103_cmd[] = {
1065 { SCPI_CMD_REMOTE, "SYST:REM" },
1066 { SCPI_CMD_LOCAL, "SYST:LOC" },
1067 { SCPI_CMD_GET_MEAS_VOLTAGE, "MEAS:VOLT?" },
1068 { SCPI_CMD_GET_MEAS_CURRENT, "MEAS:CURR?" },
1069 { SCPI_CMD_GET_MEAS_POWER, "MEAS:POW?" },
1070 { SCPI_CMD_GET_VOLTAGE_TARGET, "VOLT?" },
1071 { SCPI_CMD_SET_VOLTAGE_TARGET, "VOLT %.6f" },
1072 { SCPI_CMD_GET_CURRENT_LIMIT, "CURR?" },
1073 { SCPI_CMD_SET_CURRENT_LIMIT, "CURR %.6f" },
1074 { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP?" },
1075 { SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP 1" },
1076 { SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP 0" },
1077 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:LIM?" },
1078 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:LIM %.6f" },
1079 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, "CURR:LIM?" },
1080 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, "CURR:LIM %.6f" },
1081 ALL_ZERO
1082};
1083
c3eadb07 1084/* Philips/Fluke PM2800 series */
9d9cf1c4 1085static const uint32_t philips_pm2800_devopts[] = {
e91bb0a6 1086 SR_CONF_CONTINUOUS,
88e4daa9
ML
1087 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
1088 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
9d9cf1c4
BV
1089};
1090
c3eadb07 1091static const uint32_t philips_pm2800_devopts_cg[] = {
7a0b98b5
AJ
1092 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
1093 SR_CONF_VOLTAGE | SR_CONF_GET,
1094 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1095 SR_CONF_CURRENT | SR_CONF_GET,
1096 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
c3eadb07
BV
1097 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
1098 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
1099 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
1100 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
7a0b98b5 1101 SR_CONF_REGULATION | SR_CONF_GET,
c3eadb07
BV
1102};
1103
1104enum philips_pm2800_modules {
1105 PM2800_MOD_30V_10A = 1,
1106 PM2800_MOD_60V_5A,
1107 PM2800_MOD_60V_10A,
1108 PM2800_MOD_8V_15A,
1109 PM2800_MOD_60V_2A,
1110 PM2800_MOD_120V_1A,
1111};
1112
329733d9 1113static const struct philips_pm2800_module_spec {
c3eadb07 1114 /* Min, max, programming resolution. */
bcee1299
UH
1115 double voltage[5];
1116 double current[5];
1117 double power[5];
c3eadb07
BV
1118} philips_pm2800_module_specs[] = {
1119 /* Autoranging modules. */
6ed709fe
AJ
1120 [PM2800_MOD_30V_10A] = { { 0, 30, 0.0075, 2, 4 }, { 0, 10, 0.0025, 2, 4 }, { 0, 60 } },
1121 [PM2800_MOD_60V_5A] = { { 0, 60, 0.015, 2, 3 }, { 0, 5, 0.00125, 2, 5 }, { 0, 60 } },
1122 [PM2800_MOD_60V_10A] = { { 0, 60, 0.015, 2, 3 }, { 0, 10, 0.0025, 2, 5 }, { 0, 120 } },
c3eadb07 1123 /* Linear modules. */
6ed709fe
AJ
1124 [PM2800_MOD_8V_15A] = { { 0, 8, 0.002, 3, 3 }, { -15, 15, 0.00375, 3, 5 }, { 0, 120 } },
1125 [PM2800_MOD_60V_2A] = { { 0, 60, 0.015, 2, 3 }, { -2, 2, 0.0005, 3, 4 }, { 0, 120 } },
1126 [PM2800_MOD_120V_1A] = { { 0, 120, 0.030, 2, 2 }, { -1, 1, 0.00025, 3, 5 }, { 0, 120 } },
c3eadb07
BV
1127};
1128
329733d9 1129static const struct philips_pm2800_model {
c3eadb07
BV
1130 unsigned int chassis;
1131 unsigned int num_modules;
1132 unsigned int set;
1133 unsigned int modules[3];
1134} philips_pm2800_matrix[] = {
1135 /* Autoranging chassis. */
1136 { 1, 1, 0, { PM2800_MOD_30V_10A, 0, 0 } },
1137 { 1, 1, 1, { PM2800_MOD_60V_5A, 0, 0 } },
1138 { 1, 2, 0, { PM2800_MOD_30V_10A, PM2800_MOD_30V_10A, 0 } },
1139 { 1, 2, 1, { PM2800_MOD_60V_5A, PM2800_MOD_60V_5A, 0 } },
1140 { 1, 2, 2, { PM2800_MOD_30V_10A, PM2800_MOD_60V_5A, 0 } },
1141 { 1, 2, 3, { PM2800_MOD_30V_10A, PM2800_MOD_60V_10A, 0 } },
1142 { 1, 2, 4, { PM2800_MOD_60V_5A, PM2800_MOD_60V_10A, 0 } },
1143 { 1, 3, 0, { PM2800_MOD_30V_10A, PM2800_MOD_30V_10A, PM2800_MOD_30V_10A } },
1144 { 1, 3, 1, { PM2800_MOD_60V_5A, PM2800_MOD_60V_5A, PM2800_MOD_60V_5A } },
1145 { 1, 3, 2, { PM2800_MOD_30V_10A, PM2800_MOD_30V_10A, PM2800_MOD_60V_5A } },
1146 { 1, 3, 3, { PM2800_MOD_30V_10A, PM2800_MOD_60V_5A, PM2800_MOD_60V_5A } },
1147 /* Linear chassis. */
1148 { 3, 1, 0, { PM2800_MOD_60V_2A, 0, 0 } },
1149 { 3, 1, 1, { PM2800_MOD_120V_1A, 0, 0 } },
1150 { 3, 1, 2, { PM2800_MOD_8V_15A, 0, 0 } },
1151 { 3, 2, 0, { PM2800_MOD_60V_2A, 0, 0 } },
1152 { 3, 2, 1, { PM2800_MOD_120V_1A, 0, 0 } },
1153 { 3, 2, 2, { PM2800_MOD_60V_2A, PM2800_MOD_120V_1A, 0 } },
1154 { 3, 2, 3, { PM2800_MOD_8V_15A, PM2800_MOD_8V_15A, 0 } },
1155};
1156
329733d9 1157static const char *philips_pm2800_names[] = { "1", "2", "3" };
c3eadb07
BV
1158
1159static int philips_pm2800_probe_channels(struct sr_dev_inst *sdi,
1160 struct sr_scpi_hw_info *hw_info,
1161 struct channel_spec **channels, unsigned int *num_channels,
1162 struct channel_group_spec **channel_groups, unsigned int *num_channel_groups)
1163{
329733d9
UH
1164 const struct philips_pm2800_model *model;
1165 const struct philips_pm2800_module_spec *spec;
c3eadb07
BV
1166 unsigned int chassis, num_modules, set, module, m, i;
1167
1168 (void)sdi;
1169
1170 /*
1171 * The model number as reported by *IDN? looks like e.g. PM2813/11,
1172 * Where "PM28" is fixed, followed by the chassis code (1 = autoranging,
1173 * 3 = linear series) and the number of modules: 1-3 for autoranging,
1174 * 1-2 for linear.
1175 * After the slash, the first digit denotes the module set. The
1176 * digit after that denotes front (5) or rear (1) binding posts.
1177 */
1178 chassis = hw_info->model[4] - 0x30;
1179 num_modules = hw_info->model[5] - 0x30;
1180 set = hw_info->model[7] - 0x30;
1181 for (m = 0; m < ARRAY_SIZE(philips_pm2800_matrix); m++) {
1182 model = &philips_pm2800_matrix[m];
1183 if (model->chassis == chassis && model->num_modules == num_modules
1184 && model->set == set)
1185 break;
1186 }
1187 if (m == ARRAY_SIZE(philips_pm2800_matrix)) {
1188 sr_dbg("Model %s not found in matrix.", hw_info->model);
1189 return SR_ERR;
1190 }
1191
1192 sr_dbg("Found %d output channel%s:", num_modules, num_modules > 1 ? "s" : "");
1193 *channels = g_malloc0(sizeof(struct channel_spec) * num_modules);
1194 *channel_groups = g_malloc0(sizeof(struct channel_group_spec) * num_modules);
1195 for (i = 0; i < num_modules; i++) {
1196 module = model->modules[i];
1197 spec = &philips_pm2800_module_specs[module];
6ed709fe 1198 sr_dbg("output %d: %.0f - %.0fV, %.0f - %.0fA, %.0f - %.0fW", i + 1,
c3eadb07 1199 spec->voltage[0], spec->voltage[1],
6ed709fe 1200 spec->current[0], spec->current[1],
d9251a2c 1201 spec->power[0], spec->power[1]);
329733d9 1202 (*channels)[i].name = (char *)philips_pm2800_names[i];
bcee1299 1203 memcpy(&((*channels)[i].voltage), spec, sizeof(double) * 15);
329733d9 1204 (*channel_groups)[i].name = (char *)philips_pm2800_names[i];
c3eadb07
BV
1205 (*channel_groups)[i].channel_index_mask = 1 << i;
1206 (*channel_groups)[i].features = PPS_OTP | PPS_OVP | PPS_OCP;
f2bbcc33 1207 (*channel_groups)[i].mqflags = SR_MQFLAG_DC;
c3eadb07
BV
1208 }
1209 *num_channels = *num_channel_groups = num_modules;
1210
1211 return SR_OK;
1212}
1213
8cb5affe 1214static const struct scpi_command philips_pm2800_cmd[] = {
c3eadb07
BV
1215 { SCPI_CMD_SELECT_CHANNEL, ":INST:NSEL %s" },
1216 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT?" },
1217 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR?" },
1218 { SCPI_CMD_GET_VOLTAGE_TARGET, ":SOUR:VOLT?" },
1219 { SCPI_CMD_SET_VOLTAGE_TARGET, ":SOUR:VOLT %.6f" },
1220 { SCPI_CMD_GET_CURRENT_LIMIT, ":SOUR:CURR?" },
1221 { SCPI_CMD_SET_CURRENT_LIMIT, ":SOUR:CURR %.6f" },
1222 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP?" },
1223 { SCPI_CMD_SET_OUTPUT_ENABLE, ":OUTP ON" },
1224 { SCPI_CMD_SET_OUTPUT_DISABLE, ":OUTP OFF" },
1225 { SCPI_CMD_GET_OUTPUT_REGULATION, ":SOUR:FUNC:MODE?" },
1226 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, ":SOUR:VOLT:PROT:TRIP?" },
1227 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT:LEV?" },
1228 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":SOUR:VOLT:PROT:LEV %.6f" },
1229 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, ":SOUR:CURR:PROT:STAT?" },
1230 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, ":SOUR:CURR:PROT:STAT ON" },
1231 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, ":SOUR:CURR:PROT:STAT OFF" },
1232 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, ":SOUR:CURR:PROT:TRIP?" },
91ef511d 1233 ALL_ZERO
c3eadb07
BV
1234};
1235
81eb36d6
MS
1236static const uint32_t rs_hmc8043_devopts[] = {
1237 SR_CONF_CONTINUOUS,
88e4daa9
ML
1238 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
1239 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
81eb36d6
MS
1240};
1241
1242static const uint32_t rs_hmc8043_devopts_cg[] = {
1243 SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
1244 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
1245 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
9d2c2391
MS
1246 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_GET | SR_CONF_SET,
1247 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
1248 SR_CONF_OVER_CURRENT_PROTECTION_DELAY | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
81eb36d6
MS
1249 SR_CONF_VOLTAGE | SR_CONF_GET,
1250 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1251 SR_CONF_CURRENT | SR_CONF_GET,
1252 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1253 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
1254};
1255
1256static const struct channel_spec rs_hmc8043_ch[] = {
9d2c2391
MS
1257 { "1", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 3, 0.001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, { 0.01, 10, 0.001, 3, 4} },
1258 { "2", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 3, 0.001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, { 0.01, 10, 0.001, 3, 4} },
1259 { "3", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 3, 0.001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, { 0.01, 10, 0.001, 3, 4} },
81eb36d6
MS
1260};
1261
1262static const struct channel_group_spec rs_hmc8043_cg[] = {
9d2c2391
MS
1263 { "1", CH_IDX(0), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
1264 { "2", CH_IDX(1), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
1265 { "3", CH_IDX(2), PPS_OVP | PPS_OCP, SR_MQFLAG_DC },
81eb36d6
MS
1266};
1267
1268static const struct scpi_command rs_hmc8043_cmd[] = {
1269 { SCPI_CMD_SELECT_CHANNEL, "INST:NSEL %s" },
1270 { SCPI_CMD_GET_MEAS_VOLTAGE, "MEAS:VOLT?" },
1271 { SCPI_CMD_GET_MEAS_CURRENT, "MEAS:CURR?" },
1272 { SCPI_CMD_GET_VOLTAGE_TARGET, "VOLT?" },
1273 { SCPI_CMD_SET_VOLTAGE_TARGET, "VOLT %.6f" },
1274 { SCPI_CMD_GET_CURRENT_LIMIT, "CURR?" },
1275 { SCPI_CMD_SET_CURRENT_LIMIT, "CURR %.6f" },
1276 { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP?" },
1277 { SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP ON" },
1278 { SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP OFF" },
1279 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "VOLT:PROT:TRIP?" },
1280 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:PROT:LEV?" },
1281 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:PROT:LEV %.6f" },
1282 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ENABLED, "VOLT:PROT:STAT?" },
1283 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_ENABLE, "VOLT:PROT:STAT ON" },
1284 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_DISABLE, "VOLT:PROT:STAT OFF" },
9d2c2391
MS
1285 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, "FUSE:TRIP?" },
1286 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, "FUSE:STAT?" },
1287 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, "FUSE:STAT ON" },
1288 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, "FUSE:STAT OFF" },
1289 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_DELAY, "FUSE:DEL?" },
1290 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DELAY, "FUSE:DEL %.03f" },
81eb36d6
MS
1291 ALL_ZERO
1292};
1293
bd5f0a14
FS
1294static const uint32_t rs_hmp4040_devopts[] = {
1295 SR_CONF_CONTINUOUS,
1296 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
1297 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
1298};
1299
1300static const uint32_t rs_hmp4040_devopts_cg[] = {
1301 SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED | SR_CONF_GET,
1302 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
1303 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_GET | SR_CONF_SET,
1304 SR_CONF_VOLTAGE | SR_CONF_GET,
1305 SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1306 SR_CONF_CURRENT | SR_CONF_GET,
1307 SR_CONF_CURRENT_LIMIT | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
1308 SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
1309 SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET,
1310 SR_CONF_REGULATION | SR_CONF_GET,
1311};
1312
1c5d5905 1313static const struct channel_spec rs_hmp2020_ch[] = {
aec7d855
MS
1314 { "1", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 10.01, 0.0002, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1315 { "2", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 5.01, 0.0001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1c5d5905
GS
1316};
1317
1318static const struct channel_spec rs_hmp2030_ch[] = {
aec7d855
MS
1319 { "1", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 5.01, 0.0001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1320 { "2", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 5.01, 0.0001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1321 { "3", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 5.01, 0.0001, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1c5d5905
GS
1322};
1323
bd5f0a14 1324static const struct channel_spec rs_hmp4040_ch[] = {
aec7d855
MS
1325 { "1", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 10.01, 0.0002, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1326 { "2", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 10.01, 0.0002, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1327 { "3", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 10.01, 0.0002, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
1328 { "4", { 0, 32.050, 0.001, 3, 4 }, { 0.001, 10.01, 0.0002, 3, 4 }, { 0, 0, 0, 0, 4 }, FREQ_DC_ONLY, NO_OVP_LIMITS, NO_OCP_LIMITS, NO_OCP_DELAY },
bd5f0a14
FS
1329};
1330
1331static const struct channel_group_spec rs_hmp4040_cg[] = {
1332 { "1", CH_IDX(0), PPS_OVP | PPS_OTP, SR_MQFLAG_DC },
1333 { "2", CH_IDX(1), PPS_OVP | PPS_OTP, SR_MQFLAG_DC },
1334 { "3", CH_IDX(2), PPS_OVP | PPS_OTP, SR_MQFLAG_DC },
1335 { "4", CH_IDX(3), PPS_OVP | PPS_OTP, SR_MQFLAG_DC },
1336};
1337
1338/*
1339 * Developer's note: Currently unused device commands. Some of them
1340 * are not in use because SCPI_CMD codes are not defined yet.
1341 * OUTP:GEN
1342 * VOLT? MAX, CURR? MAX
1343 * VOLT:PROT:CLE (could set SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE)
1344 * VOLT:PROT:MODE
1345 * FUSE:STAT, FUSE:TRIP?, FUSE:LINK, FUSE:UNL
1346 * ARB:...
1347 * SYST:LOC, SYST:REM, SYST:RWL, SYST:MIX
1348 * SYST:BEEP:IMM
1349 */
1350static const struct scpi_command rs_hmp4040_cmd[] = {
f403cb9d
GS
1351 { SCPI_CMD_REMOTE, "SYST:REM" },
1352 { SCPI_CMD_LOCAL, "SYST:LOC" },
bd5f0a14
FS
1353 { SCPI_CMD_SELECT_CHANNEL, "INST:NSEL %s" },
1354 { SCPI_CMD_GET_MEAS_VOLTAGE, "MEAS:VOLT?" },
1355 { SCPI_CMD_GET_MEAS_CURRENT, "MEAS:CURR?" },
1356 { SCPI_CMD_GET_VOLTAGE_TARGET, "VOLT?" },
1357 { SCPI_CMD_SET_VOLTAGE_TARGET, "VOLT %.6f" },
1358 { SCPI_CMD_GET_CURRENT_LIMIT, "CURR?" },
1359 { SCPI_CMD_SET_CURRENT_LIMIT, "CURR %.6f" },
1360 { SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP?" },
1361 { SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP ON" },
1362 { SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP OFF" },
1363 { SCPI_CMD_GET_OUTPUT_REGULATION, "STAT:QUES:INST:ISUM%s:COND?" },
1364 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "VOLT:PROT:TRIP?" },
1365 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:PROT:LEV?" },
1366 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:PROT:LEV %.6f" },
1367 { SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE, "STAT:QUES:INST:ISUM%s:COND?" },
1368 ALL_ZERO
1369};
1370
d4eabea8 1371SR_PRIV const struct scpi_pps pps_profiles[] = {
6cc93128 1372 /* Agilent N5763A */
5e7377f4 1373 { "Agilent", "N5763A", SCPI_DIALECT_UNKNOWN, 0,
6cc93128
AG
1374 ARRAY_AND_SIZE(agilent_n5700a_devopts),
1375 ARRAY_AND_SIZE(agilent_n5700a_devopts_cg),
1376 ARRAY_AND_SIZE(agilent_n5763a_ch),
1377 ARRAY_AND_SIZE(agilent_n5700a_cg),
1378 agilent_n5700a_cmd,
1379 .probe_channels = NULL,
fd243315 1380 .init_acquisition = NULL,
7e66bf05 1381 .update_status = NULL,
6cc93128 1382 },
ca314e06 1383
5c9e56c9 1384 /* Agilent N5767A */
5e7377f4 1385 { "Agilent", "N5767A", SCPI_DIALECT_UNKNOWN, 0,
5c9e56c9
AG
1386 ARRAY_AND_SIZE(agilent_n5700a_devopts),
1387 ARRAY_AND_SIZE(agilent_n5700a_devopts_cg),
1388 ARRAY_AND_SIZE(agilent_n5767a_ch),
6cc93128 1389 ARRAY_AND_SIZE(agilent_n5700a_cg),
91ef511d 1390 agilent_n5700a_cmd,
5c9e56c9 1391 .probe_channels = NULL,
fd243315 1392 .init_acquisition = NULL,
7e66bf05 1393 .update_status = NULL,
5c9e56c9 1394 },
ca314e06 1395
c3bfb959 1396 /* BK Precision 9310 */
5e7377f4 1397 { "BK", "^9130$", SCPI_DIALECT_UNKNOWN, 0,
c3bfb959
MW
1398 ARRAY_AND_SIZE(bk_9130_devopts),
1399 ARRAY_AND_SIZE(bk_9130_devopts_cg),
1400 ARRAY_AND_SIZE(bk_9130_ch),
1401 ARRAY_AND_SIZE(bk_9130_cg),
1402 bk_9130_cmd,
1403 .probe_channels = NULL,
fd243315 1404 .init_acquisition = NULL,
7e66bf05 1405 .update_status = NULL,
c3bfb959
MW
1406 },
1407
4ee1e2f3 1408 /* Chroma 61604 */
5e7377f4 1409 { "Chroma", "61604", SCPI_DIALECT_UNKNOWN, 0,
4ee1e2f3
AG
1410 ARRAY_AND_SIZE(chroma_61604_devopts),
1411 ARRAY_AND_SIZE(chroma_61604_devopts_cg),
1412 ARRAY_AND_SIZE(chroma_61604_ch),
1413 ARRAY_AND_SIZE(chroma_61604_cg),
91ef511d 1414 chroma_61604_cmd,
4ee1e2f3 1415 .probe_channels = NULL,
fd243315 1416 .init_acquisition = NULL,
7e66bf05 1417 .update_status = NULL,
4ee1e2f3 1418 },
ca314e06 1419
5281993e 1420 /* Chroma 62000 series */
5e7377f4 1421 { "Chroma", "620[0-9]{2}P-[0-9]{2,3}-[0-9]{1,3}", SCPI_DIALECT_UNKNOWN, 0,
5281993e
AG
1422 ARRAY_AND_SIZE(chroma_62000_devopts),
1423 ARRAY_AND_SIZE(chroma_62000_devopts_cg),
9a5185c7
AG
1424 NULL, 0,
1425 NULL, 0,
91ef511d 1426 chroma_62000_cmd,
9a5185c7 1427 .probe_channels = chroma_62000p_probe_channels,
22fdb67f
MA
1428 .init_acquisition = NULL,
1429 .update_status = NULL,
1430 },
1431
1432 /*
1433 * Envox EEZ PSU Series
1434 * The documented identification strings disagree with the behavior
1435 * of at least some real units (returning "EEZ"). The first of these
1436 * is the documented one, while the second seems to be returned by
1437 * firmware v1.02 and earlier.
1438 */
1439 { "Envox", "^EEZ H24005 ", SCPI_DIALECT_UNKNOWN, 0,
1440 ARRAY_AND_SIZE(eez_psu_devopts),
1441 ARRAY_AND_SIZE(eez_psu_devopts_cg),
1442 NULL, 0,
1443 NULL, 0,
1444 eez_psu_cmd,
1445 .probe_channels = eez_psu_probe_channels,
1446 .init_acquisition = NULL,
1447 .update_status = NULL,
1448 },
1449 { "EEZ", "^PSU ", SCPI_DIALECT_UNKNOWN, 0,
1450 ARRAY_AND_SIZE(eez_psu_devopts),
1451 ARRAY_AND_SIZE(eez_psu_devopts_cg),
1452 NULL, 0,
1453 NULL, 0,
1454 eez_psu_cmd,
1455 .probe_channels = eez_psu_probe_channels,
1456 .init_acquisition = NULL,
1457 .update_status = NULL,
1458 },
1459
1460 /* Envox EEZ BB3 Series */
1461 { "Envox", "^BB3 ", SCPI_DIALECT_UNKNOWN, 0,
1462 ARRAY_AND_SIZE(eez_psu_devopts),
1463 ARRAY_AND_SIZE(eez_psu_devopts_cg),
1464 NULL, 0,
1465 NULL, 0,
1466 eez_psu_cmd,
1467 .probe_channels = eez_psu_probe_channels,
fd243315 1468 .init_acquisition = NULL,
7e66bf05 1469 .update_status = NULL,
5281993e 1470 },
ca314e06 1471
5ce427c7
FS
1472 /*
1473 * This entry is for testing the HP COMP language with a HP 6632B power
1474 * supply switched to the COMP language ("SYST:LANG COMP"). When used,
1475 * disable the entry for the HP 6632B below!
1476 */
1477 /*
1478 { "HP", "6632B", SCPI_DIALECT_HP_COMP, 0,
1479 ARRAY_AND_SIZE(hp_6630a_devopts),
1480 ARRAY_AND_SIZE(hp_6630a_devopts_cg),
1481 ARRAY_AND_SIZE(hp_6632a_ch),
1482 ARRAY_AND_SIZE(hp_6630a_cg),
1483 hp_6630a_cmd,
1484 .probe_channels = NULL,
fd243315 1485 hp_6630a_init_acquisition,
5ce427c7
FS
1486 hp_6630a_update_status,
1487 },
1488 */
1489
1490 /* HP 6632A */
1491 { "HP", "6632A", SCPI_DIALECT_HP_COMP, 0,
1492 ARRAY_AND_SIZE(hp_6630a_devopts),
1493 ARRAY_AND_SIZE(hp_6630a_devopts_cg),
1494 ARRAY_AND_SIZE(hp_6632a_ch),
1495 ARRAY_AND_SIZE(hp_6630a_cg),
1496 hp_6630a_cmd,
1497 .probe_channels = NULL,
fd243315 1498 hp_6630a_init_acquisition,
5ce427c7
FS
1499 hp_6630a_update_status,
1500 },
1501
e76a3575 1502 /* HP 6633A */
5e7377f4 1503 { "HP", "6633A", SCPI_DIALECT_HP_COMP, 0,
e76a3575 1504 ARRAY_AND_SIZE(hp_6630a_devopts),
7c517d02 1505 ARRAY_AND_SIZE(hp_6630a_devopts_cg),
e76a3575 1506 ARRAY_AND_SIZE(hp_6633a_ch),
dbc519f7 1507 ARRAY_AND_SIZE(hp_6630a_cg),
e76a3575
AG
1508 hp_6630a_cmd,
1509 .probe_channels = NULL,
fd243315 1510 hp_6630a_init_acquisition,
fdf03652 1511 hp_6630a_update_status,
e76a3575
AG
1512 },
1513
5ce427c7
FS
1514 /* HP 6634A */
1515 { "HP", "6634A", SCPI_DIALECT_HP_COMP, 0,
1516 ARRAY_AND_SIZE(hp_6630a_devopts),
1517 ARRAY_AND_SIZE(hp_6630a_devopts_cg),
1518 ARRAY_AND_SIZE(hp_6634a_ch),
1519 ARRAY_AND_SIZE(hp_6630a_cg),
1520 hp_6630a_cmd,
1521 .probe_channels = NULL,
fd243315 1522 hp_6630a_init_acquisition,
5ce427c7
FS
1523 hp_6630a_update_status,
1524 },
1525
1526 /* HP 6611C */
1527 { "HP", "6611C", SCPI_DIALECT_HP_66XXB, PPS_OTP,
1528 ARRAY_AND_SIZE(hp_6630b_devopts),
1529 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1530 ARRAY_AND_SIZE(hp_6611c_ch),
1531 ARRAY_AND_SIZE(hp_6630b_cg),
1532 hp_6630b_cmd,
1533 .probe_channels = NULL,
fd243315 1534 hp_6630b_init_acquisition,
5ce427c7
FS
1535 hp_6630b_update_status,
1536 },
1537
1538 /* HP 6612C */
1539 { "HP", "6612C", SCPI_DIALECT_HP_66XXB, PPS_OTP,
1540 ARRAY_AND_SIZE(hp_6630b_devopts),
1541 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1542 ARRAY_AND_SIZE(hp_6612c_ch),
1543 ARRAY_AND_SIZE(hp_6630b_cg),
1544 hp_6630b_cmd,
1545 .probe_channels = NULL,
fd243315 1546 hp_6630b_init_acquisition,
5ce427c7
FS
1547 hp_6630b_update_status,
1548 },
1549
1550 /* HP 6613C */
1551 { "HP", "6613C", SCPI_DIALECT_HP_66XXB, PPS_OTP,
1552 ARRAY_AND_SIZE(hp_6630b_devopts),
1553 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1554 ARRAY_AND_SIZE(hp_6613c_ch),
1555 ARRAY_AND_SIZE(hp_6630b_cg),
1556 hp_6630b_cmd,
1557 .probe_channels = NULL,
fd243315 1558 hp_6630b_init_acquisition,
5ce427c7
FS
1559 hp_6630b_update_status,
1560 },
1561
1562 /* HP 6614C */
1563 { "HP", "6614C", SCPI_DIALECT_HP_66XXB, PPS_OTP,
1564 ARRAY_AND_SIZE(hp_6630b_devopts),
1565 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1566 ARRAY_AND_SIZE(hp_6614c_ch),
1567 ARRAY_AND_SIZE(hp_6630b_cg),
1568 hp_6630b_cmd,
1569 .probe_channels = NULL,
fd243315 1570 hp_6630b_init_acquisition,
5ce427c7
FS
1571 hp_6630b_update_status,
1572 },
1573
a61c8cce 1574 /* HP 6631B */
3d1aa50f 1575 { "HP", "6631B", SCPI_DIALECT_HP_66XXB, PPS_OTP,
a61c8cce
FS
1576 ARRAY_AND_SIZE(hp_6630b_devopts),
1577 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1578 ARRAY_AND_SIZE(hp_6631b_ch),
dbc519f7 1579 ARRAY_AND_SIZE(hp_6630b_cg),
a61c8cce
FS
1580 hp_6630b_cmd,
1581 .probe_channels = NULL,
fd243315 1582 hp_6630b_init_acquisition,
fe4bb774 1583 hp_6630b_update_status,
a61c8cce
FS
1584 },
1585
bc4a2a46 1586 /* HP 6632B */
3d1aa50f 1587 { "HP", "6632B", SCPI_DIALECT_HP_66XXB, PPS_OTP,
a61c8cce
FS
1588 ARRAY_AND_SIZE(hp_6630b_devopts),
1589 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
bc4a2a46 1590 ARRAY_AND_SIZE(hp_6632b_ch),
dbc519f7 1591 ARRAY_AND_SIZE(hp_6630b_cg),
a61c8cce
FS
1592 hp_6630b_cmd,
1593 .probe_channels = NULL,
fd243315 1594 hp_6630b_init_acquisition,
fe4bb774 1595 hp_6630b_update_status,
a61c8cce
FS
1596 },
1597
0b0f40d8
MW
1598 /* HP 66312A */
1599 { "HP", "66312A", SCPI_DIALECT_HP_66XXB, PPS_OTP,
1600 ARRAY_AND_SIZE(hp_6630b_devopts),
1601 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1602 ARRAY_AND_SIZE(hp_66312a_ch),
1603 ARRAY_AND_SIZE(hp_6630b_cg),
1604 hp_6630b_cmd,
1605 .probe_channels = NULL,
1606 hp_6630b_init_acquisition,
1607 hp_6630b_update_status,
1608 },
1609
a61c8cce 1610 /* HP 66332A */
3d1aa50f 1611 { "HP", "66332A", SCPI_DIALECT_HP_66XXB, PPS_OTP,
a61c8cce
FS
1612 ARRAY_AND_SIZE(hp_6630b_devopts),
1613 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1614 ARRAY_AND_SIZE(hp_66332a_ch),
dbc519f7 1615 ARRAY_AND_SIZE(hp_6630b_cg),
a61c8cce
FS
1616 hp_6630b_cmd,
1617 .probe_channels = NULL,
fd243315 1618 hp_6630b_init_acquisition,
fe4bb774 1619 hp_6630b_update_status,
a61c8cce
FS
1620 },
1621
1622 /* HP 6633B */
3d1aa50f 1623 { "HP", "6633B", SCPI_DIALECT_HP_66XXB, PPS_OTP,
a61c8cce
FS
1624 ARRAY_AND_SIZE(hp_6630b_devopts),
1625 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1626 ARRAY_AND_SIZE(hp_6633b_ch),
dbc519f7 1627 ARRAY_AND_SIZE(hp_6630b_cg),
a61c8cce
FS
1628 hp_6630b_cmd,
1629 .probe_channels = NULL,
fd243315 1630 hp_6630b_init_acquisition,
fe4bb774 1631 hp_6630b_update_status,
a61c8cce
FS
1632 },
1633
1634 /* HP 6634B */
3d1aa50f 1635 { "HP", "6634B", SCPI_DIALECT_HP_66XXB, PPS_OTP,
a61c8cce
FS
1636 ARRAY_AND_SIZE(hp_6630b_devopts),
1637 ARRAY_AND_SIZE(hp_6630b_devopts_cg),
1638 ARRAY_AND_SIZE(hp_6634b_ch),
dbc519f7 1639 ARRAY_AND_SIZE(hp_6630b_cg),
a61c8cce 1640 hp_6630b_cmd,
c3eadb07 1641 .probe_channels = NULL,
fd243315 1642 hp_6630b_init_acquisition,
fe4bb774 1643 hp_6630b_update_status,
bc4a2a46
BV
1644 },
1645
319fe9ce 1646 /* Rigol DP700 series */
5e7377f4 1647 { "Rigol", "^DP711$", SCPI_DIALECT_UNKNOWN, 0,
319fe9ce
UH
1648 ARRAY_AND_SIZE(rigol_dp700_devopts),
1649 ARRAY_AND_SIZE(rigol_dp700_devopts_cg),
1650 ARRAY_AND_SIZE(rigol_dp711_ch),
1651 ARRAY_AND_SIZE(rigol_dp700_cg),
1652 rigol_dp700_cmd,
1653 .probe_channels = NULL,
fd243315 1654 .init_acquisition = NULL,
7e66bf05 1655 .update_status = NULL,
319fe9ce 1656 },
5e7377f4 1657 { "Rigol", "^DP712$", SCPI_DIALECT_UNKNOWN, 0,
319fe9ce
UH
1658 ARRAY_AND_SIZE(rigol_dp700_devopts),
1659 ARRAY_AND_SIZE(rigol_dp700_devopts_cg),
1660 ARRAY_AND_SIZE(rigol_dp712_ch),
1661 ARRAY_AND_SIZE(rigol_dp700_cg),
1662 rigol_dp700_cmd,
1663 .probe_channels = NULL,
fd243315 1664 .init_acquisition = NULL,
7e66bf05 1665 .update_status = NULL,
319fe9ce
UH
1666 },
1667
d4eabea8 1668 /* Rigol DP800 series */
5e7377f4 1669 { "Rigol", "^DP821A$", SCPI_DIALECT_UNKNOWN, PPS_OTP,
cfcdf576
ML
1670 ARRAY_AND_SIZE(rigol_dp800_devopts),
1671 ARRAY_AND_SIZE(rigol_dp800_devopts_cg),
1672 ARRAY_AND_SIZE(rigol_dp821a_ch),
1673 ARRAY_AND_SIZE(rigol_dp820_cg),
91ef511d 1674 rigol_dp800_cmd,
cfcdf576 1675 .probe_channels = NULL,
fd243315 1676 .init_acquisition = NULL,
7e66bf05 1677 .update_status = NULL,
cfcdf576 1678 },
5e7377f4 1679 { "Rigol", "^DP831A$", SCPI_DIALECT_UNKNOWN, PPS_OTP,
3222ee10
BV
1680 ARRAY_AND_SIZE(rigol_dp800_devopts),
1681 ARRAY_AND_SIZE(rigol_dp800_devopts_cg),
1682 ARRAY_AND_SIZE(rigol_dp831_ch),
cfcdf576 1683 ARRAY_AND_SIZE(rigol_dp830_cg),
91ef511d 1684 rigol_dp800_cmd,
c3eadb07 1685 .probe_channels = NULL,
fd243315 1686 .init_acquisition = NULL,
7e66bf05 1687 .update_status = NULL,
3222ee10 1688 },
5e7377f4 1689 { "Rigol", "^(DP832|DP832A)$", SCPI_DIALECT_UNKNOWN, PPS_OTP,
3222ee10
BV
1690 ARRAY_AND_SIZE(rigol_dp800_devopts),
1691 ARRAY_AND_SIZE(rigol_dp800_devopts_cg),
1692 ARRAY_AND_SIZE(rigol_dp832_ch),
cfcdf576 1693 ARRAY_AND_SIZE(rigol_dp830_cg),
91ef511d 1694 rigol_dp800_cmd,
c3eadb07 1695 .probe_channels = NULL,
fd243315 1696 .init_acquisition = NULL,
7e66bf05 1697 .update_status = NULL,
c3eadb07
BV
1698 },
1699
5433907e
PA
1700 /* Owon P4000 series */
1701 { "OWON", "^P4305$", SCPI_DIALECT_UNKNOWN, 0,
1702 ARRAY_AND_SIZE(owon_p4000_devopts),
1703 ARRAY_AND_SIZE(owon_p4000_devopts_cg),
1704 ARRAY_AND_SIZE(owon_p4305_ch),
1705 ARRAY_AND_SIZE(owon_p4000_cg),
1706 owon_p4000_cmd,
1707 .probe_channels = NULL,
1708 .init_acquisition = NULL,
1709 .update_status = NULL,
1710 },
1711 { "OWON", "^P4603$", SCPI_DIALECT_UNKNOWN, 0,
1712 ARRAY_AND_SIZE(owon_p4000_devopts),
1713 ARRAY_AND_SIZE(owon_p4000_devopts_cg),
1714 ARRAY_AND_SIZE(owon_p4603_ch),
1715 ARRAY_AND_SIZE(owon_p4000_cg),
1716 owon_p4000_cmd,
1717 .probe_channels = NULL,
1718 .init_acquisition = NULL,
1719 .update_status = NULL,
1720 },
1721
20a28434
SS
1722 { "OWON", "^SPE6103$", SCPI_DIALECT_UNKNOWN, 0,
1723 ARRAY_AND_SIZE(owon_p4000_devopts),
1724 ARRAY_AND_SIZE(owon_p4000_devopts_cg),
1725 ARRAY_AND_SIZE(owon_spe6103_ch),
1726 ARRAY_AND_SIZE(owon_p4000_cg),
1727 owon_spe6103_cmd,
1728 .probe_channels = NULL,
1729 .init_acquisition = NULL,
1730 .update_status = NULL,
1731 },
1732
c3eadb07 1733 /* Philips/Fluke PM2800 series */
5e7377f4 1734 { "Philips", "^PM28[13][123]/[01234]{1,2}$", SCPI_DIALECT_PHILIPS, 0,
9d9cf1c4 1735 ARRAY_AND_SIZE(philips_pm2800_devopts),
c3eadb07
BV
1736 ARRAY_AND_SIZE(philips_pm2800_devopts_cg),
1737 NULL, 0,
1738 NULL, 0,
91ef511d 1739 philips_pm2800_cmd,
c3eadb07 1740 philips_pm2800_probe_channels,
fd243315 1741 .init_acquisition = NULL,
7e66bf05 1742 .update_status = NULL,
d4eabea8 1743 },
81eb36d6 1744
3ed4b109
MS
1745 /* Rohde & Schwarz HMC8042 */
1746 { "Rohde&Schwarz", "HMC8042", SCPI_DIALECT_UNKNOWN, 0,
1747 ARRAY_AND_SIZE(rs_hmc8043_devopts),
1748 ARRAY_AND_SIZE(rs_hmc8043_devopts_cg),
1749 rs_hmc8043_ch, 2,
1750 rs_hmc8043_cg, 2,
1751 rs_hmc8043_cmd,
1752 .probe_channels = NULL,
1753 .init_acquisition = NULL,
1754 .update_status = NULL,
1755 },
1756
81eb36d6 1757 /* Rohde & Schwarz HMC8043 */
5e7377f4 1758 { "Rohde&Schwarz", "HMC8043", SCPI_DIALECT_UNKNOWN, 0,
81eb36d6
MS
1759 ARRAY_AND_SIZE(rs_hmc8043_devopts),
1760 ARRAY_AND_SIZE(rs_hmc8043_devopts_cg),
1761 ARRAY_AND_SIZE(rs_hmc8043_ch),
1762 ARRAY_AND_SIZE(rs_hmc8043_cg),
1763 rs_hmc8043_cmd,
1764 .probe_channels = NULL,
fd243315 1765 .init_acquisition = NULL,
7e66bf05 1766 .update_status = NULL,
81eb36d6 1767 },
bd5f0a14
FS
1768
1769 /* Hameg / Rohde&Schwarz HMP4000 series */
22f76e18
GS
1770 /* TODO Match on regex, pass scpi_pps item to .probe_channels(). */
1771 { "HAMEG", "HMP4030", SCPI_DIALECT_HMP, 0,
1772 ARRAY_AND_SIZE(rs_hmp4040_devopts),
1773 ARRAY_AND_SIZE(rs_hmp4040_devopts_cg),
1774 rs_hmp4040_ch, 3,
1775 rs_hmp4040_cg, 3,
1776 rs_hmp4040_cmd,
1777 .probe_channels = NULL,
f403cb9d 1778 .init_acquisition = NULL,
22f76e18
GS
1779 .update_status = NULL,
1780 },
bd5f0a14
FS
1781 { "HAMEG", "HMP4040", SCPI_DIALECT_HMP, 0,
1782 ARRAY_AND_SIZE(rs_hmp4040_devopts),
1783 ARRAY_AND_SIZE(rs_hmp4040_devopts_cg),
1784 ARRAY_AND_SIZE(rs_hmp4040_ch),
1785 ARRAY_AND_SIZE(rs_hmp4040_cg),
1786 rs_hmp4040_cmd,
1787 .probe_channels = NULL,
f403cb9d 1788 .init_acquisition = NULL,
bd5f0a14
FS
1789 .update_status = NULL,
1790 },
1c5d5905
GS
1791 { "ROHDE&SCHWARZ", "HMP2020", SCPI_DIALECT_HMP, 0,
1792 ARRAY_AND_SIZE(rs_hmp4040_devopts),
1793 ARRAY_AND_SIZE(rs_hmp4040_devopts_cg),
1794 rs_hmp2020_ch, 2,
1795 rs_hmp4040_cg, 2,
1796 rs_hmp4040_cmd,
1797 .probe_channels = NULL,
1798 .init_acquisition = NULL,
1799 .update_status = NULL,
1800 },
1801 { "ROHDE&SCHWARZ", "HMP2030", SCPI_DIALECT_HMP, 0,
1802 ARRAY_AND_SIZE(rs_hmp4040_devopts),
1803 ARRAY_AND_SIZE(rs_hmp4040_devopts_cg),
1804 rs_hmp2030_ch, 3,
1805 rs_hmp4040_cg, 3,
1806 rs_hmp4040_cmd,
1807 .probe_channels = NULL,
1808 .init_acquisition = NULL,
1809 .update_status = NULL,
1810 },
22f76e18
GS
1811 { "ROHDE&SCHWARZ", "HMP4030", SCPI_DIALECT_HMP, 0,
1812 ARRAY_AND_SIZE(rs_hmp4040_devopts),
1813 ARRAY_AND_SIZE(rs_hmp4040_devopts_cg),
1814 rs_hmp4040_ch, 3,
1815 rs_hmp4040_cg, 3,
1816 rs_hmp4040_cmd,
1817 .probe_channels = NULL,
f403cb9d 1818 .init_acquisition = NULL,
22f76e18
GS
1819 .update_status = NULL,
1820 },
1821 { "ROHDE&SCHWARZ", "HMP4040", SCPI_DIALECT_HMP, 0,
1822 ARRAY_AND_SIZE(rs_hmp4040_devopts),
1823 ARRAY_AND_SIZE(rs_hmp4040_devopts_cg),
1824 ARRAY_AND_SIZE(rs_hmp4040_ch),
1825 ARRAY_AND_SIZE(rs_hmp4040_cg),
1826 rs_hmp4040_cmd,
1827 .probe_channels = NULL,
f403cb9d 1828 .init_acquisition = NULL,
22f76e18
GS
1829 .update_status = NULL,
1830 },
d4eabea8 1831};
d4eabea8 1832
1beccaed 1833SR_PRIV unsigned int num_pps_profiles = ARRAY_SIZE(pps_profiles);