From: Daniel Elstner Date: Thu, 23 Jan 2014 01:35:51 +0000 (+0100) Subject: sysclk-lwla: Implement config_commit() callback. X-Git-Tag: libsigrok-0.3.0~192 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ee38c8ba3e49fa3b8af6d2fd83396b3dd4b109a7;p=libsigrok.git sysclk-lwla: Implement config_commit() callback. 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. --- diff --git a/hardware/sysclk-lwla/api.c b/hardware/sysclk-lwla/api.c index 2aa58875..d17408d9 100644 --- a/hardware/sysclk-lwla/api.c +++ b/hardware/sysclk-lwla/api.c @@ -329,8 +329,6 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, 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; @@ -404,6 +402,16 @@ static int config_probe_set(const struct sr_dev_inst *sdi, return SR_OK; } +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) { @@ -521,6 +529,7 @@ SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = { .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,