#include "agilent-dmm.h"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_MULTIMETER,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_MULTIMETER,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_CONTINUOUS,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
}
}
switch (hwcap) {
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
sr_err("LIMIT_MSEC can't be 0.");
sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
#include "protocol.h"
static const int hwcaps[] = {
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_CONTINUOUS,
0,
};
devc = sdi->priv;
switch (hwcap) {
- case SR_HWCAP_SAMPLERATE:
+ case SR_CONF_SAMPLERATE:
alsa_set_samplerate(sdi, *(const uint64_t *)value);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
break;
default:
};
static const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_CAPTURE_RATIO,
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_CAPTURE_RATIO,
- SR_HWCAP_LIMIT_MSEC,
+ SR_CONF_LIMIT_MSEC,
0,
};
devc = sdi->priv;
- if (hwcap == SR_HWCAP_SAMPLERATE) {
+ if (hwcap == SR_CONF_SAMPLERATE) {
ret = set_samplerate(sdi, *(const uint64_t *)value);
- } else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
+ } else if (hwcap == SR_CONF_LIMIT_MSEC) {
devc->limit_msec = *(const uint64_t *)value;
if (devc->limit_msec > 0)
ret = SR_OK;
else
ret = SR_ERR;
- } else if (hwcap == SR_HWCAP_CAPTURE_RATIO) {
+ } else if (hwcap == SR_CONF_CAPTURE_RATIO) {
devc->capture_ratio = *(const uint64_t *)value;
if (devc->capture_ratio < 0 || devc->capture_ratio > 100)
ret = SR_ERR;
}
switch (hwcap) {
- case SR_HWCAP_SAMPLERATE:
+ case SR_CONF_SAMPLERATE:
if (set_samplerate(sdi, *(const uint64_t *)value) == SR_ERR) {
sr_err("%s: setting samplerate failed.", __func__);
return SR_ERR;
}
sr_dbg("SAMPLERATE = %" PRIu64, devc->cur_samplerate);
break;
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
if (*(const uint64_t *)value == 0) {
sr_err("%s: LIMIT_MSEC can't be 0.", __func__);
return SR_ERR;
devc->limit_msec = *(const uint64_t *)value;
sr_dbg("LIMIT_MSEC = %" PRIu64, devc->limit_msec);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
if (*(const uint64_t *)value < MIN_NUM_SAMPLES) {
sr_err("%s: LIMIT_SAMPLES too small.", __func__);
return SR_ERR;
/* Note: Continuous sampling is not supported by the hardware. */
SR_PRIV const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_LIMIT_MSEC, /* TODO: Not yet implemented. */
- SR_HWCAP_LIMIT_SAMPLES, /* TODO: Not yet implemented. */
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_LIMIT_MSEC, /* TODO: Not yet implemented. */
+ SR_CONF_LIMIT_SAMPLES, /* TODO: Not yet implemented. */
0,
};
#define SERIALCOMM "2400/8n1"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_SOUNDLEVELMETER,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_SOUNDLEVELMETER,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_CONTINUOUS,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
}
}
switch (hwcap) {
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
sr_err("LIMIT_MSEC can't be 0.");
sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
#include "libsigrok.h"
#include "libsigrok-internal.h"
-/* SR_HWCAP_CONN takes one of these: */
+/* SR_CONF_CONN takes one of these: */
#define CONN_USB_VIDPID "^([0-9a-z]{1,4})\\.([0-9a-z]{1,4})$"
#define CONN_USB_BUSADDR "^(\\d+)\\.(\\d+)$"
};
static const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_DEMO_DEV,
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_PATTERN_MODE,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_DEMO_DEV,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_PATTERN_MODE,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_CONTINUOUS,
};
static const struct sr_samplerates samplerates = {
(void)sdi;
- if (hwcap == SR_HWCAP_SAMPLERATE) {
+ if (hwcap == SR_CONF_SAMPLERATE) {
cur_samplerate = *(const uint64_t *)value;
sr_dbg("%s: setting samplerate to %" PRIu64, __func__,
cur_samplerate);
ret = SR_OK;
- } else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
+ } else if (hwcap == SR_CONF_LIMIT_SAMPLES) {
limit_msec = 0;
limit_samples = *(const uint64_t *)value;
sr_dbg("%s: setting limit_samples to %" PRIu64, __func__,
limit_samples);
ret = SR_OK;
- } else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
+ } else if (hwcap == SR_CONF_LIMIT_MSEC) {
limit_msec = *(const uint64_t *)value;
limit_samples = 0;
sr_dbg("%s: setting limit_msec to %" PRIu64, __func__,
limit_msec);
ret = SR_OK;
- } else if (hwcap == SR_HWCAP_PATTERN_MODE) {
+ } else if (hwcap == SR_CONF_PATTERN_MODE) {
stropt = value;
ret = SR_OK;
if (!strcmp(stropt, "sigrok")) {
#include "fluke-dmm.h"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_MULTIMETER,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_MULTIMETER,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_CONTINUOUS,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
}
}
switch (hwcap) {
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
/* TODO: not yet implemented */
if (*(const uint64_t *)value == 0) {
sr_err("LIMIT_MSEC can't be 0.");
sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
};
static const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_SAMPLERATE,
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_SAMPLERATE,
/* These are really implemented in the driver, not the hardware. */
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_CONTINUOUS,
0,
};
if (devc->cur_samplerate == 0) {
/* Samplerate hasn't been set; default to the slowest one. */
- if (hw_dev_config_set(sdi, SR_HWCAP_SAMPLERATE,
+ if (hw_dev_config_set(sdi, SR_CONF_SAMPLERATE,
&supported_samplerates[0]) == SR_ERR)
return SR_ERR;
}
devc = sdi->priv;
- if (hwcap == SR_HWCAP_SAMPLERATE) {
+ if (hwcap == SR_CONF_SAMPLERATE) {
devc->cur_samplerate = *(const uint64_t *)value;
ret = SR_OK;
- } else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
+ } else if (hwcap == SR_CONF_LIMIT_SAMPLES) {
devc->limit_samples = *(const uint64_t *)value;
ret = SR_OK;
} else {
#define TICK 1
static const int hwcaps[] = {
- SR_HWCAP_OSCILLOSCOPE,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_CONTINUOUS,
- SR_HWCAP_TIMEBASE,
- SR_HWCAP_BUFFERSIZE,
- SR_HWCAP_TRIGGER_SOURCE,
- SR_HWCAP_TRIGGER_SLOPE,
- SR_HWCAP_HORIZ_TRIGGERPOS,
- SR_HWCAP_FILTER,
- SR_HWCAP_VDIV,
- SR_HWCAP_COUPLING,
+ SR_CONF_OSCILLOSCOPE,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_CONTINUOUS,
+ SR_CONF_TIMEBASE,
+ SR_CONF_BUFFERSIZE,
+ SR_CONF_TRIGGER_SOURCE,
+ SR_CONF_TRIGGER_SLOPE,
+ SR_CONF_HORIZ_TRIGGERPOS,
+ SR_CONF_FILTER,
+ SR_CONF_VDIV,
+ SR_CONF_COUPLING,
0,
};
ret = SR_OK;
devc = sdi->priv;
switch (hwcap) {
- case SR_HWCAP_LIMIT_FRAMES:
+ case SR_CONF_LIMIT_FRAMES:
devc->limit_frames = *(const uint64_t *)value;
break;
- case SR_HWCAP_TRIGGER_SLOPE:
+ case SR_CONF_TRIGGER_SLOPE:
tmp_u64 = *(const int *)value;
if (tmp_u64 != SLOPE_NEGATIVE && tmp_u64 != SLOPE_POSITIVE)
ret = SR_ERR_ARG;
devc->triggerslope = tmp_u64;
break;
- case SR_HWCAP_HORIZ_TRIGGERPOS:
+ case SR_CONF_HORIZ_TRIGGERPOS:
tmp_float = *(const float *)value;
if (tmp_float < 0.0 || tmp_float > 1.0) {
sr_err("Trigger position should be between 0.0 and 1.0.");
} else
devc->triggerposition = tmp_float;
break;
- case SR_HWCAP_BUFFERSIZE:
+ case SR_CONF_BUFFERSIZE:
tmp_u64 = *(const int *)value;
for (i = 0; buffersizes[i]; i++) {
if (buffersizes[i] == tmp_u64) {
if (buffersizes[i] == 0)
ret = SR_ERR_ARG;
break;
- case SR_HWCAP_TIMEBASE:
+ case SR_CONF_TIMEBASE:
tmp_rat = *(const struct sr_rational *)value;
for (i = 0; timebases[i].p && timebases[i].q; i++) {
if (timebases[i].p == tmp_rat.p
if (timebases[i].p == 0 && timebases[i].q == 0)
ret = SR_ERR_ARG;
break;
- case SR_HWCAP_TRIGGER_SOURCE:
+ case SR_CONF_TRIGGER_SOURCE:
for (i = 0; trigger_sources[i]; i++) {
if (!strcmp(value, trigger_sources[i])) {
devc->triggersource = g_strdup(value);
if (trigger_sources[i] == 0)
ret = SR_ERR_ARG;
break;
- case SR_HWCAP_FILTER:
+ case SR_CONF_FILTER:
devc->filter_ch1 = devc->filter_ch2 = devc->filter_trigger = 0;
targets = g_strsplit(value, ",", 0);
for (i = 0; targets[i]; i++) {
}
g_strfreev(targets);
break;
- case SR_HWCAP_VDIV:
+ case SR_CONF_VDIV:
/* TODO: Not supporting vdiv per channel yet. */
tmp_rat = *(const struct sr_rational *)value;
for (i = 0; vdivs[i].p && vdivs[i].q; i++) {
if (vdivs[i].p == 0 && vdivs[i].q == 0)
ret = SR_ERR_ARG;
break;
- case SR_HWCAP_COUPLING:
+ case SR_CONF_COUPLING:
/* TODO: Not supporting coupling per channel yet. */
for (i = 0; coupling[i]; i++) {
if (!strcmp(value, coupling[i])) {
static int hw_dev_close(struct sr_dev_inst *sdi);
static const int hwopts[] = {
- SR_HWOPT_CONN,
+ SR_CONF_CONN,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_THERMOMETER,
- SR_HWCAP_HYGROMETER,
- SR_HWCAP_LIMIT_SAMPLES,
+ SR_CONF_THERMOMETER,
+ SR_CONF_HYGROMETER,
+ SR_CONF_LIMIT_SAMPLES,
0
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
}
devc = sdi->priv;
ret = SR_OK;
switch (hwcap) {
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
#include "protocol.h"
static const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_TRIGGER_SLOPE,
- SR_HWCAP_HORIZ_TRIGGERPOS,
-// SR_HWCAP_CAPTURE_RATIO,
- SR_HWCAP_LIMIT_SAMPLES,
-// SR_HWCAP_RLE,
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_TRIGGER_SLOPE,
+ SR_CONF_HORIZ_TRIGGERPOS,
+// SR_CONF_CAPTURE_RATIO,
+ SR_CONF_LIMIT_SAMPLES,
+// SR_CONF_RLE,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
}
return SR_ERR;
switch (hwcap) {
- case SR_HWCAP_SAMPLERATE:
+ case SR_CONF_SAMPLERATE:
// FIXME
return mso_configure_rate(sdi, *(const uint64_t *)value);
ret = SR_OK;
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
num_samples = *(uint64_t *)value;
if (num_samples < 1024) {
sr_err("minimum of 1024 samples required");
ret = SR_OK;
}
break;
- case SR_HWCAP_CAPTURE_RATIO:
+ case SR_CONF_CAPTURE_RATIO:
ret = SR_OK;
break;
- case SR_HWCAP_TRIGGER_SLOPE:
+ case SR_CONF_TRIGGER_SLOPE:
slope = *(uint64_t *)value;
if (slope != SLOPE_NEGATIVE && slope != SLOPE_POSITIVE) {
sr_err("Invalid trigger slope");
ret = SR_OK;
}
break;
- case SR_HWCAP_HORIZ_TRIGGERPOS:
+ case SR_CONF_HORIZ_TRIGGERPOS:
pos = *(float *)value;
if (pos < 0 || pos > 255) {
sr_err("Trigger position (%f) should be between 0 and 255.", pos);
ret = SR_OK;
}
break;
- case SR_HWCAP_RLE:
+ case SR_CONF_RLE:
ret = SR_OK;
break;
default:
#define OSCI_VIDPID "04b4.1004"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_OSCILLOSCOPE,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_CONTINUOUS,
- SR_HWCAP_TIMEBASE,
- SR_HWCAP_VDIV,
+ SR_CONF_OSCILLOSCOPE,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_CONTINUOUS,
+ SR_CONF_TIMEBASE,
+ SR_CONF_VDIV,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
}
#define SERIALCOMM "115200/8n1"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_CAPTURE_RATIO,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_RLE,
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_CAPTURE_RATIO,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_RLE,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
}
return SR_ERR;
switch (hwcap) {
- case SR_HWCAP_SAMPLERATE:
+ case SR_CONF_SAMPLERATE:
ret = ols_set_samplerate(sdi, *(const uint64_t *)value,
&samplerates);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
tmp_u64 = value;
if (*tmp_u64 < MIN_NUM_SAMPLES)
return SR_ERR;
sr_info("Sample limit is %" PRIu64 ".", devc->limit_samples);
ret = SR_OK;
break;
- case SR_HWCAP_CAPTURE_RATIO:
+ case SR_CONF_CAPTURE_RATIO:
devc->capture_ratio = *(const uint64_t *)value;
if (devc->capture_ratio < 0 || devc->capture_ratio > 100) {
devc->capture_ratio = 0;
} else
ret = SR_OK;
break;
- case SR_HWCAP_RLE:
+ case SR_CONF_RLE:
if (GPOINTER_TO_INT(value)) {
sr_info("Enabling RLE.");
devc->flag_reg |= FLAG_RLE;
#include "protocol.h"
static const int hwcaps[] = {
- SR_HWCAP_OSCILLOSCOPE,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_TIMEBASE,
- SR_HWCAP_TRIGGER_SOURCE,
- SR_HWCAP_TRIGGER_SLOPE,
- SR_HWCAP_HORIZ_TRIGGERPOS,
- SR_HWCAP_VDIV,
- SR_HWCAP_COUPLING,
+ SR_CONF_OSCILLOSCOPE,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_TIMEBASE,
+ SR_CONF_TRIGGER_SOURCE,
+ SR_CONF_TRIGGER_SLOPE,
+ SR_CONF_HORIZ_TRIGGERPOS,
+ SR_CONF_VDIV,
+ SR_CONF_COUPLING,
0,
};
ret = SR_OK;
switch (hwcap) {
- case SR_HWCAP_LIMIT_FRAMES:
+ case SR_CONF_LIMIT_FRAMES:
devc->limit_frames = *(const uint64_t *)value;
break;
- case SR_HWCAP_TRIGGER_SLOPE:
+ case SR_CONF_TRIGGER_SLOPE:
tmp_u64 = *(const int *)value;
rigol_ds1xx2_send_data(devc->fd, ":TRIG:EDGE:SLOP %s\n",
tmp_u64 ? "POS" : "NEG");
break;
- case SR_HWCAP_HORIZ_TRIGGERPOS:
+ case SR_CONF_HORIZ_TRIGGERPOS:
tmp_float = *(const float *)value;
rigol_ds1xx2_send_data(devc->fd, ":TIM:OFFS %.9f\n", tmp_float);
break;
- case SR_HWCAP_TIMEBASE:
+ case SR_CONF_TIMEBASE:
tmp_rat = *(const struct sr_rational *)value;
rigol_ds1xx2_send_data(devc->fd, ":TIM:SCAL %.9f\n",
(float)tmp_rat.p / tmp_rat.q);
break;
- case SR_HWCAP_TRIGGER_SOURCE:
+ case SR_CONF_TRIGGER_SOURCE:
if (!strcmp(value, "CH1"))
channel = "CHAN1";
else if (!strcmp(value, "CH2"))
}
rigol_ds1xx2_send_data(devc->fd, ":TRIG:EDGE:SOUR %s\n", channel);
break;
- case SR_HWCAP_VDIV:
+ case SR_CONF_VDIV:
/* TODO: Not supporting vdiv per channel yet. */
tmp_rat = *(const struct sr_rational *)value;
for (i = 0; vdivs[i].p && vdivs[i].q; i++) {
if (vdivs[i].p == 0 && vdivs[i].q == 0)
ret = SR_ERR_ARG;
break;
- case SR_HWCAP_COUPLING:
+ case SR_CONF_COUPLING:
/* TODO: Not supporting coupling per channel yet. */
for (i = 0; coupling[i]; i++) {
if (!strcmp(value, coupling[i])) {
#include "protocol.h"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_MULTIMETER,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_MULTIMETER,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_CONTINUOUS,
0,
};
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
}
}
switch (hwcap) {
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
break;
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
devc->limit_msec = *(const uint64_t *)value;
sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
#define SERIALCOMM "9600/8e1"
static const int hwopts[] = {
- SR_HWOPT_CONN,
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_CONN,
+ SR_CONF_SERIALCOMM,
0,
};
static const int hwcaps[] = {
- SR_HWCAP_SOUNDLEVELMETER,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_SOUNDLEVELMETER,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_CONTINUOUS,
0,
};
continue;
}
switch (src->key) {
- case SR_HWOPT_CONN:
+ case SR_CONF_CONN:
conn = src->value;
break;
- case SR_HWOPT_SERIALCOMM:
+ case SR_CONF_SERIALCOMM:
serialcomm = src->value;
break;
default:
devc = sdi->priv;
switch (hwcap) {
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
};
static const int hwcaps[] = {
- SR_HWCAP_MULTIMETER,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_MULTIMETER,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_CONTINUOUS,
0,
};
devc = sdi->priv;
switch (hwcap) {
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
/* TODO: Not yet implemented. */
if (*(const uint64_t *)value == 0) {
sr_err("Time limit cannot be 0.");
sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
if (*(const uint64_t *)value == 0) {
sr_err("Sample limit cannot be 0.");
return SR_ERR;
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static const int hwcaps[] = {
- SR_HWCAP_MULTIMETER,
- SR_HWCAP_LIMIT_MSEC,
- SR_HWCAP_LIMIT_SAMPLES,
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_MULTIMETER,
+ SR_CONF_LIMIT_MSEC,
+ SR_CONF_LIMIT_SAMPLES,
+ SR_CONF_CONTINUOUS,
0
};
devc = sdi->priv;
ret = SR_OK;
switch (hwcap) {
- case SR_HWCAP_LIMIT_MSEC:
+ case SR_CONF_LIMIT_MSEC:
devc->limit_msec = *(const int64_t *)value;
now = g_get_monotonic_time() / 1000;
devc->end_time = now + devc->limit_msec;
sr_dbg("Setting time limit to %" PRIu64 "ms.",
devc->limit_msec);
break;
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = *(const uint64_t *)value;
sr_dbg("Setting sample limit to %" PRIu64 ".",
devc->limit_samples);
};
static const int hwcaps[] = {
- SR_HWCAP_LOGIC_ANALYZER,
- SR_HWCAP_SAMPLERATE,
- SR_HWCAP_CAPTURE_RATIO,
+ SR_CONF_LOGIC_ANALYZER,
+ SR_CONF_SAMPLERATE,
+ SR_CONF_CAPTURE_RATIO,
/* These are really implemented in the driver, not the hardware. */
- SR_HWCAP_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_SAMPLES,
0,
};
}
switch (hwcap) {
- case SR_HWCAP_SAMPLERATE:
+ case SR_CONF_SAMPLERATE:
return set_samplerate(devc, *(const uint64_t *)value);
- case SR_HWCAP_LIMIT_SAMPLES:
+ case SR_CONF_LIMIT_SAMPLES:
return set_limit_samples(devc, *(const uint64_t *)value);
- case SR_HWCAP_CAPTURE_RATIO:
+ case SR_CONF_CAPTURE_RATIO:
return set_capture_ratio(devc, *(const uint64_t *)value);
default:
return SR_ERR;
*/
static struct sr_config_info sr_config_info_data[] = {
- {SR_HWOPT_CONN, SR_T_CHAR, "conn",
+ {SR_CONF_CONN, SR_T_CHAR, "conn",
"Connection", NULL},
- {SR_HWOPT_SERIALCOMM, SR_T_CHAR, "serialcomm",
+ {SR_CONF_SERIALCOMM, SR_T_CHAR, "serialcomm",
"Serial communication", NULL},
- {SR_HWCAP_SAMPLERATE, SR_T_UINT64, "samplerate",
+ {SR_CONF_SAMPLERATE, SR_T_UINT64, "samplerate",
"Sample rate", NULL},
- {SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "captureratio",
+ {SR_CONF_CAPTURE_RATIO, SR_T_UINT64, "captureratio",
"Pre-trigger capture ratio", NULL},
- {SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "pattern",
+ {SR_CONF_PATTERN_MODE, SR_T_CHAR, "pattern",
"Pattern generator mode", NULL},
- {SR_HWCAP_RLE, SR_T_BOOL, "rle",
+ {SR_CONF_RLE, SR_T_BOOL, "rle",
"Run Length Encoding", NULL},
- {SR_HWCAP_TRIGGER_SLOPE, SR_T_UINT64, "triggerslope",
+ {SR_CONF_TRIGGER_SLOPE, SR_T_UINT64, "triggerslope",
"Trigger slope", NULL},
- {SR_HWCAP_TRIGGER_SOURCE, SR_T_CHAR, "triggersource",
+ {SR_CONF_TRIGGER_SOURCE, SR_T_CHAR, "triggersource",
"Trigger source", NULL},
- {SR_HWCAP_HORIZ_TRIGGERPOS, SR_T_FLOAT, "horiz_triggerpos",
+ {SR_CONF_HORIZ_TRIGGERPOS, SR_T_FLOAT, "horiz_triggerpos",
"Horizontal trigger position", NULL},
- {SR_HWCAP_BUFFERSIZE, SR_T_UINT64, "buffersize",
+ {SR_CONF_BUFFERSIZE, SR_T_UINT64, "buffersize",
"Buffer size", NULL},
- {SR_HWCAP_TIMEBASE, SR_T_RATIONAL_PERIOD, "timebase",
+ {SR_CONF_TIMEBASE, SR_T_RATIONAL_PERIOD, "timebase",
"Time base", NULL},
- {SR_HWCAP_FILTER, SR_T_CHAR, "filter",
+ {SR_CONF_FILTER, SR_T_CHAR, "filter",
"Filter targets", NULL},
- {SR_HWCAP_VDIV, SR_T_RATIONAL_VOLT, "vdiv",
+ {SR_CONF_VDIV, SR_T_RATIONAL_VOLT, "vdiv",
"Volts/div", NULL},
- {SR_HWCAP_COUPLING, SR_T_CHAR, "coupling",
+ {SR_CONF_COUPLING, SR_T_CHAR, "coupling",
"Coupling", NULL},
{0, 0, NULL, NULL, NULL},
};
* Returns information about the given driver or device instance.
*
* @param driver The sr_dev_driver struct to query.
- * @param id The type of information, in the form of an SR_HWCAP_* option.
+ * @param id The type of information, in the form of an SR_CONF_* option.
* @param data Pointer where the value. will be stored. Must not be NULL.
* @param sdi Pointer to the struct sr_dev_inst to be checked. Must not be NULL.
*
if (ctx->samplerate) {
packet.type = SR_DF_META;
packet.payload = &meta;
- src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&ctx->samplerate);
+ src = sr_config_make(SR_CONF_SAMPLERATE, (const void *)&ctx->samplerate);
meta.config = g_slist_append(NULL, src);
sr_session_send(in->sdi, &packet);
}
/* Send metadata about the SR_DF_LOGIC packets to come. */
packet.type = SR_DF_META;
packet.payload = &meta;
- src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&samplerate);
+ src = sr_config_make(SR_CONF_SAMPLERATE, (const void *)&samplerate);
meta.config = g_slist_append(NULL, src);
sr_session_send(in->sdi, &packet);
packet.type = SR_DF_META;
packet.payload = &meta;
samplerate = ctx->samplerate / ctx->downsample;
- src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&samplerate);
+ src = sr_config_make(SR_CONF_SAMPLERATE, (const void *)&samplerate);
meta.config = g_slist_append(NULL, src);
sr_session_send(in->sdi, &packet);
/*--- Device classes ------------------------------------------------*/
/** The device can act as logic analyzer. */
- SR_HWCAP_LOGIC_ANALYZER = 10000,
+ SR_CONF_LOGIC_ANALYZER = 10000,
/** The device can act as an oscilloscope. */
- SR_HWCAP_OSCILLOSCOPE,
+ SR_CONF_OSCILLOSCOPE,
/** The device can act as a multimeter. */
- SR_HWCAP_MULTIMETER,
+ SR_CONF_MULTIMETER,
/** The device is a demo device. */
- SR_HWCAP_DEMO_DEV,
+ SR_CONF_DEMO_DEV,
/** The device can act as a sound level meter. */
- SR_HWCAP_SOUNDLEVELMETER,
+ SR_CONF_SOUNDLEVELMETER,
/** The device can measure temperature. */
- SR_HWCAP_THERMOMETER,
+ SR_CONF_THERMOMETER,
/** The device can measure humidity. */
- SR_HWCAP_HYGROMETER,
+ SR_CONF_HYGROMETER,
/*--- Driver options ------------------------------------------------*/
/**
* Specification on how to connect to a device.
*
- * In combination with SR_HWOPT_SERIALCOMM, this is a serial port in
+ * In combination with SR_CONF_SERIALCOMM, this is a serial port in
* the form which makes sense to the OS (e.g., /dev/ttyS0).
* Otherwise this specifies a USB device, either in the form of
* @verbatim <bus>.<address> @endverbatim (decimal, e.g. 1.65) or
* @verbatim <vendorid>.<productid> @endverbatim
* (hexadecimal, e.g. 1d6b.0001).
*/
- SR_HWOPT_CONN = 20000,
+ SR_CONF_CONN = 20000,
/**
* Serial communication specification, in the form:
* This is always an optional parameter, since a driver typically
* knows the speed at which the device wants to communicate.
*/
- SR_HWOPT_SERIALCOMM,
+ SR_CONF_SERIALCOMM,
/*--- Device configuration ------------------------------------------*/
/** The device supports setting/changing its samplerate. */
- SR_HWCAP_SAMPLERATE = 30000,
+ SR_CONF_SAMPLERATE = 30000,
/** The device supports setting a pre/post-trigger capture ratio. */
- SR_HWCAP_CAPTURE_RATIO,
+ SR_CONF_CAPTURE_RATIO,
/** The device supports setting a pattern (pattern generator mode). */
- SR_HWCAP_PATTERN_MODE,
+ SR_CONF_PATTERN_MODE,
/** The device supports Run Length Encoding. */
- SR_HWCAP_RLE,
+ SR_CONF_RLE,
/** The device supports setting trigger slope. */
- SR_HWCAP_TRIGGER_SLOPE,
+ SR_CONF_TRIGGER_SLOPE,
/** Trigger source. */
- SR_HWCAP_TRIGGER_SOURCE,
+ SR_CONF_TRIGGER_SOURCE,
/** Horizontal trigger position. */
- SR_HWCAP_HORIZ_TRIGGERPOS,
+ SR_CONF_HORIZ_TRIGGERPOS,
/** Buffer size. */
- SR_HWCAP_BUFFERSIZE,
+ SR_CONF_BUFFERSIZE,
/** Time base. */
- SR_HWCAP_TIMEBASE,
+ SR_CONF_TIMEBASE,
/** Filter. */
- SR_HWCAP_FILTER,
+ SR_CONF_FILTER,
/** Volts/div. */
- SR_HWCAP_VDIV,
+ SR_CONF_VDIV,
/** Coupling. */
- SR_HWCAP_COUPLING,
+ SR_CONF_COUPLING,
/*--- Special stuff -------------------------------------------------*/
/** Session filename. */
- SR_HWCAP_SESSIONFILE = 40000,
+ SR_CONF_SESSIONFILE = 40000,
/* TODO: Better description. */
/** The device supports specifying a capturefile to inject. */
- SR_HWCAP_CAPTUREFILE,
+ SR_CONF_CAPTUREFILE,
/* TODO: Better description. */
/** The device supports specifying the capturefile unit size. */
- SR_HWCAP_CAPTURE_UNITSIZE,
+ SR_CONF_CAPTURE_UNITSIZE,
/* TODO: Better description. */
/** The device supports setting the number of probes. */
- SR_HWCAP_CAPTURE_NUM_PROBES,
+ SR_CONF_CAPTURE_NUM_PROBES,
/*--- Acquisition modes ---------------------------------------------*/
* The device supports setting a sample time limit (how long
* the sample acquisition should run, in ms).
*/
- SR_HWCAP_LIMIT_MSEC = 50000,
+ SR_CONF_LIMIT_MSEC = 50000,
/**
* The device supports setting a sample number limit (how many
* samples should be acquired).
*/
- SR_HWCAP_LIMIT_SAMPLES,
+ SR_CONF_LIMIT_SAMPLES,
/**
* The device supports setting a frame limit (how many
* frames should be acquired).
*/
- SR_HWCAP_LIMIT_FRAMES,
+ SR_CONF_LIMIT_FRAMES,
/**
* The device supports continuous sampling. Neither a time limit
* nor a sample number limit has to be supplied, it will just acquire
* samples continuously, until explicitly stopped by a certain command.
*/
- SR_HWCAP_CONTINUOUS,
+ SR_CONF_CONTINUOUS,
};
struct sr_dev_inst {
ctx->probelist[ctx->num_enabled_probes] = 0;
ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
- if (sr_dev_has_hwcap(o->sdi, SR_HWCAP_SAMPLERATE)) {
+ if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
ctx->samplerate = *samplerate;
num_probes = g_slist_length(o->sdi->probes);
- if (sr_dev_has_hwcap(o->sdi, SR_HWCAP_SAMPLERATE)) {
+ if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
ctx->samplerate = *samplerate;
num_probes = g_slist_length(o->sdi->probes);
comment[0] = '\0';
- if (sr_dev_has_hwcap(o->sdi, SR_HWCAP_SAMPLERATE)) {
+ if (sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
if (!(frequency_s = sr_samplerate_string(*samplerate))) {
}
ctx->unitsize = (num_enabled_probes + 7) / 8;
- if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_HWCAP_SAMPLERATE))
+ if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE))
o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
else {
snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
num_probes = g_slist_length(o->sdi->probes);
- if (o->sdi->driver || sr_dev_has_hwcap(o->sdi, SR_HWCAP_SAMPLERATE)) {
+ if (o->sdi->driver || sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
ret = o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
if (ret != SR_OK)
g_string_append_printf(ctx->header, "$version %s %s $end\n",
PACKAGE, PACKAGE_VERSION);
- if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_HWCAP_SAMPLERATE)) {
+ if (o->sdi->driver && sr_dev_has_hwcap(o->sdi, SR_CONF_SAMPLERATE)) {
o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
ctx->samplerate = *samplerate;
static GSList *dev_insts = NULL;
static const int hwcaps[] = {
- SR_HWCAP_CAPTUREFILE,
- SR_HWCAP_CAPTURE_UNITSIZE,
+ SR_CONF_CAPTUREFILE,
+ SR_CONF_CAPTURE_UNITSIZE,
0,
};
vdev = sdi->priv;
switch (hwcap) {
- case SR_HWCAP_SAMPLERATE:
+ case SR_CONF_SAMPLERATE:
tmp_u64 = value;
vdev->samplerate = *tmp_u64;
sr_info("Setting samplerate to %" PRIu64 ".", vdev->samplerate);
break;
- case SR_HWCAP_SESSIONFILE:
+ case SR_CONF_SESSIONFILE:
vdev->sessionfile = g_strdup(value);
sr_info("Setting sessionfile to '%s'.", vdev->sessionfile);
break;
- case SR_HWCAP_CAPTUREFILE:
+ case SR_CONF_CAPTUREFILE:
vdev->capturefile = g_strdup(value);
sr_info("Setting capturefile to '%s'.", vdev->capturefile);
break;
- case SR_HWCAP_CAPTURE_UNITSIZE:
+ case SR_CONF_CAPTURE_UNITSIZE:
tmp_u64 = value;
vdev->unitsize = *tmp_u64;
break;
- case SR_HWCAP_CAPTURE_NUM_PROBES:
+ case SR_CONF_CAPTURE_NUM_PROBES:
tmp_u64 = value;
vdev->num_probes = *tmp_u64;
break;
/* first device, init the driver */
sdi->driver->init(NULL);
sr_session_dev_add(sdi);
- sdi->driver->dev_config_set(sdi, SR_HWCAP_SESSIONFILE, filename);
- sdi->driver->dev_config_set(sdi, SR_HWCAP_CAPTUREFILE, val);
+ sdi->driver->dev_config_set(sdi, SR_CONF_SESSIONFILE, filename);
+ sdi->driver->dev_config_set(sdi, SR_CONF_CAPTUREFILE, val);
g_ptr_array_add(capturefiles, val);
} else if (!strcmp(keys[j], "samplerate")) {
sr_parse_sizestring(val, &tmp_u64);
- sdi->driver->dev_config_set(sdi, SR_HWCAP_SAMPLERATE, &tmp_u64);
+ sdi->driver->dev_config_set(sdi, SR_CONF_SAMPLERATE, &tmp_u64);
} else if (!strcmp(keys[j], "unitsize")) {
tmp_u64 = strtoull(val, NULL, 10);
- sdi->driver->dev_config_set(sdi, SR_HWCAP_CAPTURE_UNITSIZE, &tmp_u64);
+ sdi->driver->dev_config_set(sdi, SR_CONF_CAPTURE_UNITSIZE, &tmp_u64);
} else if (!strcmp(keys[j], "total probes")) {
total_probes = strtoull(val, NULL, 10);
- sdi->driver->dev_config_set(sdi, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
+ sdi->driver->dev_config_set(sdi, SR_CONF_CAPTURE_NUM_PROBES, &total_probes);
for (p = 0; p < total_probes; p++) {
snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
if (!(probe = sr_probe_new(p, SR_PROBE_LOGIC, TRUE,
fprintf(meta, "capturefile = logic-1\n");
fprintf(meta, "unitsize = %d\n", unitsize);
fprintf(meta, "total probes = %d\n", g_slist_length(sdi->probes));
- if (sr_dev_has_hwcap(sdi, SR_HWCAP_SAMPLERATE)) {
+ if (sr_dev_has_hwcap(sdi, SR_CONF_SAMPLERATE)) {
if (sr_info_get(sdi->driver, SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, sdi) == SR_OK) {
s = sr_samplerate_string(*samplerate);