]> sigrok.org Git - libsigrok.git/blobdiff - hwdriver.c
hwdriver: Introduce sr_config_commit() API call.
[libsigrok.git] / hwdriver.c
index 557181176009bce2c2265f9b95011ba37ea618ad..88b6f638e04722903a96ab79164f6f282a36598d 100644 (file)
@@ -53,7 +53,7 @@ static struct sr_config_info sr_config_info_data[] = {
        {SR_CONF_CAPTURE_RATIO, SR_T_UINT64, "captureratio",
                "Pre-trigger capture ratio", NULL},
        {SR_CONF_PATTERN_MODE, SR_T_CHAR, "pattern",
-               "Pattern generator mode", NULL},
+               "Pattern", NULL},
        {SR_CONF_TRIGGER_TYPE, SR_T_CHAR, "triggertype",
                "Trigger types", NULL},
        {SR_CONF_EXTERNAL_CLOCK, SR_T_BOOL, "external_clock",
@@ -100,8 +100,6 @@ static struct sr_config_info sr_config_info_data[] = {
                "Number of logic probes", NULL},
        {SR_CONF_NUM_ANALOG_PROBES, SR_T_INT32, "analog_probes",
                "Number of analog probes", NULL},
-       {SR_CONF_MAX_UNCOMPRESSED_SAMPLES, SR_T_UINT64, "max_uncompressed_samples",
-               "Maximum number of uncompressed samples", NULL},
        {SR_CONF_OUTPUT_VOLTAGE, SR_T_FLOAT, "output_voltage",
                "Current output voltage", NULL},
        {SR_CONF_OUTPUT_VOLTAGE_MAX, SR_T_FLOAT, "output_voltage_max",
@@ -118,6 +116,8 @@ static struct sr_config_info sr_config_info_data[] = {
                "Over-voltage protection", NULL},
        {SR_CONF_OVER_CURRENT_PROTECTION, SR_T_BOOL, "ocp",
                "Over-current protection", NULL},
+       {SR_CONF_LIMIT_SAMPLES, SR_T_UINT64, "limit_samples",
+               "Sample limit", NULL},
        {0, 0, NULL, NULL, NULL},
 };
 
@@ -633,6 +633,27 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi,
        return ret;
 }
 
+/**
+ * Apply configuration settings to the device hardware.
+ *
+ * @param sdi The device instance.
+ *
+ * @return SR_OK upon success or SR_ERR in case of error.
+ */
+SR_API int sr_config_commit(const struct sr_dev_inst *sdi)
+{
+       int ret;
+
+       if (!sdi || !sdi->driver)
+               ret = SR_ERR;
+       else if (!sdi->driver->config_commit)
+               ret = SR_OK;
+       else
+               ret = sdi->driver->config_commit(sdi);
+
+       return ret;
+}
+
 /**
  * List all possible values for a configuration key.
  *