]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Correct digital waveform block sizes.
authorMartin Ling <redacted>
Fri, 17 Jan 2014 02:56:01 +0000 (02:56 +0000)
committerMartin Ling <redacted>
Mon, 20 Jan 2014 00:24:14 +0000 (00:24 +0000)
hardware/rigol-ds/api.c
hardware/rigol-ds/protocol.c
hardware/rigol-ds/protocol.h

index 63c6e22549c9108de17910b8a2cfdbc13589d9f6..44847c715be75612d1bc97453ec02f48fd2ea459 100644 (file)
@@ -489,6 +489,20 @@ static int analog_frame_size(const struct sr_dev_inst *sdi)
        }
 }
 
+static int digital_frame_size(const struct sr_dev_inst *sdi)
+{
+       struct dev_context *devc = sdi->priv;
+
+       switch (devc->model->series) {
+       case RIGOL_VS5000:
+               return VS5000_DIGITAL_WAVEFORM_SIZE;
+       case RIGOL_DS1000:
+               return DS1000_DIGITAL_WAVEFORM_SIZE;
+       default:
+               return 0;
+       }
+}
+
 static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_probe_group *probe_group)
 {
@@ -875,6 +889,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                devc->channel_entry = devc->enabled_digital_probes;
 
        devc->analog_frame_size = analog_frame_size(sdi);
+       devc->digital_frame_size = digital_frame_size(sdi);
 
        if (devc->model->protocol == PROTOCOL_LEGACY) {
                /* Fetch the first frame. */
index 0dc36cf4d822fdab0c10ca370faafef8434bc187..9b2dd68d5cf80846ce4c9f92623249c2830090d4 100644 (file)
@@ -477,10 +477,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                                devc->num_block_bytes = len;
                        } else {
                                devc->num_block_bytes = probe->type == SR_PROBE_ANALOG ?
-                                       (devc->model->series == RIGOL_VS5000 ?
-                                               VS5000_ANALOG_LIVE_WAVEFORM_SIZE :
-                                               DS1000_ANALOG_LIVE_WAVEFORM_SIZE) :
-                                       DIGITAL_WAVEFORM_SIZE;
+                                       devc->analog_frame_size : devc->digital_frame_size;
                        }
                        devc->num_block_read = 0;
                }
@@ -553,7 +550,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                devc->num_frame_samples += len;
 
                if (devc->num_frame_samples < (probe->type == SR_PROBE_ANALOG ?
-                                       devc->analog_frame_size : DIGITAL_WAVEFORM_SIZE))
+                                       devc->analog_frame_size : devc->digital_frame_size))
                        /* Don't have the whole frame yet. */
                        return TRUE;
 
index e19ac490358d8151baa0d64c25c6e538bd6afa0e..f19bf75b0bdaf66e407a294fdcdf0498ce8dd9be 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
 #define DSO1000_ANALOG_LIVE_WAVEFORM_SIZE 600
-/* Needs to be made configurable later */
 #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
 
@@ -107,6 +111,7 @@ 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[MAX_ANALOG_PROBES];