]> sigrok.org Git - libsigrok.git/blame_incremental - src/hardware/demo/api.c
use common channel group allocation/release code
[libsigrok.git] / src / hardware / demo / api.c
... / ...
CommitLineData
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
5 * Copyright (C) 2011 Olivier Fauchon <olivier@aixmarseille.com>
6 * Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
7 * Copyright (C) 2015 Bartosz Golaszewski <bgolaszewski@baylibre.com>
8 * Copyright (C) 2019 Frank Stettner <frank-stettner@gmx.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 */
23
24#include <config.h>
25#include <stdlib.h>
26#include <string.h>
27#include <math.h>
28#include <libsigrok/libsigrok.h>
29#include "libsigrok-internal.h"
30#include "protocol.h"
31
32#define DEFAULT_NUM_LOGIC_CHANNELS 8
33#define DEFAULT_LOGIC_PATTERN PATTERN_SIGROK
34
35#define DEFAULT_NUM_ANALOG_CHANNELS 5
36
37/* Note: No spaces allowed because of sigrok-cli. */
38static const char *logic_pattern_str[] = {
39 "sigrok",
40 "random",
41 "incremental",
42 "walking-one",
43 "walking-zero",
44 "all-low",
45 "all-high",
46 "squid",
47 "graycode",
48};
49
50static const uint32_t scanopts[] = {
51 SR_CONF_NUM_LOGIC_CHANNELS,
52 SR_CONF_NUM_ANALOG_CHANNELS,
53 SR_CONF_LIMIT_FRAMES,
54};
55
56static const uint32_t drvopts[] = {
57 SR_CONF_DEMO_DEV,
58 SR_CONF_LOGIC_ANALYZER,
59 SR_CONF_OSCILLOSCOPE,
60};
61
62static const uint32_t devopts[] = {
63 SR_CONF_CONTINUOUS,
64 SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
65 SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
66 SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET,
67 SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
68 SR_CONF_AVERAGING | SR_CONF_GET | SR_CONF_SET,
69 SR_CONF_AVG_SAMPLES | SR_CONF_GET | SR_CONF_SET,
70 SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
71 SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET,
72};
73
74static const uint32_t devopts_cg_logic[] = {
75 SR_CONF_PATTERN_MODE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
76};
77
78static const uint32_t devopts_cg_analog_group[] = {
79 SR_CONF_AMPLITUDE | SR_CONF_GET | SR_CONF_SET,
80 SR_CONF_OFFSET | SR_CONF_GET | SR_CONF_SET,
81};
82
83static const uint32_t devopts_cg_analog_channel[] = {
84 SR_CONF_MEASURED_QUANTITY | SR_CONF_GET | SR_CONF_SET,
85 SR_CONF_PATTERN_MODE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
86 SR_CONF_AMPLITUDE | SR_CONF_GET | SR_CONF_SET,
87 SR_CONF_OFFSET | SR_CONF_GET | SR_CONF_SET,
88};
89
90static const int32_t trigger_matches[] = {
91 SR_TRIGGER_ZERO,
92 SR_TRIGGER_ONE,
93 SR_TRIGGER_RISING,
94 SR_TRIGGER_FALLING,
95 SR_TRIGGER_EDGE,
96};
97
98static const uint64_t samplerates[] = {
99 SR_HZ(1),
100 SR_GHZ(1),
101 SR_HZ(1),
102};
103
104static GSList *scan(struct sr_dev_driver *di, GSList *options)
105{
106 struct dev_context *devc;
107 struct sr_dev_inst *sdi;
108 struct sr_channel *ch;
109 struct sr_channel_group *cg, *acg;
110 struct sr_config *src;
111 struct analog_gen *ag;
112 GSList *l;
113 int num_logic_channels, num_analog_channels, pattern, i;
114 uint64_t limit_frames;
115 char channel_name[16];
116
117 num_logic_channels = DEFAULT_NUM_LOGIC_CHANNELS;
118 num_analog_channels = DEFAULT_NUM_ANALOG_CHANNELS;
119 limit_frames = DEFAULT_LIMIT_FRAMES;
120 for (l = options; l; l = l->next) {
121 src = l->data;
122 switch (src->key) {
123 case SR_CONF_NUM_LOGIC_CHANNELS:
124 num_logic_channels = g_variant_get_int32(src->data);
125 break;
126 case SR_CONF_NUM_ANALOG_CHANNELS:
127 num_analog_channels = g_variant_get_int32(src->data);
128 break;
129 case SR_CONF_LIMIT_FRAMES:
130 limit_frames = g_variant_get_uint64(src->data);
131 break;
132 }
133 }
134
135 sdi = g_malloc0(sizeof(struct sr_dev_inst));
136 sdi->status = SR_ST_INACTIVE;
137 sdi->model = g_strdup("Demo device");
138
139 devc = g_malloc0(sizeof(struct dev_context));
140 devc->cur_samplerate = SR_KHZ(200);
141 devc->num_logic_channels = num_logic_channels;
142 devc->logic_unitsize = (devc->num_logic_channels + 7) / 8;
143 devc->all_logic_channels_mask = 1UL << 0;
144 devc->all_logic_channels_mask <<= devc->num_logic_channels;
145 devc->all_logic_channels_mask--;
146 devc->logic_pattern = DEFAULT_LOGIC_PATTERN;
147 devc->num_analog_channels = num_analog_channels;
148 devc->limit_frames = limit_frames;
149 devc->capture_ratio = 20;
150 devc->stl = NULL;
151
152 if (num_logic_channels > 0) {
153 /* Logic channels, all in one channel group. */
154 cg = sr_channel_group_new(sdi, "Logic", NULL);
155 for (i = 0; i < num_logic_channels; i++) {
156 sprintf(channel_name, "D%d", i);
157 ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_name);
158 cg->channels = g_slist_append(cg->channels, ch);
159 }
160 }
161
162 /* Analog channels, channel groups and pattern generators. */
163 devc->ch_ag = g_hash_table_new(g_direct_hash, g_direct_equal);
164 if (num_analog_channels > 0) {
165 /*
166 * Have the waveform for analog patterns pre-generated. It's
167 * supposed to be periodic, so the generator just needs to
168 * access the prepared sample data (DDS style).
169 */
170 demo_generate_analog_pattern(devc);
171
172 pattern = 0;
173 /* An "Analog" channel group with all analog channels in it. */
174 acg = sr_channel_group_new(sdi, "Analog", NULL);
175
176 for (i = 0; i < num_analog_channels; i++) {
177 snprintf(channel_name, 16, "A%d", i);
178 ch = sr_channel_new(sdi, i + num_logic_channels, SR_CHANNEL_ANALOG,
179 TRUE, channel_name);
180 acg->channels = g_slist_append(acg->channels, ch);
181
182 /* Every analog channel gets its own channel group as well. */
183 cg = sr_channel_group_new(sdi, channel_name, NULL);
184 cg->channels = g_slist_append(NULL, ch);
185
186 /* Every channel gets a generator struct. */
187 ag = g_malloc(sizeof(struct analog_gen));
188 ag->ch = ch;
189 ag->mq = SR_MQ_VOLTAGE;
190 ag->mq_flags = SR_MQFLAG_DC;
191 ag->unit = SR_UNIT_VOLT;
192 ag->amplitude = DEFAULT_ANALOG_AMPLITUDE;
193 ag->offset = DEFAULT_ANALOG_OFFSET;
194 sr_analog_init(&ag->packet, &ag->encoding, &ag->meaning, &ag->spec, 2);
195 ag->packet.meaning->channels = cg->channels;
196 ag->packet.meaning->mq = ag->mq;
197 ag->packet.meaning->mqflags = ag->mq_flags;
198 ag->packet.meaning->unit = ag->unit;
199 ag->packet.encoding->digits = DEFAULT_ANALOG_ENCODING_DIGITS;
200 ag->packet.spec->spec_digits = DEFAULT_ANALOG_SPEC_DIGITS;
201 ag->packet.data = devc->analog_patterns[pattern];
202 ag->pattern = pattern;
203 ag->avg_val = 0.0f;
204 ag->num_avgs = 0;
205 g_hash_table_insert(devc->ch_ag, ch, ag);
206
207 if (++pattern == ARRAY_SIZE(analog_pattern_str))
208 pattern = 0;
209 }
210 }
211
212 sdi->priv = devc;
213
214 return std_scan_complete(di, g_slist_append(NULL, sdi));
215}
216
217static void clear_helper(struct dev_context *devc)
218{
219 GHashTableIter iter;
220 void *value;
221
222 demo_free_analog_pattern(devc);
223
224 /* Analog generators. */
225 g_hash_table_iter_init(&iter, devc->ch_ag);
226 while (g_hash_table_iter_next(&iter, NULL, &value))
227 g_free(value);
228 g_hash_table_unref(devc->ch_ag);
229}
230
231static int dev_clear(const struct sr_dev_driver *di)
232{
233 return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
234}
235
236static int config_get(uint32_t key, GVariant **data,
237 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
238{
239 struct dev_context *devc;
240 struct sr_channel *ch;
241 struct analog_gen *ag;
242 GVariant *mq_arr[2];
243 int pattern;
244
245 if (!sdi)
246 return SR_ERR_ARG;
247
248 devc = sdi->priv;
249 switch (key) {
250 case SR_CONF_SAMPLERATE:
251 *data = g_variant_new_uint64(devc->cur_samplerate);
252 break;
253 case SR_CONF_LIMIT_SAMPLES:
254 *data = g_variant_new_uint64(devc->limit_samples);
255 break;
256 case SR_CONF_LIMIT_MSEC:
257 *data = g_variant_new_uint64(devc->limit_msec);
258 break;
259 case SR_CONF_LIMIT_FRAMES:
260 *data = g_variant_new_uint64(devc->limit_frames);
261 break;
262 case SR_CONF_AVERAGING:
263 *data = g_variant_new_boolean(devc->avg);
264 break;
265 case SR_CONF_AVG_SAMPLES:
266 *data = g_variant_new_uint64(devc->avg_samples);
267 break;
268 case SR_CONF_MEASURED_QUANTITY:
269 if (!cg)
270 return SR_ERR_CHANNEL_GROUP;
271 /* Any channel in the group will do. */
272 ch = cg->channels->data;
273 if (ch->type != SR_CHANNEL_ANALOG)
274 return SR_ERR_ARG;
275 ag = g_hash_table_lookup(devc->ch_ag, ch);
276 mq_arr[0] = g_variant_new_uint32(ag->mq);
277 mq_arr[1] = g_variant_new_uint64(ag->mq_flags);
278 *data = g_variant_new_tuple(mq_arr, 2);
279 break;
280 case SR_CONF_PATTERN_MODE:
281 if (!cg)
282 return SR_ERR_CHANNEL_GROUP;
283 /* Any channel in the group will do. */
284 ch = cg->channels->data;
285 if (ch->type == SR_CHANNEL_LOGIC) {
286 pattern = devc->logic_pattern;
287 *data = g_variant_new_string(logic_pattern_str[pattern]);
288 } else if (ch->type == SR_CHANNEL_ANALOG) {
289 ag = g_hash_table_lookup(devc->ch_ag, ch);
290 pattern = ag->pattern;
291 *data = g_variant_new_string(analog_pattern_str[pattern]);
292 } else
293 return SR_ERR_BUG;
294 break;
295 case SR_CONF_AMPLITUDE:
296 if (!cg)
297 return SR_ERR_CHANNEL_GROUP;
298 /* Any channel in the group will do. */
299 ch = cg->channels->data;
300 if (ch->type != SR_CHANNEL_ANALOG)
301 return SR_ERR_ARG;
302 ag = g_hash_table_lookup(devc->ch_ag, ch);
303 *data = g_variant_new_double(ag->amplitude);
304 break;
305 case SR_CONF_OFFSET:
306 if (!cg)
307 return SR_ERR_CHANNEL_GROUP;
308 /* Any channel in the group will do. */
309 ch = cg->channels->data;
310 if (ch->type != SR_CHANNEL_ANALOG)
311 return SR_ERR_ARG;
312 ag = g_hash_table_lookup(devc->ch_ag, ch);
313 *data = g_variant_new_double(ag->offset);
314 break;
315 case SR_CONF_CAPTURE_RATIO:
316 *data = g_variant_new_uint64(devc->capture_ratio);
317 break;
318 default:
319 return SR_ERR_NA;
320 }
321
322 return SR_OK;
323}
324
325static int config_set(uint32_t key, GVariant *data,
326 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
327{
328 struct dev_context *devc;
329 struct analog_gen *ag;
330 struct sr_channel *ch;
331 GVariant *mq_tuple_child;
332 GSList *l;
333 int logic_pattern, analog_pattern;
334
335 devc = sdi->priv;
336
337 switch (key) {
338 case SR_CONF_SAMPLERATE:
339 devc->cur_samplerate = g_variant_get_uint64(data);
340 break;
341 case SR_CONF_LIMIT_SAMPLES:
342 devc->limit_msec = 0;
343 devc->limit_samples = g_variant_get_uint64(data);
344 break;
345 case SR_CONF_LIMIT_MSEC:
346 devc->limit_msec = g_variant_get_uint64(data);
347 devc->limit_samples = 0;
348 break;
349 case SR_CONF_LIMIT_FRAMES:
350 devc->limit_frames = g_variant_get_uint64(data);
351 break;
352 case SR_CONF_AVERAGING:
353 devc->avg = g_variant_get_boolean(data);
354 sr_dbg("%s averaging", devc->avg ? "Enabling" : "Disabling");
355 break;
356 case SR_CONF_AVG_SAMPLES:
357 devc->avg_samples = g_variant_get_uint64(data);
358 sr_dbg("Setting averaging rate to %" PRIu64, devc->avg_samples);
359 break;
360 case SR_CONF_MEASURED_QUANTITY:
361 if (!cg)
362 return SR_ERR_CHANNEL_GROUP;
363 for (l = cg->channels; l; l = l->next) {
364 ch = l->data;
365 if (ch->type != SR_CHANNEL_ANALOG)
366 return SR_ERR_ARG;
367 ag = g_hash_table_lookup(devc->ch_ag, ch);
368 mq_tuple_child = g_variant_get_child_value(data, 0);
369 ag->mq = g_variant_get_uint32(mq_tuple_child);
370 mq_tuple_child = g_variant_get_child_value(data, 1);
371 ag->mq_flags = g_variant_get_uint64(mq_tuple_child);
372 g_variant_unref(mq_tuple_child);
373 }
374 break;
375 case SR_CONF_PATTERN_MODE:
376 if (!cg)
377 return SR_ERR_CHANNEL_GROUP;
378 logic_pattern = std_str_idx(data, ARRAY_AND_SIZE(logic_pattern_str));
379 analog_pattern = std_str_idx(data, ARRAY_AND_SIZE(analog_pattern_str));
380 if (logic_pattern < 0 && analog_pattern < 0)
381 return SR_ERR_ARG;
382 for (l = cg->channels; l; l = l->next) {
383 ch = l->data;
384 if (ch->type == SR_CHANNEL_LOGIC) {
385 if (logic_pattern == -1)
386 return SR_ERR_ARG;
387 sr_dbg("Setting logic pattern to %s",
388 logic_pattern_str[logic_pattern]);
389 devc->logic_pattern = logic_pattern;
390 /* Might as well do this now, these are static. */
391 if (logic_pattern == PATTERN_ALL_LOW)
392 memset(devc->logic_data, 0x00, LOGIC_BUFSIZE);
393 else if (logic_pattern == PATTERN_ALL_HIGH)
394 memset(devc->logic_data, 0xff, LOGIC_BUFSIZE);
395 } else if (ch->type == SR_CHANNEL_ANALOG) {
396 if (analog_pattern == -1)
397 return SR_ERR_ARG;
398 sr_dbg("Setting analog pattern for channel %s to %s",
399 ch->name, analog_pattern_str[analog_pattern]);
400 ag = g_hash_table_lookup(devc->ch_ag, ch);
401 ag->pattern = analog_pattern;
402 } else
403 return SR_ERR_BUG;
404 }
405 break;
406 case SR_CONF_AMPLITUDE:
407 if (!cg)
408 return SR_ERR_CHANNEL_GROUP;
409 for (l = cg->channels; l; l = l->next) {
410 ch = l->data;
411 if (ch->type != SR_CHANNEL_ANALOG)
412 return SR_ERR_ARG;
413 ag = g_hash_table_lookup(devc->ch_ag, ch);
414 ag->amplitude = g_variant_get_double(data);
415 }
416 break;
417 case SR_CONF_OFFSET:
418 if (!cg)
419 return SR_ERR_CHANNEL_GROUP;
420 for (l = cg->channels; l; l = l->next) {
421 ch = l->data;
422 if (ch->type != SR_CHANNEL_ANALOG)
423 return SR_ERR_ARG;
424 ag = g_hash_table_lookup(devc->ch_ag, ch);
425 ag->offset = g_variant_get_double(data);
426 }
427 break;
428 case SR_CONF_CAPTURE_RATIO:
429 devc->capture_ratio = g_variant_get_uint64(data);
430 break;
431 default:
432 return SR_ERR_NA;
433 }
434
435 return SR_OK;
436}
437
438static int config_list(uint32_t key, GVariant **data,
439 const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
440{
441 struct sr_channel *ch;
442
443 if (!cg) {
444 switch (key) {
445 case SR_CONF_SCAN_OPTIONS:
446 case SR_CONF_DEVICE_OPTIONS:
447 return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
448 case SR_CONF_SAMPLERATE:
449 *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
450 break;
451 case SR_CONF_TRIGGER_MATCH:
452 *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
453 break;
454 default:
455 return SR_ERR_NA;
456 }
457 } else {
458 ch = cg->channels->data;
459 switch (key) {
460 case SR_CONF_DEVICE_OPTIONS:
461 if (ch->type == SR_CHANNEL_LOGIC)
462 *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_logic));
463 else if (ch->type == SR_CHANNEL_ANALOG) {
464 if (strcmp(cg->name, "Analog") == 0)
465 *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog_group));
466 else
467 *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog_channel));
468 }
469 else
470 return SR_ERR_BUG;
471 break;
472 case SR_CONF_PATTERN_MODE:
473 /* The analog group (with all 4 channels) shall not have a pattern property. */
474 if (strcmp(cg->name, "Analog") == 0)
475 return SR_ERR_NA;
476
477 if (ch->type == SR_CHANNEL_LOGIC)
478 *data = g_variant_new_strv(ARRAY_AND_SIZE(logic_pattern_str));
479 else if (ch->type == SR_CHANNEL_ANALOG)
480 *data = g_variant_new_strv(ARRAY_AND_SIZE(analog_pattern_str));
481 else
482 return SR_ERR_BUG;
483 break;
484 default:
485 return SR_ERR_NA;
486 }
487 }
488
489 return SR_OK;
490}
491
492static int dev_acquisition_start(const struct sr_dev_inst *sdi)
493{
494 struct dev_context *devc;
495 GSList *l;
496 struct sr_channel *ch;
497 int bitpos;
498 uint8_t mask;
499 struct sr_trigger *trigger;
500
501 devc = sdi->priv;
502 devc->sent_samples = 0;
503 devc->sent_frame_samples = 0;
504
505 /* Setup triggers */
506 if ((trigger = sr_session_trigger_get(sdi->session))) {
507 int pre_trigger_samples = 0;
508 if (devc->limit_samples > 0)
509 pre_trigger_samples = (devc->capture_ratio * devc->limit_samples) / 100;
510 devc->stl = soft_trigger_logic_new(sdi, trigger, pre_trigger_samples);
511 if (!devc->stl)
512 return SR_ERR_MALLOC;
513
514 /* Disable all analog channels since using them when there are logic
515 * triggers set up would require having pre-trigger sample buffers
516 * for analog sample data.
517 */
518 for (l = sdi->channels; l; l = l->next) {
519 ch = l->data;
520 if (ch->type == SR_CHANNEL_ANALOG)
521 ch->enabled = FALSE;
522 }
523 }
524 devc->trigger_fired = FALSE;
525
526 /*
527 * Determine the numbers of logic and analog channels that are
528 * involved in the acquisition. Determine an offset and a mask to
529 * remove excess logic data content before datafeed submission.
530 */
531 devc->enabled_logic_channels = 0;
532 devc->enabled_analog_channels = 0;
533 for (l = sdi->channels; l; l = l->next) {
534 ch = l->data;
535 if (!ch->enabled)
536 continue;
537 if (ch->type == SR_CHANNEL_ANALOG) {
538 devc->enabled_analog_channels++;
539 continue;
540 }
541 if (ch->type != SR_CHANNEL_LOGIC)
542 continue;
543 /*
544 * TODO: Need we create a channel map here, such that the
545 * session datafeed packets will have a dense representation
546 * of the enabled channels' data? For example store channels
547 * D3 and D5 in bit positions 0 and 1 respectively, when all
548 * other channels are disabled? The current implementation
549 * generates a sparse layout, might provide data for logic
550 * channels that are disabled while it might suppress data
551 * from enabled channels at the same time.
552 */
553 devc->enabled_logic_channels++;
554 }
555 devc->first_partial_logic_index = devc->enabled_logic_channels / 8;
556 bitpos = devc->enabled_logic_channels % 8;
557 mask = (1 << bitpos) - 1;
558 devc->first_partial_logic_mask = mask;
559 sr_dbg("num logic %zu, partial off %zu, mask 0x%02x.",
560 devc->enabled_logic_channels,
561 devc->first_partial_logic_index,
562 devc->first_partial_logic_mask);
563
564 sr_session_source_add(sdi->session, -1, 0, 100,
565 demo_prepare_data, (struct sr_dev_inst *)sdi);
566
567 std_session_send_df_header(sdi);
568
569 if (devc->limit_frames > 0)
570 std_session_send_df_frame_begin(sdi);
571
572 /* We use this timestamp to decide how many more samples to send. */
573 devc->start_us = g_get_monotonic_time();
574 devc->spent_us = 0;
575 devc->step = 0;
576
577 return SR_OK;
578}
579
580static int dev_acquisition_stop(struct sr_dev_inst *sdi)
581{
582 struct dev_context *devc;
583
584 sr_session_source_remove(sdi->session, -1);
585
586 devc = sdi->priv;
587 if (devc->limit_frames > 0)
588 std_session_send_df_frame_end(sdi);
589
590 std_session_send_df_end(sdi);
591
592 if (devc->stl) {
593 soft_trigger_logic_free(devc->stl);
594 devc->stl = NULL;
595 }
596
597 return SR_OK;
598}
599
600static struct sr_dev_driver demo_driver_info = {
601 .name = "demo",
602 .longname = "Demo driver and pattern generator",
603 .api_version = 1,
604 .init = std_init,
605 .cleanup = std_cleanup,
606 .scan = scan,
607 .dev_list = std_dev_list,
608 .dev_clear = dev_clear,
609 .config_get = config_get,
610 .config_set = config_set,
611 .config_list = config_list,
612 .dev_open = std_dummy_dev_open,
613 .dev_close = std_dummy_dev_close,
614 .dev_acquisition_start = dev_acquisition_start,
615 .dev_acquisition_stop = dev_acquisition_stop,
616 .context = NULL,
617};
618SR_REGISTER_DEV_DRIVER(demo_driver_info);