rigol-ds: Use rigol_ds_channel_start() function for legacy protocol too.
This commit is contained in:
parent
0d87bd93eb
commit
677f85d00b
|
@ -839,20 +839,14 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||||
std_session_send_df_header(cb_data, LOG_PREFIX);
|
std_session_send_df_header(cb_data, LOG_PREFIX);
|
||||||
|
|
||||||
if (devc->model->protocol == PROTOCOL_LEGACY) {
|
if (devc->model->protocol == PROTOCOL_LEGACY) {
|
||||||
|
devc->analog_frame_size = DS1000_ANALOG_LIVE_WAVEFORM_SIZE;
|
||||||
/* Fetch the first frame. */
|
/* Fetch the first frame. */
|
||||||
if (devc->enabled_analog_probes) {
|
if (devc->enabled_analog_probes)
|
||||||
devc->analog_frame_size = DS1000_ANALOG_LIVE_WAVEFORM_SIZE;
|
|
||||||
devc->channel = devc->enabled_analog_probes->data;
|
devc->channel = devc->enabled_analog_probes->data;
|
||||||
if (sr_scpi_send(sdi->conn, ":WAV:DATA? CHAN%d",
|
else
|
||||||
devc->channel->index + 1) != SR_OK)
|
|
||||||
return SR_ERR;
|
|
||||||
} else {
|
|
||||||
devc->channel = devc->enabled_digital_probes->data;
|
devc->channel = devc->enabled_digital_probes->data;
|
||||||
if (sr_scpi_send(sdi->conn, ":WAV:DATA? DIG") != SR_OK)
|
if (rigol_ds_channel_start(sdi) != SR_OK)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
|
||||||
|
|
||||||
devc->num_frame_samples = 0;
|
|
||||||
} else {
|
} else {
|
||||||
if (devc->enabled_analog_probes) {
|
if (devc->enabled_analog_probes) {
|
||||||
if (devc->data_source == DATA_SOURCE_MEMORY)
|
if (devc->data_source == DATA_SOURCE_MEMORY)
|
||||||
|
|
|
@ -327,17 +327,28 @@ SR_PRIV int rigol_ds_channel_start(const struct sr_dev_inst *sdi)
|
||||||
sr_dbg("Starting reading data from channel %d",
|
sr_dbg("Starting reading data from channel %d",
|
||||||
devc->channel->index + 1);
|
devc->channel->index + 1);
|
||||||
|
|
||||||
if (sr_scpi_send(sdi->conn, ":WAV:SOUR CHAN%d",
|
if (devc->model->protocol == PROTOCOL_LEGACY) {
|
||||||
devc->channel->index + 1) != SR_OK)
|
if (devc->channel->type == SR_DF_LOGIC) {
|
||||||
return SR_ERR;
|
if (sr_scpi_send(sdi->conn, ":WAV:DATA? DIG") != SR_OK)
|
||||||
if (devc->data_source != DATA_SOURCE_LIVE) {
|
return SR_ERR;
|
||||||
if (sr_scpi_send(sdi->conn, ":WAV:RES") != SR_OK)
|
} else {
|
||||||
|
if (sr_scpi_send(sdi->conn, ":WAV:DATA? CHAN%c",
|
||||||
|
devc->channel->name[2]) != SR_OK)
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (sr_scpi_send(sdi->conn, ":WAV:SOUR CHAN%d",
|
||||||
|
devc->channel->index + 1) != SR_OK)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
if (sr_scpi_send(sdi->conn, ":WAV:BEG") != SR_OK)
|
if (devc->data_source != DATA_SOURCE_LIVE) {
|
||||||
return SR_ERR;
|
if (sr_scpi_send(sdi->conn, ":WAV:RES") != SR_OK)
|
||||||
rigol_ds_set_wait_event(devc, WAIT_BLOCK);
|
return SR_ERR;
|
||||||
} else
|
if (sr_scpi_send(sdi->conn, ":WAV:BEG") != SR_OK)
|
||||||
rigol_ds_set_wait_event(devc, WAIT_NONE);
|
return SR_ERR;
|
||||||
|
rigol_ds_set_wait_event(devc, WAIT_BLOCK);
|
||||||
|
} else
|
||||||
|
rigol_ds_set_wait_event(devc, WAIT_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
devc->num_frame_samples = 0;
|
devc->num_frame_samples = 0;
|
||||||
devc->num_block_bytes = 0;
|
devc->num_block_bytes = 0;
|
||||||
|
@ -564,19 +575,14 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
||||||
/* We got the frame for the first analog channel, but
|
/* We got the frame for the first analog channel, but
|
||||||
* there's a second analog channel. */
|
* there's a second analog channel. */
|
||||||
devc->channel = devc->enabled_analog_probes->next->data;
|
devc->channel = devc->enabled_analog_probes->next->data;
|
||||||
if (devc->model->protocol == PROTOCOL_IEEE488_2) {
|
rigol_ds_channel_start(sdi);
|
||||||
rigol_ds_channel_start(sdi);
|
|
||||||
} else {
|
|
||||||
sr_scpi_send(sdi->conn, ":WAV:DATA? CHAN%c",
|
|
||||||
devc->channel->name[2]);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* Done with both analog channels in this frame. */
|
/* Done with both analog channels in this frame. */
|
||||||
if (devc->enabled_digital_probes
|
if (devc->enabled_digital_probes
|
||||||
&& devc->channel != devc->enabled_digital_probes->data) {
|
&& devc->channel != devc->enabled_digital_probes->data) {
|
||||||
/* Now we need to get the digital data. */
|
/* Now we need to get the digital data. */
|
||||||
devc->channel = devc->enabled_digital_probes->data;
|
devc->channel = devc->enabled_digital_probes->data;
|
||||||
sr_scpi_send(sdi->conn, ":WAV:DATA? DIG");
|
rigol_ds_channel_start(sdi);
|
||||||
} else if (++devc->num_frames == devc->limit_frames) {
|
} else if (++devc->num_frames == devc->limit_frames) {
|
||||||
/* End of last frame. */
|
/* End of last frame. */
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
|
@ -584,21 +590,15 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
|
||||||
sdi->driver->dev_acquisition_stop(sdi, cb_data);
|
sdi->driver->dev_acquisition_stop(sdi, cb_data);
|
||||||
} else {
|
} else {
|
||||||
/* Get the next frame, starting with the first analog channel. */
|
/* Get the next frame, starting with the first analog channel. */
|
||||||
if (devc->model->protocol == PROTOCOL_IEEE488_2) {
|
if (devc->enabled_analog_probes)
|
||||||
if (devc->enabled_analog_probes) {
|
devc->channel = devc->enabled_analog_probes->data;
|
||||||
devc->channel = devc->enabled_analog_probes->data;
|
else
|
||||||
rigol_ds_capture_start(sdi);
|
devc->channel = devc->enabled_digital_probes->data;
|
||||||
}
|
|
||||||
} else {
|
if (devc->model->protocol == PROTOCOL_LEGACY)
|
||||||
if (devc->enabled_analog_probes) {
|
rigol_ds_channel_start(sdi);
|
||||||
devc->channel = devc->enabled_analog_probes->data;
|
else
|
||||||
sr_scpi_send(sdi->conn, ":WAV:DATA? CHAN%c",
|
rigol_ds_capture_start(sdi);
|
||||||
devc->channel->name[2]);
|
|
||||||
} else {
|
|
||||||
devc->channel = devc->enabled_digital_probes->data;
|
|
||||||
sr_scpi_send(sdi->conn, ":WAV:DATA? DIG");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,7 @@ struct dev_context {
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV int rigol_ds_capture_start(const struct sr_dev_inst *sdi);
|
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_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(const struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue