]> sigrok.org Git - libsigrok.git/blobdiff - hardware/rigol-ds/protocol.h
rigol-ds: On DS1000 with firmware < 0.2.4, use legacy protocol.
[libsigrok.git] / hardware / rigol-ds / protocol.h
index d1c67fd8af2754e5edb7752c5f386de20abc54c1..9c4c7f80e25443236cf7a828f11d2156f4237e5b 100644 (file)
 
 #define LOG_PREFIX "rigol-ds"
 
+/* Analog waveform block sizes */
 #define DS1000_ANALOG_LIVE_WAVEFORM_SIZE 600
 #define DS2000_ANALOG_LIVE_WAVEFORM_SIZE 1400
 #define VS5000_ANALOG_LIVE_WAVEFORM_SIZE 2048
-/* Needs to be made configurable later */
+#define DSO1000_ANALOG_LIVE_WAVEFORM_SIZE 600
 #define DS2000_ANALOG_MEM_WAVEFORM_SIZE_1C 14000
 #define DS2000_ANALOG_MEM_WAVEFORM_SIZE_2C 7000
-#define DIGITAL_WAVEFORM_SIZE 1210
+
+/* Digital waveform block size */
+#define DS1000_DIGITAL_WAVEFORM_SIZE 1200
+#define VS5000_DIGITAL_WAVEFORM_SIZE 4096
+
 /* Size of acquisition buffers */
 #define ACQ_BUFFER_SIZE 32768
 
+#define MAX_ANALOG_PROBES 4
+#define MAX_DIGITAL_PROBES 16
+
 enum rigol_ds_series {
+       RIGOL_VS5000,
        RIGOL_DS1000,
        RIGOL_DS1000Z,
        RIGOL_DS2000,
        RIGOL_DS4000,
        RIGOL_DS6000,
-       RIGOL_VS5000,
+       AGILENT_DSO1000,
 };
 
 enum rigol_protocol_flavor {
@@ -61,12 +70,14 @@ enum data_source {
 };
 
 struct rigol_ds_model {
+       char *vendor;
        char *name;
        enum rigol_ds_series series;
        enum rigol_protocol_flavor protocol;
        uint64_t min_timebase[2];
        uint64_t max_timebase[2];
        uint64_t min_vdiv[2];
+       unsigned int analog_channels;
        bool has_digital;
        int num_horizontal_divs;
 };
@@ -82,6 +93,7 @@ enum wait_events {
 struct dev_context {
        /* Device model */
        const struct rigol_ds_model *model;
+       enum rigol_protocol_flavor protocol;
 
        /* Device properties */
        const uint64_t (*timebases)[2];
@@ -90,7 +102,7 @@ struct dev_context {
        uint64_t num_vdivs;
 
        /* Probe groups */
-       struct sr_probe_group analog_groups[2];
+       struct sr_probe_group analog_groups[MAX_ANALOG_PROBES];
        struct sr_probe_group digital_group;
 
        /* Acquisition settings */
@@ -100,24 +112,29 @@ struct dev_context {
        void *cb_data;
        enum data_source data_source;
        uint64_t analog_frame_size;
+       uint64_t digital_frame_size;
 
        /* Device settings */
-       gboolean analog_channels[2];
-       gboolean digital_channels[16];
+       gboolean analog_channels[MAX_ANALOG_PROBES];
+       gboolean digital_channels[MAX_DIGITAL_PROBES];
+       gboolean la_enabled;
        float timebase;
-       float vdiv[2];
-       int vert_reference[2];
-       float vert_offset[2];
+       float vdiv[MAX_ANALOG_PROBES];
+       int vert_reference[MAX_ANALOG_PROBES];
+       float vert_offset[MAX_ANALOG_PROBES];
        char *trigger_source;
        float horiz_triggerpos;
        char *trigger_slope;
-       char *coupling[2];
+       char *coupling[MAX_ANALOG_PROBES];
 
        /* Operational state */
+
+       /* Number of frames received in total. */
        uint64_t num_frames;
-       /* FIXME: misnomer, actually this is number of frame samples? */
-       uint64_t num_frame_bytes;
-       struct sr_probe *channel_frame;
+       /* GSList entry for the current channel. */
+       GSList *channel_entry;
+       /* Number of bytes received for current channel. */
+       uint64_t num_channel_bytes;
        /* Number of bytes in current data block, if 0 block header expected */
        uint64_t num_block_bytes;
        /* Number of data block bytes already read */
@@ -132,6 +149,7 @@ struct dev_context {
 };
 
 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);