Move pre-acquisition hardware setup to the new config_commit()
callback. At the moment, the only setting applied at commit
time is switching the clock source, which involves uploading
a new bitstream to the FPGA.
sr_info("Disabling external clock.");
devc->selected_clock_source = CLOCK_SOURCE_INT;
}
sr_info("Disabling external clock.");
devc->selected_clock_source = CLOCK_SOURCE_INT;
}
- if (sdi->status == SR_ST_ACTIVE)
- return lwla_set_clock_source(sdi);
break;
default:
return SR_ERR_NA;
break;
default:
return SR_ERR_NA;
+static int config_commit(const struct sr_dev_inst *sdi)
+{
+ if (sdi->status != SR_ST_ACTIVE) {
+ sr_err("Device not ready (status %d).", (int)sdi->status);
+ return SR_ERR;
+ }
+
+ return lwla_set_clock_source(sdi);
+}
+
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_probe_group *probe_group)
{
.config_get = config_get,
.config_set = config_set,
.config_probe_set = config_probe_set,
.config_get = config_get,
.config_set = config_set,
.config_probe_set = config_probe_set,
+ .config_commit = config_commit,
.config_list = config_list,
.dev_open = dev_open,
.dev_close = dev_close,
.config_list = config_list,
.dev_open = dev_open,
.dev_close = dev_close,