]> sigrok.org Git - libsigrok.git/commitdiff
Remove SR_CONF_MAX_UNCOMPRESSED_SAMPLES again.
authorBert Vermeulen <redacted>
Sun, 19 Jan 2014 16:18:59 +0000 (17:18 +0100)
committerBert Vermeulen <redacted>
Sun, 19 Jan 2014 16:18:59 +0000 (17:18 +0100)
The maximum sample size that can be set on a device is now published
by sr_config_list(SR_CONF_LIMIT_SAMPLES). This returns a tuple of
uint64_t representing minimum and maximum number of samples.

hardware/chronovu-la8/api.c
hardware/ikalogic-scanalogic2/api.c
hardware/openbench-logic-sniffer/api.c
hardware/zeroplus-logic-cube/api.c
hwdriver.c
libsigrok.h

index 3d5a5658e16293e9b3dd8f64261edf123d943332..0fc90353016c1ad54db726acd0d461bd40eaaf78 100644 (file)
@@ -42,7 +42,6 @@ SR_PRIV const int32_t chronovu_la8_hwcaps[] = {
        SR_CONF_SAMPLERATE,
        SR_CONF_LIMIT_MSEC, /* TODO: Not yet implemented. */
        SR_CONF_LIMIT_SAMPLES, /* TODO: Not yet implemented. */
-       SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
 };
 
 /*
@@ -280,9 +279,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                } else
                        return SR_ERR;
                break;
-       case SR_CONF_MAX_UNCOMPRESSED_SAMPLES:
-               *data = g_variant_new_uint64(MAX_NUM_SAMPLES);
-               break;
        default:
                return SR_ERR_NA;
        }
@@ -339,7 +335,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_probe_group *probe_group)
 {
-       GVariant *gvar;
+       GVariant *gvar, *grange[2];
        GVariantBuilder gvb;
 
        (void)sdi;
@@ -362,6 +358,11 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar);
                *data = g_variant_builder_end(&gvb);
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               grange[0] = g_variant_new_uint64(0);
+               grange[1] = g_variant_new_uint64(MAX_NUM_SAMPLES);
+               *data = g_variant_new_tuple(grange, 2);
+               break;
        case SR_CONF_TRIGGER_TYPE:
                *data = g_variant_new_string(TRIGGER_TYPE);
                break;
index 93a9ca87ce692bb384dfe98c8a01d005c9e96875..b48edf254a5a5713c2c256d9da1971a064e40710 100644 (file)
@@ -25,7 +25,6 @@ static const int hwcaps[] = {
        SR_CONF_LIMIT_SAMPLES,
        SR_CONF_TRIGGER_TYPE,
        SR_CONF_CAPTURE_RATIO,
-       SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
 };
 
 SR_PRIV const uint64_t sl2_samplerates[NUM_SAMPLERATES] = {
@@ -326,9 +325,6 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
        case SR_CONF_CAPTURE_RATIO:
                *data = g_variant_new_uint64(devc->capture_ratio);
                break;
-       case SR_CONF_MAX_UNCOMPRESSED_SAMPLES:
-               *data = g_variant_new_uint64(MAX_SAMPLES);
-               break;
        default:
                return SR_ERR_NA;
        }
@@ -372,7 +368,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_probe_group *probe_group)
 {
-       GVariant *gvar;
+       GVariant *gvar, *grange[2];
        GVariantBuilder gvb;
        int ret;
 
@@ -397,6 +393,11 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
        case SR_CONF_TRIGGER_TYPE:
                *data = g_variant_new_string(TRIGGER_TYPES);
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               grange[0] = g_variant_new_uint64(0);
+               grange[1] = g_variant_new_uint64(MAX_SAMPLES);
+               *data = g_variant_new_tuple(grange, 2);
+               break;
        default:
                return SR_ERR_NA;
        }
index 0191d08bc1d22b7967957325fb9edf338a79ba6e..ff48d4ddebe94a1c54ab6d0b2bbd83b9be59584d 100644 (file)
@@ -37,7 +37,6 @@ static const int32_t hwcaps[] = {
        SR_CONF_PATTERN_MODE,
        SR_CONF_SWAP,
        SR_CONF_RLE,
-       SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
 };
 
 #define STR_PATTERN_EXTERNAL "external"
@@ -220,7 +219,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_probe_group *probe_group)
 {
        struct dev_context *devc;
-       int num_channels, i;
 
        (void)probe_group;
 
@@ -247,24 +245,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
        case SR_CONF_RLE:
                *data = g_variant_new_boolean(devc->flag_reg & FLAG_RLE ? TRUE : FALSE);
                break;
-       case SR_CONF_MAX_UNCOMPRESSED_SAMPLES:
-               if (devc->flag_reg & FLAG_RLE)
-                       return SR_ERR_NA;
-               if (devc->max_samples == 0)
-                       /* Device didn't specify sample memory size in metadata. */
-                       return SR_ERR_NA;
-               /*
-                * Channel groups are turned off if no probes in that group are
-                * enabled, making more room for samples for the enabled group.
-                */
-               ols_configure_probes(sdi);
-               num_channels = 0;
-               for (i = 0; i < 4; i++) {
-                       if (devc->probe_mask & (0xff << (i * 8)))
-                               num_channels++;
-               }
-               *data = g_variant_new_uint64(devc->max_samples / num_channels);
-               break;
        default:
                return SR_ERR_NA;
        }
