2 * This file is part of the libsigrok project.
4 * Copyright (C) 2013 poljar (Damir Jelić) <poljarinho@gmail.com>
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.
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.
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/>.
20 #ifndef LIBSIGROK_HARDWARE_LECROY_XSTREAM_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_LECROY_XSTREAM_PROTOCOL_H
26 #include <libsigrok/libsigrok.h>
27 #include "libsigrok-internal.h"
29 #define LOG_PREFIX "lecroy-xstream"
31 #define MAX_INSTRUMENT_VERSIONS 10
32 #define MAX_COMMAND_SIZE 48
33 #define MAX_ANALOG_CHANNEL_COUNT 4
36 const char *name[MAX_INSTRUMENT_VERSIONS];
37 const uint8_t analog_channels;
39 const char *(*analog_names)[];
41 const uint32_t (*devopts)[];
42 const uint8_t num_devopts;
44 const uint32_t (*analog_devopts)[];
45 const uint8_t num_analog_devopts;
47 const char *(*coupling_options)[];
48 const uint8_t num_coupling_options;
50 const char *(*trigger_sources)[];
51 const uint8_t num_trigger_sources;
53 const char *(*trigger_slopes)[];
55 const struct sr_rational *timebases;
56 const uint8_t num_timebases;
58 const struct sr_rational *vdivs;
59 const uint8_t num_vdivs;
61 const uint8_t num_xdivs;
62 const uint8_t num_ydivs;
65 struct analog_channel_state {
69 float vertical_offset;
75 struct analog_channel_state *analog_channels;
78 float horiz_triggerpos;
85 /** Private, per-device-instance driver context. */
87 const void *model_config;
90 struct sr_channel_group **analog_groups;
92 GSList *enabled_channels;
93 GSList *current_channel;
99 SR_PRIV int lecroy_xstream_init_device(struct sr_dev_inst *sdi);
100 SR_PRIV int lecroy_xstream_request_data(const struct sr_dev_inst *sdi);
101 SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data);
103 SR_PRIV void lecroy_xstream_state_free(struct scope_state *state);
104 SR_PRIV int lecroy_xstream_state_get(struct sr_dev_inst *sdi);
105 SR_PRIV int lecroy_xstream_update_sample_rate(const struct sr_dev_inst *sdi);