#define AGILENT "Agilent Technologies"
static const struct rigol_ds_model supported_models[] = {
- {RIGOL, "DS1052E", RIGOL_DS1000, PROTOCOL_LEGACY, {5, 1000000000}, {50, 1}, {2, 1000}, 2, false, 12},
- {RIGOL, "DS1102E", RIGOL_DS1000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, 2, false, 12},
- {RIGOL, "DS1152E", RIGOL_DS1000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, 2, false, 12},
- {RIGOL, "DS1052D", RIGOL_DS1000, PROTOCOL_LEGACY, {5, 1000000000}, {50, 1}, {2, 1000}, 2, true, 12},
- {RIGOL, "DS1102D", RIGOL_DS1000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, 2, true, 12},
- {RIGOL, "DS1152D", RIGOL_DS1000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, 2, true, 12},
+ {RIGOL, "DS1052E", RIGOL_DS1000, PROTOCOL_IEEE488_2, {5, 1000000000}, {50, 1}, {2, 1000}, 2, false, 12},
+ {RIGOL, "DS1102E", RIGOL_DS1000, PROTOCOL_IEEE488_2, {2, 1000000000}, {50, 1}, {2, 1000}, 2, false, 12},
+ {RIGOL, "DS1152E", RIGOL_DS1000, PROTOCOL_IEEE488_2, {2, 1000000000}, {50, 1}, {2, 1000}, 2, false, 12},
+ {RIGOL, "DS1052D", RIGOL_DS1000, PROTOCOL_IEEE488_2, {5, 1000000000}, {50, 1}, {2, 1000}, 2, true, 12},
+ {RIGOL, "DS1102D", RIGOL_DS1000, PROTOCOL_IEEE488_2, {2, 1000000000}, {50, 1}, {2, 1000}, 2, true, 12},
+ {RIGOL, "DS1152D", RIGOL_DS1000, PROTOCOL_IEEE488_2, {2, 1000000000}, {50, 1}, {2, 1000}, 2, true, 12},
{RIGOL, "DS2072", RIGOL_DS2000, PROTOCOL_IEEE488_2, {5, 1000000000}, {500, 1}, {500, 1000000}, 2, false, 14},
{RIGOL, "DS2102", RIGOL_DS2000, PROTOCOL_IEEE488_2, {5, 1000000000}, {500, 1}, {500, 1000000}, 2, false, 14},
{RIGOL, "DS2202", RIGOL_DS2000, PROTOCOL_IEEE488_2, {2, 1000000000}, {500, 1}, {500, 1000000}, 2, false, 14},
int analog_probes = 0;
GSList *l;
- if (devc->model->protocol == PROTOCOL_LEGACY) {
- if (devc->model->series == RIGOL_VS5000)
- return VS5000_ANALOG_LIVE_WAVEFORM_SIZE;
- else
- return DS1000_ANALOG_LIVE_WAVEFORM_SIZE;
- } else {
+ switch (devc->model->series) {
+ case RIGOL_VS5000:
+ return VS5000_ANALOG_LIVE_WAVEFORM_SIZE;
+ case RIGOL_DS1000:
+ return DS1000_ANALOG_LIVE_WAVEFORM_SIZE;
+ default:
for (l = sdi->probes; l; l = l->next) {
probe = l->data;
if (probe->type == SR_PROBE_ANALOG && probe->enabled)
devc->data_source = DATA_SOURCE_LIVE;
else if (!strcmp(tmp_str, "Memory"))
devc->data_source = DATA_SOURCE_MEMORY;
- else if (devc->model->protocol == PROTOCOL_IEEE488_2
+ else if (devc->model->series >= RIGOL_DS1000Z
&& !strcmp(tmp_str, "Segmented"))
devc->data_source = DATA_SOURCE_SEGMENTED;
else
devc->analog_frame_size = analog_frame_size(sdi);
devc->digital_frame_size = digital_frame_size(sdi);
- if (devc->model->protocol == PROTOCOL_LEGACY) {
+ if (devc->model->series < RIGOL_DS1000Z) {
/* Fetch the first frame. */
if (rigol_ds_channel_start(sdi) != SR_OK)
return SR_ERR;
sr_dbg("Starting reading data from channel %d", probe->index + 1);
- if (devc->model->protocol == PROTOCOL_LEGACY) {
+ if (devc->model->series < RIGOL_DS1000Z) {
if (probe->type == SR_PROBE_LOGIC) {
if (sr_scpi_send(sdi->conn, ":WAV:DATA? DIG") != SR_OK)
return SR_ERR;
scpi = sdi->conn;
if (revents == G_IO_IN || revents == 0) {
- if (devc->model->protocol == PROTOCOL_IEEE488_2) {
- switch (devc->wait_event) {
+ if (devc->model->series >= RIGOL_DS1000Z) {
+ switch(devc->wait_event) {
case WAIT_NONE:
break;
case WAIT_TRIGGER:
probe = devc->channel_entry->data;
if (devc->num_block_bytes == 0 &&
- devc->model->protocol == PROTOCOL_IEEE488_2) {
+ devc->model->series >= RIGOL_DS1000Z) {
if (sr_scpi_send(sdi->conn, ":WAV:DATA?") != SR_OK)
return TRUE;
}
vref = devc->vert_reference[probe->index];
vdiv = devc->vdiv[probe->index] / 25.6;
offset = devc->vert_offset[probe->index];
- if (devc->model->protocol == PROTOCOL_IEEE488_2)
+ if (devc->model->series >= RIGOL_DS1000Z)
for (i = 0; i < len; i++)
devc->data[i] = ((int)devc->buffer[i] - vref) * vdiv - offset;
else
sr_session_send(cb_data, &packet);
g_slist_free(analog.probes);
} else {
- logic.length = len - 10;
+ logic.length = len;
logic.unitsize = 2;
- logic.data = devc->buffer + 10;
+ logic.data = devc->buffer;
packet.type = SR_DF_LOGIC;
packet.payload = &logic;
sr_session_send(cb_data, &packet);
if (devc->num_block_read == devc->num_block_bytes) {
sr_dbg("Block has been completed");
- if (devc->model->protocol == PROTOCOL_IEEE488_2) {
- /* Discard the terminating linefeed and prepare for
- possible next block */
+ if (devc->model->series >= RIGOL_DS1000Z) {
+ /* Discard the terminating linefeed */
sr_scpi_read_data(scpi, (char *)devc->buffer, 1);
+ }
+ if (devc->model->protocol == PROTOCOL_IEEE488_2) {
+ /* Prepare for possible next block */
devc->num_block_bytes = 0;
if (devc->data_source != DATA_SOURCE_LIVE)
rigol_ds_set_wait_event(devc, WAIT_BLOCK);
sr_dbg("Frame completed, %d samples", devc->num_frame_samples);
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
- if (devc->model->protocol == PROTOCOL_IEEE488_2) {
+ if (devc->model->series >= RIGOL_DS1000Z) {
/* Signal end of data download to scope */
if (devc->data_source != DATA_SOURCE_LIVE)
/*
else
devc->channel_entry = devc->enabled_digital_probes;
- if (devc->model->protocol == PROTOCOL_LEGACY)
+ if (devc->model->series < RIGOL_DS1000Z)
rigol_ds_channel_start(sdi);
else
rigol_ds_capture_start(sdi);
g_free(response);
len = strlen(reply);
- if (devc->model->protocol == PROTOCOL_IEEE488_2) {
+ if (devc->model->series >= RIGOL_DS1000Z) {
/* get rid of trailing linefeed */
if (len >= 1 && reply[len-1] == '\n')
reply[len-1] = '\0';
sr_dbg("CH%d %g", i + 1, devc->vdiv[i]);
sr_dbg("Current vertical reference:");
- if (devc->model->protocol == PROTOCOL_IEEE488_2) {
+ if (devc->model->series >= RIGOL_DS1000Z) {
/* Vertical reference - not certain if this is the place to read it. */
for (i = 0; i < devc->model->analog_channels; i++) {
if (sr_scpi_send(sdi->conn, ":WAV:SOUR CHAN%d", i + 1) != SR_OK)