]>
Commit | Line | Data |
---|---|---|
e3b83c5e SS |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2017 Sven Schnelle <svens@stackframe.org> | |
5 | * | |
6 | * This program is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | #include <config.h> | |
3f2c7c94 SS |
21 | #include <stdlib.h> |
22 | #include "scpi.h" | |
e3b83c5e SS |
23 | #include "protocol.h" |
24 | ||
3f2c7c94 SS |
25 | static struct sr_dev_driver lecroy_xstream_driver_info; |
26 | ||
27 | static const char *manufacturers[] = { | |
28 | "LECROY", | |
29 | }; | |
30 | ||
31 | static const uint32_t scanopts[] = { | |
32 | SR_CONF_CONN, | |
33 | }; | |
34 | ||
90230cfa SA |
35 | static const uint32_t drvopts[] = { |
36 | SR_CONF_OSCILLOSCOPE, | |
37 | }; | |
38 | ||
39 | static const uint32_t devopts[] = { | |
40 | SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET, | |
86621306 | 41 | SR_CONF_SAMPLERATE | SR_CONF_GET, |
90230cfa SA |
42 | SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, |
43 | SR_CONF_NUM_HDIV | SR_CONF_GET, | |
90230cfa | 44 | SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_GET | SR_CONF_SET, |
86621306 UH |
45 | SR_CONF_TRIGGER_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, |
46 | SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, | |
90230cfa SA |
47 | }; |
48 | ||
6b82c3e5 | 49 | static const uint32_t devopts_cg_analog[] = { |
90230cfa | 50 | SR_CONF_NUM_VDIV | SR_CONF_GET, |
90230cfa | 51 | SR_CONF_VDIV | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, |
86621306 | 52 | SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, |
90230cfa SA |
53 | }; |
54 | ||
373e92a4 | 55 | static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) |
3f2c7c94 SS |
56 | { |
57 | struct sr_dev_inst *sdi; | |
58 | struct dev_context *devc; | |
59 | struct sr_scpi_hw_info *hw_info; | |
60 | ||
61 | sdi = NULL; | |
62 | devc = NULL; | |
63 | hw_info = NULL; | |
64 | ||
3f2c7c94 SS |
65 | if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { |
66 | sr_info("Couldn't get IDN response."); | |
67 | goto fail; | |
68 | } | |
69 | ||
697fb6dd | 70 | if (std_str_idx_s(hw_info->manufacturer, ARRAY_AND_SIZE(manufacturers)) < 0) |
3f2c7c94 SS |
71 | goto fail; |
72 | ||
73 | sdi = g_malloc0(sizeof(struct sr_dev_inst)); | |
74 | sdi->vendor = g_strdup(hw_info->manufacturer); | |
75 | sdi->model = g_strdup(hw_info->model); | |
76 | sdi->version = g_strdup(hw_info->firmware_version); | |
77 | sdi->serial_num = g_strdup(hw_info->serial_number); | |
78 | sdi->driver = &lecroy_xstream_driver_info; | |
79 | sdi->inst_type = SR_INST_SCPI; | |
80 | sdi->conn = scpi; | |
81 | ||
82 | sr_scpi_hw_info_free(hw_info); | |
83 | hw_info = NULL; | |
84 | ||
85 | devc = g_malloc0(sizeof(struct dev_context)); | |
86 | ||
87 | sdi->priv = devc; | |
88 | ||
89 | if (lecroy_xstream_init_device(sdi) != SR_OK) | |
90 | goto fail; | |
91 | ||
92 | return sdi; | |
93 | ||
94 | fail: | |
95 | sr_scpi_hw_info_free(hw_info); | |
4bf93988 | 96 | sr_dev_inst_free(sdi); |
3f2c7c94 SS |
97 | g_free(devc); |
98 | ||
99 | return NULL; | |
100 | } | |
e3b83c5e SS |
101 | |
102 | static GSList *scan(struct sr_dev_driver *di, GSList *options) | |
103 | { | |
373e92a4 | 104 | return sr_scpi_scan(di->context, options, probe_device); |
3f2c7c94 SS |
105 | } |
106 | ||
3553451f | 107 | static void clear_helper(struct dev_context *devc) |
3f2c7c94 | 108 | { |
3f2c7c94 | 109 | lecroy_xstream_state_free(devc->model_state); |
3f2c7c94 | 110 | g_free(devc->analog_groups); |
e3b83c5e SS |
111 | } |
112 | ||
113 | static int dev_clear(const struct sr_dev_driver *di) | |
114 | { | |
3553451f | 115 | return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper); |
e3b83c5e SS |
116 | } |
117 | ||
118 | static int dev_open(struct sr_dev_inst *sdi) | |
119 | { | |
6402c379 | 120 | if (sr_scpi_open(sdi->conn) != SR_OK) |
3f2c7c94 | 121 | return SR_ERR; |
e3b83c5e | 122 | |
3f2c7c94 SS |
123 | if (lecroy_xstream_state_get(sdi) != SR_OK) |
124 | return SR_ERR; | |
e3b83c5e | 125 | |
e3b83c5e SS |
126 | return SR_OK; |
127 | } | |
128 | ||
129 | static int dev_close(struct sr_dev_inst *sdi) | |
130 | { | |
f1ba6b4b | 131 | return sr_scpi_close(sdi->conn); |
e3b83c5e SS |
132 | } |
133 | ||
134 | static int config_get(uint32_t key, GVariant **data, | |
ea257cdc | 135 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) |
e3b83c5e | 136 | { |
3f2c7c94 SS |
137 | unsigned int i; |
138 | struct dev_context *devc; | |
139 | const struct scope_config *model; | |
140 | struct scope_state *state; | |
e3b83c5e | 141 | |
3f2c7c94 SS |
142 | if (!sdi) |
143 | return SR_ERR_ARG; | |
144 | ||
145 | devc = sdi->priv; | |
e3b83c5e | 146 | |
3f2c7c94 SS |
147 | model = devc->model_config; |
148 | state = devc->model_state; | |
149 | *data = NULL; | |
ea257cdc | 150 | |
e3b83c5e | 151 | switch (key) { |
3f2c7c94 SS |
152 | case SR_CONF_NUM_HDIV: |
153 | *data = g_variant_new_int32(model->num_xdivs); | |
3f2c7c94 SS |
154 | break; |
155 | case SR_CONF_TIMEBASE: | |
156 | *data = g_variant_new("(tt)", | |
ea257cdc UH |
157 | model->timebases[state->timebase].p, |
158 | model->timebases[state->timebase].q); | |
3f2c7c94 SS |
159 | break; |
160 | case SR_CONF_NUM_VDIV: | |
161 | for (i = 0; i < model->analog_channels; i++) { | |
162 | if (cg != devc->analog_groups[i]) | |
163 | continue; | |
164 | *data = g_variant_new_int32(model->num_ydivs); | |
3f2c7c94 SS |
165 | } |
166 | break; | |
167 | case SR_CONF_VDIV: | |
168 | for (i = 0; i < model->analog_channels; i++) { | |
169 | if (cg != devc->analog_groups[i]) | |
170 | continue; | |
171 | *data = g_variant_new("(tt)", | |
ea257cdc UH |
172 | model->vdivs[state->analog_channels[i].vdiv].p, |
173 | model->vdivs[state->analog_channels[i].vdiv].q); | |
3f2c7c94 SS |
174 | } |
175 | break; | |
176 | case SR_CONF_TRIGGER_SOURCE: | |
177 | *data = g_variant_new_string((*model->trigger_sources)[state->trigger_source]); | |
3f2c7c94 SS |
178 | break; |
179 | case SR_CONF_TRIGGER_SLOPE: | |
180 | *data = g_variant_new_string((*model->trigger_slopes)[state->trigger_slope]); | |
3f2c7c94 SS |
181 | break; |
182 | case SR_CONF_HORIZ_TRIGGERPOS: | |
183 | *data = g_variant_new_double(state->horiz_triggerpos); | |
3f2c7c94 SS |
184 | break; |
185 | case SR_CONF_COUPLING: | |
3f2c7c94 | 186 | for (i = 0; i < model->analog_channels; i++) { |
ea257cdc | 187 | if (cg != devc->analog_groups[i]) |
3f2c7c94 | 188 | continue; |
3f2c7c94 | 189 | *data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]); |
3f2c7c94 SS |
190 | } |
191 | break; | |
192 | case SR_CONF_SAMPLERATE: | |
193 | *data = g_variant_new_uint64(state->sample_rate); | |
3f2c7c94 SS |
194 | break; |
195 | case SR_CONF_ENABLED: | |
196 | *data = g_variant_new_boolean(FALSE); | |
3f2c7c94 | 197 | break; |
e3b83c5e | 198 | default: |
a9010323 | 199 | return SR_ERR_NA; |
e3b83c5e | 200 | } |
ea257cdc | 201 | |
a9010323 | 202 | return SR_OK; |
e3b83c5e SS |
203 | } |
204 | ||
ea257cdc UH |
205 | static int config_set(uint32_t key, GVariant *data, |
206 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
e3b83c5e SS |
207 | { |
208 | int ret; | |
3f2c7c94 SS |
209 | unsigned int i, j; |
210 | char command[MAX_COMMAND_SIZE]; | |
211 | struct dev_context *devc; | |
212 | const struct scope_config *model; | |
213 | struct scope_state *state; | |
214 | const char *tmp; | |
215 | int64_t p; | |
216 | uint64_t q; | |
217 | double tmp_d; | |
218 | gboolean update_sample_rate; | |
e3b83c5e | 219 | |
3f2c7c94 SS |
220 | if (!sdi) |
221 | return SR_ERR_ARG; | |
e3b83c5e | 222 | |
3f2c7c94 SS |
223 | devc = sdi->priv; |
224 | ||
225 | model = devc->model_config; | |
226 | state = devc->model_state; | |
227 | update_sample_rate = FALSE; | |
228 | ||
229 | ret = SR_ERR_NA; | |
e3b83c5e | 230 | |
e3b83c5e | 231 | switch (key) { |
3f2c7c94 SS |
232 | case SR_CONF_LIMIT_FRAMES: |
233 | devc->frame_limit = g_variant_get_uint64(data); | |
234 | ret = SR_OK; | |
235 | break; | |
236 | case SR_CONF_TRIGGER_SOURCE: | |
237 | tmp = g_variant_get_string(data, NULL); | |
692716f5 | 238 | for (i = 0; i < model->num_trigger_sources; i++) { |
3f2c7c94 SS |
239 | if (g_strcmp0(tmp, (*model->trigger_sources)[i]) != 0) |
240 | continue; | |
241 | state->trigger_source = i; | |
242 | g_snprintf(command, sizeof(command), | |
243 | "SET TRIGGER SOURCE %s", | |
244 | (*model->trigger_sources)[i]); | |
245 | ||
246 | ret = sr_scpi_send(sdi->conn, command); | |
247 | break; | |
248 | } | |
249 | break; | |
250 | case SR_CONF_VDIV: | |
251 | g_variant_get(data, "(tt)", &p, &q); | |
252 | ||
253 | for (i = 0; i < model->num_vdivs; i++) { | |
254 | if (p != model->vdivs[i].p || q != model->vdivs[i].q) | |
255 | continue; | |
256 | for (j = 1; j <= model->analog_channels; j++) { | |
257 | if (cg != devc->analog_groups[j - 1]) | |
258 | continue; | |
259 | state->analog_channels[j - 1].vdiv = i; | |
260 | g_snprintf(command, sizeof(command), | |
261 | "C%d:VDIV %E", j, (float)p/q); | |
262 | ||
263 | if (sr_scpi_send(sdi->conn, command) != SR_OK || | |
264 | sr_scpi_get_opc(sdi->conn) != SR_OK) | |
265 | return SR_ERR; | |
266 | ||
267 | break; | |
268 | } | |
269 | ||
270 | ret = SR_OK; | |
271 | break; | |
272 | } | |
273 | break; | |
274 | case SR_CONF_TIMEBASE: | |
275 | g_variant_get(data, "(tt)", &p, &q); | |
276 | ||
277 | for (i = 0; i < model->num_timebases; i++) { | |
278 | if (p != model->timebases[i].p || | |
279 | q != model->timebases[i].q) | |
280 | continue; | |
281 | state->timebase = i; | |
282 | g_snprintf(command, sizeof(command), | |
283 | "TIME_DIV %E", (float)p/q); | |
284 | ||
285 | ret = sr_scpi_send(sdi->conn, command); | |
286 | update_sample_rate = TRUE; | |
287 | break; | |
288 | } | |
289 | break; | |
290 | case SR_CONF_HORIZ_TRIGGERPOS: | |
291 | tmp_d = g_variant_get_double(data); | |
292 | ||
293 | if (tmp_d < 0.0 || tmp_d > 1.0) | |
294 | return SR_ERR; | |
295 | ||
296 | state->horiz_triggerpos = tmp_d; | |
297 | tmp_d = -(tmp_d - 0.5) * | |
298 | ((double)model->timebases[state->timebase].p / | |
299 | model->timebases[state->timebase].q) | |
300 | * model->num_xdivs; | |
301 | ||
302 | g_snprintf(command, sizeof(command), "TRIG POS %e S", tmp_d); | |
303 | ||
304 | ret = sr_scpi_send(sdi->conn, command); | |
305 | break; | |
306 | case SR_CONF_TRIGGER_SLOPE: | |
307 | tmp = g_variant_get_string(data, NULL); | |
692716f5 | 308 | for (i = 0; i < model->num_trigger_slopes; i++) { |
3f2c7c94 SS |
309 | if (g_strcmp0(tmp, (*model->trigger_slopes)[i]) != 0) |
310 | continue; | |
311 | state->trigger_slope = i; | |
312 | g_snprintf(command, sizeof(command), | |
313 | "SET TRIGGER SLOPE %s", | |
314 | (*model->trigger_slopes)[i]); | |
315 | ||
316 | ret = sr_scpi_send(sdi->conn, command); | |
317 | break; | |
318 | } | |
319 | break; | |
320 | case SR_CONF_COUPLING: | |
3f2c7c94 SS |
321 | tmp = g_variant_get_string(data, NULL); |
322 | ||
692716f5 | 323 | for (i = 0; i < model->num_coupling_options; i++) { |
3f2c7c94 SS |
324 | if (strcmp(tmp, (*model->coupling_options)[i]) != 0) |
325 | continue; | |
326 | for (j = 1; j <= model->analog_channels; j++) { | |
327 | if (cg != devc->analog_groups[j - 1]) | |
328 | continue; | |
ea257cdc | 329 | state->analog_channels[j - 1].coupling = i; |
3f2c7c94 SS |
330 | |
331 | g_snprintf(command, sizeof(command), | |
332 | "C%d:COUPLING %s", j, tmp); | |
333 | ||
334 | if (sr_scpi_send(sdi->conn, command) != SR_OK || | |
335 | sr_scpi_get_opc(sdi->conn) != SR_OK) | |
336 | return SR_ERR; | |
337 | break; | |
338 | } | |
339 | ||
340 | ret = SR_OK; | |
341 | break; | |
342 | } | |
343 | break; | |
e3b83c5e SS |
344 | default: |
345 | ret = SR_ERR_NA; | |
3f2c7c94 | 346 | break; |
e3b83c5e SS |
347 | } |
348 | ||
3f2c7c94 SS |
349 | if (ret == SR_OK) |
350 | ret = sr_scpi_get_opc(sdi->conn); | |
351 | ||
352 | if (ret == SR_OK && update_sample_rate) | |
353 | ret = lecroy_xstream_update_sample_rate(sdi); | |
354 | ||
e3b83c5e SS |
355 | return ret; |
356 | } | |
357 | ||
ea257cdc UH |
358 | static int config_list(uint32_t key, GVariant **data, |
359 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
e3b83c5e | 360 | { |
e66d1892 UH |
361 | struct dev_context *devc; |
362 | const struct scope_config *model; | |
90230cfa | 363 | |
e66d1892 UH |
364 | devc = (sdi) ? sdi->priv : NULL; |
365 | model = (devc) ? devc->model_config : NULL; | |
90230cfa SA |
366 | |
367 | switch (key) { | |
e66d1892 UH |
368 | case SR_CONF_SCAN_OPTIONS: |
369 | return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, NULL, NULL); | |
3f2c7c94 | 370 | case SR_CONF_DEVICE_OPTIONS: |
e66d1892 UH |
371 | if (!cg) |
372 | return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts); | |
53012da6 | 373 | *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog)); |
3f2c7c94 SS |
374 | break; |
375 | case SR_CONF_COUPLING: | |
692716f5 | 376 | *data = g_variant_new_strv(*model->coupling_options, model->num_coupling_options); |
3f2c7c94 SS |
377 | break; |
378 | case SR_CONF_TRIGGER_SOURCE: | |
379 | if (!model) | |
380 | return SR_ERR_ARG; | |
692716f5 | 381 | *data = g_variant_new_strv(*model->trigger_sources, model->num_trigger_sources); |
3f2c7c94 SS |
382 | break; |
383 | case SR_CONF_TRIGGER_SLOPE: | |
384 | if (!model) | |
385 | return SR_ERR_ARG; | |
692716f5 | 386 | *data = g_variant_new_strv(*model->trigger_slopes, model->num_trigger_slopes); |
3f2c7c94 SS |
387 | break; |
388 | case SR_CONF_TIMEBASE: | |
389 | if (!model) | |
390 | return SR_ERR_ARG; | |
db944f16 | 391 | *data = std_gvar_tuple_rational(model->timebases, model->num_timebases); |
3f2c7c94 SS |
392 | break; |
393 | case SR_CONF_VDIV: | |
394 | if (!model) | |
395 | return SR_ERR_ARG; | |
db944f16 | 396 | *data = std_gvar_tuple_rational(model->vdivs, model->num_vdivs); |
3f2c7c94 | 397 | break; |
e3b83c5e SS |
398 | default: |
399 | return SR_ERR_NA; | |
400 | } | |
758906aa | 401 | |
3f2c7c94 SS |
402 | return SR_OK; |
403 | } | |
e3b83c5e | 404 | |
3f2c7c94 SS |
405 | SR_PRIV int lecroy_xstream_request_data(const struct sr_dev_inst *sdi) |
406 | { | |
407 | char command[MAX_COMMAND_SIZE]; | |
408 | struct sr_channel *ch; | |
409 | struct dev_context *devc; | |
410 | ||
411 | devc = sdi->priv; | |
412 | ||
413 | ch = devc->current_channel->data; | |
414 | ||
415 | if (ch->type != SR_CHANNEL_ANALOG) | |
416 | return SR_ERR; | |
417 | ||
418 | g_snprintf(command, sizeof(command), | |
ea257cdc | 419 | "COMM_FORMAT DEF9,WORD,BIN;C%d:WAVEFORM?", ch->index + 1); |
3f2c7c94 SS |
420 | return sr_scpi_send(sdi->conn, command); |
421 | } | |
422 | ||
6d13a46c | 423 | static int setup_channels(const struct sr_dev_inst *sdi) |
3f2c7c94 SS |
424 | { |
425 | GSList *l; | |
426 | gboolean setup_changed; | |
427 | char command[MAX_COMMAND_SIZE]; | |
428 | struct scope_state *state; | |
429 | struct sr_channel *ch; | |
430 | struct dev_context *devc; | |
431 | struct sr_scpi_dev_inst *scpi; | |
432 | ||
433 | devc = sdi->priv; | |
434 | scpi = sdi->conn; | |
435 | state = devc->model_state; | |
436 | setup_changed = FALSE; | |
437 | ||
438 | for (l = sdi->channels; l; l = l->next) { | |
439 | ch = l->data; | |
440 | switch (ch->type) { | |
441 | case SR_CHANNEL_ANALOG: | |
442 | if (ch->enabled == state->analog_channels[ch->index].state) | |
443 | break; | |
444 | g_snprintf(command, sizeof(command), "C%d:TRACE %s", | |
ea257cdc | 445 | ch->index + 1, ch->enabled ? "ON" : "OFF"); |
3f2c7c94 SS |
446 | |
447 | if (sr_scpi_send(scpi, command) != SR_OK) | |
448 | return SR_ERR; | |
449 | state->analog_channels[ch->index].state = ch->enabled; | |
450 | setup_changed = TRUE; | |
451 | break; | |
452 | default: | |
453 | return SR_ERR; | |
454 | } | |
455 | } | |
456 | ||
457 | if (setup_changed && lecroy_xstream_update_sample_rate(sdi) != SR_OK) | |
458 | return SR_ERR; | |
459 | ||
460 | return SR_OK; | |
e3b83c5e SS |
461 | } |
462 | ||
463 | static int dev_acquisition_start(const struct sr_dev_inst *sdi) | |
464 | { | |
3f2c7c94 SS |
465 | GSList *l; |
466 | struct sr_channel *ch; | |
467 | struct dev_context *devc; | |
468 | int ret; | |
469 | struct sr_scpi_dev_inst *scpi; | |
470 | ||
3f2c7c94 SS |
471 | devc = sdi->priv; |
472 | scpi = sdi->conn; | |
ca314e06 | 473 | |
3f2c7c94 SS |
474 | /* Preset empty results. */ |
475 | g_slist_free(devc->enabled_channels); | |
476 | devc->enabled_channels = NULL; | |
477 | ||
478 | /* | |
479 | * Contruct the list of enabled channels. Determine the highest | |
480 | * number of digital pods involved in the acquisition. | |
481 | */ | |
482 | ||
483 | for (l = sdi->channels; l; l = l->next) { | |
484 | ch = l->data; | |
485 | if (!ch->enabled) | |
486 | continue; | |
487 | /* Only add a single digital channel per group (pod). */ | |
488 | devc->enabled_channels = g_slist_append( | |
489 | devc->enabled_channels, ch); | |
490 | } | |
e3b83c5e | 491 | |
3f2c7c94 SS |
492 | if (!devc->enabled_channels) |
493 | return SR_ERR; | |
494 | ||
495 | /* | |
496 | * Configure the analog channels and the | |
497 | * corresponding digital pods. | |
498 | */ | |
6d13a46c | 499 | if (setup_channels(sdi) != SR_OK) { |
3f2c7c94 SS |
500 | sr_err("Failed to setup channel configuration!"); |
501 | ret = SR_ERR; | |
502 | goto free_enabled; | |
503 | } | |
504 | ||
505 | /* | |
506 | * Start acquisition on the first enabled channel. The | |
507 | * receive routine will continue driving the acquisition. | |
508 | */ | |
509 | sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 50, | |
510 | lecroy_xstream_receive_data, (void *)sdi); | |
511 | ||
512 | std_session_send_df_header(sdi); | |
513 | ||
514 | devc->current_channel = devc->enabled_channels; | |
515 | ||
516 | return lecroy_xstream_request_data(sdi); | |
517 | ||
518 | free_enabled: | |
519 | g_slist_free(devc->enabled_channels); | |
520 | devc->enabled_channels = NULL; | |
ea257cdc | 521 | |
3f2c7c94 | 522 | return ret; |
e3b83c5e SS |
523 | } |
524 | ||
525 | static int dev_acquisition_stop(struct sr_dev_inst *sdi) | |
526 | { | |
3f2c7c94 SS |
527 | struct dev_context *devc; |
528 | struct sr_scpi_dev_inst *scpi; | |
529 | ||
530 | std_session_send_df_end(sdi); | |
531 | ||
3f2c7c94 SS |
532 | devc = sdi->priv; |
533 | ||
534 | devc->num_frames = 0; | |
535 | g_slist_free(devc->enabled_channels); | |
536 | devc->enabled_channels = NULL; | |
537 | scpi = sdi->conn; | |
538 | sr_scpi_source_remove(sdi->session, scpi); | |
e3b83c5e SS |
539 | |
540 | return SR_OK; | |
541 | } | |
542 | ||
3f2c7c94 | 543 | static struct sr_dev_driver lecroy_xstream_driver_info = { |
e3b83c5e | 544 | .name = "lecroy-xstream", |
bb08570f | 545 | .longname = "LeCroy X-Stream", |
e3b83c5e SS |
546 | .api_version = 1, |
547 | .init = std_init, | |
548 | .cleanup = std_cleanup, | |
549 | .scan = scan, | |
550 | .dev_list = std_dev_list, | |
551 | .dev_clear = dev_clear, | |
552 | .config_get = config_get, | |
553 | .config_set = config_set, | |
554 | .config_list = config_list, | |
555 | .dev_open = dev_open, | |
556 | .dev_close = dev_close, | |
557 | .dev_acquisition_start = dev_acquisition_start, | |
558 | .dev_acquisition_stop = dev_acquisition_stop, | |
559 | .context = NULL, | |
560 | }; | |
e3b83c5e | 561 | SR_REGISTER_DEV_DRIVER(lecroy_xstream_driver_info); |