}
if (sr_sw_limits_check(&devc->limits) || stop)
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
else
dispatch(sdi);
if (devc->data_source != DATA_SOURCE_MEMORY)
return;
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
static const uint8_t *appa_55ii_parse_data(struct sr_dev_inst *sdi,
}
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
handle_new_data(sdi);
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
std_session_send_df_end(sdi);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
g_free(dram_line);
{
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->acquisition_running = FALSE;
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
dev_acquisition_close(sdi);
sr_session_source_remove_channel(sdi->session, devc->channel);
g_io_channel_shutdown(devc->channel, FALSE, NULL);
sr_sw_limits_update_samples_read(&devc->limits, 1);
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
{
struct dev_context *devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
/* Execute a stop on BeagleLogic */
beaglelogic_stop(devc);
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
std_session_send_df_end(sdi);
sr_session_source_remove(sdi->session, -1);
return FALSE;
if (sr_sw_limits_check(&devc->sw_limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
}
if (sr_sw_limits_check(&devc->sw_limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
devc->num_samples++;
if (devc->limit_samples && devc->num_samples >= devc->limit_samples)
- sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
+ sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
break;
case TOKEN_RECORDING_ON:
devc->recording = TRUE;
devc->num_samples += analog.num_samples;
if (devc->limit_samples && devc->num_samples >= devc->limit_samples)
- sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
+ sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
return;
}
* records. Otherwise the frontend would have no
* way to tell where stored data ends and live
* measurements begin. */
- sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
+ sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
} else if (c == RECORD_DATA) {
devc->buf_len = 0;
devc->state = ST_GET_LOG_RECORD_DATA;
}
if (sr_sw_limits_check(&devc->sw_limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
SR_TRIGGER_FALLING,
};
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
-
static void clear_helper(void *priv)
{
struct dev_context *devc;
/* Get one block of data. */
if ((ret = cv_read_block(devc)) < 0) {
sr_err("Failed to read data block: %d.", ret);
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
for (i = 0; i < NUM_BLOCKS; i++)
cv_send_block_to_session_bus(sdi, i);
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- sr_dbg("Stopping acquisition.");
sr_session_source_remove(sdi->session, -1);
std_session_send_df_end(sdi);
sr_sw_limits_update_samples_read(&devc->limits, 1);
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
+ sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
}
SR_PRIV int colead_slm_receive_data(int fd, int revents, void *cb_data)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
+ (void)sdi;
return SR_OK;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- sr_dbg("Stopping acquisition.");
sr_session_source_remove(sdi->session, -1);
std_session_send_df_end(sdi);
if (devc->cur_samplerate <= 0
|| (devc->num_logic_channels <= 0
&& devc->num_analog_channels <= 0)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return G_SOURCE_CONTINUE;
}
}
}
sr_dbg("Requested number of samples reached.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
return G_SOURCE_CONTINUE;
}
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
- sr_dbg("Stopping acquisition.");
sr_session_source_remove(sdi->session, -1);
std_session_send_df_end(sdi);
if (bytes_read < 0) {
sr_err("Failed to read FTDI data (%d): %s.",
bytes_read, ftdi_get_error_string(devc->ftdic));
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
if (bytes_read == 0) {
if (devc->limit_samples && (n >= devc->limit_samples)) {
send_samples(sdi, devc->limit_samples - devc->samples_sent);
sr_info("Requested number of samples reached.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else {
send_samples(sdi, devc->bytes_received);
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
/* Request next data set, if required */
if (sdi->status == SR_ST_ACTIVE) {
scpi = sdi->conn;
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE) {
- sr_err("Device inactive, can't stop acquisition.");
- return SR_ERR;
- }
-
if (devc->df_started) {
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
data_size - devc->cur_rcv_buffer_position);
if (len < 0) {
sr_err("Read data error.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
devc->cur_rcv_buffer_position = 0;
return SR_ERR;
}
return SR_OK;
} else {
sr_err("Too many bytes read.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
devc->cur_rcv_buffer_position = 0;
return SR_ERR;
}
case START_ACQUISITION:
if (sr_scpi_send(scpi, ":TRIG:MOD 3") != SR_OK) {
sr_err("Failed to set trigger mode to SINGLE.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
if (sr_scpi_send(scpi, ":STOP") != SR_OK) {
sr_err("Failed to put the trigger system into STOP state.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
if (sr_scpi_send(scpi, ":RUN") != SR_OK) {
sr_err("Failed to put the trigger system into RUN state.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
if (((struct sr_channel *)g_slist_nth_data(sdi->channels, devc->cur_acq_channel))->enabled) {
if (sr_scpi_send(scpi, ":ACQ%d:MEM?", devc->cur_acq_channel+1) != SR_OK) {
sr_err("Failed to acquire memory.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
if (sr_scpi_read_begin(scpi) != SR_OK) {
sr_err("Could not begin reading SCPI response.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
devc->state = WAIT_FOR_TRANSFER_OF_BEGIN_TRANSMISSION_COMPLETE;
/* All frames accquired. */
sr_spew("All frames acquired.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else {
/* Start acquiring next frame. */
devc->rcv_buffer[0] != '6') {
sr_err("Data size digits is not 4, 5 or 6 but "
"'%c'.", devc->rcv_buffer[0]);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else {
devc->data_size_digits = devc->rcv_buffer[0] - '0';
devc->rcv_buffer[devc->data_size_digits] = 0;
if (sr_atoi(devc->rcv_buffer, &devc->data_size) != SR_OK) {
sr_err("Could not parse data size '%s'", devc->rcv_buffer);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else
devc->state = WAIT_FOR_TRANSFER_OF_SAMPLE_RATE_COMPLETE;
devc->cur_acq_channel + 1);
if (sr_scpi_get_string(scpi, command, &response) != SR_OK) {
sr_err("Failed to get volts per division.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
volts_per_division = g_ascii_strtod(response, &end_ptr);
if (devc->cur_acq_frame == devc->frame_limit - 1) {
/* All frames acquired. */
sr_spew("All frames acquired.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else {
/* Start acquiring next frame. */
std_session_send_df_end(sdi);
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->num_frames = 0;
* the first enabled channel.
*/
if (++devc->num_frames == devc->frame_limit) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
hmo_cleanup_logic_data(devc);
} else {
devc->current_channel = devc->enabled_channels;
static int read_channel(const struct sr_dev_inst *sdi, uint32_t amount);
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
-
static struct sr_dev_inst *hantek_6xxx_dev_new(const struct hantek_6xxx_profile *prof)
{
struct sr_dev_inst *sdi;
PRIu64 " <= %" PRIu64, devc->limit_samples,
devc->samp_received);
send_data(sdi, devc->sample_buf, devc->limit_samples);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else if (devc->limit_msec && (g_get_monotonic_time() -
devc->aq_started) / 1000 >= devc->limit_msec) {
sr_info("Requested time limit reached, stopping. %d <= %d",
send_data(sdi, devc->sample_buf, devc->samp_received);
g_free(devc->sample_buf);
devc->sample_buf = NULL;
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else {
read_channel(sdi, data_amount(sdi));
}
{
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR;
-
devc = sdi->priv;
devc->dev_state = STOPPING;
"GND",
};
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
-
static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
{
struct sr_dev_inst *sdi;
{
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR;
-
devc = sdi->priv;
devc->dev_state = STOPPING;
ret = sr_scpi_get_double(scpi, NULL, &devc->last_channel_sync);
if (ret != SR_OK) {
sr_err("Cannot check channel synchronization.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
devc->acq_state = ACQ_GOT_CHANNEL_SYNC;
sr_err("Expected channel %u, but device says %u",
chanc->index,
(unsigned int)devc->last_channel_sync);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
/* All is good. Back to business. */
}
if (devc->limit_samples && (devc->num_samples >= devc->limit_samples)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
return SR_OK;
}
-SR_PRIV int hung_chang_dso_2100_dev_acquisition_stop(const struct sr_dev_inst *sdi)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
std_session_send_df_end(sdi);
sr_session_source_remove(sdi->session, -1);
hung_chang_dso_2100_move_to(sdi, 1);
return SR_OK;
}
-static int dev_acquisition_stop(struct sr_dev_inst *sdi)
-{
- return hung_chang_dso_2100_dev_acquisition_stop(sdi);
-}
-
static struct sr_dev_driver hung_chang_dso_2100_driver_info = {
.name = "hung-chang-dso-2100",
.longname = "Hung-Chang DSO-2100",
SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data)
{
struct sr_datafeed_packet packet = { .type = SR_DF_FRAME_BEGIN };
- const struct sr_dev_inst *sdi;
+ struct sr_dev_inst *sdi;
struct dev_context *devc;
uint8_t state, buf[1000];
sr_session_send(sdi, &packet);
if (++devc->frame >= devc->frame_limit)
- hung_chang_dso_2100_dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
else
hung_chang_dso_2100_move_to(sdi, 0x21);
SR_PRIV uint8_t hung_chang_dso_2100_read_mbox(struct parport *port, float timeout);
SR_PRIV int hung_chang_dso_2100_move_to(const struct sr_dev_inst *sdi, uint8_t target);
SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data);
-SR_PRIV int hung_chang_dso_2100_dev_acquisition_stop(const struct sr_dev_inst *sdi);
#endif
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
- sr_dbg("Stopping acquisition.");
-
sdi->status = SR_ST_STOPPING;
return SR_OK;
/* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */
static const uint64_t samplerates[1] = { SR_MHZ(100) };
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
-
static void clear_helper(void *priv)
{
struct dev_context *devc;
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- sr_dbg("Stopping acquisition.");
sr_session_source_remove(sdi->session, -1);
std_session_send_df_end(sdi);
if (bytes_read < 0) {
sr_err("Failed to read FTDI data (%d): %s.",
bytes_read, ftdi_get_error_string(devc->ftdic));
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
if (bytes_read == 0) {
if (devc->limit_samples && (n >= devc->limit_samples)) {
send_samples(sdi, devc->limit_samples - devc->samples_sent);
sr_info("Requested number of samples reached.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else if (devc->limit_msec && (n >= max)) {
send_samples(sdi, max - devc->samples_sent);
sr_info("Requested time limit reached.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else {
send_samples(sdi, devc->bytes_received / 2);
{
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
/* Signal USB transfer handler to clean up and stop. */
sdi->status = SR_ST_STOPPING;
if (ret != 0 || len != 1) {
sr_dbg("Failed to request new acquisition: %s",
libusb_error_name(ret));
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
libusb_submit_transfer(devc->xfer);
if (ret != 0 || len != 4) {
sr_dbg("Failed to request next chunk: %s",
libusb_error_name(ret));
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
libusb_submit_transfer(devc->xfer);
switch (transfer->status) {
case LIBUSB_TRANSFER_NO_DEVICE:
/* USB device was unplugged. */
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return;
case LIBUSB_TRANSFER_COMPLETED:
case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */
send_data(sdi, fvalue, 1);
devc->num_samples++;
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else {
/* let USB event handler fire off another
* request when the time is right. */
send_data(sdi, fvalue, 1);
devc->num_samples += num_samples;
if (devc->num_samples >= devc->stored_samples) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else {
/* let USB event handler fire off another
* request when the time is right. */
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
}
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
return SR_OK;
}
-SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE) {
- sr_err("Device inactive, can't stop acquisition.");
- return SR_ERR;
- }
-
sdi->status = SR_ST_STOPPING;
/* TODO: free ongoing transfers? */
switch (transfer->status) {
case LIBUSB_TRANSFER_NO_DEVICE:
/* USB device was unplugged. */
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return;
case LIBUSB_TRANSFER_COMPLETED:
case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */
devc->rcvd_bytes, devc->log_size,
devc->rcvd_samples, devc->logged_samples);
if (devc->rcvd_bytes >= devc->log_size)
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
if (sdi->status == SR_ST_ACTIVE) {
libusb_error_name(ret));
g_free(transfer->buffer);
libusb_free_transfer(transfer);
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
} else {
/* This was the last transfer we're going to receive, so
SR_PRIV int lascar_start_logging(const struct sr_dev_inst *sdi);
SR_PRIV int lascar_stop_logging(const struct sr_dev_inst *sdi);
SR_PRIV int lascar_is_logging(const struct sr_dev_inst *sdi);
-SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi);
#endif
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
return lls_stop_acquisition(sdi);
}
std_session_send_df_end(sdi);
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->num_frames = 0;
* the first enabled channel.
*/
if (++devc->num_frames == devc->frame_limit) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else {
devc->current_channel = devc->enabled_channels;
lecroy_xstream_request_data(sdi);
if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
sr_info("Requested number of samples reached.");
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
return TRUE;
}
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
{
struct sr_modbus_dev_inst *modbus;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
std_session_send_df_end(sdi);
modbus = sdi->conn;
}
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
/* Only request the next packet if required. */
if (!((sdi->status == SR_ST_ACTIVE) && (devc->acq_running)))
}
if (sr_sw_limits_check(&devc->limits)) {
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else {
/* Request next package. */
if (devc->last_req_pending) {
devc->num_samples++;
/* Limiting number of samples is only supported for live data. */
if (devc->cur_data_source == DATA_SOURCE_LIVE && devc->limit_samples && devc->num_samples >= devc->limit_samples)
- sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
+ sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
}
static void process_measurement(const struct sr_dev_inst *sdi)
devc = sdi->priv;
- sr_dbg("Stopping acquisition.");
write_shortcommand(devc, CMD_RESET);
write_shortcommand(devc, CMD_RESET);
write_shortcommand(devc, CMD_RESET);
if (bytes_read < 0) {
sr_err("Failed to read FTDI data (%d): %s.",
bytes_read, ftdi_get_error_string(devc->ftdic));
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return FALSE;
}
if (bytes_read == 0) {
}
g_free(devc->raw_sample_buf);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
return TRUE;
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE) {
- sr_err("Device inactive, can't stop acquisition.");
- return SR_ERR;
- }
-
std_session_send_df_end(sdi);
g_slist_free(devc->enabled_channels);
sr_err("Read error, aborting capture.");
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
/* At slow timebases in live capture the DS2072
sr_err("Read error, aborting capture.");
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
sr_err("Read should have been completed");
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
devc->num_block_read = 0;
if (++devc->num_frames == devc->limit_frames) {
/* Last frame, stop capture. */
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else {
/* Get the next frame, starting with the first channel. */
devc->channel_entry = devc->enabled_channels;
struct dev_context *devc = sdi->priv;
struct drv_context *drvc = sdi->driver->context;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
saleae_logic_pro_stop(sdi);
std_session_send_df_end(sdi);
{
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
ret = logic16_abort_acquisition(sdi);
abort_acquisition(sdi->priv);
struct sr_scpi_dev_inst *scpi;
float f;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
scpi = sdi->conn;
/*
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
if (devc->state != STATE_IDLE && !devc->cancel_requested) {
devc->cancel_requested = TRUE;
- sr_dbg("Stopping acquisition.");
+ sr_dbg("Requesting cancel.");
}
return SR_OK;
}
if (sr_sw_limits_check(&devc->sw_limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
#include "protocol.h"
#define SERIALCOMM "115200/8n1"
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
static const uint32_t scanopts[] = {
SR_CONF_CONN,
devc->reply_size = 0;
if (sr_sw_limits_check(&devc->sw_limits))
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
else
testo_request_packet(sdi);
if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
/* USB device was unplugged. */
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
/* First two bytes in any transfer are FTDI status bytes. */
if (transfer->actual_length > 2)
libusb_error_name(ret));
g_free(transfer->buffer);
libusb_free_transfer(transfer);
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
} else {
/* This was the last transfer we're going to receive, so
drvc = di->context;
if (sr_sw_limits_check(&devc->sw_limits))
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
if (sdi->status == SR_ST_STOPPING) {
usb_source_remove(sdi->session, drvc->sr_ctx);
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
sdi->status = SR_ST_STOPPING;
return SR_OK;
receive_transfer, (void *)sdi, 100);
if ((ret = libusb_submit_transfer(devc->out_transfer) != 0)) {
sr_err("Failed to request packet: %s.", libusb_error_name(ret));
- sdi->driver->dev_acquisition_stop((struct sr_dev_inst *)sdi);
+ sr_dev_acquisition_stop((struct sr_dev_inst *)sdi);
return SR_ERR;
}
sr_dbg("Requested new packet.");
}
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- sr_dbg("Stopping acquisition.");
std_session_send_df_end(sdi);
sr_session_source_remove(sdi->session, -1);
/* Abort acquisition if we acquired enough samples. */
if (sr_sw_limits_check(&devc->limits))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
/* Signal USB transfer handler to clean up and stop. */
sdi->status = SR_ST_STOPPING;
* a sample limit on "Memory" data source still works: unused
* memory slots come through as "----" measurements. */
devc->num_samples++;
- if (devc->limit_samples && devc->num_samples >= devc->limit_samples) {
- sdi->driver->dev_acquisition_stop(sdi);
- }
-
+ if (devc->limit_samples && devc->num_samples >= devc->limit_samples)
+ sr_dev_acquisition_stop(sdi);
}
SR_PRIV void LIBUSB_CALL uni_t_ut32x_receive_transfer(struct libusb_transfer *transfer)
#define VICTOR_INTERFACE 0
#define VICTOR_ENDPOINT (LIBUSB_ENDPOINT_IN | 1)
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
-
static const uint32_t drvopts[] = {
SR_CONF_MULTIMETER,
};
devc = sdi->priv;
if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
/* USB device was unplugged. */
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
} else if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
sr_dbg("Got %d-byte packet.", transfer->actual_length);
if (transfer->actual_length == DMM_DATA_SIZE) {
victor_dmm_receive_data(sdi, transfer->buffer);
if (sr_sw_limits_check(&devc->limits))
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
}
/* Anything else is either an error or a timeout, which is fine:
libusb_error_name(ret));
g_free(transfer->buffer);
libusb_free_transfer(transfer);
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
} else {
/* This was the last transfer we're going to receive, so
drvc = di->context;
if (sr_sw_limits_check(&devc->limits))
- dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
if (sdi->status == SR_ST_STOPPING) {
usb_source_remove(sdi->session, drvc->sr_ctx);
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE) {
- sr_err("Device not active, can't stop acquisition.");
- return SR_ERR;
- }
-
sdi->status = SR_ST_STOPPING;
return SR_OK;
std_session_send_df_end(sdi);
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->num_frames = 0;
* As of now we only support importing the current acquisition
* data so we're going to stop at this point.
*/
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
} else
devc->current_channel = devc->current_channel->next;
}
+/** @private */
+SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi)
+{
+ if (!sdi || !sdi->driver) {
+ sr_err("%s: Invalid arguments.", __func__);
+ return SR_ERR_ARG;
+ }
+
+ if (sdi->status != SR_ST_ACTIVE) {
+ sr_err("%s: Device instance not active, can't stop.",
+ sdi->driver->name);
+ return SR_ERR_DEV_CLOSED;
+ }
+
+ sr_dbg("%s: Stopping acquisition.", sdi->driver->name);
+
+ return sdi->driver->dev_acquisition_stop(sdi);
+}
+
static void log_key(const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg, uint32_t key, int op, GVariant *data)
{
if (dev_limit_counter_limit_reached(&devc->frame_count) ||
dev_time_limit_reached(&devc->time_count))
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
return TRUE;
}
SR_PRIV void sr_hw_cleanup_all(const struct sr_context *ctx);
SR_PRIV struct sr_config *sr_config_new(uint32_t key, GVariant *data);
SR_PRIV void sr_config_free(struct sr_config *src);
+SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi);
/*--- session.c -------------------------------------------------------------*/
lend = l->next;
for (l = session->devs; l != lend; l = l->next) {
sdi = l->data;
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
/* TODO: Handle delayed stops. Need to iterate the event
* sources... */
for (node = session->devs; node; node = node->next) {
sdi = node->data;
- if (sdi->driver && sdi->driver->dev_acquisition_stop)
- sdi->driver->dev_acquisition_stop(sdi);
+ sr_dev_acquisition_stop(sdi);
}
return G_SOURCE_REMOVE;
const char *prefix = sdi->driver->name;
int ret;
- if (sdi->status != SR_ST_ACTIVE) {
- sr_err("%s: Device inactive, can't stop acquisition.", prefix);
- return SR_ERR_DEV_CLOSED;
- }
-
- sr_dbg("%s: Stopping acquisition.", prefix);
-
if ((ret = serial_source_remove(sdi->session, serial)) < 0) {
sr_err("%s: Failed to remove source: %d.", prefix, ret);
return ret;