struct dev_context *devc = sdi->priv;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc->cur_channel = sr_next_enabled_channel(sdi, NULL);
devc->cur_conf = sr_next_enabled_channel(sdi, NULL);
devc->cur_sample = 1;
struct dev_context *devc;
serial = sdi->conn;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
serial = sdi->conn;
uint8_t clock_bytes[sizeof(clockselect)];
size_t clock_idx;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (sigma_convert_trigger(sdi) != SR_OK) {
struct sr_serial_dev_inst *serial;
uint8_t packet[PACKET_SIZE];
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
memset(devc->packet, 0x44, PACKET_SIZE);
devc->packet_size = 0;
.it_value = { 0, 0 }
};
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
if (dev_acquisition_open(sdi))
return SR_ERR;
struct dev_context *devc = sdi->priv;
struct sr_trigger *trigger;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
/* Clear capture state */
devc->bytes_read = 0;
devc->offset = 0;
{
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->sw_limits);
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->sw_limits);
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->state = ST_INIT;
devc->num_samples = 0;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->sw_limits);
uint8_t buf[8];
int bytes_to_write, bytes_written;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (!devc->ftdic) {
struct dev_context *devc = sdi->priv;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
+ (void)sdi;
return SR_OK;
}
GHashTableIter iter;
void *value;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->sent_samples = 0;
struct libusb_transfer *transfer;
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
di = sdi->driver;
drvc = di->context;
devc = sdi->priv;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
if (!devc->ftdic)
return SR_ERR_BUG;
int timeout, ret;
size_t size;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
di = sdi->driver;
drvc = di->context;
devc = sdi->priv;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->settings_ok = FALSE;
devc->buflen = 0;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->settings_ok = FALSE;
devc->buflen = 0;
scpi = sdi->conn;
devc = sdi->priv;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc->state = START_ACQUISITION;
devc->cur_acq_frame = 0;
struct sr_scpi_dev_inst *scpi;
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
scpi = sdi->conn;
devc = sdi->priv;
struct sr_dev_driver *di = sdi->driver;
struct drv_context *drvc = di->context;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (configure_channels(sdi) != SR_OK) {
struct sr_dev_driver *di = sdi->driver;
struct drv_context *drvc = di->context;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (configure_channels(sdi) != SR_OK) {
GArray *ch_list;
GSList *channels;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
scpi = sdi->conn;
devc = sdi->priv;
struct dev_context *devc = sdi->priv;
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
if (devc->channel) {
static const float res_array[] = {0.5, 1, 2, 5};
static const uint8_t relays[] = {100, 10, 10, 1};
unsigned int i, j;
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
drvc = di->context;
int ret;
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (!devc->ftdic)
int req_len, buf_len, len, ret;
unsigned char buf[9];
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
serial = sdi->conn;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
int ret;
unsigned char cmd[3], resp[4], *buf;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
struct drv_context *drvc;
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
drvc = sdi->driver->context;
if ((ret = lls_start_acquisition(sdi)) < 0)
int ret;
struct sr_scpi_dev_inst *scpi;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
scpi = sdi->conn;
/* Preset empty results. */
struct dev_context *devc;
int ret = SR_ERR;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (mso_configure_channels(sdi) != SR_OK) {
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
struct sr_modbus_dev_inst *modbus;
int ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
modbus = sdi->conn;
devc = sdi->priv;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->acq_running = TRUE;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
int num_ols_changrp;
int ret, i;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
serial = sdi->conn;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
devc->buffer_len = 0;
devc->memory_state = MEM_STATE_REQUEST_MEMORY_USAGE;
int num_pols_changrp, samplespercount;
int ret, i;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
pols_channel_mask(sdi);
gboolean some_digital;
GSList *l;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
scpi = sdi->conn;
devc = sdi->priv;
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
+ (void)sdi;
return SR_OK;
}
uint8_t *buf;
unsigned int i, ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
ret = saleae_logic_pro_init(sdi);
if (ret != SR_OK)
return ret;
unsigned char *buf;
size_t size, convsize;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
struct pps_channel *pch;
int cmd, ret;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
scpi = sdi->conn;
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
*/
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
- sr_info("Starting acquisition.");
-
return lwla_start_acquisition(sdi);
}
struct sr_serial_dev_inst *serial = sdi->conn;
struct dev_context *devc;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->sw_limits);
unsigned char *buf;
drvc = di->context;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
-
devc = sdi->priv;
usb = sdi->conn;
devc->reply_size = 0;
struct dev_context *devc = sdi->priv;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
std_session_send_df_header(sdi);
sr_sw_limits_acquisition_start(&devc->limits);
int len, ret;
unsigned char cmd[2];
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
int ret;
unsigned char *buf;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
usb = sdi->conn;
std_session_send_df_header(sdi);
struct dev_context *devc;
struct sr_scpi_dev_inst *scpi;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
scpi = sdi->conn;
devc = sdi->priv;
digital_added = FALSE;
unsigned int discard;
int trigger_now;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
if (analyzer_add_triggers(sdi) != SR_OK) {
}
+/** @private */
+SR_PRIV int sr_dev_acquisition_start(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 start.",
+ sdi->driver->name);
+ return SR_ERR_DEV_CLOSED;
+ }
+
+ sr_dbg("%s: Starting acquisition.", sdi->driver->name);
+
+ return sdi->driver->dev_acquisition_start(sdi);
+}
+
/** @private */
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
if (!(devc = sdi->priv))
return SR_ERR_BUG;
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_start(struct sr_dev_inst *sdi);
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi);
/*--- session.c -------------------------------------------------------------*/
sr_strerror(ret));
return ret;
}
- if ((ret = sdi->driver->dev_acquisition_start(sdi)) != SR_OK) {
+ if ((ret = sr_dev_acquisition_start(sdi)) != SR_OK) {
sr_err("Failed to start acquisition of device in "
"running session (%s)", sr_strerror(ret));
return ret;
ret = SR_ERR;
break;
}
- ret = sdi->driver->dev_acquisition_start(sdi);
+ ret = sr_dev_acquisition_start(sdi);
if (ret != SR_OK) {
sr_err("Could not start %s device %s acquisition.",
sdi->driver->name, sdi->connection_id);
struct sr_datafeed_packet packet;
struct sr_datafeed_header header;
- sr_dbg("%s: Starting acquisition.", prefix);
-
/* Send header packet to the session bus. */
sr_dbg("%s: Sending SR_DF_HEADER packet.", prefix);
packet.type = SR_DF_HEADER;