Add sr_dev_acquisition_start(), factor out SR_ERR_DEV_CLOSED check.
This ensures consistent checks and log messages across all drivers and reduces the per-driver boilerplate.
This commit is contained in:
parent
d2f7c417fd
commit
f670835f1f
|
@ -311,9 +311,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
struct sr_serial_dev_inst *serial;
|
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_channel = sr_next_enabled_channel(sdi, NULL);
|
||||||
devc->cur_conf = sr_next_enabled_channel(sdi, NULL);
|
devc->cur_conf = sr_next_enabled_channel(sdi, NULL);
|
||||||
devc->cur_sample = 1;
|
devc->cur_sample = 1;
|
||||||
|
|
|
@ -200,9 +200,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -308,9 +308,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
|
|
||||||
|
|
|
@ -299,9 +299,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
uint8_t clock_bytes[sizeof(clockselect)];
|
uint8_t clock_bytes[sizeof(clockselect)];
|
||||||
size_t clock_idx;
|
size_t clock_idx;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (sigma_convert_trigger(sdi) != SR_OK) {
|
if (sigma_convert_trigger(sdi) != SR_OK) {
|
||||||
|
|
|
@ -439,9 +439,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
uint8_t packet[PACKET_SIZE];
|
uint8_t packet[PACKET_SIZE];
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
memset(devc->packet, 0x44, PACKET_SIZE);
|
memset(devc->packet, 0x44, PACKET_SIZE);
|
||||||
devc->packet_size = 0;
|
devc->packet_size = 0;
|
||||||
|
|
|
@ -316,9 +316,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
.it_value = { 0, 0 }
|
.it_value = { 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
if (dev_acquisition_open(sdi))
|
if (dev_acquisition_open(sdi))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
|
|
|
@ -294,9 +294,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
struct sr_trigger *trigger;
|
struct sr_trigger *trigger;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
/* Clear capture state */
|
/* Clear capture state */
|
||||||
devc->bytes_read = 0;
|
devc->bytes_read = 0;
|
||||||
devc->offset = 0;
|
devc->offset = 0;
|
||||||
|
|
|
@ -210,9 +210,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
||||||
|
|
|
@ -160,9 +160,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
||||||
|
|
|
@ -346,9 +346,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->state = ST_INIT;
|
devc->state = ST_INIT;
|
||||||
devc->num_samples = 0;
|
devc->num_samples = 0;
|
||||||
|
|
|
@ -165,9 +165,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
||||||
|
|
|
@ -484,9 +484,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
uint8_t buf[8];
|
uint8_t buf[8];
|
||||||
int bytes_to_write, bytes_written;
|
int bytes_to_write, bytes_written;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (!devc->ftdic) {
|
if (!devc->ftdic) {
|
||||||
|
|
|
@ -123,9 +123,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
std_session_send_df_header(sdi);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
|
||||||
|
|
||||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
(void)sdi;
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,9 +464,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
void *value;
|
void *value;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->sent_samples = 0;
|
devc->sent_samples = 0;
|
||||||
|
|
||||||
|
|
|
@ -1056,9 +1056,6 @@ SR_PRIV int dslogic_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct libusb_transfer *transfer;
|
struct libusb_transfer *transfer;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
di = sdi->driver;
|
di = sdi->driver;
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
|
@ -221,9 +221,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -439,9 +439,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
if (!devc->ftdic)
|
if (!devc->ftdic)
|
||||||
return SR_ERR_BUG;
|
return SR_ERR_BUG;
|
||||||
|
|
||||||
|
|
|
@ -683,9 +683,6 @@ SR_PRIV int fx2lafw_start_acquisition(const struct sr_dev_inst *sdi)
|
||||||
int timeout, ret;
|
int timeout, ret;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
di = sdi->driver;
|
di = sdi->driver;
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
|
@ -427,9 +427,6 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->settings_ok = FALSE;
|
devc->settings_ok = FALSE;
|
||||||
devc->buflen = 0;
|
devc->buflen = 0;
|
||||||
|
@ -450,9 +447,6 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->settings_ok = FALSE;
|
devc->settings_ok = FALSE;
|
||||||
devc->buflen = 0;
|
devc->buflen = 0;
|
||||||
|
|
|
@ -199,9 +199,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc->state = START_ACQUISITION;
|
devc->state = START_ACQUISITION;
|
||||||
devc->cur_acq_frame = 0;
|
devc->cur_acq_frame = 0;
|
||||||
|
|
||||||
|
|
|
@ -727,9 +727,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct sr_scpi_dev_inst *scpi;
|
struct sr_scpi_dev_inst *scpi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
|
|
@ -784,9 +784,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
struct sr_dev_driver *di = sdi->driver;
|
||||||
struct drv_context *drvc = di->context;
|
struct drv_context *drvc = di->context;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (configure_channels(sdi) != SR_OK) {
|
if (configure_channels(sdi) != SR_OK) {
|
||||||
|
|
|
@ -954,9 +954,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
struct sr_dev_driver *di = sdi->driver;
|
||||||
struct drv_context *drvc = di->context;
|
struct drv_context *drvc = di->context;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (configure_channels(sdi) != SR_OK) {
|
if (configure_channels(sdi) != SR_OK) {
|
||||||
|
|
|
@ -367,9 +367,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
GArray *ch_list;
|
GArray *ch_list;
|
||||||
GSList *channels;
|
GSList *channels;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
|
|
@ -664,9 +664,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
if (devc->channel) {
|
if (devc->channel) {
|
||||||
static const float res_array[] = {0.5, 1, 2, 5};
|
static const float res_array[] = {0.5, 1, 2, 5};
|
||||||
static const uint8_t relays[] = {100, 10, 10, 1};
|
static const uint8_t relays[] = {100, 10, 10, 1};
|
||||||
|
|
|
@ -361,9 +361,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
|
|
||||||
|
|
|
@ -325,9 +325,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int ret;
|
int ret;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (!devc->ftdic)
|
if (!devc->ftdic)
|
||||||
|
|
|
@ -380,9 +380,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int req_len, buf_len, len, ret;
|
int req_len, buf_len, len, ret;
|
||||||
unsigned char buf[9];
|
unsigned char buf[9];
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
|
@ -152,9 +152,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
|
|
||||||
|
|
|
@ -344,9 +344,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -293,9 +293,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char cmd[3], resp[4], *buf;
|
unsigned char cmd[3], resp[4], *buf;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
|
@ -472,9 +472,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
drvc = sdi->driver->context;
|
drvc = sdi->driver->context;
|
||||||
|
|
||||||
if ((ret = lls_start_acquisition(sdi)) < 0)
|
if ((ret = lls_start_acquisition(sdi)) < 0)
|
||||||
|
|
|
@ -553,9 +553,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int ret;
|
int ret;
|
||||||
struct sr_scpi_dev_inst *scpi;
|
struct sr_scpi_dev_inst *scpi;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
/* Preset empty results. */
|
/* Preset empty results. */
|
||||||
|
|
|
@ -330,9 +330,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret = SR_ERR;
|
int ret = SR_ERR;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (mso_configure_channels(sdi) != SR_OK) {
|
if (mso_configure_channels(sdi) != SR_OK) {
|
||||||
|
|
|
@ -353,9 +353,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -435,9 +435,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct sr_modbus_dev_inst *modbus;
|
struct sr_modbus_dev_inst *modbus;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
modbus = sdi->conn;
|
modbus = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
|
|
@ -178,9 +178,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -764,9 +764,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
devc->acq_running = TRUE;
|
devc->acq_running = TRUE;
|
||||||
|
|
|
@ -203,9 +203,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -439,9 +439,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int num_ols_changrp;
|
int num_ols_changrp;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
serial = sdi->conn;
|
serial = sdi->conn;
|
||||||
|
|
||||||
|
|
|
@ -328,9 +328,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->buffer_len = 0;
|
devc->buffer_len = 0;
|
||||||
devc->memory_state = MEM_STATE_REQUEST_MEMORY_USAGE;
|
devc->memory_state = MEM_STATE_REQUEST_MEMORY_USAGE;
|
||||||
|
|
|
@ -523,9 +523,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int num_pols_changrp, samplespercount;
|
int num_pols_changrp, samplespercount;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
pols_channel_mask(sdi);
|
pols_channel_mask(sdi);
|
||||||
|
|
|
@ -997,9 +997,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
gboolean some_digital;
|
gboolean some_digital;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
|
|
@ -265,8 +265,7 @@ static int config_list(uint32_t key, GVariant **data,
|
||||||
|
|
||||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
(void)sdi;
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,9 +348,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
unsigned int i, ret;
|
unsigned int i, ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
ret = saleae_logic_pro_init(sdi);
|
ret = saleae_logic_pro_init(sdi);
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -674,9 +674,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
size_t size, convsize;
|
size_t size, convsize;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
|
@ -642,9 +642,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct pps_channel *pch;
|
struct pps_channel *pch;
|
||||||
int cmd, ret;
|
int cmd, ret;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
|
|
||||||
|
|
|
@ -179,9 +179,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -743,11 +743,6 @@ static int config_list(uint32_t key, GVariant **data,
|
||||||
*/
|
*/
|
||||||
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
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);
|
return lwla_start_acquisition(sdi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,9 +163,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct sr_serial_dev_inst *serial = sdi->conn;
|
struct sr_serial_dev_inst *serial = sdi->conn;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
sr_sw_limits_acquisition_start(&devc->sw_limits);
|
||||||
|
|
|
@ -372,10 +372,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
devc->reply_size = 0;
|
devc->reply_size = 0;
|
||||||
|
|
|
@ -133,9 +133,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
std_session_send_df_header(sdi);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
|
|
|
@ -241,9 +241,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int len, ret;
|
int len, ret;
|
||||||
unsigned char cmd[2];
|
unsigned char cmd[2];
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
|
@ -291,9 +291,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
std_session_send_df_header(sdi);
|
std_session_send_df_header(sdi);
|
||||||
|
|
|
@ -612,9 +612,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_scpi_dev_inst *scpi;
|
struct sr_scpi_dev_inst *scpi;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
scpi = sdi->conn;
|
scpi = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
digital_added = FALSE;
|
digital_added = FALSE;
|
||||||
|
|
|
@ -490,9 +490,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
unsigned int discard;
|
unsigned int discard;
|
||||||
int trigger_now;
|
int trigger_now;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (analyzer_add_triggers(sdi) != SR_OK) {
|
if (analyzer_add_triggers(sdi) != SR_OK) {
|
||||||
|
|
|
@ -592,6 +592,25 @@ SR_PRIV void sr_config_free(struct sr_config *src)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @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 */
|
/** @private */
|
||||||
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi)
|
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -909,9 +909,6 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
|
||||||
return SR_ERR_DEV_CLOSED;
|
|
||||||
|
|
||||||
if (!(devc = sdi->priv))
|
if (!(devc = sdi->priv))
|
||||||
return SR_ERR_BUG;
|
return SR_ERR_BUG;
|
||||||
|
|
||||||
|
|
|
@ -834,6 +834,7 @@ SR_PRIV int sr_variant_type_check(uint32_t key, GVariant *data);
|
||||||
SR_PRIV void sr_hw_cleanup_all(const struct sr_context *ctx);
|
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 struct sr_config *sr_config_new(uint32_t key, GVariant *data);
|
||||||
SR_PRIV void sr_config_free(struct sr_config *src);
|
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);
|
SR_PRIV int sr_dev_acquisition_stop(struct sr_dev_inst *sdi);
|
||||||
|
|
||||||
/*--- session.c -------------------------------------------------------------*/
|
/*--- session.c -------------------------------------------------------------*/
|
||||||
|
|
|
@ -365,7 +365,7 @@ SR_API int sr_session_dev_add(struct sr_session *session,
|
||||||
sr_strerror(ret));
|
sr_strerror(ret));
|
||||||
return 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 "
|
sr_err("Failed to start acquisition of device in "
|
||||||
"running session (%s)", sr_strerror(ret));
|
"running session (%s)", sr_strerror(ret));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -816,7 +816,7 @@ SR_API int sr_session_start(struct sr_session *session)
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = sdi->driver->dev_acquisition_start(sdi);
|
ret = sr_dev_acquisition_start(sdi);
|
||||||
if (ret != SR_OK) {
|
if (ret != SR_OK) {
|
||||||
sr_err("Could not start %s device %s acquisition.",
|
sr_err("Could not start %s device %s acquisition.",
|
||||||
sdi->driver->name, sdi->connection_id);
|
sdi->driver->name, sdi->connection_id);
|
||||||
|
|
|
@ -98,8 +98,6 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi)
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_header header;
|
struct sr_datafeed_header header;
|
||||||
|
|
||||||
sr_dbg("%s: Starting acquisition.", prefix);
|
|
||||||
|
|
||||||
/* Send header packet to the session bus. */
|
/* Send header packet to the session bus. */
|
||||||
sr_dbg("%s: Sending SR_DF_HEADER packet.", prefix);
|
sr_dbg("%s: Sending SR_DF_HEADER packet.", prefix);
|
||||||
packet.type = SR_DF_HEADER;
|
packet.type = SR_DF_HEADER;
|
||||||
|
|
Loading…
Reference in New Issue