]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: Implement config_commit() callback.
authorDaniel Elstner <redacted>
Thu, 23 Jan 2014 01:35:51 +0000 (02:35 +0100)
committerDaniel Elstner <redacted>
Thu, 23 Jan 2014 01:43:16 +0000 (02:43 +0100)
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.

hardware/sysclk-lwla/api.c

index 2aa58875ac2ce18a9adfc185ddfbc14243d3c1df..d17408d92343eec298de5558691369a9b7c18c42 100644 (file)
@@ -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,