Rename SR_HWOPT_* and SR_HWCAP_* to SR_CONF_*
This commit is contained in:
parent
c89c1c9c21
commit
1953564a96
|
@ -28,16 +28,16 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -125,10 +125,10 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
|
||||
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.");
|
||||
|
@ -290,7 +290,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -177,10 +177,10 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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:
|
||||
|
|
|
@ -77,11 +77,11 @@ static const struct sr_samplerates samplerates = {
|
|||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -824,15 +824,15 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
|
||||
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;
|
||||
|
|
|
@ -334,14 +334,14 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -349,7 +349,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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;
|
||||
|
|
|
@ -46,10 +46,10 @@ const struct sr_samplerates samplerates = {
|
|||
|
||||
/* 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,
|
||||
};
|
||||
|
||||
|
|
|
@ -31,16 +31,16 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -105,10 +105,10 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
|
||||
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.");
|
||||
|
@ -234,7 +234,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#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+)$"
|
||||
|
||||
|
|
|
@ -84,13 +84,13 @@ struct dev_context {
|
|||
};
|
||||
|
||||
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 = {
|
||||
|
@ -259,24 +259,24 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
|
||||
(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")) {
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -203,10 +203,10 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
|
||||
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.");
|
||||
|
@ -324,7 +324,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
|
|
@ -82,12 +82,12 @@ static const struct fx2lafw_profile supported_fx2[] = {
|
|||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -561,7 +561,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -640,10 +640,10 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
|
||||
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 {
|
||||
|
|
|
@ -38,17 +38,17 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -473,16 +473,16 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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.");
|
||||
|
@ -490,7 +490,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
} 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) {
|
||||
|
@ -501,7 +501,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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
|
||||
|
@ -513,7 +513,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
@ -523,7 +523,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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++) {
|
||||
|
@ -543,7 +543,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
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++) {
|
||||
|
@ -557,7 +557,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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])) {
|
||||
|
|
|
@ -29,14 +29,14 @@ static struct sr_dev_driver *di = &lascar_el_usb_driver_info;
|
|||
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
|
||||
};
|
||||
|
||||
|
@ -107,7 +107,7 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -82,10 +82,10 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
@ -342,12 +342,12 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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");
|
||||
|
@ -359,10 +359,10 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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");
|
||||
|
@ -372,7 +372,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
@ -383,7 +383,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
ret = SR_OK;
|
||||
}
|
||||
break;
|
||||
case SR_HWCAP_RLE:
|
||||
case SR_CONF_RLE:
|
||||
ret = SR_OK;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -30,17 +30,17 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -179,7 +179,7 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -22,17 +22,17 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -91,10 +91,10 @@ static GSList *hw_scan(GSList *options)
|
|||
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;
|
||||
}
|
||||
|
@ -295,11 +295,11 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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;
|
||||
|
@ -309,7 +309,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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;
|
||||
|
@ -317,7 +317,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
} 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;
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -370,24 +370,24 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
|
||||
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"))
|
||||
|
@ -402,7 +402,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
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++) {
|
||||
|
@ -418,7 +418,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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])) {
|
||||
|
|
|
@ -30,16 +30,16 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -301,10 +301,10 @@ static GSList *hw_scan(GSList *options, int dmm)
|
|||
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;
|
||||
}
|
||||
|
@ -406,12 +406,12 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
#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,
|
||||
};
|
||||
|
||||
|
@ -104,10 +104,10 @@ static GSList *hw_scan(GSList *options)
|
|||
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:
|
||||
|
@ -227,7 +227,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
|
|
@ -32,10 +32,10 @@ static const int hwopts[] = {
|
|||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -229,7 +229,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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.");
|
||||
|
@ -239,7 +239,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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;
|
||||
|
|
|
@ -37,10 +37,10 @@ static int hw_dev_close(struct sr_dev_inst *sdi);
|
|||
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
|
||||
};
|
||||
|
||||
|
@ -280,14 +280,14 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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);
|
||||
|
|
|
@ -71,12 +71,12 @@ static model_t zeroplus_models[] = {
|
|||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -640,11 +640,11 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
30
hwdriver.c
30
hwdriver.c
|
@ -42,33 +42,33 @@
|
|||
*/
|
||||
|
||||
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},
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ SR_PRIV struct sr_config *sr_config_make(int key, const void *value)
|
|||
* 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.
|
||||
*
|
||||
|
|
|
@ -124,7 +124,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
/* 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);
|
||||
|
||||
|
|
|
@ -574,7 +574,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
|||
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);
|
||||
|
||||
|
|
60
libsigrok.h
60
libsigrok.h
|
@ -388,39 +388,39 @@ enum {
|
|||
/*--- 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:
|
||||
|
@ -441,62 +441,62 @@ enum {
|
|||
* 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 ---------------------------------------------*/
|
||||
|
||||
|
@ -504,26 +504,26 @@ enum {
|
|||
* 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 {
|
||||
|
|
|
@ -128,7 +128,7 @@ static int init(struct sr_output *o)
|
|||
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;
|
||||
|
|
|
@ -99,7 +99,7 @@ static int init(struct sr_output *o)
|
|||
|
||||
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;
|
||||
|
|
|
@ -109,7 +109,7 @@ static int init(struct sr_output *o)
|
|||
|
||||
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))) {
|
||||
|
|
|
@ -69,7 +69,7 @@ static int init(struct sr_output *o)
|
|||
}
|
||||
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 {
|
||||
|
|
|
@ -123,7 +123,7 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
|
|||
|
||||
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)
|
||||
|
|
|
@ -94,7 +94,7 @@ static int init(struct sr_output *o)
|
|||
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;
|
||||
|
|
|
@ -53,8 +53,8 @@ struct session_vdev {
|
|||
|
||||
static GSList *dev_insts = NULL;
|
||||
static const int hwcaps[] = {
|
||||
SR_HWCAP_CAPTUREFILE,
|
||||
SR_HWCAP_CAPTURE_UNITSIZE,
|
||||
SR_CONF_CAPTUREFILE,
|
||||
SR_CONF_CAPTURE_UNITSIZE,
|
||||
0,
|
||||
};
|
||||
|
||||
|
@ -180,24 +180,24 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
|
|||
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;
|
||||
|
|
|
@ -146,18 +146,18 @@ SR_API int sr_session_load(const char *filename)
|
|||
/* 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,
|
||||
|
@ -253,7 +253,7 @@ SR_API int sr_session_save(const char *filename, const struct sr_dev_inst *sdi,
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue