]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/rigol-ds/protocol.h
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / src / hardware / rigol-ds / protocol.h
index 6298185656663ec12f981ba08376b1a40cc03312..e2efffa227bd0c9f254b0505fd739f6543551354 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
-#include "libsigrok.h"
+#include <libsigrok/libsigrok.h>
 #include "libsigrok-internal.h"
 
 #define LOG_PREFIX "rigol-ds"
@@ -42,6 +42,7 @@ enum protocol_version {
        PROTOCOL_V2, /* DS1000 */
        PROTOCOL_V3, /* DS2000, DSO1000 */
        PROTOCOL_V4, /* DS1000Z */
+       PROTOCOL_V5, /* MSO5000 */
 };
 
 enum data_format {
@@ -74,12 +75,25 @@ struct rigol_ds_series {
        int buffer_samples;
 };
 
+enum cmds {
+       CMD_GET_HORIZ_TRIGGERPOS,
+       CMD_SET_HORIZ_TRIGGERPOS,
+};
+
+struct rigol_ds_command {
+       int cmd;
+       const char *str;
+};
+
 struct rigol_ds_model {
        const struct rigol_ds_series *series;
        const char *name;
        uint64_t min_timebase[2];
        unsigned int analog_channels;
        bool has_digital;
+       const char **trigger_sources;
+       unsigned int num_trigger_sources;
+       const struct rigol_ds_command *cmds;
 };
 
 enum wait_events {
@@ -89,9 +103,7 @@ enum wait_events {
        WAIT_STOP,    /* Wait for scope stopping (only single shots) */
 };
 
-/** Private, per-device-instance driver context. */
 struct dev_context {
-       /* Device model */
        const struct rigol_ds_model *model;
        enum data_format format;
 
@@ -108,7 +120,6 @@ struct dev_context {
        /* Acquisition settings */
        GSList *enabled_channels;
        uint64_t limit_frames;
-       void *cb_data;
        enum data_source data_source;
        uint64_t analog_frame_size;
        uint64_t digital_frame_size;
@@ -118,18 +129,23 @@ struct dev_context {
        gboolean digital_channels[MAX_DIGITAL_CHANNELS];
        gboolean la_enabled;
        float timebase;
+       float sample_rate;
+       float attenuation[MAX_ANALOG_CHANNELS];
        float vdiv[MAX_ANALOG_CHANNELS];
        int vert_reference[MAX_ANALOG_CHANNELS];
+       float vert_origin[MAX_ANALOG_CHANNELS];
        float vert_offset[MAX_ANALOG_CHANNELS];
+       float vert_inc[MAX_ANALOG_CHANNELS];
        char *trigger_source;
        float horiz_triggerpos;
        char *trigger_slope;
+       float trigger_level;
        char *coupling[MAX_ANALOG_CHANNELS];
 
-       /* Operational state */
-
        /* Number of frames received in total. */
        uint64_t num_frames;
+       /* Number of frames available from the Segmented data source */
+       uint64_t num_frames_segmented;
        /* GSList entry for the current channel. */
        GSList *channel_entry;
        /* Number of bytes received for current channel. */
@@ -154,5 +170,6 @@ SR_PRIV int rigol_ds_capture_start(const struct sr_dev_inst *sdi);
 SR_PRIV int rigol_ds_channel_start(const struct sr_dev_inst *sdi);
 SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data);
 SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi);
+SR_PRIV int rigol_ds_get_dev_cfg_vertical(const struct sr_dev_inst *sdi);
 
 #endif