]> sigrok.org Git - libsigrok.git/blame - libsigrok.h
Doxygen: Add @file items for the relevant files.
[libsigrok.git] / libsigrok.h
CommitLineData
a1bb33af
UH
1/*
2 * This file is part of the sigrok project.
3 *
c73d2ea4 4 * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
a1bb33af
UH
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
0f8522bf
UH
20#ifndef LIBSIGROK_SIGROK_H
21#define LIBSIGROK_SIGROK_H
a1bb33af
UH
22
23#include <stdio.h>
24#include <sys/time.h>
25#include <stdint.h>
26#include <inttypes.h>
27#include <glib.h>
a1bb33af 28
a00b530c
UH
29#ifdef __cplusplus
30extern "C" {
31#endif
32
393fb9cb
UH
33/**
34 * @file
35 *
36 * The public libsigrok header file to be used by frontends.
37 */
38
e31b636d 39/*
e31b636d
UH
40 * All possible return codes of libsigrok functions must be listed here.
41 * Functions should never return hardcoded numbers as status, but rather
3c0839d5 42 * use these enum values. All error codes are negative numbers.
e31b636d
UH
43 *
44 * The error codes are globally unique in libsigrok, i.e. if one of the
2b3414a4
UH
45 * libsigrok functions returns a "malloc error" it must be exactly the same
46 * return value as used by all other functions to indicate "malloc error".
e31b636d
UH
47 * There must be no functions which indicate two different errors via the
48 * same return code.
49 *
50 * Also, for compatibility reasons, no defined return codes are ever removed
3c0839d5 51 * or reused for different errors later. You can only add new entries and
e31b636d
UH
52 * return codes, but never remove or redefine existing ones.
53 */
3c0839d5
UH
54
55/** Status/error codes returned by libsigrok functions. */
56enum {
57 SR_OK = 0, /**< No error. */
58 SR_ERR = -1, /**< Generic/unspecified error. */
59 SR_ERR_MALLOC = -2, /**< Malloc/calloc/realloc error. */
60 SR_ERR_ARG = -3, /**< Function argument error. */
61 SR_ERR_BUG = -4, /**< Errors hinting at internal bugs. */
62 SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */
63};
a1bb33af 64
b2ff9506
BV
65#define SR_MAX_NUM_PROBES 64 /* Limited by uint64_t. */
66#define SR_MAX_PROBENAME_LEN 32
2a3f9541 67
a1bb33af 68/* Handy little macros */
c9140419 69#define SR_HZ(n) (n)
59df0c77
UH
70#define SR_KHZ(n) ((n) * 1000)
71#define SR_MHZ(n) ((n) * 1000000)
72#define SR_GHZ(n) ((n) * 1000000000)
a1bb33af 73
59df0c77 74#define SR_HZ_TO_NS(n) (1000000000 / (n))
3677f3ec 75
3c0839d5
UH
76/** libsigrok loglevels. */
77enum {
78 SR_LOG_NONE = 0, /**< Output no messages at all. */
79 SR_LOG_ERR = 1, /**< Output error messages. */
80 SR_LOG_WARN = 2, /**< Output warnings. */
81 SR_LOG_INFO = 3, /**< Output informational messages. */
82 SR_LOG_DBG = 4, /**< Output debug messages. */
83 SR_LOG_SPEW = 5, /**< Output very noisy debug messages. */
84};
1352eedd 85
1a081ca6
UH
86/*
87 * Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
88 *
89 * Variables and functions marked 'static' are private already and don't
90 * need SR_PRIV. However, functions which are not static (because they need
91 * to be used in other libsigrok-internal files) but are also not meant to
92 * be part of the public libsigrok API, must use SR_PRIV.
93 *
94 * This uses the 'visibility' feature of gcc (requires gcc >= 4.0).
95 *
69e70c23
UH
96 * This feature is not available on MinGW/Windows, as it is a feature of
97 * ELF files and MinGW/Windows uses PE files.
98 *
1a081ca6
UH
99 * Details: http://gcc.gnu.org/wiki/Visibility
100 */
101
102/* Marks public libsigrok API symbols. */
69e70c23 103#ifndef _WIN32
1a081ca6 104#define SR_API __attribute__((visibility("default")))
69e70c23
UH
105#else
106#define SR_API
107#endif
1a081ca6
UH
108
109/* Marks private, non-public libsigrok symbols (not part of the API). */
69e70c23 110#ifndef _WIN32
1a081ca6 111#define SR_PRIV __attribute__((visibility("hidden")))
69e70c23
UH
112#else
113#define SR_PRIV
114#endif
1a081ca6 115
1f9813eb 116typedef int (*sr_receive_data_callback_t)(int fd, int revents, void *cb_data);
882e2075 117
3c0839d5 118/** Data types used by hardware drivers for dev_config_set(). */
a1bb33af 119enum {
5a2326a7
UH
120 SR_T_UINT64,
121 SR_T_CHAR,
4d436e71 122 SR_T_BOOL,
0fe11789 123 SR_T_FLOAT,
c1e48618 124 SR_T_RATIONAL_PERIOD,
bd8db307 125 SR_T_RATIONAL_VOLT,
45edd0b2 126 SR_T_KEYVALUE,
0fe11789
BV
127};
128
3c0839d5 129/** Rational number data type, containing numerator and denominator values. */
0fe11789 130struct sr_rational {
3c0839d5 131 /** Numerator of the rational number. */
0fe11789 132 uint64_t p;
3c0839d5 133 /** Denominator of the rational number. */
0fe11789 134 uint64_t q;
a1bb33af
UH
135};
136
3c0839d5 137/** Value for sr_datafeed_packet.type. */
a1bb33af 138enum {
5a2326a7
UH
139 SR_DF_HEADER,
140 SR_DF_END,
141 SR_DF_TRIGGER,
142 SR_DF_LOGIC,
ee7489d2
BV
143 SR_DF_META_LOGIC,
144 SR_DF_ANALOG,
145 SR_DF_META_ANALOG,
6ea7669c
BV
146 SR_DF_FRAME_BEGIN,
147 SR_DF_FRAME_END,
a1bb33af
UH
148};
149
3c0839d5 150/** Values for sr_datafeed_analog.mq. */
9956f285
UH
151enum {
152 SR_MQ_VOLTAGE,
153 SR_MQ_CURRENT,
154 SR_MQ_RESISTANCE,
155 SR_MQ_CAPACITANCE,
156 SR_MQ_TEMPERATURE,
157 SR_MQ_FREQUENCY,
158 SR_MQ_DUTY_CYCLE,
64591be2 159 SR_MQ_CONTINUITY,
aa839a5c 160 SR_MQ_PULSE_WIDTH,
96b3b3d5 161 SR_MQ_CONDUCTANCE,
3c0839d5 162 /** Electrical power, usually in W, or dBm. */
b82a17d3 163 SR_MQ_POWER,
3c0839d5 164 /** Gain (e.g. a transistor's gain, or hFE). */
b82a17d3 165 SR_MQ_GAIN,
9956f285
UH
166};
167
3c0839d5 168/** Values for sr_datafeed_analog.unit. */
aff5a729 169enum {
9956f285
UH
170 SR_UNIT_VOLT,
171 SR_UNIT_AMPERE,
172 SR_UNIT_OHM,
173 SR_UNIT_FARAD,
9956f285 174 SR_UNIT_KELVIN,
edb000eb
BV
175 SR_UNIT_CELSIUS,
176 SR_UNIT_FAHRENHEIT,
9956f285
UH
177 SR_UNIT_HERTZ,
178 SR_UNIT_PERCENTAGE,
edb000eb 179 SR_UNIT_BOOLEAN,
aa839a5c 180 SR_UNIT_SECOND,
3c0839d5 181 /** Unit of conductance, the inverse of resistance. */
96b3b3d5 182 SR_UNIT_SIEMENS,
3c0839d5
UH
183 /**
184 * An absolute measurement of power, in decibels, referenced to
185 * 1 milliwatt (dBu).
186 */
b82a17d3 187 SR_UNIT_DECIBEL_MW,
6b869234
BV
188 /** Voltage in decibel, referenced to 1 volt (dBV). */
189 SR_UNIT_DECIBEL_VOLT,
3c0839d5
UH
190 /**
191 * Measurements that intrinsically do not have units attached, such
6b869234 192 * as ratios, gains, etc. Specifically, a transistor's gain (hFE) is
3c0839d5
UH
193 * a unitless quantity, for example.
194 */
b82a17d3 195 SR_UNIT_UNITLESS,
aff5a729
BV
196};
197
3c0839d5 198/** Values for sr_datafeed_analog.flags. */
02e864d0 199enum {
3c0839d5 200 /** Voltage measurement is alternating current (AC). */
02e864d0 201 SR_MQFLAG_AC = 0x01,
3c0839d5 202 /** Voltage measurement is direct current (DC). */
02e864d0
BV
203 SR_MQFLAG_DC = 0x02,
204 /** This is a true RMS measurement. */
205 SR_MQFLAG_RMS = 0x04,
206 /** Value is voltage drop across a diode, or NAN. */
207 SR_MQFLAG_DIODE = 0x08,
208 /** Device is in "hold" mode, i.e. repeating the last measurement. */
209 SR_MQFLAG_HOLD = 0x10,
3c0839d5 210 /** Device is in "max" mode, only updating upon a new max value. */
02e864d0 211 SR_MQFLAG_MAX = 0x20,
3c0839d5 212 /** Device is in "min" mode, only updating upon a new min value. */
02e864d0
BV
213 SR_MQFLAG_MIN = 0x40,
214 /** Device is in autoranging mode. */
215 SR_MQFLAG_AUTORANGE = 0x80,
216 /** Device is in relative mode. */
217 SR_MQFLAG_RELATIVE = 0x100,
218};
219
b8072700
PS
220struct sr_context;
221
b9c735a2 222struct sr_datafeed_packet {
a1bb33af 223 uint16_t type;
a1bb33af
UH
224 void *payload;
225};
226
b9c735a2 227struct sr_datafeed_header {
a1bb33af
UH
228 int feed_version;
229 struct timeval starttime;
ee7489d2
BV
230};
231
232struct sr_datafeed_meta_logic {
233 int num_probes;
4c100f32 234 uint64_t samplerate;
a1bb33af
UH
235};
236
38ab3ee7
BV
237struct sr_datafeed_logic {
238 uint64_t length;
239 uint16_t unitsize;
9c939c51 240 void *data;
38ab3ee7
BV
241};
242
ee7489d2
BV
243struct sr_datafeed_meta_analog {
244 int num_probes;
245};
246
247struct sr_datafeed_analog {
248 int num_samples;
3c0839d5 249 /** Measured quantity (e.g. voltage, current, temperature). */
02e864d0
BV
250 int mq;
251 /** Unit in which the MQ is measured. */
252 int unit;
253 /** Bitmap with extra information about the MQ. */
254 uint64_t mqflags;
3c0839d5 255 /** The analog value. */
ee7489d2
BV
256 float *data;
257};
258
f50f3f40
UH
259struct sr_input {
260 struct sr_input_format *format;
3dafb92b 261 GHashTable *param;
5c3c1241 262 struct sr_dev_inst *sdi;
3dafb92b 263 void *internal;
34e4813f
BV
264};
265
f50f3f40 266struct sr_input_format {
cdb3573c 267 char *id;
34e4813f 268 char *description;
757b8c62 269 int (*format_match) (const char *filename);
f50f3f40
UH
270 int (*init) (struct sr_input *in);
271 int (*loadfile) (struct sr_input *in, const char *filename);
34e4813f
BV
272};
273
f50f3f40
UH
274struct sr_output {
275 struct sr_output_format *format;
5c3c1241 276 struct sr_dev_inst *sdi;
a1bb33af
UH
277 char *param;
278 void *internal;
279};
280
f50f3f40 281struct sr_output_format {
cdb3573c 282 char *id;
a1bb33af 283 char *description;
f0411b1d 284 int df_type;
f50f3f40 285 int (*init) (struct sr_output *o);
054e6709
UH
286 int (*data) (struct sr_output *o, const uint8_t *data_in,
287 uint64_t length_in, uint8_t **data_out,
288 uint64_t *length_out);
289 int (*event) (struct sr_output *o, int event_type, uint8_t **data_out,
a1bb33af 290 uint64_t *length_out);
f45b7590
BV
291 GString *(*recv) (struct sr_output *o, const struct sr_dev_inst *sdi,
292 struct sr_datafeed_packet *packet);
293 int (*cleanup) (struct sr_output *o);
a1bb33af
UH
294};
295
c4911129 296struct sr_datastore {
3c0839d5 297 /** Size in bytes of the number of units stored in this datastore. */
a1bb33af 298 int ds_unitsize;
33247d6a 299 unsigned int num_units; /* TODO: uint64_t */
a1bb33af
UH
300 GSList *chunklist;
301};
302
a1bb33af
UH
303/*
304 * This represents a generic device connected to the system.
c09f0b57
UH
305 * For device-specific information, ask the driver. The driver_index refers
306 * to the device index within that driver; it may be handling more than one
307 * device. All relevant driver calls take a dev_index parameter for this.
a1bb33af 308 */
bb7ef793 309struct sr_dev {
3c0839d5 310 /** Which driver handles this device. */
c09f0b57 311 struct sr_dev_driver *driver;
3c0839d5 312 /** A driver may handle multiple devices of the same type. */
c09f0b57 313 int driver_index;
3c0839d5 314 /** List of struct sr_probe pointers. */
a1bb33af 315 GSList *probes;
3c0839d5 316 /** Data acquired by this device, if any. */
c4911129 317 struct sr_datastore *datastore;
a1bb33af
UH
318};
319
921e753f 320enum {
47211d65 321 SR_PROBE_LOGIC,
87ca93c5 322 SR_PROBE_ANALOG,
921e753f
DR
323};
324
1afe8989 325struct sr_probe {
a1bb33af 326 int index;
6ea7e235 327 int type;
a1bb33af
UH
328 gboolean enabled;
329 char *name;
330 char *trigger;
331};
332
b159add3
BV
333struct sr_hwopt {
334 int hwopt;
335 const void *value;
336};
337
3c0839d5 338/** Hardware driver options. */
b159add3 339enum {
3c0839d5
UH
340 /** Used to terminate lists. Must be 0! */
341 SR_HWOPT_DUMMY = 0,
8bfdc8c4 342
9c5332d2
UH
343 /**
344 * Some drivers cannot detect the exact model they're talking to
345 * (may be phased out).
346 */
b159add3
BV
347 SR_HWOPT_MODEL,
348
9c5332d2
UH
349 /**
350 * Specification on how to connect to a device. In combination
777bbd5b 351 * with SR_HWOPT_SERIALCOMM, this is a serial port in the form
9c5332d2 352 * which makes sense to the operating system (e.g., /dev/ttyS0).
777bbd5b 353 * Otherwise this specifies a USB device, either in the form of
9c5332d2
UH
354 * [bus].[address] (decimal, e.g. 1.65) or [vendorid].[productid]
355 * (hexadecimal, e.g. 1d6b.0001).
356 */
b159add3
BV
357 SR_HWOPT_CONN,
358
9c5332d2
UH
359 /**
360 * Serial communication specification, in the form:
3c0839d5 361 * [baudrate]/[databits][parity][stopbits], e.g. 9600/8n1
9c5332d2 362 *
777bbd5b 363 * This is always an optional parameter, since a driver typically
9c5332d2
UH
364 * knows the speed at which the device wants to communicate.
365 */
b159add3
BV
366 SR_HWOPT_SERIALCOMM,
367};
368
3c0839d5 369/** Hardware device capabilities. */
a1bb33af 370enum {
3c0839d5
UH
371 /** Used to terminate lists. Must be 0! */
372 SR_HWCAP_DUMMY = 0,
e88dadd7
UH
373
374 /*--- Device classes ------------------------------------------------*/
375
376 /** The device can act as logic analyzer. */
5a2326a7 377 SR_HWCAP_LOGIC_ANALYZER,
925dbf9f 378
ee7489d2
BV
379 /** The device can act as an oscilloscope. */
380 SR_HWCAP_OSCILLOSCOPE,
e88dadd7 381
ca3d84cc
BV
382 /** The device can act as a multimeter. */
383 SR_HWCAP_MULTIMETER,
a141db8c 384
ca3d84cc 385 /** The device is a demo device. */
bb7ef793 386 SR_HWCAP_DEMO_DEV,
a141db8c 387
ca3d84cc 388
ca3d84cc 389 /*--- Device configuration ------------------------------------------*/
e88dadd7
UH
390
391 /** The device supports setting/changing its samplerate. */
392 SR_HWCAP_SAMPLERATE,
393
e88dadd7
UH
394 /** The device supports setting a pre/post-trigger capture ratio. */
395 SR_HWCAP_CAPTURE_RATIO,
396
397 /* TODO? */
398 /** The device supports setting a pattern (pattern generator mode). */
399 SR_HWCAP_PATTERN_MODE,
400
3a4d09c0
GM
401 /** The device supports Run Length Encoding. */
402 SR_HWCAP_RLE,
403
ee7489d2 404 /** The device supports setting trigger slope. */
0fe11789
BV
405 SR_HWCAP_TRIGGER_SLOPE,
406
407 /** Trigger source. */
408 SR_HWCAP_TRIGGER_SOURCE,
409
3c0839d5 410 /** Horizontal trigger position. */
0fe11789
BV
411 SR_HWCAP_HORIZ_TRIGGERPOS,
412
413 /** Buffer size. */
414 SR_HWCAP_BUFFERSIZE,
415
416 /** Time base. */
417 SR_HWCAP_TIMEBASE,
ee7489d2 418
3c4976c9
BV
419 /** Filter. */
420 SR_HWCAP_FILTER,
421
bd8db307
BV
422 /** Volts/div. */
423 SR_HWCAP_VDIV,
424
e1c8b2ab
BV
425 /** Coupling. */
426 SR_HWCAP_COUPLING,
427
ca3d84cc 428
e88dadd7
UH
429 /*--- Special stuff -------------------------------------------------*/
430
3c0839d5 431 /** Session filename. */
40dda2c3
BV
432 SR_HWCAP_SESSIONFILE,
433
e88dadd7
UH
434 /* TODO: Better description. */
435 /** The device supports specifying a capturefile to inject. */
436 SR_HWCAP_CAPTUREFILE,
925dbf9f 437
e88dadd7
UH
438 /* TODO: Better description. */
439 /** The device supports specifying the capturefile unit size. */
440 SR_HWCAP_CAPTURE_UNITSIZE,
7d658874 441
e88dadd7
UH
442 /* TODO: Better description. */
443 /** The device supports setting the number of probes. */
444 SR_HWCAP_CAPTURE_NUM_PROBES,
445
ca3d84cc 446
e88dadd7
UH
447 /*--- Acquisition modes ---------------------------------------------*/
448
449 /**
450 * The device supports setting a sample time limit, i.e. how long the
451 * sample acquisition should run (in ms).
452 */
453 SR_HWCAP_LIMIT_MSEC,
454
455 /**
456 * The device supports setting a sample number limit, i.e. how many
457 * samples should be acquired.
458 */
459 SR_HWCAP_LIMIT_SAMPLES,
460
6ea7669c
BV
461 /**
462 * The device supports setting a frame limit, i.e. how many
463 * frames should be acquired.
464 */
465 SR_HWCAP_LIMIT_FRAMES,
466
e88dadd7
UH
467 /**
468 * The device supports continuous sampling, i.e. neither a time limit
469 * nor a sample number limit has to be supplied, it will just acquire
470 * samples continuously, until explicitly stopped by a certain command.
471 */
5a2326a7 472 SR_HWCAP_CONTINUOUS,
e88dadd7 473
a1bb33af
UH
474};
475
a65de030 476struct sr_hwcap_option {
ffedd0bf 477 int hwcap;
a1bb33af
UH
478 int type;
479 char *description;
480 char *shortname;
481};
482
d68e2d1a 483struct sr_dev_inst {
9e41fdba 484 struct sr_dev_driver *driver;
a1bb33af
UH
485 int index;
486 int status;
1d9a8a5f 487 int inst_type;
a1bb33af
UH
488 char *vendor;
489 char *model;
490 char *version;
47211d65 491 GSList *probes;
8d672550 492 void *priv;
a1bb33af
UH
493};
494
3c0839d5 495/** Types of device instances (sr_dev_inst). */
a1bb33af 496enum {
4101f961
UH
497 /** Device instance type for USB devices. */
498 SR_INST_USB,
499 /** Device instance type for serial port devices. */
500 SR_INST_SERIAL,
a1bb33af
UH
501};
502
3c0839d5 503/** Device instance status. */
a1bb33af 504enum {
3c0839d5 505 /** The device instance was not found. */
5a2326a7 506 SR_ST_NOT_FOUND,
3c0839d5 507 /** The device instance was found, but is still booting. */
5a2326a7 508 SR_ST_INITIALIZING,
3c0839d5 509 /** The device instance is live, but not in use. */
5a2326a7 510 SR_ST_INACTIVE,
3c0839d5 511 /** The device instance is actively in use in a session. */
5a2326a7 512 SR_ST_ACTIVE,
a1bb33af
UH
513};
514
515/*
516 * TODO: This sucks, you just kinda have to "know" the returned type.
517 * TODO: Need a DI to return the number of trigger stages supported.
518 */
519
3c0839d5 520/** Device info IDs. */
a1bb33af 521enum {
3c0839d5 522 /** A list of options supported by the driver. */
be34a1c7 523 SR_DI_HWOPTS,
3c0839d5 524 /** A list of capabilities supported by the device. */
be34a1c7 525 SR_DI_HWCAPS,
3c0839d5 526 /** The number of probes connected to this device. */
5a2326a7 527 SR_DI_NUM_PROBES,
3c0839d5 528 /** The probe names on this device. */
464d12c7 529 SR_DI_PROBE_NAMES,
3c0839d5 530 /** Samplerates supported by this device (struct sr_samplerates). */
5a2326a7 531 SR_DI_SAMPLERATES,
3c0839d5 532 /** Types of logic trigger supported, out of "01crf" (char *). */
5a2326a7 533 SR_DI_TRIGGER_TYPES,
3c0839d5 534 /** The currently set samplerate in Hz (uint64_t). */
5a2326a7 535 SR_DI_CUR_SAMPLERATE,
3c0839d5 536 /** Supported patterns (in pattern generator mode). */
eb0a3731 537 SR_DI_PATTERNS,
3c0839d5 538 /** Supported buffer sizes. */
0fe11789 539 SR_DI_BUFFERSIZES,
3c0839d5 540 /** Supported time bases. */
0fe11789 541 SR_DI_TIMEBASES,
3c0839d5 542 /** Supported trigger sources. */
0fe11789 543 SR_DI_TRIGGER_SOURCES,
3c0839d5 544 /** Supported filter targets. */
3c4976c9 545 SR_DI_FILTERS,
3c0839d5 546 /** Valid volts/div values. */
bd8db307 547 SR_DI_VDIVS,
3c0839d5 548 /** Coupling options. */
e1c8b2ab 549 SR_DI_COUPLING,
a1bb33af
UH
550};
551
1b452b85
UH
552/*
553 * A device supports either a range of samplerates with steps of a given
554 * granularity, or is limited to a set of defined samplerates. Use either
a1bb33af
UH
555 * step or list, but not both.
556 */
60679b18 557struct sr_samplerates {
a1bb33af
UH
558 uint64_t low;
559 uint64_t high;
560 uint64_t step;
a533743d 561 const uint64_t *list;
a1bb33af
UH
562};
563
c09f0b57
UH
564struct sr_dev_driver {
565 /* Driver-specific */
a1bb33af 566 char *name;
9f8274a5 567 char *longname;
a1bb33af 568 int api_version;
40dda2c3 569 int (*init) (void);
57ab7d9f 570 int (*cleanup) (void);
80bf0426 571 GSList *(*scan) (GSList *options);
811deee4
BV
572 GSList *(*dev_list) (void);
573 int (*dev_clear) (void);
a1bb33af 574
1b452b85 575 /* Device-specific */
25a0f108
BV
576 int (*dev_open) (struct sr_dev_inst *sdi);
577 int (*dev_close) (struct sr_dev_inst *sdi);
9e90dcba 578 int (*info_get) (int info_id, const void **data,
f92f4eab 579 const struct sr_dev_inst *sdi);
6f4b1868
BV
580 int (*dev_config_set) (const struct sr_dev_inst *sdi, int hwcap,
581 const void *value);
3ffb6964
BV
582 int (*dev_acquisition_start) (const struct sr_dev_inst *sdi,
583 void *cb_data);
584 int (*dev_acquisition_stop) (const struct sr_dev_inst *sdi,
585 void *cb_data);
dd34b8d3
BV
586
587 /* Dynamic */
c259726a 588 void *priv;
a1bb33af
UH
589};
590
2872d21e 591struct sr_session {
3c0839d5 592 /** List of struct sr_dev pointers. */
bb7ef793 593 GSList *devs;
3c0839d5 594 /** List of sr_receive_data_callback_t items. */
a1bb33af
UH
595 GSList *datafeed_callbacks;
596 GTimeVal starttime;
b7e94111
LPC
597
598 unsigned int num_sources;
599
3c0839d5
UH
600 /*
601 * Both "sources" and "pollfds" are of the same size and contain pairs
602 * of descriptor and callback function. We can not embed the GPollFD
603 * into the source struct since we want to be able to pass the array
604 * of all poll descriptors to g_poll().
b7e94111
LPC
605 */
606 struct source *sources;
607 GPollFD *pollfds;
608 int source_timeout;
a1bb33af
UH
609};
610
45c59c8b
BV
611#include "proto.h"
612#include "version.h"
c2bd92ec 613
a00b530c
UH
614#ifdef __cplusplus
615}
616#endif
617
a1bb33af 618#endif