X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flecroy-xstream%2Fprotocol.h;h=fa68f71f311fdf19a9547df635db2ab08fbbe1e8;hb=e7d2cd1e0558594f590f1a4d531c87dd4922c6d9;hp=4fe4400bbf07b43d468798afd99e7e34b50ff073;hpb=e3b83c5ec3bff62c7b6e13954f2a654139874aa5;p=libsigrok.git diff --git a/src/hardware/lecroy-xstream/protocol.h b/src/hardware/lecroy-xstream/protocol.h index 4fe4400b..fa68f71f 100644 --- a/src/hardware/lecroy-xstream/protocol.h +++ b/src/hardware/lecroy-xstream/protocol.h @@ -1,7 +1,7 @@ /* * This file is part of the libsigrok project. * - * Copyright (C) 2017 Sven Schnelle + * Copyright (C) 2013 poljar (Damir Jelić) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,25 +20,82 @@ #ifndef LIBSIGROK_HARDWARE_LECROY_XSTREAM_PROTOCOL_H #define LIBSIGROK_HARDWARE_LECROY_XSTREAM_PROTOCOL_H -#include #include +#include +#include #include #include "libsigrok-internal.h" #define LOG_PREFIX "lecroy-xstream" -/** Private, per-device-instance driver context. */ -struct dev_context { - /* Model-specific information */ +#define MAX_INSTRUMENT_VERSIONS 10 +#define MAX_COMMAND_SIZE 48 +#define MAX_ANALOG_CHANNEL_COUNT 4 + +struct scope_config { + const char *name[MAX_INSTRUMENT_VERSIONS]; + const uint8_t analog_channels; + + const char *(*analog_names)[]; + + const char *(*coupling_options)[]; + const uint8_t num_coupling_options; + + const char *(*trigger_sources)[]; + const uint8_t num_trigger_sources; + + const char *(*trigger_slopes)[]; + const uint8_t num_trigger_slopes; + + const uint64_t (*timebases)[][2]; + const uint8_t num_timebases; + + const uint64_t (*vdivs)[][2]; + const uint8_t num_vdivs; + + const uint8_t num_xdivs; + const uint8_t num_ydivs; +}; + +struct analog_channel_state { + int coupling; + + int vdiv; + float vertical_offset; - /* Acquisition settings */ + gboolean state; +}; - /* Operational state */ +struct scope_state { + struct analog_channel_state *analog_channels; - /* Temporary state across callbacks */ + int timebase; + float horiz_triggerpos; + int trigger_source; + int trigger_slope; + uint64_t sample_rate; }; +struct dev_context { + const void *model_config; + void *model_state; + + struct sr_channel_group **analog_groups; + + GSList *enabled_channels; + GSList *current_channel; + uint64_t num_frames; + + uint64_t frame_limit; +}; + +SR_PRIV int lecroy_xstream_init_device(struct sr_dev_inst *sdi); +SR_PRIV int lecroy_xstream_request_data(const struct sr_dev_inst *sdi); SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data); +SR_PRIV void lecroy_xstream_state_free(struct scope_state *state); +SR_PRIV int lecroy_xstream_state_get(struct sr_dev_inst *sdi); +SR_PRIV int lecroy_xstream_update_sample_rate(const struct sr_dev_inst *sdi); + #endif