#ifndef LIBSIGROK_HARDWARE_SIGLENT_SDS_PROTOCOL_H
#define LIBSIGROK_HARDWARE_SIGLENT_SDS_PROTOCOL_H
-#include <stdbool.h>
#include <stdint.h>
#include <glib.h>
#include <libsigrok/libsigrok.h>
//#define ACQ_BUFFER_SIZE (6000000)
#define ACQ_BUFFER_SIZE (18000000)
+#define SIGLENT_HEADER_SIZE 363
+#define SIGLENT_DIG_HEADER_SIZE 346
+
/* Maximum number of samples to retrieve at once. */
#define ACQ_BLOCK_SIZE (30 * 1000)
#define MAX_ANALOG_CHANNELS 4
#define MAX_DIGITAL_CHANNELS 16
-#define DEVICE_STATE_STOPPED 0 /* Scope is in stopped state */
-#define DEVICE_STATE_DATA_ACQ 1 /* A new signal has been acquired */
-#define DEVICE_STATE_TRIG_RDY 8192 /* Trigger is ready */
+#define DEVICE_STATE_STOPPED 0 /* Scope is in stopped state bit */
+#define DEVICE_STATE_DATA_ACQ 1 /* A new signal has been acquired bit */
+#define DEVICE_STATE_TRIG_RDY 8192 /* Trigger is ready bit */
+#define DEVICE_STATE_DATA_TRIG_RDY 8193 /* Trigger is ready bit */
enum protocol_version {
SPO_MODEL,
NON_SPO_MODEL,
-};
-
-enum data_format {
- FORMAT_IEEE488_2,
+ ESERIES,
};
enum data_source {
struct siglent_sds_vendor {
const char *name;
const char *full_name;
- const char *usb_name;
};
struct siglent_sds_series {
const char *name;
uint64_t min_timebase[2];
unsigned int analog_channels;
- bool has_digital;
+ gboolean has_digital;
unsigned int digital_channels;
};
WAIT_STOP, /* Wait for scope stopping (only single shots) */
};
-/** Private, per-device-instance driver context. */
struct dev_context {
/* Device model */
const struct siglent_sds_model *model;
/* Acquisition settings */
GSList *enabled_channels;
uint64_t limit_frames;
+ uint64_t average_samples;
+ gboolean average_enabled;
enum data_source data_source;
uint64_t analog_frame_size;
uint64_t digital_frame_size;
uint64_t num_samples;
- long blockHeaderSize;
- float sampleRate;
+ uint64_t memory_depth_analog;
+ uint64_t memory_depth_digital;
+ long block_header_size;
+ float samplerate;
/* Device settings */
gboolean analog_channels[MAX_ANALOG_CHANNELS];
GSList *channel_entry;
/* Number of bytes received for current channel. */
uint64_t num_channel_bytes;
- /* Number of bytes of block header read */
+ /* Number of bytes of block header read. */
uint64_t num_header_bytes;
- /* Number of bytes in current data block, if 0 block header expected */
+ /* Number of data blocks bytes already read. */
uint64_t num_block_bytes;
- /* Number of data block bytes already read */
- uint64_t num_block_read;
- /* What to wait for in *_receive */
+ /* Number of data blocks read. */
+ int num_block_read;
+ /* What to wait for in *_receive. */
enum wait_events wait_event;
- /* Trigger/block copying/stop waiting status */
+ /* Trigger/block copying/stop waiting status. */
int wait_status;
- /* Acq buffers used for reading from the scope and sending data to app */
+ /* Acq buffers used for reading from the scope and sending data to app. */
unsigned char *buffer;
float *data;
+ GArray *dig_buffer;
};
SR_PRIV int siglent_sds_config_set(const struct sr_dev_inst *sdi,