]> sigrok.org Git - libsigrok.git/blame - src/hardware/kingst-la2016/api.c
kingst-la2016: separate complex calls from caller's control flow
[libsigrok.git] / src / hardware / kingst-la2016 / api.c
CommitLineData
f2cd2deb
FS
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2020 Florian Schmidt <schmidt_florian@gmx.de>
5 * Copyright (C) 2013 Marcus Comstedt <marcus@mc.pp.se>
6 * Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
7 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
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
96dc954e
GS
23/*
24 * This driver implementation initially was derived from the
25 * src/hardware/saleae-logic16/ source code.
26 */
f2cd2deb
FS
27
28#include <config.h>
a7740b06 29
a7740b06 30#include <libsigrok/libsigrok.h>
f2cd2deb 31#include <string.h>
a7740b06 32
f2cd2deb
FS
33#include "libsigrok-internal.h"
34#include "protocol.h"
35
36static const uint32_t scanopts[] = {
37 SR_CONF_CONN,
38};
39
40static const uint32_t drvopts[] = {
41 SR_CONF_LOGIC_ANALYZER,
42};
43
44static const uint32_t devopts[] = {
45 /* TODO: SR_CONF_CONTINUOUS, */
46 SR_CONF_CONN | SR_CONF_GET,
47 SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
48 SR_CONF_LIMIT_SAMPLES | SR_CONF_SET | SR_CONF_GET | SR_CONF_LIST,
49 SR_CONF_VOLTAGE_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
50 SR_CONF_LOGIC_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
51 SR_CONF_LOGIC_THRESHOLD_CUSTOM | SR_CONF_GET | SR_CONF_SET,
52 SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
53 SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET,
54};
55
56static const int32_t trigger_matches[] = {
57 SR_TRIGGER_ZERO,
58 SR_TRIGGER_ONE,
59 SR_TRIGGER_RISING,
60 SR_TRIGGER_FALLING,
61};
62
63static const char *channel_names[] = {
955ab604
GS
64 "0", "1", "2", "3", "4", "5", "6", "7",
65 "8", "9", "10", "11", "12", "13", "14", "15",
f2cd2deb
FS
66};
67
8b172e78 68static const uint64_t samplerates_la2016[] = {
f2cd2deb
FS
69 SR_KHZ(20),
70 SR_KHZ(50),
71 SR_KHZ(100),
72 SR_KHZ(200),
73 SR_KHZ(500),
74 SR_MHZ(1),
75 SR_MHZ(2),
76 SR_MHZ(4),
77 SR_MHZ(5),
78 SR_MHZ(8),
79 SR_MHZ(10),
80 SR_MHZ(20),
81 SR_MHZ(50),
82 SR_MHZ(100),
83 SR_MHZ(200),
84};
85
8b172e78
KG
86static const uint64_t samplerates_la1016[] = {
87 SR_KHZ(20),
88 SR_KHZ(50),
89 SR_KHZ(100),
90 SR_KHZ(200),
91 SR_KHZ(500),
92 SR_MHZ(1),
93 SR_MHZ(2),
94 SR_MHZ(4),
95 SR_MHZ(5),
96 SR_MHZ(8),
97 SR_MHZ(10),
98 SR_MHZ(20),
99 SR_MHZ(50),
100 SR_MHZ(100),
101};
102
f2cd2deb
FS
103static const float logic_threshold_value[] = {
104 1.58,
105 2.5,
106 1.165,
107 1.5,
108 1.25,
109 0.9,
110 0.75,
111 0.60,
112 0.45,
113};
114
115static const char *logic_threshold[] = {
116 "TTL 5V",
117 "CMOS 5V",
118 "CMOS 3.3V",
119 "CMOS 3.0V",
120 "CMOS 2.5V",
121 "CMOS 1.8V",
122 "CMOS 1.5V",
123 "CMOS 1.2V",
124 "CMOS 0.9V",
125 "USER",
126};
127
da2cb50d 128#define LOGIC_THRESHOLD_IDX_USER (ARRAY_SIZE(logic_threshold) - 1)
f2cd2deb 129
f2cd2deb
FS
130static GSList *scan(struct sr_dev_driver *di, GSList *options)
131{
132 struct drv_context *drvc;
133 struct dev_context *devc;
134 struct sr_dev_inst *sdi;
135 struct sr_usb_dev_inst *usb;
136 struct sr_config *src;
137 GSList *l;
138 GSList *devices;
139 GSList *conn_devices;
140 struct libusb_device_descriptor des;
141 libusb_device **devlist;
142 unsigned int i, j;
143 const char *conn;
144 char connection_id[64];
22cb067a 145 uint64_t fw_uploaded;
f2cd2deb
FS
146 unsigned int dev_addr;
147
148 drvc = di->context;
149
150 conn = NULL;
151 for (l = options; l; l = l->next) {
152 src = l->data;
153 switch (src->key) {
154 case SR_CONF_CONN:
155 conn = g_variant_get_string(src->data, NULL);
156 break;
157 }
158 }
159 if (conn)
160 conn_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn);
161 else
162 conn_devices = NULL;
163
96dc954e 164 /* Find all LA2016 devices, optionally upload firmware to them. */
f2cd2deb
FS
165 devices = NULL;
166 libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
167 for (i = 0; devlist[i]; i++) {
168 if (conn) {
169 usb = NULL;
170 for (l = conn_devices; l; l = l->next) {
171 usb = l->data;
955ab604
GS
172 if (usb->bus == libusb_get_bus_number(devlist[i]) &&
173 usb->address == libusb_get_device_address(devlist[i]))
f2cd2deb
FS
174 break;
175 }
955ab604 176 if (!l) {
96dc954e
GS
177 /*
178 * A connection parameter was specified and
179 * this device does not match the filter.
180 */
f2cd2deb 181 continue;
955ab604 182 }
f2cd2deb
FS
183 }
184
185 libusb_get_device_descriptor(devlist[i], &des);
186
187 if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
188 continue;
189
190 if (des.idVendor != LA2016_VID || des.idProduct != LA2016_PID)
191 continue;
192
96dc954e 193 /* USB identification matches, a device was found. */
cf057ac4 194 sr_dbg("Found a device (USB identification).");
f2cd2deb
FS
195 sdi = g_malloc0(sizeof(struct sr_dev_inst));
196 sdi->status = SR_ST_INITIALIZING;
197 sdi->connection_id = g_strdup(connection_id);
198
22cb067a 199 fw_uploaded = 0;
f2cd2deb 200 dev_addr = libusb_get_device_address(devlist[i]);
852c7d14 201 if (des.iProduct != LA2016_IPRODUCT_INDEX) {
91f73872 202 sr_info("Device at '%s' has no firmware loaded.", connection_id);
f2cd2deb
FS
203
204 if (la2016_upload_firmware(drvc->sr_ctx, devlist[i], des.idProduct) != SR_OK) {
91f73872 205 sr_err("MCU firmware upload failed.");
f2cd2deb
FS
206 g_free(sdi->connection_id);
207 g_free(sdi);
208 continue;
209 }
22cb067a 210 fw_uploaded = g_get_monotonic_time();
96dc954e
GS
211 /* Will re-enumerate. Mark as "unknown address yet". */
212 dev_addr = 0xff;
f2cd2deb
FS
213 }
214
215 sdi->vendor = g_strdup("Kingst");
216 sdi->model = g_strdup("LA2016");
217
218 for (j = 0; j < ARRAY_SIZE(channel_names); j++)
219 sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE, channel_names[j]);
220
221 devices = g_slist_append(devices, sdi);
222
223 devc = g_malloc0(sizeof(struct dev_context));
224 sdi->priv = devc;
22cb067a 225 devc->fw_uploaded = fw_uploaded;
f2cd2deb
FS
226 devc->threshold_voltage_idx = 0;
227 devc->threshold_voltage = logic_threshold_value[devc->threshold_voltage_idx];
228
229 sdi->status = SR_ST_INACTIVE;
230 sdi->inst_type = SR_INST_USB;
231
232 sdi->conn = sr_usb_dev_inst_new(
233 libusb_get_bus_number(devlist[i]),
234 dev_addr, NULL);
235 }
236 libusb_free_device_list(devlist, 1);
237 g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
238
239 return std_scan_complete(di, devices);
240}
241
242static int la2016_dev_open(struct sr_dev_inst *sdi)
243{
244 struct sr_dev_driver *di;
245 libusb_device **devlist;
246 struct sr_usb_dev_inst *usb;
247 struct libusb_device_descriptor des;
248 struct drv_context *drvc;
249 int ret, i, device_count;
250 char connection_id[64];
251
252 di = sdi->driver;
253 drvc = di->context;
254 usb = sdi->conn;
255 ret = SR_ERR;
256
257 device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
258 if (device_count < 0) {
259 sr_err("Failed to get device list: %s.", libusb_error_name(device_count));
260 return SR_ERR;
261 }
262
263 for (i = 0; i < device_count; i++) {
264 libusb_get_device_descriptor(devlist[i], &des);
265
852c7d14
GS
266 if (des.idVendor != LA2016_VID || des.idProduct != LA2016_PID)
267 continue;
268 if (des.iProduct != LA2016_IPRODUCT_INDEX)
f2cd2deb
FS
269 continue;
270
271 if ((sdi->status == SR_ST_INITIALIZING) || (sdi->status == SR_ST_INACTIVE)) {
96dc954e 272 /* Check physical USB bus/port address. */
f2cd2deb
FS
273 if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
274 continue;
275
96dc954e
GS
276 if (strcmp(sdi->connection_id, connection_id)) {
277 /* Not the device we looked up before. */
f2cd2deb 278 continue;
96dc954e 279 }
f2cd2deb
FS
280 }
281
282 if (!(ret = libusb_open(devlist[i], &usb->devhdl))) {
96dc954e 283 if (usb->address == 0xff) {
f2cd2deb 284 /*
96dc954e
GS
285 * First encounter after firmware upload.
286 * Grab current address after enumeration.
f2cd2deb
FS
287 */
288 usb->address = libusb_get_device_address(devlist[i]);
96dc954e 289 }
f2cd2deb
FS
290 } else {
291 sr_err("Failed to open device: %s.", libusb_error_name(ret));
292 ret = SR_ERR;
293 break;
294 }
295
296 ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE);
297 if (ret == LIBUSB_ERROR_BUSY) {
91f73872 298 sr_err("Cannot claim USB interface. Another program or driver using it?");
f2cd2deb
FS
299 ret = SR_ERR;
300 break;
301 } else if (ret == LIBUSB_ERROR_NO_DEVICE) {
302 sr_err("Device has been disconnected.");
303 ret = SR_ERR;
304 break;
305 } else if (ret != 0) {
91f73872 306 sr_err("Cannot claim USB interface: %s.", libusb_error_name(ret));
f2cd2deb
FS
307 ret = SR_ERR;
308 break;
309 }
310
311 if ((ret = la2016_init_device(sdi)) != SR_OK) {
91f73872 312 sr_err("Cannot initialize device.");
f2cd2deb
FS
313 break;
314 }
315
316 sr_info("Opened device on %d.%d (logical) / %s (physical), interface %d.",
317 usb->bus, usb->address, sdi->connection_id, USB_INTERFACE);
318
319 ret = SR_OK;
320
321 break;
322 }
323
324 libusb_free_device_list(devlist, 1);
325
326 if (ret != SR_OK) {
327 if (usb->devhdl) {
328 libusb_release_interface(usb->devhdl, USB_INTERFACE);
329 libusb_close(usb->devhdl);
330 usb->devhdl = NULL;
331 }
332 return SR_ERR;
333 }
334
335 return SR_OK;
336}
337
338static int dev_open(struct sr_dev_inst *sdi)
339{
340 struct dev_context *devc;
22cb067a 341 uint64_t reset_done, now, elapsed_ms;
f2cd2deb
FS
342 int ret;
343
344 devc = sdi->priv;
345
346 /*
22cb067a
GS
347 * When the sigrok driver recently has uploaded MCU firmware,
348 * then wait for the FX2 to re-enumerate. Allow the USB device
349 * to vanish before it reappears. Timeouts are rough estimates
350 * after all, the imprecise time of the last check (potentially
351 * executes after the total check period) simplifies code paths
352 * with optional diagnostics. And increases the probability of
353 * successfully detecting "late/slow" devices.
f2cd2deb 354 */
22cb067a 355 if (devc->fw_uploaded) {
f2cd2deb 356 sr_info("Waiting for device to reset after firmware upload.");
f2cd2deb 357 now = g_get_monotonic_time();
22cb067a
GS
358 reset_done = devc->fw_uploaded + RENUM_GONE_DELAY_MS * 1000;
359 if (now < reset_done)
f2cd2deb 360 g_usleep(reset_done - now);
22cb067a
GS
361 do {
362 now = g_get_monotonic_time();
363 elapsed_ms = (now - devc->fw_uploaded) / 1000;
364 sr_spew("Waited %" PRIu64 "ms.", elapsed_ms);
365 ret = la2016_dev_open(sdi);
366 if (ret == SR_OK) {
367 devc->fw_uploaded = 0;
f2cd2deb 368 break;
22cb067a
GS
369 }
370 g_usleep(RENUM_POLL_INTERVAL_MS * 1000);
371 } while (elapsed_ms < RENUM_CHECK_PERIOD_MS);
f2cd2deb
FS
372 if (ret != SR_OK) {
373 sr_err("Device failed to re-enumerate.");
374 return SR_ERR;
375 }
22cb067a 376 sr_info("Device came back after %" PRIi64 "ms.", elapsed_ms);
955ab604 377 } else {
f2cd2deb 378 ret = la2016_dev_open(sdi);
955ab604 379 }
f2cd2deb
FS
380
381 if (ret != SR_OK) {
91f73872 382 sr_err("Cannot open device.");
f2cd2deb
FS
383 return SR_ERR;
384 }
385
386 return SR_OK;
387}
388
389static int dev_close(struct sr_dev_inst *sdi)
390{
391 struct sr_usb_dev_inst *usb;
392
393 usb = sdi->conn;
394
395 if (!usb->devhdl)
396 return SR_ERR_BUG;
397
398 la2016_deinit_device(sdi);
399
400 sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.",
401 usb->bus, usb->address, sdi->connection_id, USB_INTERFACE);
402 libusb_release_interface(usb->devhdl, USB_INTERFACE);
403 libusb_close(usb->devhdl);
404 usb->devhdl = NULL;
405
406 return SR_OK;
407}
408
955ab604
GS
409static int config_get(uint32_t key, GVariant **data,
410 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
f2cd2deb
FS
411{
412 struct dev_context *devc;
413 struct sr_usb_dev_inst *usb;
414 double rounded;
da2cb50d 415 const char *label;
f2cd2deb
FS
416
417 (void)cg;
418
419 if (!sdi)
420 return SR_ERR_ARG;
421 devc = sdi->priv;
422
423 switch (key) {
424 case SR_CONF_CONN:
425 if (!sdi->conn)
426 return SR_ERR_ARG;
427 usb = sdi->conn;
96dc954e
GS
428 if (usb->address == 0xff) {
429 /*
430 * Device still needs to re-enumerate after firmware
431 * upload, so we don't know its (future) address.
432 */
f2cd2deb 433 return SR_ERR;
955ab604 434 }
f2cd2deb
FS
435 *data = g_variant_new_printf("%d.%d", usb->bus, usb->address);
436 break;
437 case SR_CONF_SAMPLERATE:
438 *data = g_variant_new_uint64(devc->cur_samplerate);
439 break;
440 case SR_CONF_LIMIT_SAMPLES:
441 *data = g_variant_new_uint64(devc->limit_samples);
442 break;
443 case SR_CONF_CAPTURE_RATIO:
444 *data = g_variant_new_uint64(devc->capture_ratio);
445 break;
446 case SR_CONF_VOLTAGE_THRESHOLD:
447 rounded = (int)(devc->threshold_voltage / 0.1) * 0.1;
448 *data = std_gvar_tuple_double(rounded, rounded + 0.1);
449 return SR_OK;
450 case SR_CONF_LOGIC_THRESHOLD:
da2cb50d
GS
451 label = logic_threshold[devc->threshold_voltage_idx];
452 *data = g_variant_new_string(label);
f2cd2deb
FS
453 break;
454 case SR_CONF_LOGIC_THRESHOLD_CUSTOM:
455 *data = g_variant_new_double(devc->threshold_voltage);
456 break;
955ab604 457
f2cd2deb
FS
458 default:
459 return SR_ERR_NA;
460 }
461
462 return SR_OK;
463}
464
955ab604
GS
465static int config_set(uint32_t key, GVariant *data,
466 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
f2cd2deb
FS
467{
468 struct dev_context *devc;
469 double low, high;
470 int idx;
471
472 (void)cg;
473
474 devc = sdi->priv;
475
476 switch (key) {
477 case SR_CONF_SAMPLERATE:
478 devc->cur_samplerate = g_variant_get_uint64(data);
479 break;
480 case SR_CONF_LIMIT_SAMPLES:
481 devc->limit_samples = g_variant_get_uint64(data);
482 break;
483 case SR_CONF_CAPTURE_RATIO:
484 devc->capture_ratio = g_variant_get_uint64(data);
485 break;
486 case SR_CONF_VOLTAGE_THRESHOLD:
487 g_variant_get(data, "(dd)", &low, &high);
488 devc->threshold_voltage = (low + high) / 2.0;
da2cb50d 489 devc->threshold_voltage_idx = LOGIC_THRESHOLD_IDX_USER;
f2cd2deb
FS
490 break;
491 case SR_CONF_LOGIC_THRESHOLD: {
411ad77c
GS
492 idx = std_str_idx(data, ARRAY_AND_SIZE(logic_threshold));
493 if (idx < 0)
f2cd2deb 494 return SR_ERR_ARG;
da2cb50d 495 if (idx != LOGIC_THRESHOLD_IDX_USER) {
f2cd2deb
FS
496 devc->threshold_voltage = logic_threshold_value[idx];
497 }
498 devc->threshold_voltage_idx = idx;
499 break;
500 }
501 case SR_CONF_LOGIC_THRESHOLD_CUSTOM:
502 devc->threshold_voltage = g_variant_get_double(data);
503 break;
504 default:
505 return SR_ERR_NA;
506 }
507
508 return SR_OK;
509}
510
955ab604
GS
511static int config_list(uint32_t key, GVariant **data,
512 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
f2cd2deb 513{
8b172e78
KG
514 struct dev_context *devc;
515
f2cd2deb
FS
516 switch (key) {
517 case SR_CONF_SCAN_OPTIONS:
518 case SR_CONF_DEVICE_OPTIONS:
411ad77c
GS
519 return STD_CONFIG_LIST(key, data, sdi, cg,
520 scanopts, drvopts, devopts);
f2cd2deb 521 case SR_CONF_SAMPLERATE:
fb28e72d
MW
522 if (!sdi)
523 return SR_ERR_ARG;
524 devc = sdi->priv;
8b172e78
KG
525 if (devc->max_samplerate == SR_MHZ(200)) {
526 *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates_la2016));
1ed93110 527 } else {
8b172e78
KG
528 *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates_la1016));
529 }
f2cd2deb
FS
530 break;
531 case SR_CONF_LIMIT_SAMPLES:
411ad77c
GS
532 *data = std_gvar_tuple_u64(LA2016_NUM_SAMPLES_MIN,
533 LA2016_NUM_SAMPLES_MAX);
f2cd2deb
FS
534 break;
535 case SR_CONF_VOLTAGE_THRESHOLD:
536 *data = std_gvar_min_max_step_thresholds(
537 LA2016_THR_VOLTAGE_MIN,
538 LA2016_THR_VOLTAGE_MAX, 0.1);
539 break;
540 case SR_CONF_TRIGGER_MATCH:
541 *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
542 break;
543 case SR_CONF_LOGIC_THRESHOLD:
da2cb50d 544 *data = g_variant_new_strv(ARRAY_AND_SIZE(logic_threshold));
f2cd2deb
FS
545 break;
546 default:
547 return SR_ERR_NA;
548 }
549
550 return SR_OK;
551}
552
f2cd2deb
FS
553static int configure_channels(const struct sr_dev_inst *sdi)
554{
555 struct dev_context *devc;
556
557 devc = sdi->priv;
558 devc->cur_channels = 0;
f2cd2deb
FS
559 for (GSList *l = sdi->channels; l; l = l->next) {
560 struct sr_channel *ch = (struct sr_channel*)l->data;
561 if (ch->enabled == FALSE)
562 continue;
955ab604 563 devc->cur_channels |= 1 << ch->index;
f2cd2deb
FS
564 }
565
566 return SR_OK;
567}
568
569static int dev_acquisition_start(const struct sr_dev_inst *sdi)
570{
571 struct sr_dev_driver *di;
572 struct drv_context *drvc;
573 struct dev_context *devc;
574 int ret;
575
576 di = sdi->driver;
577 drvc = di->context;
578 devc = sdi->priv;
579
580 if (configure_channels(sdi) != SR_OK) {
91f73872 581 sr_err("Cannot configure channels.");
f2cd2deb
FS
582 return SR_ERR;
583 }
584
852c7d14 585 devc->convbuffer_size = LA2016_CONVBUFFER_SIZE;
411ad77c
GS
586 devc->convbuffer = g_try_malloc(devc->convbuffer_size);
587 if (!devc->convbuffer) {
91f73872 588 sr_err("Cannot allocate conversion buffer.");
f2cd2deb
FS
589 return SR_ERR_MALLOC;
590 }
591
411ad77c
GS
592 ret = la2016_setup_acquisition(sdi);
593 if (ret != SR_OK) {
f2cd2deb
FS
594 g_free(devc->convbuffer);
595 devc->convbuffer = NULL;
596 return ret;
597 }
598
599 devc->ctx = drvc->sr_ctx;
600
411ad77c
GS
601 ret = la2016_start_acquisition(sdi);
602 if (ret != SR_OK) {
3ebc1cb2 603 la2016_abort_acquisition(sdi);
f2cd2deb
FS
604 return ret;
605 }
606
cf057ac4 607 devc->completion_seen = FALSE;
388438e4
GS
608 usb_source_add(sdi->session, drvc->sr_ctx, 50,
609 la2016_receive_data, (void *)sdi);
f2cd2deb
FS
610
611 std_session_send_df_header(sdi);
612
613 return SR_OK;
614}
615
616static int dev_acquisition_stop(struct sr_dev_inst *sdi)
617{
618 int ret;
619
620 ret = la2016_abort_acquisition(sdi);
f2cd2deb
FS
621
622 return ret;
623}
624
625static struct sr_dev_driver kingst_la2016_driver_info = {
626 .name = "kingst-la2016",
627 .longname = "Kingst LA2016",
628 .api_version = 1,
629 .init = std_init,
630 .cleanup = std_cleanup,
631 .scan = scan,
632 .dev_list = std_dev_list,
633 .dev_clear = std_dev_clear,
634 .config_get = config_get,
635 .config_set = config_set,
636 .config_list = config_list,
637 .dev_open = dev_open,
638 .dev_close = dev_close,
639 .dev_acquisition_start = dev_acquisition_start,
640 .dev_acquisition_stop = dev_acquisition_stop,
641 .context = NULL,
642};
643SR_REGISTER_DEV_DRIVER(kingst_la2016_driver_info);