SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
SR_HWCAP_CAPTURE_RATIO,
- SR_HWCAP_PROBECONFIG,
SR_HWCAP_LIMIT_MSEC,
0,
* The Sigma supports complex triggers using boolean expressions, but this
* has not been implemented yet.
*/
-static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi)
{
struct dev_context *devc = sdi->priv;
const struct sr_probe *probe;
memset(&devc->trigger, 0, sizeof(struct sigma_trigger));
- for (l = probes; l; l = l->next) {
+ for (l = sdi->probes; l; l = l->next) {
probe = (struct sr_probe *)l->data;
probebit = 1 << (probe->index);
if (hwcap == SR_HWCAP_SAMPLERATE) {
ret = set_samplerate(sdi, *(const uint64_t *)value);
- } else if (hwcap == SR_HWCAP_PROBECONFIG) {
- ret = configure_probes(sdi, value);
} else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
devc->limit_msec = *(const uint64_t *)value;
if (devc->limit_msec > 0)
devc = sdi->priv;
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("asix-sigma: failed to configured probes");
+ return SR_ERR;
+ }
+
/* If the samplerate has not been set, default to 200 kHz. */
if (devc->cur_firmware == -1) {
if ((ret = set_samplerate(sdi, SR_KHZ(200))) != SR_OK)
}
sr_dbg("la8: SAMPLERATE = %" PRIu64, devc->cur_samplerate);
break;
- case SR_HWCAP_PROBECONFIG:
- if (configure_probes(devc, (const GSList *)value) != SR_OK) {
- sr_err("la8: %s: probe config failed.", __func__);
- return SR_ERR;
- }
- break;
case SR_HWCAP_LIMIT_MSEC:
if (*(const uint64_t *)value == 0) {
sr_err("la8: %s: LIMIT_MSEC can't be 0.", __func__);
return SR_ERR;
}
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("chronovu-la8: failed to configured probes");
+ return SR_ERR;
+ }
+
sr_dbg("la8: Starting acquisition.");
/* Fill acquisition parameters into buf[]. */
return SR_OK;
}
-SR_PRIV int configure_probes(struct dev_context *devc, const GSList *probes)
+SR_PRIV int configure_probes(const struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
const struct sr_probe *probe;
const GSList *l;
uint8_t probe_bit;
char *tc;
- /* Note: Caller checked that devc != NULL. */
-
+ devc = sdi->priv;
devc->trigger_pattern = 0;
devc->trigger_mask = 0; /* Default to "don't care" for all probes. */
- for (l = probes; l; l = l->next) {
+ for (l = sdi->probes; l; l = l->next) {
probe = (struct sr_probe *)l->data;
if (!probe) {
SR_PRIV int la8_close(struct dev_context *devc);
SR_PRIV int la8_close_usb_reset_sequencer(struct dev_context *devc);
SR_PRIV int la8_reset(struct dev_context *devc);
-SR_PRIV int configure_probes(struct dev_context *devc, const GSList *probes);
+SR_PRIV int configure_probes(const struct sr_dev_inst *sdi);
SR_PRIV int set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate);
SR_PRIV int la8_read_block(struct dev_context *devc);
SR_PRIV void send_block_to_session_bus(struct dev_context *devc, int block);
(void)sdi;
- if (hwcap == SR_HWCAP_PROBECONFIG) {
- /* Nothing to do, but must be supported */
- ret = SR_OK;
- } else if (hwcap == SR_HWCAP_SAMPLERATE) {
+ if (hwcap == SR_HWCAP_SAMPLERATE) {
cur_samplerate = *(const uint64_t *)value;
sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
cur_samplerate);
return SR_OK;
}
-static int configure_probes(struct dev_context *devc, GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
struct sr_probe *probe;
GSList *l;
int probe_bit, stage, i;
char *tc;
+ devc = sdi->priv;
for (i = 0; i < NUM_TRIGGER_STAGES; i++) {
devc->trigger_mask[i] = 0;
devc->trigger_value[i] = 0;
}
stage = -1;
- for (l = probes; l; l = l->next) {
+ for (l = sdi->probes; l; l = l->next) {
probe = (struct sr_probe *)l->data;
if (probe->enabled == FALSE)
continue;
if (hwcap == SR_HWCAP_SAMPLERATE) {
devc->cur_samplerate = *(const uint64_t *)value;
ret = SR_OK;
- } else if (hwcap == SR_HWCAP_PROBECONFIG) {
- ret = configure_probes(devc, (GSList *) value);
} else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
devc->limit_samples = *(const uint64_t *)value;
ret = SR_OK;
if (devc->submitted_transfers != 0)
return SR_ERR;
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("fx2lafw: failed to configured probes");
+ return SR_ERR;
+ }
+
devc->session_dev_id = cb_data;
devc->num_samples = 0;
devc->empty_transfer_count = 0;
return sdi;
}
-static int configure_probes(struct dev_context *devc, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
const struct sr_probe *probe;
const GSList *l;
+ devc = sdi->priv;
+
devc->ch1_enabled = devc->ch2_enabled = FALSE;
- for (l = probes; l; l = l->next) {
+ for (l = sdi->probes; l; l = l->next) {
probe = (struct sr_probe *)l->data;
if (probe->index == 0)
devc->ch1_enabled = probe->enabled;
case SR_HWCAP_LIMIT_FRAMES:
devc->limit_frames = *(const uint64_t *)value;
break;
- case SR_HWCAP_PROBECONFIG:
- ret = configure_probes(devc, (const GSList *)value);
- break;
case SR_HWCAP_TRIGGER_SLOPE:
tmp_u64 = *(const int *)value;
if (tmp_u64 != SLOPE_NEGATIVE && tmp_u64 != SLOPE_POSITIVE)
devc = sdi->priv;
devc->cb_data = cb_data;
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("hantek-dso: failed to configured probes");
+ return SR_ERR;
+ }
+
if (dso_init(devc) != SR_OK)
return SR_ERR;
return SR_OK;
}
-static int configure_probes(struct dev_context *devc, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
const struct sr_probe *probe;
const GSList *l;
int probe_bit, stage, i;
char *tc;
+ devc = sdi->priv;
+
devc->probe_mask = 0;
for (i = 0; i < NUM_TRIGGER_STAGES; i++) {
devc->trigger_mask[i] = 0;
}
devc->num_stages = 0;
- for (l = probes; l; l = l->next) {
+ for (l = sdi->probes; l; l = l->next) {
probe = (const struct sr_probe *)l->data;
if (!probe->enabled)
continue;
case SR_HWCAP_SAMPLERATE:
ret = set_samplerate(sdi, *(const uint64_t *)value);
break;
- case SR_HWCAP_PROBECONFIG:
- ret = configure_probes(devc, (const GSList *)value);
- break;
case SR_HWCAP_LIMIT_SAMPLES:
tmp_u64 = value;
if (*tmp_u64 < MIN_NUM_SAMPLES)
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("ols: failed to configured probes");
+ return SR_ERR;
+ }
+
/*
* Enable/disable channel groups in the flag register according to the
* probe mask. Calculate this here, because num_channels is needed
static const int hwcaps[] = {
SR_HWCAP_LOGIC_ANALYZER,
SR_HWCAP_SAMPLERATE,
- SR_HWCAP_PROBECONFIG,
SR_HWCAP_CAPTURE_RATIO,
/* These are really implemented in the driver, not the hardware. */
return 0;
}
-static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
+static int configure_probes(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
const struct sr_probe *probe;
}
stage = -1;
- for (l = probes; l; l = l->next) {
+ for (l = sdi->probes; l; l = l->next) {
probe = (struct sr_probe *)l->data;
if (probe->enabled == FALSE)
continue;
switch (hwcap) {
case SR_HWCAP_SAMPLERATE:
return set_samplerate(sdi, *(const uint64_t *)value);
- case SR_HWCAP_PROBECONFIG:
- return configure_probes(sdi, (const GSList *)value);
case SR_HWCAP_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
return SR_OK;
return SR_ERR_ARG;
}
+ if (configure_probes(sdi) != SR_OK) {
+ sr_err("zp: failed to configured probes");
+ return SR_ERR;
+ }
+
/* push configured settings to device */
analyzer_configure(devc->usb->devhdl);
/** The device supports setting/changing its samplerate. */
SR_HWCAP_SAMPLERATE,
- /* TODO: Better description? Rename to PROBE_AND_TRIGGER_CONFIG? */
- /** The device supports setting a probe mask. */
- SR_HWCAP_PROBECONFIG,
-
/** The device supports setting a pre/post-trigger capture ratio. */
SR_HWCAP_CAPTURE_RATIO,