]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2011-2015 Uwe Hermann <uwe@hermann-uwe.de> | |
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 2 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, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #include <config.h> | |
22 | #include "protocol.h" | |
23 | ||
24 | SR_PRIV struct sr_dev_driver chronovu_la_driver_info; | |
25 | static struct sr_dev_driver *di = &chronovu_la_driver_info; | |
26 | ||
27 | static const uint32_t drvopts[] = { | |
28 | SR_CONF_LOGIC_ANALYZER, | |
29 | }; | |
30 | ||
31 | static const uint32_t scanopts[] = { | |
32 | SR_CONF_CONN, | |
33 | }; | |
34 | ||
35 | static const uint32_t devopts[] = { | |
36 | SR_CONF_LIMIT_MSEC | SR_CONF_SET, | |
37 | SR_CONF_LIMIT_SAMPLES | SR_CONF_SET | SR_CONF_LIST, | |
38 | SR_CONF_CONN | SR_CONF_GET, | |
39 | SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, | |
40 | SR_CONF_TRIGGER_MATCH | SR_CONF_LIST, | |
41 | }; | |
42 | ||
43 | static const int32_t trigger_matches[] = { | |
44 | SR_TRIGGER_ZERO, | |
45 | SR_TRIGGER_ONE, | |
46 | SR_TRIGGER_RISING, | |
47 | SR_TRIGGER_FALLING, | |
48 | }; | |
49 | ||
50 | static int dev_acquisition_stop(struct sr_dev_inst *sdi); | |
51 | ||
52 | static void clear_helper(void *priv) | |
53 | { | |
54 | struct dev_context *devc; | |
55 | ||
56 | devc = priv; | |
57 | ||
58 | ftdi_free(devc->ftdic); | |
59 | g_free(devc->final_buf); | |
60 | } | |
61 | ||
62 | static int dev_clear(const struct sr_dev_driver *di) | |
63 | { | |
64 | return std_dev_clear(di, clear_helper); | |
65 | } | |
66 | ||
67 | static int add_device(int model, struct libusb_device_descriptor *des, | |
68 | const char *serial_num, const char *connection_id, | |
69 | libusb_device *usbdev, GSList **devices) | |
70 | { | |
71 | int ret; | |
72 | unsigned int i; | |
73 | struct sr_dev_inst *sdi; | |
74 | struct drv_context *drvc; | |
75 | struct dev_context *devc; | |
76 | ||
77 | ret = SR_OK; | |
78 | ||
79 | drvc = di->context; | |
80 | ||
81 | /* Allocate memory for our private device context. */ | |
82 | devc = g_malloc0(sizeof(struct dev_context)); | |
83 | ||
84 | /* Set some sane defaults. */ | |
85 | devc->prof = &cv_profiles[model]; | |
86 | devc->ftdic = NULL; /* Will be set in the open() API call. */ | |
87 | devc->cur_samplerate = 0; /* Set later (different for LA8/LA16). */ | |
88 | devc->limit_msec = 0; | |
89 | devc->limit_samples = 0; | |
90 | memset(devc->mangled_buf, 0, BS); | |
91 | devc->final_buf = NULL; | |
92 | devc->trigger_pattern = 0x0000; /* Irrelevant, see trigger_mask. */ | |
93 | devc->trigger_mask = 0x0000; /* All channels: "don't care". */ | |
94 | devc->trigger_edgemask = 0x0000; /* All channels: "state triggered". */ | |
95 | devc->trigger_found = 0; | |
96 | devc->done = 0; | |
97 | devc->block_counter = 0; | |
98 | devc->divcount = 0; | |
99 | devc->usb_vid = des->idVendor; | |
100 | devc->usb_pid = des->idProduct; | |
101 | memset(devc->samplerates, 0, sizeof(uint64_t) * 255); | |
102 | ||
103 | /* Allocate memory where we'll store the de-mangled data. */ | |
104 | if (!(devc->final_buf = g_try_malloc(SDRAM_SIZE))) { | |
105 | sr_err("Failed to allocate memory for sample buffer."); | |
106 | ret = SR_ERR_MALLOC; | |
107 | goto err_free_devc; | |
108 | } | |
109 | ||
110 | /* We now know the device, set its max. samplerate as default. */ | |
111 | devc->cur_samplerate = devc->prof->max_samplerate; | |
112 | ||
113 | /* Register the device with libsigrok. */ | |
114 | sdi = g_malloc0(sizeof(struct sr_dev_inst)); | |
115 | sdi->status = SR_ST_INACTIVE; | |
116 | sdi->vendor = g_strdup("ChronoVu"); | |
117 | sdi->model = g_strdup(devc->prof->modelname); | |
118 | sdi->serial_num = g_strdup(serial_num); | |
119 | sdi->connection_id = g_strdup(connection_id); | |
120 | sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(usbdev), | |
121 | libusb_get_device_address(usbdev), NULL); | |
122 | sdi->driver = di; | |
123 | sdi->priv = devc; | |
124 | ||
125 | for (i = 0; i < devc->prof->num_channels; i++) | |
126 | sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, | |
127 | cv_channel_names[i]); | |
128 | ||
129 | *devices = g_slist_append(*devices, sdi); | |
130 | drvc->instances = g_slist_append(drvc->instances, sdi); | |
131 | ||
132 | if (ret == SR_OK) | |
133 | return SR_OK; | |
134 | ||
135 | err_free_devc: | |
136 | g_free(devc); | |
137 | ||
138 | return ret; | |
139 | } | |
140 | ||
141 | static GSList *scan(struct sr_dev_driver *di, GSList *options) | |
142 | { | |
143 | int i, ret, model; | |
144 | struct drv_context *drvc; | |
145 | GSList *devices, *conn_devices, *l; | |
146 | struct sr_usb_dev_inst *usb; | |
147 | struct sr_config *src; | |
148 | struct libusb_device_descriptor des; | |
149 | libusb_device **devlist; | |
150 | struct libusb_device_handle *hdl; | |
151 | const char *conn; | |
152 | char product[64], serial_num[64], connection_id[64]; | |
153 | ||
154 | drvc = di->context; | |
155 | drvc->instances = NULL; | |
156 | ||
157 | conn = NULL; | |
158 | for (l = options; l; l = l->next) { | |
159 | src = l->data; | |
160 | switch (src->key) { | |
161 | case SR_CONF_CONN: | |
162 | conn = g_variant_get_string(src->data, NULL); | |
163 | break; | |
164 | } | |
165 | } | |
166 | if (conn) | |
167 | conn_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn); | |
168 | else | |
169 | conn_devices = NULL; | |
170 | ||
171 | devices = NULL; | |
172 | libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); | |
173 | ||
174 | for (i = 0; devlist[i]; i++) { | |
175 | if (conn) { | |
176 | for (l = conn_devices; l; l = l->next) { | |
177 | usb = l->data; | |
178 | if (usb->bus == libusb_get_bus_number(devlist[i]) | |
179 | && usb->address == libusb_get_device_address(devlist[i])) | |
180 | break; | |
181 | } | |
182 | if (!l) | |
183 | /* This device matched none of the ones that | |
184 | * matched the conn specification. */ | |
185 | continue; | |
186 | } | |
187 | ||
188 | libusb_get_device_descriptor(devlist[i], &des); | |
189 | ||
190 | if ((ret = libusb_open(devlist[i], &hdl)) < 0) | |
191 | continue; | |
192 | ||
193 | if (des.iProduct == 0) { | |
194 | product[0] = '\0'; | |
195 | } else if ((ret = libusb_get_string_descriptor_ascii(hdl, | |
196 | des.iProduct, (unsigned char *)product, | |
197 | sizeof(product))) < 0) { | |
198 | sr_warn("Failed to get product string descriptor: %s.", | |
199 | libusb_error_name(ret)); | |
200 | continue; | |
201 | } | |
202 | ||
203 | if (des.iSerialNumber == 0) { | |
204 | serial_num[0] = '\0'; | |
205 | } else if ((ret = libusb_get_string_descriptor_ascii(hdl, | |
206 | des.iSerialNumber, (unsigned char *)serial_num, | |
207 | sizeof(serial_num))) < 0) { | |
208 | sr_warn("Failed to get serial number string descriptor: %s.", | |
209 | libusb_error_name(ret)); | |
210 | continue; | |
211 | } | |
212 | ||
213 | usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); | |
214 | ||
215 | libusb_close(hdl); | |
216 | ||
217 | if (!strcmp(product, "ChronoVu LA8")) { | |
218 | model = 0; | |
219 | } else if (!strcmp(product, "ChronoVu LA16")) { | |
220 | model = 1; | |
221 | } else { | |
222 | sr_spew("Unknown iProduct string '%s'.", product); | |
223 | continue; | |
224 | } | |
225 | ||
226 | sr_dbg("Found %s (%04x:%04x, %d.%d, %s).", | |
227 | product, des.idVendor, des.idProduct, | |
228 | libusb_get_bus_number(devlist[i]), | |
229 | libusb_get_device_address(devlist[i]), connection_id); | |
230 | ||
231 | if ((ret = add_device(model, &des, serial_num, connection_id, | |
232 | devlist[i], &devices)) < 0) { | |
233 | sr_dbg("Failed to add device: %d.", ret); | |
234 | } | |
235 | } | |
236 | ||
237 | libusb_free_device_list(devlist, 1); | |
238 | g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free); | |
239 | ||
240 | return devices; | |
241 | } | |
242 | ||
243 | static int dev_open(struct sr_dev_inst *sdi) | |
244 | { | |
245 | struct dev_context *devc; | |
246 | int ret; | |
247 | ||
248 | devc = sdi->priv; | |
249 | ||
250 | /* Allocate memory for the FTDI context and initialize it. */ | |
251 | if (!(devc->ftdic = ftdi_new())) { | |
252 | sr_err("Failed to initialize libftdi."); | |
253 | return SR_ERR; | |
254 | } | |
255 | ||
256 | sr_dbg("Opening %s device (%04x:%04x).", devc->prof->modelname, | |
257 | devc->usb_vid, devc->usb_pid); | |
258 | ||
259 | /* Open the device. */ | |
260 | if ((ret = ftdi_usb_open_desc(devc->ftdic, devc->usb_vid, | |
261 | devc->usb_pid, devc->prof->iproduct, NULL)) < 0) { | |
262 | sr_err("Failed to open FTDI device (%d): %s.", | |
263 | ret, ftdi_get_error_string(devc->ftdic)); | |
264 | goto err_ftdi_free; | |
265 | } | |
266 | sr_dbg("Device opened successfully."); | |
267 | ||
268 | /* Purge RX/TX buffers in the FTDI chip. */ | |
269 | if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) { | |
270 | sr_err("Failed to purge FTDI buffers (%d): %s.", | |
271 | ret, ftdi_get_error_string(devc->ftdic)); | |
272 | goto err_ftdi_free; | |
273 | } | |
274 | sr_dbg("FTDI buffers purged successfully."); | |
275 | ||
276 | /* Enable flow control in the FTDI chip. */ | |
277 | if ((ret = ftdi_setflowctrl(devc->ftdic, SIO_RTS_CTS_HS)) < 0) { | |
278 | sr_err("Failed to enable FTDI flow control (%d): %s.", | |
279 | ret, ftdi_get_error_string(devc->ftdic)); | |
280 | goto err_ftdi_free; | |
281 | } | |
282 | sr_dbg("FTDI flow control enabled successfully."); | |
283 | ||
284 | /* Wait 100ms. */ | |
285 | g_usleep(100 * 1000); | |
286 | ||
287 | sdi->status = SR_ST_ACTIVE; | |
288 | ||
289 | if (ret == SR_OK) | |
290 | return SR_OK; | |
291 | ||
292 | err_ftdi_free: | |
293 | ftdi_free(devc->ftdic); /* Close device (if open), free FTDI context. */ | |
294 | devc->ftdic = NULL; | |
295 | return ret; | |
296 | } | |
297 | ||
298 | static int dev_close(struct sr_dev_inst *sdi) | |
299 | { | |
300 | int ret; | |
301 | struct dev_context *devc; | |
302 | ||
303 | if (sdi->status != SR_ST_ACTIVE) | |
304 | return SR_OK; | |
305 | ||
306 | devc = sdi->priv; | |
307 | ||
308 | if (devc->ftdic && (ret = ftdi_usb_close(devc->ftdic)) < 0) | |
309 | sr_err("Failed to close FTDI device (%d): %s.", | |
310 | ret, ftdi_get_error_string(devc->ftdic)); | |
311 | sdi->status = SR_ST_INACTIVE; | |
312 | ||
313 | return SR_OK; | |
314 | } | |
315 | ||
316 | static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, | |
317 | const struct sr_channel_group *cg) | |
318 | { | |
319 | struct dev_context *devc; | |
320 | struct sr_usb_dev_inst *usb; | |
321 | char str[128]; | |
322 | ||
323 | (void)cg; | |
324 | ||
325 | switch (key) { | |
326 | case SR_CONF_CONN: | |
327 | if (!sdi || !(usb = sdi->conn)) | |
328 | return SR_ERR_ARG; | |
329 | snprintf(str, 128, "%d.%d", usb->bus, usb->address); | |
330 | *data = g_variant_new_string(str); | |
331 | break; | |
332 | case SR_CONF_SAMPLERATE: | |
333 | if (!sdi || !(devc = sdi->priv)) | |
334 | return SR_ERR_BUG; | |
335 | *data = g_variant_new_uint64(devc->cur_samplerate); | |
336 | break; | |
337 | default: | |
338 | return SR_ERR_NA; | |
339 | } | |
340 | ||
341 | return SR_OK; | |
342 | } | |
343 | ||
344 | static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, | |
345 | const struct sr_channel_group *cg) | |
346 | { | |
347 | struct dev_context *devc; | |
348 | ||
349 | (void)cg; | |
350 | ||
351 | if (sdi->status != SR_ST_ACTIVE) | |
352 | return SR_ERR_DEV_CLOSED; | |
353 | ||
354 | if (!(devc = sdi->priv)) | |
355 | return SR_ERR_BUG; | |
356 | ||
357 | switch (key) { | |
358 | case SR_CONF_SAMPLERATE: | |
359 | if (cv_set_samplerate(sdi, g_variant_get_uint64(data)) < 0) | |
360 | return SR_ERR; | |
361 | break; | |
362 | case SR_CONF_LIMIT_MSEC: | |
363 | if (g_variant_get_uint64(data) == 0) | |
364 | return SR_ERR_ARG; | |
365 | devc->limit_msec = g_variant_get_uint64(data); | |
366 | break; | |
367 | case SR_CONF_LIMIT_SAMPLES: | |
368 | if (g_variant_get_uint64(data) == 0) | |
369 | return SR_ERR_ARG; | |
370 | devc->limit_samples = g_variant_get_uint64(data); | |
371 | break; | |
372 | default: | |
373 | return SR_ERR_NA; | |
374 | } | |
375 | ||
376 | return SR_OK; | |
377 | } | |
378 | ||
379 | static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, | |
380 | const struct sr_channel_group *cg) | |
381 | { | |
382 | GVariant *gvar, *grange[2]; | |
383 | GVariantBuilder gvb; | |
384 | struct dev_context *devc; | |
385 | ||
386 | (void)cg; | |
387 | ||
388 | switch (key) { | |
389 | case SR_CONF_SCAN_OPTIONS: | |
390 | *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, | |
391 | scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); | |
392 | break; | |
393 | case SR_CONF_DEVICE_OPTIONS: | |
394 | if (!sdi) | |
395 | *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, | |
396 | drvopts, ARRAY_SIZE(drvopts), sizeof(uint32_t)); | |
397 | else | |
398 | *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, | |
399 | devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); | |
400 | break; | |
401 | case SR_CONF_SAMPLERATE: | |
402 | if (!sdi || !sdi->priv || !(devc = sdi->priv)) | |
403 | return SR_ERR_BUG; | |
404 | cv_fill_samplerates_if_needed(sdi); | |
405 | g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); | |
406 | gvar = g_variant_new_fixed_array(G_VARIANT_TYPE("t"), | |
407 | devc->samplerates, | |
408 | ARRAY_SIZE(devc->samplerates), | |
409 | sizeof(uint64_t)); | |
410 | g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar); | |
411 | *data = g_variant_builder_end(&gvb); | |
412 | break; | |
413 | case SR_CONF_LIMIT_SAMPLES: | |
414 | if (!sdi || !sdi->priv || !(devc = sdi->priv) || !devc->prof) | |
415 | return SR_ERR_BUG; | |
416 | grange[0] = g_variant_new_uint64(0); | |
417 | if (devc->prof->model == CHRONOVU_LA8) | |
418 | grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES); | |
419 | else | |
420 | grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES / 2); | |
421 | *data = g_variant_new_tuple(grange, 2); | |
422 | break; | |
423 | case SR_CONF_TRIGGER_MATCH: | |
424 | if (!sdi || !sdi->priv || !(devc = sdi->priv) || !devc->prof) | |
425 | return SR_ERR_BUG; | |
426 | *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, | |
427 | trigger_matches, devc->prof->num_trigger_matches, | |
428 | sizeof(int32_t)); | |
429 | break; | |
430 | default: | |
431 | return SR_ERR_NA; | |
432 | } | |
433 | ||
434 | return SR_OK; | |
435 | } | |
436 | ||
437 | static int receive_data(int fd, int revents, void *cb_data) | |
438 | { | |
439 | int i, ret; | |
440 | struct sr_dev_inst *sdi; | |
441 | struct dev_context *devc; | |
442 | ||
443 | (void)fd; | |
444 | (void)revents; | |
445 | ||
446 | if (!(sdi = cb_data)) { | |
447 | sr_err("cb_data was NULL."); | |
448 | return FALSE; | |
449 | } | |
450 | ||
451 | if (!(devc = sdi->priv)) { | |
452 | sr_err("sdi->priv was NULL."); | |
453 | return FALSE; | |
454 | } | |
455 | ||
456 | if (!devc->ftdic) { | |
457 | sr_err("devc->ftdic was NULL."); | |
458 | return FALSE; | |
459 | } | |
460 | ||
461 | /* Get one block of data. */ | |
462 | if ((ret = cv_read_block(devc)) < 0) { | |
463 | sr_err("Failed to read data block: %d.", ret); | |
464 | dev_acquisition_stop(sdi); | |
465 | return FALSE; | |
466 | } | |
467 | ||
468 | /* We need to get exactly NUM_BLOCKS blocks (i.e. 8MB) of data. */ | |
469 | if (devc->block_counter != (NUM_BLOCKS - 1)) { | |
470 | devc->block_counter++; | |
471 | return TRUE; | |
472 | } | |
473 | ||
474 | sr_dbg("Sampling finished, sending data to session bus now."); | |
475 | ||
476 | /* | |
477 | * All data was received and demangled, send it to the session bus. | |
478 | * | |
479 | * Note: Due to the method how data is spread across the 8MByte of | |
480 | * SDRAM, we can _not_ send it to the session bus in a streaming | |
481 | * manner while we receive it. We have to receive and de-mangle the | |
482 | * full 8MByte first, only then the whole buffer contains valid data. | |
483 | */ | |
484 | for (i = 0; i < NUM_BLOCKS; i++) | |
485 | cv_send_block_to_session_bus(sdi, i); | |
486 | ||
487 | dev_acquisition_stop(sdi); | |
488 | ||
489 | return TRUE; | |
490 | } | |
491 | ||
492 | static int dev_acquisition_start(const struct sr_dev_inst *sdi) | |
493 | { | |
494 | struct dev_context *devc; | |
495 | uint8_t buf[8]; | |
496 | int bytes_to_write, bytes_written; | |
497 | ||
498 | if (sdi->status != SR_ST_ACTIVE) | |
499 | return SR_ERR_DEV_CLOSED; | |
500 | ||
501 | devc = sdi->priv; | |
502 | ||
503 | if (!devc->ftdic) { | |
504 | sr_err("devc->ftdic was NULL."); | |
505 | return SR_ERR_BUG; | |
506 | } | |
507 | ||
508 | devc->divcount = cv_samplerate_to_divcount(sdi, devc->cur_samplerate); | |
509 | if (devc->divcount == 0xff) { | |
510 | sr_err("Invalid divcount/samplerate."); | |
511 | return SR_ERR; | |
512 | } | |
513 | ||
514 | if (cv_convert_trigger(sdi) != SR_OK) { | |
515 | sr_err("Failed to configure trigger."); | |
516 | return SR_ERR; | |
517 | } | |
518 | ||
519 | /* Fill acquisition parameters into buf[]. */ | |
520 | if (devc->prof->model == CHRONOVU_LA8) { | |
521 | buf[0] = devc->divcount; | |
522 | buf[1] = 0xff; /* This byte must always be 0xff. */ | |
523 | buf[2] = devc->trigger_pattern & 0xff; | |
524 | buf[3] = devc->trigger_mask & 0xff; | |
525 | bytes_to_write = 4; | |
526 | } else { | |
527 | buf[0] = devc->divcount; | |
528 | buf[1] = 0xff; /* This byte must always be 0xff. */ | |
529 | buf[2] = (devc->trigger_pattern & 0xff00) >> 8; /* LSB */ | |
530 | buf[3] = (devc->trigger_pattern & 0x00ff) >> 0; /* MSB */ | |
531 | buf[4] = (devc->trigger_mask & 0xff00) >> 8; /* LSB */ | |
532 | buf[5] = (devc->trigger_mask & 0x00ff) >> 0; /* MSB */ | |
533 | buf[6] = (devc->trigger_edgemask & 0xff00) >> 8; /* LSB */ | |
534 | buf[7] = (devc->trigger_edgemask & 0x00ff) >> 0; /* MSB */ | |
535 | bytes_to_write = 8; | |
536 | } | |
537 | ||
538 | /* Start acquisition. */ | |
539 | bytes_written = cv_write(devc, buf, bytes_to_write); | |
540 | ||
541 | if (bytes_written < 0 || bytes_written != bytes_to_write) { | |
542 | sr_err("Acquisition failed to start."); | |
543 | return SR_ERR; | |
544 | } | |
545 | ||
546 | sr_dbg("Hardware acquisition started successfully."); | |
547 | ||
548 | std_session_send_df_header(sdi, LOG_PREFIX); | |
549 | ||
550 | /* Time when we should be done (for detecting trigger timeouts). */ | |
551 | devc->done = (devc->divcount + 1) * devc->prof->trigger_constant + | |
552 | g_get_monotonic_time() + (10 * G_TIME_SPAN_SECOND); | |
553 | devc->block_counter = 0; | |
554 | devc->trigger_found = 0; | |
555 | ||
556 | /* Hook up a dummy handler to receive data from the device. */ | |
557 | sr_session_source_add(sdi->session, -1, 0, 0, receive_data, (void *)sdi); | |
558 | ||
559 | return SR_OK; | |
560 | } | |
561 | ||
562 | static int dev_acquisition_stop(struct sr_dev_inst *sdi) | |
563 | { | |
564 | sr_dbg("Stopping acquisition."); | |
565 | sr_session_source_remove(sdi->session, -1); | |
566 | std_session_send_df_end(sdi, LOG_PREFIX); | |
567 | ||
568 | return SR_OK; | |
569 | } | |
570 | ||
571 | SR_PRIV struct sr_dev_driver chronovu_la_driver_info = { | |
572 | .name = "chronovu-la", | |
573 | .longname = "ChronoVu LA8/LA16", | |
574 | .api_version = 1, | |
575 | .init = std_init, | |
576 | .cleanup = std_cleanup, | |
577 | .scan = scan, | |
578 | .dev_list = std_dev_list, | |
579 | .dev_clear = dev_clear, | |
580 | .config_get = config_get, | |
581 | .config_set = config_set, | |
582 | .config_list = config_list, | |
583 | .dev_open = dev_open, | |
584 | .dev_close = dev_close, | |
585 | .dev_acquisition_start = dev_acquisition_start, | |
586 | .dev_acquisition_stop = dev_acquisition_stop, | |
587 | .context = NULL, | |
588 | }; |