]>
Commit | Line | Data |
---|---|---|
a1bb33af UH |
1 | /* |
2 | * This file is part of the sigrok project. | |
3 | * | |
4 | * Copyright (C) 2010 Bert Vermeulen <bert@biot.com> | |
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 <stdio.h> | |
21 | #include <stdint.h> | |
22 | #include <stdlib.h> | |
23 | #include <sys/types.h> | |
24 | #include <sys/stat.h> | |
25 | #include <fcntl.h> | |
26 | #include <unistd.h> | |
a9f54bcd UH |
27 | #ifdef _WIN32 |
28 | #include <windows.h> | |
29 | #else | |
a1bb33af | 30 | #include <termios.h> |
926b866c | 31 | #endif |
a1bb33af UH |
32 | #include <string.h> |
33 | #include <sys/time.h> | |
34 | #include <inttypes.h> | |
926b866c UH |
35 | #ifdef _WIN32 |
36 | /* TODO */ | |
37 | #else | |
6937bb75 | 38 | #include <arpa/inet.h> |
926b866c | 39 | #endif |
a1bb33af | 40 | #include <glib.h> |
43fc7885 | 41 | #include <sigrok.h> |
1483577e | 42 | #include <sigrok-internal.h> |
4fe9a6da | 43 | #include "ols.h" |
a1bb33af | 44 | |
1fdb75e1 UH |
45 | #ifdef _WIN32 |
46 | #define O_NONBLOCK FIONBIO | |
47 | #endif | |
48 | ||
a1bb33af | 49 | static int capabilities[] = { |
5a2326a7 UH |
50 | SR_HWCAP_LOGIC_ANALYZER, |
51 | SR_HWCAP_SAMPLERATE, | |
52 | SR_HWCAP_CAPTURE_RATIO, | |
53 | SR_HWCAP_LIMIT_SAMPLES, | |
43fc7885 | 54 | 0, |
a1bb33af UH |
55 | }; |
56 | ||
4fe9a6da | 57 | /* default supported samplerates, can be overridden by device metadata */ |
60679b18 | 58 | static struct sr_samplerates samplerates = { |
c9140419 | 59 | SR_HZ(10), |
59df0c77 | 60 | SR_MHZ(200), |
c9140419 UH |
61 | SR_HZ(1), |
62 | NULL, | |
a1bb33af UH |
63 | }; |
64 | ||
6c290072 | 65 | /* List of struct sr_serial_device_instance */ |
a1bb33af UH |
66 | static GSList *device_instances = NULL; |
67 | ||
6937bb75 | 68 | static int send_shortcommand(int fd, uint8_t command) |
a1bb33af UH |
69 | { |
70 | char buf[1]; | |
71 | ||
b08024a8 | 72 | sr_dbg("ols: sending cmd 0x%.2x", command); |
a1bb33af | 73 | buf[0] = command; |
2119ab03 | 74 | if (serial_write(fd, buf, 1) != 1) |
e46b8fb1 | 75 | return SR_ERR; |
a1bb33af | 76 | |
e46b8fb1 | 77 | return SR_OK; |
a1bb33af UH |
78 | } |
79 | ||
6937bb75 | 80 | static int send_longcommand(int fd, uint8_t command, uint32_t data) |
a1bb33af UH |
81 | { |
82 | char buf[5]; | |
83 | ||
b08024a8 | 84 | sr_dbg("ols: sending cmd 0x%.2x data 0x%.8x", command, data); |
a1bb33af | 85 | buf[0] = command; |
6937bb75 BV |
86 | buf[1] = (data & 0xff000000) >> 24; |
87 | buf[2] = (data & 0xff0000) >> 16; | |
88 | buf[3] = (data & 0xff00) >> 8; | |
89 | buf[4] = data & 0xff; | |
2119ab03 | 90 | if (serial_write(fd, buf, 5) != 5) |
e46b8fb1 | 91 | return SR_ERR; |
a1bb33af | 92 | |
e46b8fb1 | 93 | return SR_OK; |
a1bb33af UH |
94 | } |
95 | ||
4fe9a6da | 96 | static int configure_probes(struct ols_device *ols, GSList *probes) |
a1bb33af | 97 | { |
1afe8989 | 98 | struct sr_probe *probe; |
a1bb33af | 99 | GSList *l; |
6937bb75 | 100 | int probe_bit, stage, i; |
a1bb33af UH |
101 | char *tc; |
102 | ||
4fe9a6da | 103 | ols->probe_mask = 0; |
43fc7885 | 104 | for (i = 0; i < NUM_TRIGGER_STAGES; i++) { |
4fe9a6da BV |
105 | ols->trigger_mask[i] = 0; |
106 | ols->trigger_value[i] = 0; | |
a1bb33af UH |
107 | } |
108 | ||
4fe9a6da | 109 | ols->num_stages = 0; |
43fc7885 | 110 | for (l = probes; l; l = l->next) { |
1afe8989 | 111 | probe = (struct sr_probe *)l->data; |
43fc7885 | 112 | if (!probe->enabled) |
6937bb75 BV |
113 | continue; |
114 | ||
43fc7885 UH |
115 | /* |
116 | * Set up the probe mask for later configuration into the | |
117 | * flag register. | |
118 | */ | |
a1bb33af | 119 | probe_bit = 1 << (probe->index - 1); |
4fe9a6da | 120 | ols->probe_mask |= probe_bit; |
6937bb75 | 121 | |
a803c0db | 122 | if (!probe->trigger) |
6937bb75 BV |
123 | continue; |
124 | ||
43fc7885 | 125 | /* Configure trigger mask and value. */ |
6937bb75 | 126 | stage = 0; |
43fc7885 | 127 | for (tc = probe->trigger; tc && *tc; tc++) { |
4fe9a6da | 128 | ols->trigger_mask[stage] |= probe_bit; |
43fc7885 | 129 | if (*tc == '1') |
4fe9a6da | 130 | ols->trigger_value[stage] |= probe_bit; |
6937bb75 | 131 | stage++; |
43fc7885 UH |
132 | if (stage > 3) |
133 | /* | |
134 | * TODO: Only supporting parallel mode, with | |
135 | * up to 4 stages. | |
136 | */ | |
e46b8fb1 | 137 | return SR_ERR; |
a1bb33af | 138 | } |
4fe9a6da BV |
139 | if (stage > ols->num_stages) |
140 | ols->num_stages = stage; | |
a1bb33af UH |
141 | } |
142 | ||
e46b8fb1 | 143 | return SR_OK; |
a1bb33af UH |
144 | } |
145 | ||
a803c0db | 146 | static uint32_t reverse16(uint32_t in) |
6937bb75 BV |
147 | { |
148 | uint32_t out; | |
149 | ||
a803c0db BV |
150 | out = (in & 0xff) << 8; |
151 | out |= (in & 0xff00) >> 8; | |
152 | out |= (in & 0xff0000) << 8; | |
153 | out |= (in & 0xff000000) >> 8; | |
154 | ||
155 | return out; | |
156 | } | |
157 | ||
158 | static uint32_t reverse32(uint32_t in) | |
159 | { | |
160 | uint32_t out; | |
161 | ||
162 | out = (in & 0xff) << 24; | |
163 | out |= (in & 0xff00) << 8; | |
164 | out |= (in & 0xff0000) >> 8; | |
165 | out |= (in & 0xff000000) >> 24; | |
166 | ||
167 | return out; | |
6937bb75 BV |
168 | } |
169 | ||
4fe9a6da BV |
170 | static struct ols_device *ols_device_new(void) |
171 | { | |
172 | struct ols_device *ols; | |
173 | ||
c0a4b971 | 174 | /* TODO: Is 'ols' ever g_free()'d? */ |
b53738ba UH |
175 | if (!(ols = g_try_malloc0(sizeof(struct ols_device)))) { |
176 | sr_err("ols: %s: ols malloc failed", __func__); | |
177 | return NULL; | |
178 | } | |
179 | ||
4fe9a6da BV |
180 | ols->trigger_at = -1; |
181 | ols->probe_mask = 0xffffffff; | |
182 | ols->cur_samplerate = SR_KHZ(200); | |
183 | ||
184 | return ols; | |
185 | } | |
186 | ||
187 | static struct sr_device_instance *get_metadata(int fd) | |
188 | { | |
189 | struct sr_device_instance *sdi; | |
190 | struct ols_device *ols; | |
191 | uint32_t tmp_int; | |
192 | uint8_t key, type, token; | |
193 | GString *tmp_str, *devicename, *version; | |
194 | gchar tmp_c; | |
195 | ||
196 | sdi = sr_device_instance_new(0, SR_ST_INACTIVE, NULL, NULL, NULL); | |
197 | ols = ols_device_new(); | |
198 | sdi->priv = ols; | |
199 | ||
200 | devicename = g_string_new(""); | |
201 | version = g_string_new(""); | |
202 | ||
203 | key = 0xff; | |
204 | while (key) { | |
205 | if (serial_read(fd, &key, 1) != 1 || key == 0x00) | |
206 | break; | |
207 | type = key >> 5; | |
208 | token = key & 0x1f; | |
209 | switch (type) { | |
210 | case 0: | |
211 | /* NULL-terminated string */ | |
212 | tmp_str = g_string_new(""); | |
213 | while (serial_read(fd, &tmp_c, 1) == 1 && tmp_c != '\0') | |
214 | g_string_append_c(tmp_str, tmp_c); | |
b08024a8 UH |
215 | sr_dbg("ols: got metadata key 0x%.2x value '%s'", |
216 | key, tmp_str->str); | |
4fe9a6da BV |
217 | switch (token) { |
218 | case 0x01: | |
219 | /* Device name */ | |
220 | devicename = g_string_append(devicename, tmp_str->str); | |
221 | break; | |
222 | case 0x02: | |
223 | /* FPGA firmware version */ | |
224 | if (version->len) | |
225 | g_string_append(version, ", "); | |
226 | g_string_append(version, "FPGA version "); | |
227 | g_string_append(version, tmp_str->str); | |
228 | break; | |
229 | case 0x03: | |
230 | /* Ancillary version */ | |
231 | if (version->len) | |
232 | g_string_append(version, ", "); | |
233 | g_string_append(version, "Ancillary version "); | |
234 | g_string_append(version, tmp_str->str); | |
235 | break; | |
236 | default: | |
b08024a8 UH |
237 | sr_info("ols: unknown token 0x%.2x: '%s'", |
238 | token, tmp_str->str); | |
4fe9a6da BV |
239 | break; |
240 | } | |
241 | g_string_free(tmp_str, TRUE); | |
242 | break; | |
243 | case 1: | |
244 | /* 32-bit unsigned integer */ | |
245 | if (serial_read(fd, &tmp_int, 4) != 4) | |
246 | break; | |
247 | tmp_int = reverse32(tmp_int); | |
b08024a8 UH |
248 | sr_dbg("ols: got metadata key 0x%.2x value 0x%.8x", |
249 | key, tmp_int); | |
4fe9a6da BV |
250 | switch (token) { |
251 | case 0x00: | |
252 | /* Number of usable probes */ | |
253 | ols->num_probes = tmp_int; | |
254 | break; | |
255 | case 0x01: | |
256 | /* Amount of sample memory available (bytes) */ | |
257 | ols->max_samples = tmp_int; | |
258 | break; | |
259 | case 0x02: | |
260 | /* Amount of dynamic memory available (bytes) */ | |
261 | /* what is this for? */ | |
262 | break; | |
263 | case 0x03: | |
264 | /* Maximum sample rate (hz) */ | |
265 | ols->max_samplerate = tmp_int; | |
266 | break; | |
267 | case 0x04: | |
268 | /* protocol version */ | |
269 | ols->protocol_version = tmp_int; | |
270 | break; | |
271 | default: | |
b08024a8 UH |
272 | sr_info("ols: unknown token 0x%.2x: 0x%.8x", |
273 | token, tmp_int); | |
4fe9a6da BV |
274 | break; |
275 | } | |
276 | break; | |
277 | case 2: | |
278 | /* 8-bit unsigned integer */ | |
279 | if (serial_read(fd, &tmp_c, 1) != 1) | |
280 | break; | |
b08024a8 UH |
281 | sr_dbg("ols: got metadata key 0x%.2x value 0x%.2x", |
282 | key, tmp_c); | |
4fe9a6da BV |
283 | switch (token) { |
284 | case 0x00: | |
285 | /* Number of usable probes */ | |
286 | ols->num_probes = tmp_c; | |
287 | break; | |
288 | case 0x01: | |
289 | /* protocol version */ | |
290 | ols->protocol_version = tmp_c; | |
291 | break; | |
292 | default: | |
b08024a8 UH |
293 | sr_info("ols: unknown token 0x%.2x: 0x%.2x", |
294 | token, tmp_c); | |
4fe9a6da BV |
295 | break; |
296 | } | |
297 | break; | |
298 | default: | |
299 | /* unknown type */ | |
300 | break; | |
301 | } | |
302 | } | |
303 | ||
304 | sdi->model = devicename->str; | |
305 | sdi->version = version->str; | |
306 | g_string_free(devicename, FALSE); | |
307 | g_string_free(version, FALSE); | |
308 | ||
309 | return sdi; | |
310 | } | |
311 | ||
54ac5277 | 312 | static int hw_init(const char *deviceinfo) |
a1bb33af | 313 | { |
a00ba012 | 314 | struct sr_device_instance *sdi; |
4fe9a6da | 315 | struct ols_device *ols; |
a1bb33af | 316 | GSList *ports, *l; |
4fe9a6da | 317 | GPollFD *fds, probefd; |
6937bb75 | 318 | int devcnt, final_devcnt, num_ports, fd, ret, i; |
d02a535e | 319 | char buf[8], **device_names, **serial_params; |
a1bb33af | 320 | |
c0a4b971 UH |
321 | final_devcnt = 0; |
322 | ||
43fc7885 | 323 | if (deviceinfo) |
6937bb75 | 324 | ports = g_slist_append(NULL, strdup(deviceinfo)); |
a1bb33af | 325 | else |
43fc7885 | 326 | /* No specific device given, so scan all serial ports. */ |
a1bb33af UH |
327 | ports = list_serial_ports(); |
328 | ||
329 | num_ports = g_slist_length(ports); | |
c0a4b971 UH |
330 | |
331 | if (!(fds = g_try_malloc0(num_ports * sizeof(GPollFD)))) { | |
332 | sr_err("ols: %s: fds malloc failed", __func__); | |
333 | goto hw_init_free_ports; /* TODO: SR_ERR_MALLOC. */ | |
334 | } | |
335 | ||
336 | if (!(device_names = g_try_malloc(num_ports * sizeof(char *)))) { | |
337 | sr_err("ols: %s: device_names malloc failed", __func__); | |
338 | goto hw_init_free_fds; /* TODO: SR_ERR_MALLOC. */ | |
339 | } | |
340 | ||
341 | if (!(serial_params = g_try_malloc(num_ports * sizeof(char *)))) { | |
342 | sr_err("ols: %s: serial_params malloc failed", __func__); | |
343 | goto hw_init_free_device_names; /* TODO: SR_ERR_MALLOC. */ | |
344 | } | |
345 | ||
a1bb33af | 346 | devcnt = 0; |
43fc7885 UH |
347 | for (l = ports; l; l = l->next) { |
348 | /* The discovery procedure is like this: first send the Reset | |
349 | * command (0x00) 5 times, since the device could be anywhere | |
350 | * in a 5-byte command. Then send the ID command (0x02). | |
351 | * If the device responds with 4 bytes ("OLS1" or "SLA1"), we | |
352 | * have a match. | |
353 | * | |
354 | * Since it may take the device a while to respond at 115Kb/s, | |
355 | * we do all the sending first, then wait for all of them to | |
356 | * respond with g_poll(). | |
a1bb33af | 357 | */ |
b08024a8 | 358 | sr_info("ols: probing %s...", (char *)l->data); |
d02a535e | 359 | fd = serial_open(l->data, O_RDWR | O_NONBLOCK); |
43fc7885 | 360 | if (fd != -1) { |
d02a535e BV |
361 | serial_params[devcnt] = serial_backup_params(fd); |
362 | serial_set_params(fd, 115200, 8, 0, 1, 2); | |
e46b8fb1 | 363 | ret = SR_OK; |
43fc7885 UH |
364 | for (i = 0; i < 5; i++) { |
365 | if ((ret = send_shortcommand(fd, | |
e46b8fb1 | 366 | CMD_RESET)) != SR_OK) { |
43fc7885 | 367 | /* Serial port is not writable. */ |
6937bb75 BV |
368 | break; |
369 | } | |
a1bb33af | 370 | } |
e46b8fb1 | 371 | if (ret != SR_OK) { |
43fc7885 UH |
372 | serial_restore_params(fd, |
373 | serial_params[devcnt]); | |
d02a535e | 374 | serial_close(fd); |
6937bb75 | 375 | continue; |
d02a535e | 376 | } |
6937bb75 BV |
377 | send_shortcommand(fd, CMD_ID); |
378 | fds[devcnt].fd = fd; | |
379 | fds[devcnt].events = G_IO_IN; | |
380 | device_names[devcnt] = strdup(l->data); | |
381 | devcnt++; | |
a1bb33af | 382 | } |
6937bb75 | 383 | free(l->data); |
a1bb33af UH |
384 | } |
385 | ||
5b15b41e PS |
386 | /* 2ms isn't enough for reliable transfer with pl2303, let's try 10 */ |
387 | usleep(10000); | |
a1bb33af | 388 | |
a1bb33af | 389 | g_poll(fds, devcnt, 1); |
4fe9a6da | 390 | |
43fc7885 | 391 | for (i = 0; i < devcnt; i++) { |
4fe9a6da BV |
392 | if (fds[i].revents != G_IO_IN) |
393 | continue; | |
394 | if (serial_read(fds[i].fd, buf, 4) != 4) | |
395 | continue; | |
396 | if (strncmp(buf, "1SLO", 4) && strncmp(buf, "1ALS", 4)) | |
397 | continue; | |
398 | ||
399 | /* definitely using the OLS protocol, check if it supports | |
400 | * the metadata command | |
401 | */ | |
402 | send_shortcommand(fds[i].fd, CMD_METADATA); | |
403 | probefd.fd = fds[i].fd; | |
404 | probefd.events = G_IO_IN; | |
405 | if (g_poll(&probefd, 1, 10) > 0) { | |
406 | /* got metadata */ | |
407 | sdi = get_metadata(fds[i].fd); | |
408 | sdi->index = final_devcnt; | |
409 | } else { | |
410 | /* not an OLS -- some other board that uses the sump protocol */ | |
411 | sdi = sr_device_instance_new(final_devcnt, SR_ST_INACTIVE, | |
412 | "Sump", "Logic Analyzer", "v1.0"); | |
413 | ols = ols_device_new(); | |
414 | ols->num_probes = 32; | |
415 | sdi->priv = ols; | |
a1bb33af | 416 | } |
4fe9a6da BV |
417 | sdi->serial = sr_serial_device_instance_new(device_names[i], -1); |
418 | device_instances = g_slist_append(device_instances, sdi); | |
419 | final_devcnt++; | |
420 | serial_close(fds[i].fd); | |
421 | fds[i].fd = 0; | |
4fe9a6da BV |
422 | } |
423 | ||
424 | /* clean up after all the probing */ | |
425 | for (i = 0; i < devcnt; i++) { | |
43fc7885 | 426 | if (fds[i].fd != 0) { |
d02a535e BV |
427 | serial_restore_params(fds[i].fd, serial_params[i]); |
428 | serial_close(fds[i].fd); | |
6937bb75 | 429 | } |
d02a535e | 430 | free(serial_params[i]); |
4fe9a6da | 431 | free(device_names[i]); |
a1bb33af UH |
432 | } |
433 | ||
c0a4b971 UH |
434 | g_free(serial_params); |
435 | hw_init_free_device_names: | |
436 | g_free(device_names); | |
437 | hw_init_free_fds: | |
438 | g_free(fds); | |
439 | hw_init_free_ports: | |
a1bb33af UH |
440 | g_slist_free(ports); |
441 | ||
442 | return final_devcnt; | |
443 | } | |
444 | ||
a1bb33af UH |
445 | static int hw_opendev(int device_index) |
446 | { | |
a00ba012 | 447 | struct sr_device_instance *sdi; |
a1bb33af | 448 | |
d32d961d | 449 | if (!(sdi = sr_get_device_instance(device_instances, device_index))) |
e46b8fb1 | 450 | return SR_ERR; |
a1bb33af | 451 | |
d02a535e | 452 | sdi->serial->fd = serial_open(sdi->serial->port, O_RDWR); |
43fc7885 | 453 | if (sdi->serial->fd == -1) |
e46b8fb1 | 454 | return SR_ERR; |
a1bb33af | 455 | |
5a2326a7 | 456 | sdi->status = SR_ST_ACTIVE; |
a1bb33af | 457 | |
e46b8fb1 | 458 | return SR_OK; |
a1bb33af UH |
459 | } |
460 | ||
a1bb33af UH |
461 | static void hw_closedev(int device_index) |
462 | { | |
a00ba012 | 463 | struct sr_device_instance *sdi; |
a1bb33af | 464 | |
d32d961d | 465 | if (!(sdi = sr_get_device_instance(device_instances, device_index))) |
a1bb33af UH |
466 | return; |
467 | ||
43fc7885 | 468 | if (sdi->serial->fd != -1) { |
d02a535e | 469 | serial_close(sdi->serial->fd); |
a1bb33af | 470 | sdi->serial->fd = -1; |
5a2326a7 | 471 | sdi->status = SR_ST_INACTIVE; |
a1bb33af | 472 | } |
a1bb33af UH |
473 | } |
474 | ||
a1bb33af UH |
475 | static void hw_cleanup(void) |
476 | { | |
477 | GSList *l; | |
a00ba012 | 478 | struct sr_device_instance *sdi; |
a1bb33af | 479 | |
43fc7885 UH |
480 | /* Properly close all devices. */ |
481 | for (l = device_instances; l; l = l->next) { | |
a1bb33af | 482 | sdi = l->data; |
43fc7885 | 483 | if (sdi->serial->fd != -1) |
d02a535e | 484 | serial_close(sdi->serial->fd); |
a00ba012 | 485 | sr_device_instance_free(sdi); |
a1bb33af UH |
486 | } |
487 | g_slist_free(device_instances); | |
488 | device_instances = NULL; | |
a1bb33af UH |
489 | } |
490 | ||
a1bb33af UH |
491 | static void *hw_get_device_info(int device_index, int device_info_id) |
492 | { | |
a00ba012 | 493 | struct sr_device_instance *sdi; |
4fe9a6da | 494 | struct ols_device *ols; |
a1bb33af UH |
495 | void *info; |
496 | ||
d32d961d | 497 | if (!(sdi = sr_get_device_instance(device_instances, device_index))) |
a1bb33af | 498 | return NULL; |
4fe9a6da | 499 | ols = sdi->priv; |
a1bb33af UH |
500 | |
501 | info = NULL; | |
43fc7885 | 502 | switch (device_info_id) { |
5a2326a7 | 503 | case SR_DI_INSTANCE: |
a1bb33af UH |
504 | info = sdi; |
505 | break; | |
5a2326a7 | 506 | case SR_DI_NUM_PROBES: |
a1bb33af UH |
507 | info = GINT_TO_POINTER(NUM_PROBES); |
508 | break; | |
5a2326a7 | 509 | case SR_DI_SAMPLERATES: |
a1bb33af UH |
510 | info = &samplerates; |
511 | break; | |
5a2326a7 | 512 | case SR_DI_TRIGGER_TYPES: |
43fc7885 | 513 | info = (char *)TRIGGER_TYPES; |
a1bb33af | 514 | break; |
5a2326a7 | 515 | case SR_DI_CUR_SAMPLERATE: |
4fe9a6da | 516 | info = &ols->cur_samplerate; |
a1bb33af UH |
517 | break; |
518 | } | |
519 | ||
520 | return info; | |
521 | } | |
522 | ||
a1bb33af UH |
523 | static int hw_get_status(int device_index) |
524 | { | |
a00ba012 | 525 | struct sr_device_instance *sdi; |
a1bb33af | 526 | |
d32d961d | 527 | if (!(sdi = sr_get_device_instance(device_instances, device_index))) |
5a2326a7 | 528 | return SR_ST_NOT_FOUND; |
a1bb33af UH |
529 | |
530 | return sdi->status; | |
531 | } | |
532 | ||
a1bb33af UH |
533 | static int *hw_get_capabilities(void) |
534 | { | |
a1bb33af UH |
535 | return capabilities; |
536 | } | |
537 | ||
a00ba012 | 538 | static int set_configuration_samplerate(struct sr_device_instance *sdi, |
43fc7885 | 539 | uint64_t samplerate) |
a1bb33af | 540 | { |
4fe9a6da | 541 | struct ols_device *ols; |
a1bb33af | 542 | |
4fe9a6da BV |
543 | ols = sdi->priv; |
544 | if (ols->max_samplerate) { | |
545 | if (samplerate > ols->max_samplerate) | |
546 | return SR_ERR_SAMPLERATE; | |
547 | } else if (samplerate < samplerates.low || samplerate > samplerates.high) | |
e46b8fb1 | 548 | return SR_ERR_SAMPLERATE; |
a1bb33af | 549 | |
4fe9a6da | 550 | ols->cur_samplerate = samplerate; |
43fc7885 | 551 | if (samplerate > CLOCK_RATE) { |
4fe9a6da BV |
552 | ols->flag_reg |= FLAG_DEMUX; |
553 | ols->cur_samplerate_divider = (CLOCK_RATE * 2 / samplerate) - 1; | |
43fc7885 | 554 | } else { |
4fe9a6da BV |
555 | ols->flag_reg &= ~FLAG_DEMUX; |
556 | ols->cur_samplerate_divider = (CLOCK_RATE / samplerate) - 1; | |
a1bb33af | 557 | } |
a1bb33af | 558 | |
e46b8fb1 | 559 | return SR_OK; |
a1bb33af UH |
560 | } |
561 | ||
a1bb33af UH |
562 | static int hw_set_configuration(int device_index, int capability, void *value) |
563 | { | |
a00ba012 | 564 | struct sr_device_instance *sdi; |
4fe9a6da | 565 | struct ols_device *ols; |
a1bb33af UH |
566 | int ret; |
567 | uint64_t *tmp_u64; | |
568 | ||
d32d961d | 569 | if (!(sdi = sr_get_device_instance(device_instances, device_index))) |
e46b8fb1 | 570 | return SR_ERR; |
4fe9a6da | 571 | ols = sdi->priv; |
a1bb33af | 572 | |
5a2326a7 | 573 | if (sdi->status != SR_ST_ACTIVE) |
e46b8fb1 | 574 | return SR_ERR; |
a1bb33af | 575 | |
a803c0db | 576 | switch (capability) { |
5a2326a7 | 577 | case SR_HWCAP_SAMPLERATE: |
a1bb33af UH |
578 | tmp_u64 = value; |
579 | ret = set_configuration_samplerate(sdi, *tmp_u64); | |
a803c0db | 580 | break; |
5a2326a7 | 581 | case SR_HWCAP_PROBECONFIG: |
4fe9a6da | 582 | ret = configure_probes(ols, (GSList *) value); |
a803c0db | 583 | break; |
5a2326a7 | 584 | case SR_HWCAP_LIMIT_SAMPLES: |
2458ea65 | 585 | tmp_u64 = value; |
574ce498 | 586 | if (*tmp_u64 < MIN_NUM_SAMPLES) |
e46b8fb1 | 587 | return SR_ERR; |
4fe9a6da | 588 | ols->limit_samples = *tmp_u64; |
b08024a8 | 589 | sr_info("ols: sample limit %" PRIu64, ols->limit_samples); |
e46b8fb1 | 590 | ret = SR_OK; |
a803c0db | 591 | break; |
5a2326a7 | 592 | case SR_HWCAP_CAPTURE_RATIO: |
a803c0db | 593 | tmp_u64 = value; |
4fe9a6da BV |
594 | ols->capture_ratio = *tmp_u64; |
595 | if (ols->capture_ratio < 0 || ols->capture_ratio > 100) { | |
596 | ols->capture_ratio = 0; | |
e46b8fb1 | 597 | ret = SR_ERR; |
43fc7885 | 598 | } else |
e46b8fb1 | 599 | ret = SR_OK; |
a803c0db BV |
600 | break; |
601 | default: | |
e46b8fb1 | 602 | ret = SR_ERR; |
43fc7885 | 603 | } |
a1bb33af UH |
604 | |
605 | return ret; | |
606 | } | |
607 | ||
a1bb33af UH |
608 | static int receive_data(int fd, int revents, void *user_data) |
609 | { | |
b9c735a2 | 610 | struct sr_datafeed_packet packet; |
4fe9a6da BV |
611 | struct sr_device_instance *sdi; |
612 | struct ols_device *ols; | |
613 | GSList *l; | |
614 | int count, buflen, num_channels, offset, i, j; | |
a1bb33af UH |
615 | unsigned char byte, *buffer; |
616 | ||
4fe9a6da BV |
617 | /* find this device's ols_device struct by its fd */ |
618 | ols = NULL; | |
619 | for (l = device_instances; l; l = l->next) { | |
620 | sdi = l->data; | |
621 | if (sdi->serial->fd == fd) { | |
622 | ols = sdi->priv; | |
623 | break; | |
624 | } | |
625 | } | |
626 | if (!ols) | |
627 | /* shouldn't happen */ | |
628 | return TRUE; | |
629 | ||
630 | if (ols->num_transfers++ == 0) { | |
43fc7885 UH |
631 | /* |
632 | * First time round, means the device started sending data, | |
633 | * and will not stop until done. If it stops sending for | |
634 | * longer than it takes to send a byte, that means it's | |
635 | * finished. We'll double that to 30ms to be sure... | |
a1bb33af | 636 | */ |
6f1be0a2 UH |
637 | sr_source_remove(fd); |
638 | sr_source_add(fd, G_IO_IN, 30, receive_data, user_data); | |
c0a4b971 UH |
639 | ols->raw_sample_buf = g_try_malloc(ols->limit_samples * 4); |
640 | if (!ols->raw_sample_buf) { | |
641 | sr_err("ols: %s: ols->raw_sample_buf malloc failed", | |
642 | __func__); | |
643 | return FALSE; | |
644 | } | |
a803c0db | 645 | /* fill with 1010... for debugging */ |
4fe9a6da | 646 | memset(ols->raw_sample_buf, 0x82, ols->limit_samples * 4); |
a1bb33af UH |
647 | } |
648 | ||
6937bb75 | 649 | num_channels = 0; |
43fc7885 | 650 | for (i = 0x20; i > 0x02; i /= 2) { |
4fe9a6da | 651 | if ((ols->flag_reg & i) == 0) |
6937bb75 | 652 | num_channels++; |
43fc7885 | 653 | } |
6937bb75 | 654 | |
43fc7885 | 655 | if (revents == G_IO_IN |
4fe9a6da | 656 | && ols->num_transfers / num_channels <= ols->limit_samples) { |
2119ab03 | 657 | if (serial_read(fd, &byte, 1) != 1) |
a1bb33af UH |
658 | return FALSE; |
659 | ||
4fe9a6da | 660 | ols->sample[ols->num_bytes++] = byte; |
b08024a8 | 661 | sr_dbg("ols: received byte 0x%.2x", byte); |
4fe9a6da | 662 | if (ols->num_bytes == num_channels) { |
43fc7885 | 663 | /* Got a full sample. */ |
b08024a8 UH |
664 | sr_dbg("ols: received sample 0x%.*x", |
665 | ols->num_bytes * 2, (int) *ols->sample); | |
4fe9a6da | 666 | if (ols->flag_reg & FLAG_RLE) { |
43fc7885 UH |
667 | /* |
668 | * In RLE mode -1 should never come in as a | |
669 | * sample, because bit 31 is the "count" flag. | |
670 | * TODO: Endianness may be wrong here, could be | |
671 | * sample[3]. | |
672 | */ | |
4fe9a6da BV |
673 | if (ols->sample[0] & 0x80 |
674 | && !(ols->last_sample[0] & 0x80)) { | |
675 | count = (int)(*ols->sample) & 0x7fffffff; | |
b53738ba UH |
676 | if (!(buffer = g_try_malloc(count))) { |
677 | sr_err("ols: %s: buffer malloc " | |
678 | "failed", __func__); | |
679 | return FALSE; | |
680 | } | |
681 | ||
a1bb33af | 682 | buflen = 0; |
43fc7885 | 683 | for (i = 0; i < count; i++) { |
4fe9a6da | 684 | memcpy(buffer + buflen, ols->last_sample, 4); |
a1bb33af UH |
685 | buflen += 4; |
686 | } | |
43fc7885 UH |
687 | } else { |
688 | /* | |
689 | * Just a single sample, next sample | |
690 | * will probably be a count referring | |
691 | * to this -- but this one is still a | |
692 | * part of the stream. | |
a1bb33af | 693 | */ |
4fe9a6da | 694 | buffer = ols->sample; |
a1bb33af UH |
695 | buflen = 4; |
696 | } | |
43fc7885 UH |
697 | } else { |
698 | /* No compression. */ | |
4fe9a6da | 699 | buffer = ols->sample; |
a1bb33af UH |
700 | buflen = 4; |
701 | } | |
702 | ||
43fc7885 UH |
703 | if (num_channels < 4) { |
704 | /* | |
705 | * Some channel groups may have been turned | |
706 | * off, to speed up transfer between the | |
707 | * hardware and the PC. Expand that here before | |
708 | * submitting it over the session bus -- | |
709 | * whatever is listening on the bus will be | |
710 | * expecting a full 32-bit sample, based on | |
711 | * the number of probes. | |
6937bb75 BV |
712 | */ |
713 | j = 0; | |
4fe9a6da | 714 | memset(ols->tmp_sample, 0, 4); |
43fc7885 | 715 | for (i = 0; i < 4; i++) { |
4fe9a6da | 716 | if (((ols->flag_reg >> 2) & (1 << i)) == 0) { |
43fc7885 UH |
717 | /* |
718 | * This channel group was | |
719 | * enabled, copy from received | |
720 | * sample. | |
721 | */ | |
4fe9a6da | 722 | ols->tmp_sample[i] = ols->sample[j++]; |
6937bb75 BV |
723 | } |
724 | } | |
4fe9a6da | 725 | memcpy(ols->sample, ols->tmp_sample, 4); |
b08024a8 | 726 | sr_dbg("ols: full sample 0x%.8x", (int) *ols->sample); |
6937bb75 BV |
727 | } |
728 | ||
a803c0db BV |
729 | /* the OLS sends its sample buffer backwards. |
730 | * store it in reverse order here, so we can dump | |
731 | * this on the session bus later. | |
732 | */ | |
4fe9a6da BV |
733 | offset = (ols->limit_samples - ols->num_transfers / num_channels) * 4; |
734 | memcpy(ols->raw_sample_buf + offset, ols->sample, 4); | |
a803c0db | 735 | |
4fe9a6da BV |
736 | if (buffer == ols->sample) |
737 | memcpy(ols->last_sample, buffer, num_channels); | |
a1bb33af UH |
738 | else |
739 | g_free(buffer); | |
740 | ||
4fe9a6da BV |
741 | memset(ols->sample, 0, 4); |
742 | ols->num_bytes = 0; | |
a1bb33af | 743 | } |
43fc7885 UH |
744 | } else { |
745 | /* | |
746 | * This is the main loop telling us a timeout was reached, or | |
747 | * we've acquired all the samples we asked for -- we're done. | |
a803c0db | 748 | * Send the (properly-ordered) buffer to the frontend. |
43fc7885 | 749 | */ |
4fe9a6da | 750 | if (ols->trigger_at != -1) { |
a803c0db BV |
751 | /* a trigger was set up, so we need to tell the frontend |
752 | * about it. | |
753 | */ | |
4fe9a6da | 754 | if (ols->trigger_at > 0) { |
a803c0db | 755 | /* there are pre-trigger samples, send those first */ |
5a2326a7 | 756 | packet.type = SR_DF_LOGIC; |
4fe9a6da | 757 | packet.length = ols->trigger_at * 4; |
4c046c6b | 758 | packet.unitsize = 4; |
4fe9a6da | 759 | packet.payload = ols->raw_sample_buf; |
8a2efef2 | 760 | sr_session_bus(user_data, &packet); |
a803c0db BV |
761 | } |
762 | ||
5a2326a7 | 763 | packet.type = SR_DF_TRIGGER; |
a803c0db | 764 | packet.length = 0; |
8a2efef2 | 765 | sr_session_bus(user_data, &packet); |
a803c0db | 766 | |
5a2326a7 | 767 | packet.type = SR_DF_LOGIC; |
4fe9a6da | 768 | packet.length = (ols->limit_samples * 4) - (ols->trigger_at * 4); |
4c046c6b | 769 | packet.unitsize = 4; |
4fe9a6da | 770 | packet.payload = ols->raw_sample_buf + ols->trigger_at * 4; |
8a2efef2 | 771 | sr_session_bus(user_data, &packet); |
a803c0db | 772 | } else { |
5a2326a7 | 773 | packet.type = SR_DF_LOGIC; |
4fe9a6da | 774 | packet.length = ols->limit_samples * 4; |
4c046c6b | 775 | packet.unitsize = 4; |
4fe9a6da | 776 | packet.payload = ols->raw_sample_buf; |
8a2efef2 | 777 | sr_session_bus(user_data, &packet); |
a803c0db | 778 | } |
c0a4b971 | 779 | g_free(ols->raw_sample_buf); |
a803c0db | 780 | |
06d64eb8 | 781 | serial_flush(fd); |
d02a535e | 782 | serial_close(fd); |
5a2326a7 | 783 | packet.type = SR_DF_END; |
a1bb33af | 784 | packet.length = 0; |
8a2efef2 | 785 | sr_session_bus(user_data, &packet); |
a1bb33af UH |
786 | } |
787 | ||
788 | return TRUE; | |
789 | } | |
790 | ||
a1bb33af UH |
791 | static int hw_start_acquisition(int device_index, gpointer session_device_id) |
792 | { | |
b9c735a2 UH |
793 | struct sr_datafeed_packet *packet; |
794 | struct sr_datafeed_header *header; | |
a00ba012 | 795 | struct sr_device_instance *sdi; |
4fe9a6da | 796 | struct ols_device *ols; |
a803c0db | 797 | uint32_t trigger_config[4]; |
a1bb33af | 798 | uint32_t data; |
6937bb75 BV |
799 | uint16_t readcount, delaycount; |
800 | uint8_t changrp_mask; | |
4fe9a6da | 801 | int i; |
a1bb33af | 802 | |
d32d961d | 803 | if (!(sdi = sr_get_device_instance(device_instances, device_index))) |
e46b8fb1 | 804 | return SR_ERR; |
c0a4b971 | 805 | |
4fe9a6da | 806 | ols = sdi->priv; |
a1bb33af | 807 | |
5a2326a7 | 808 | if (sdi->status != SR_ST_ACTIVE) |
e46b8fb1 | 809 | return SR_ERR; |
a1bb33af | 810 | |
4fe9a6da | 811 | readcount = ols->limit_samples / 4; |
a803c0db BV |
812 | |
813 | memset(trigger_config, 0, 16); | |
4fe9a6da BV |
814 | trigger_config[ols->num_stages - 1] |= 0x08; |
815 | if (ols->trigger_mask[0]) { | |
816 | delaycount = readcount * (1 - ols->capture_ratio / 100.0); | |
817 | ols->trigger_at = (readcount - delaycount) * 4 - ols->num_stages; | |
a803c0db | 818 | |
43fc7885 | 819 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_0, |
4fe9a6da | 820 | reverse32(ols->trigger_mask[0])) != SR_OK) |
e46b8fb1 | 821 | return SR_ERR; |
a803c0db | 822 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_VALUE_0, |
4fe9a6da | 823 | reverse32(ols->trigger_value[0])) != SR_OK) |
e46b8fb1 | 824 | return SR_ERR; |
a803c0db | 825 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_CONFIG_0, |
e46b8fb1 UH |
826 | trigger_config[0]) != SR_OK) |
827 | return SR_ERR; | |
6937bb75 | 828 | |
a803c0db | 829 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_1, |
4fe9a6da | 830 | reverse32(ols->trigger_mask[1])) != SR_OK) |
e46b8fb1 | 831 | return SR_ERR; |
43fc7885 | 832 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_VALUE_1, |
4fe9a6da | 833 | reverse32(ols->trigger_value[1])) != SR_OK) |
e46b8fb1 | 834 | return SR_ERR; |
a803c0db | 835 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_CONFIG_1, |
e46b8fb1 UH |
836 | trigger_config[1]) != SR_OK) |
837 | return SR_ERR; | |
6937bb75 | 838 | |
a803c0db | 839 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_2, |
4fe9a6da | 840 | reverse32(ols->trigger_mask[2])) != SR_OK) |
e46b8fb1 | 841 | return SR_ERR; |
a803c0db | 842 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_VALUE_2, |
4fe9a6da | 843 | reverse32(ols->trigger_value[2])) != SR_OK) |
e46b8fb1 | 844 | return SR_ERR; |
43fc7885 | 845 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_CONFIG_2, |
e46b8fb1 UH |
846 | trigger_config[2]) != SR_OK) |
847 | return SR_ERR; | |
a803c0db BV |
848 | |
849 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_3, | |
4fe9a6da | 850 | reverse32(ols->trigger_mask[3])) != SR_OK) |
e46b8fb1 | 851 | return SR_ERR; |
a803c0db | 852 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_VALUE_3, |
4fe9a6da | 853 | reverse32(ols->trigger_value[3])) != SR_OK) |
e46b8fb1 | 854 | return SR_ERR; |
43fc7885 | 855 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_CONFIG_3, |
e46b8fb1 UH |
856 | trigger_config[3]) != SR_OK) |
857 | return SR_ERR; | |
6937bb75 | 858 | } else { |
43fc7885 | 859 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_0, |
4fe9a6da | 860 | ols->trigger_mask[0]) != SR_OK) |
e46b8fb1 | 861 | return SR_ERR; |
43fc7885 | 862 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_VALUE_0, |
4fe9a6da | 863 | ols->trigger_value[0]) != SR_OK) |
e46b8fb1 | 864 | return SR_ERR; |
43fc7885 | 865 | if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_CONFIG_0, |
e46b8fb1 UH |
866 | 0x00000008) != SR_OK) |
867 | return SR_ERR; | |
a803c0db | 868 | delaycount = readcount; |
6937bb75 | 869 | } |
a1bb33af | 870 | |
b08024a8 UH |
871 | sr_info("ols: setting samplerate to %" PRIu64 " Hz (divider %u, " |
872 | "demux %s)", ols->cur_samplerate, ols->cur_samplerate_divider, | |
873 | ols->flag_reg & FLAG_DEMUX ? "on" : "off"); | |
4fe9a6da BV |
874 | if (send_longcommand(sdi->serial->fd, CMD_SET_DIVIDER, |
875 | reverse32(ols->cur_samplerate_divider)) != SR_OK) | |
876 | return SR_ERR; | |
a1bb33af | 877 | |
43fc7885 | 878 | /* Send sample limit and pre/post-trigger capture ratio. */ |
a803c0db BV |
879 | data = ((readcount - 1) & 0xffff) << 16; |
880 | data |= (delaycount - 1) & 0xffff; | |
e46b8fb1 UH |
881 | if (send_longcommand(sdi->serial->fd, CMD_CAPTURE_SIZE, reverse16(data)) != SR_OK) |
882 | return SR_ERR; | |
a1bb33af | 883 | |
43fc7885 UH |
884 | /* |
885 | * Enable/disable channel groups in the flag register according to the | |
a803c0db | 886 | * probe mask. |
6937bb75 BV |
887 | */ |
888 | changrp_mask = 0; | |
43fc7885 | 889 | for (i = 0; i < 4; i++) { |
4fe9a6da | 890 | if (ols->probe_mask & (0xff << (i * 8))) |
a803c0db | 891 | changrp_mask |= (1 << i); |
6937bb75 | 892 | } |
43fc7885 UH |
893 | |
894 | /* The flag register wants them here, and 1 means "disable channel". */ | |
4fe9a6da BV |
895 | ols->flag_reg |= ~(changrp_mask << 2) & 0x3c; |
896 | ols->flag_reg |= FLAG_FILTER; | |
897 | data = ols->flag_reg << 24; | |
e46b8fb1 UH |
898 | if (send_longcommand(sdi->serial->fd, CMD_SET_FLAGS, data) != SR_OK) |
899 | return SR_ERR; | |
a1bb33af | 900 | |
43fc7885 | 901 | /* Start acquisition on the device. */ |
e46b8fb1 UH |
902 | if (send_shortcommand(sdi->serial->fd, CMD_RUN) != SR_OK) |
903 | return SR_ERR; | |
a1bb33af | 904 | |
6f1be0a2 UH |
905 | sr_source_add(sdi->serial->fd, G_IO_IN, -1, receive_data, |
906 | session_device_id); | |
a1bb33af | 907 | |
b53738ba UH |
908 | if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) { |
909 | sr_err("ols: %s: packet malloc failed", __func__); | |
910 | return SR_ERR_MALLOC; | |
911 | } | |
912 | ||
913 | if (!(header = g_try_malloc(sizeof(struct sr_datafeed_header)))) { | |
914 | sr_err("ols: %s: header malloc failed", __func__); | |
c0a4b971 | 915 | g_free(packet); |
b53738ba UH |
916 | return SR_ERR_MALLOC; |
917 | } | |
918 | ||
43fc7885 | 919 | /* Send header packet to the session bus. */ |
5a2326a7 | 920 | packet->type = SR_DF_HEADER; |
b9c735a2 | 921 | packet->length = sizeof(struct sr_datafeed_header); |
43fc7885 | 922 | packet->payload = (unsigned char *)header; |
a1bb33af UH |
923 | header->feed_version = 1; |
924 | gettimeofday(&header->starttime, NULL); | |
4fe9a6da | 925 | header->samplerate = ols->cur_samplerate; |
5a2326a7 | 926 | header->protocol_id = SR_PROTO_RAW; |
c2616fb9 DR |
927 | header->num_logic_probes = NUM_PROBES; |
928 | header->num_analog_probes = 0; | |
8a2efef2 | 929 | sr_session_bus(session_device_id, packet); |
c0a4b971 | 930 | |
a1bb33af UH |
931 | g_free(header); |
932 | g_free(packet); | |
933 | ||
e46b8fb1 | 934 | return SR_OK; |
a1bb33af UH |
935 | } |
936 | ||
a1bb33af UH |
937 | static void hw_stop_acquisition(int device_index, gpointer session_device_id) |
938 | { | |
b9c735a2 | 939 | struct sr_datafeed_packet packet; |
a1bb33af | 940 | |
17e1afcb | 941 | /* Avoid compiler warnings. */ |
afc8e4de UH |
942 | device_index = device_index; |
943 | ||
5a2326a7 | 944 | packet.type = SR_DF_END; |
a1bb33af | 945 | packet.length = 0; |
8a2efef2 | 946 | sr_session_bus(session_device_id, &packet); |
a1bb33af UH |
947 | } |
948 | ||
5c2d46d1 | 949 | struct sr_device_plugin ols_plugin_info = { |
e519ba86 UH |
950 | .name = "ols", |
951 | .longname = "Openbench Logic Sniffer", | |
952 | .api_version = 1, | |
953 | .init = hw_init, | |
954 | .cleanup = hw_cleanup, | |
86f5e3d8 UH |
955 | .opendev = hw_opendev, |
956 | .closedev = hw_closedev, | |
e519ba86 UH |
957 | .get_device_info = hw_get_device_info, |
958 | .get_status = hw_get_status, | |
959 | .get_capabilities = hw_get_capabilities, | |
960 | .set_configuration = hw_set_configuration, | |
961 | .start_acquisition = hw_start_acquisition, | |
962 | .stop_acquisition = hw_stop_acquisition, | |
a1bb33af | 963 | }; |