@@ -363,10 +343,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_probe_group *probe_group)
 {
-       GVariant *gvar;
+       struct dev_context *devc;
+       GVariant *gvar, *grange[2];
        GVariantBuilder gvb;
+       int num_channels, i;
 
-       (void)sdi;
        (void)probe_group;
 
        switch (key) {
@@ -391,6 +372,29 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
        case SR_CONF_PATTERN_MODE:
                *data = g_variant_new_strv(patterns, ARRAY_SIZE(patterns));
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               if (!sdi)
+                       return SR_ERR_ARG;
+               devc = sdi->priv;
+               if (devc->flag_reg & FLAG_RLE)
+                       return SR_ERR_NA;
+               if (devc->max_samples == 0)
+                       /* Device didn't specify sample memory size in metadata. */
+                       return SR_ERR_NA;
+               /*
+                * Channel groups are turned off if no probes in that group are
+                * enabled, making more room for samples for the enabled group.
+               */
+               ols_configure_probes(sdi);
+               num_channels = 0;
+               for (i = 0; i < 4; i++) {
+                       if (devc->probe_mask & (0xff << (i * 8)))
+                               num_channels++;
+               }
+               grange[0] = g_variant_new_uint64(MIN_NUM_SAMPLES);
+               grange[1] = g_variant_new_uint64(devc->max_samples / num_channels);
+               *data = g_variant_new_tuple(grange, 2);
+               break;
        default:
                return SR_ERR_NA;
        }
index 4ff07830932799cce8b02d4073c3837377078cbd..56804f22d45aef98b7f395221b408df9cb3fec1c 100644 (file)
@@ -59,7 +59,6 @@ static const int32_t hwcaps[] = {
        SR_CONF_CAPTURE_RATIO,
        SR_CONF_VOLTAGE_THRESHOLD,
        SR_CONF_LIMIT_SAMPLES,
-       SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
 };
 
 /*
@@ -506,16 +505,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                } else
                        return SR_ERR_ARG;
                break;
-       case SR_CONF_MAX_UNCOMPRESSED_SAMPLES:
-               if (sdi) {
-                       /* As long as this driver doesn't support compression,
-                        * this is ok. When compression is enabled, this should
-                        * return SR_ERR_NA instead. */
-                       devc = sdi->priv;
-                       *data = g_variant_new_uint64(devc->max_sample_depth);
-               } else
-                       return SR_ERR;
-               break;
        default:
                return SR_ERR_NA;
        }
@@ -560,7 +549,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_probe_group *probe_group)
 {
        struct dev_context *devc;
-       GVariant *gvar;
+       GVariant *gvar, *grange[2];
        GVariantBuilder gvb;
        double v;
        GVariant *range[2];
@@ -604,6 +593,14 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                }
                *data = g_variant_builder_end(&gvb);
                break;
+       case SR_CONF_LIMIT_SAMPLES:
+               if (!sdi)
+                       return SR_ERR_ARG;
+               devc = sdi->priv;
+               grange[0] = g_variant_new_uint64(0);
+               grange[1] = g_variant_new_uint64(devc->max_sample_depth);
+               *data = g_variant_new_tuple(grange, 2);
+               break;
        default:
                return SR_ERR_NA;
        }
index 048450001b1f4196c4c0d13c6648ce7e09cd98ea..55358ebf3953a86c7a6476dcb33041b940dd7a12 100644 (file)
@@ -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},
 };
 
index e43338e52dc0561985e5fb3ccc6a93643c55d472..7fc48cfdede3a1e8f46e5282b463048f44d20470 100644 (file)
@@ -868,18 +868,6 @@ enum {
         */
        SR_CONF_DATA_SOURCE,
 
-       /**
-        * On devices without sample compression (or compression turned off),
-        * this returns the maximum number of samples that can be stored. This
-        * can change as probes are disabled, depending on the hardware, so
-        * should be queried after such changes are made. If not applicable,
-        * fetching this value with sr_config_get() will return SR_ERR_NA.
-        *
-        * SR_CONF_LIMIT_SAMPLES should not be set to a higher value than
-        * this value, if applicable.
-        */
-       SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
-
        /*--- Acquisition modes ---------------------------------------------*/
 
        /**