SR_CONF_SAMPLERATE,
SR_CONF_LIMIT_MSEC, /* TODO: Not yet implemented. */
SR_CONF_LIMIT_SAMPLES, /* TODO: Not yet implemented. */
- SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
};
/*
} 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;
}
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;
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;
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] = {
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;
}
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;
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;
}
SR_CONF_PATTERN_MODE,
SR_CONF_SWAP,
SR_CONF_RLE,
- SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
};
#define STR_PATTERN_EXTERNAL "external"
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
- int num_channels, i;
(void)probe_group;
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;
}
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) {
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;
}
SR_CONF_CAPTURE_RATIO,
SR_CONF_VOLTAGE_THRESHOLD,
SR_CONF_LIMIT_SAMPLES,
- SR_CONF_MAX_UNCOMPRESSED_SAMPLES,
};
/*
} 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;
}
const struct sr_probe_group *probe_group)
{
struct dev_context *devc;
- GVariant *gvar;
+ GVariant *gvar, *grange[2];
GVariantBuilder gvb;
double v;
GVariant *range[2];
}
*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;
}
"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",
"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},
};
*/
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 ---------------------------------------------*/
/**