sr/cli/gtk: s/capability/hwcap/.
This commit is contained in:
parent
1d9a8a5fe1
commit
ffedd0bf5d
8
device.c
8
device.c
|
@ -374,7 +374,7 @@ SR_API int sr_dev_trigger_set(struct sr_dev *dev, int probenum,
|
||||||
*/
|
*/
|
||||||
SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
|
SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
|
||||||
{
|
{
|
||||||
int *capabilities, i;
|
int *hwcaps, i;
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
sr_err("dev: %s: dev was NULL", __func__);
|
sr_err("dev: %s: dev was NULL", __func__);
|
||||||
|
@ -388,13 +388,13 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
|
||||||
|
|
||||||
/* TODO: Sanity check on 'hwcap'. */
|
/* TODO: Sanity check on 'hwcap'. */
|
||||||
|
|
||||||
if (!(capabilities = dev->plugin->get_capabilities())) {
|
if (!(hwcaps = dev->plugin->hwcap_get_all())) {
|
||||||
sr_err("dev: %s: dev has no capabilities", __func__);
|
sr_err("dev: %s: dev has no capabilities", __func__);
|
||||||
return FALSE; /* TODO: SR_ERR*. */
|
return FALSE; /* TODO: SR_ERR*. */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; capabilities[i]; i++) {
|
for (i = 0; hwcaps[i]; i++) {
|
||||||
if (capabilities[i] != hwcap)
|
if (hwcaps[i] != hwcap)
|
||||||
continue;
|
continue;
|
||||||
sr_spew("dev: %s: found hwcap %d", __func__, hwcap);
|
sr_spew("dev: %s: found hwcap %d", __func__, hwcap);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct sr_analog_sample {
|
||||||
struct sr_analog_probe probes[];
|
struct sr_analog_probe probes[];
|
||||||
};
|
};
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
SR_HWCAP_LIMIT_SAMPLES,
|
SR_HWCAP_LIMIT_SAMPLES,
|
||||||
SR_HWCAP_CONTINUOUS,
|
SR_HWCAP_CONTINUOUS,
|
||||||
|
@ -86,6 +86,7 @@ static int hw_init(const char *devinfo)
|
||||||
dev_insts = g_slist_append(dev_insts, sdi);
|
dev_insts = g_slist_append(dev_insts, sdi);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
free_alsa:
|
free_alsa:
|
||||||
g_free(alsa);
|
g_free(alsa);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -203,12 +204,12 @@ static int hw_get_status(int dev_index)
|
||||||
return SR_ST_ACTIVE;
|
return SR_ST_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct alsa *alsa;
|
struct alsa *alsa;
|
||||||
|
@ -217,7 +218,7 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
alsa = sdi->priv;
|
alsa = sdi->priv;
|
||||||
|
|
||||||
switch (capability) {
|
switch (hwcap) {
|
||||||
case SR_HWCAP_PROBECONFIG:
|
case SR_HWCAP_PROBECONFIG:
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
case SR_HWCAP_SAMPLERATE:
|
case SR_HWCAP_SAMPLERATE:
|
||||||
|
@ -401,7 +402,7 @@ SR_PRIV struct sr_dev_plugin alsa_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -84,7 +84,7 @@ static struct sr_samplerates samplerates = {
|
||||||
supported_samplerates,
|
supported_samplerates,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
SR_HWCAP_CAPTURE_RATIO,
|
SR_HWCAP_CAPTURE_RATIO,
|
||||||
|
@ -792,12 +792,12 @@ static int hw_get_status(int dev_index)
|
||||||
return SR_ST_NOT_FOUND;
|
return SR_ST_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sigma *sigma;
|
struct sigma *sigma;
|
||||||
|
@ -808,17 +808,17 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
|
|
||||||
sigma = sdi->priv;
|
sigma = sdi->priv;
|
||||||
|
|
||||||
if (capability == SR_HWCAP_SAMPLERATE) {
|
if (hwcap == SR_HWCAP_SAMPLERATE) {
|
||||||
ret = set_samplerate(sdi, *(uint64_t*) value);
|
ret = set_samplerate(sdi, *(uint64_t*) value);
|
||||||
} else if (capability == SR_HWCAP_PROBECONFIG) {
|
} else if (hwcap == SR_HWCAP_PROBECONFIG) {
|
||||||
ret = configure_probes(sdi, value);
|
ret = configure_probes(sdi, value);
|
||||||
} else if (capability == SR_HWCAP_LIMIT_MSEC) {
|
} else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
|
||||||
sigma->limit_msec = *(uint64_t*) value;
|
sigma->limit_msec = *(uint64_t*) value;
|
||||||
if (sigma->limit_msec > 0)
|
if (sigma->limit_msec > 0)
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
else
|
else
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
} else if (capability == SR_HWCAP_CAPTURE_RATIO) {
|
} else if (hwcap == SR_HWCAP_CAPTURE_RATIO) {
|
||||||
sigma->capture_ratio = *(uint64_t*) value;
|
sigma->capture_ratio = *(uint64_t*) value;
|
||||||
if (sigma->capture_ratio < 0 || sigma->capture_ratio > 100)
|
if (sigma->capture_ratio < 0 || sigma->capture_ratio > 100)
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
|
@ -1421,7 +1421,7 @@ SR_PRIV struct sr_dev_plugin asix_sigma_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -126,7 +126,7 @@ static struct sr_samplerates samplerates = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Note: Continuous sampling is not supported by the hardware. */
|
/* Note: Continuous sampling is not supported by the hardware. */
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
SR_HWCAP_LIMIT_MSEC, /* TODO: Not yet implemented. */
|
SR_HWCAP_LIMIT_MSEC, /* TODO: Not yet implemented. */
|
||||||
|
@ -755,14 +755,14 @@ static int hw_get_status(int dev_index)
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
sr_spew("la8: entering %s", __func__);
|
sr_spew("la8: entering %s", __func__);
|
||||||
|
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct la8 *la8;
|
struct la8 *la8;
|
||||||
|
@ -779,7 +779,7 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
return SR_ERR; /* TODO: SR_ERR_ARG? */
|
return SR_ERR; /* TODO: SR_ERR_ARG? */
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (capability) {
|
switch (hwcap) {
|
||||||
case SR_HWCAP_SAMPLERATE:
|
case SR_HWCAP_SAMPLERATE:
|
||||||
if (set_samplerate(sdi, *(uint64_t *)value) == SR_ERR)
|
if (set_samplerate(sdi, *(uint64_t *)value) == SR_ERR)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -1123,7 +1123,7 @@ SR_PRIV struct sr_dev_plugin chronovu_la8_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct databag {
|
||||||
GTimer *timer;
|
GTimer *timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
SR_HWCAP_DEMO_DEV,
|
SR_HWCAP_DEMO_DEV,
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
|
@ -222,12 +222,12 @@ static int hw_get_status(int dev_index)
|
||||||
return SR_ST_ACTIVE;
|
return SR_ST_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *stropt;
|
char *stropt;
|
||||||
|
@ -235,25 +235,25 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
/* Avoid compiler warnings. */
|
/* Avoid compiler warnings. */
|
||||||
(void)dev_index;
|
(void)dev_index;
|
||||||
|
|
||||||
if (capability == SR_HWCAP_PROBECONFIG) {
|
if (hwcap == SR_HWCAP_PROBECONFIG) {
|
||||||
/* Nothing to do, but must be supported */
|
/* Nothing to do, but must be supported */
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
} else if (capability == SR_HWCAP_SAMPLERATE) {
|
} else if (hwcap == SR_HWCAP_SAMPLERATE) {
|
||||||
cur_samplerate = *(uint64_t *)value;
|
cur_samplerate = *(uint64_t *)value;
|
||||||
sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
|
sr_dbg("demo: %s: setting samplerate to %" PRIu64, __func__,
|
||||||
cur_samplerate);
|
cur_samplerate);
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
} else if (capability == SR_HWCAP_LIMIT_SAMPLES) {
|
} else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
|
||||||
limit_samples = *(uint64_t *)value;
|
limit_samples = *(uint64_t *)value;
|
||||||
sr_dbg("demo: %s: setting limit_samples to %" PRIu64, __func__,
|
sr_dbg("demo: %s: setting limit_samples to %" PRIu64, __func__,
|
||||||
limit_samples);
|
limit_samples);
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
} else if (capability == SR_HWCAP_LIMIT_MSEC) {
|
} else if (hwcap == SR_HWCAP_LIMIT_MSEC) {
|
||||||
limit_msec = *(uint64_t *)value;
|
limit_msec = *(uint64_t *)value;
|
||||||
sr_dbg("demo: %s: setting limit_msec to %" PRIu64, __func__,
|
sr_dbg("demo: %s: setting limit_msec to %" PRIu64, __func__,
|
||||||
limit_msec);
|
limit_msec);
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
} else if (capability == SR_HWCAP_PATTERN_MODE) {
|
} else if (hwcap == SR_HWCAP_PATTERN_MODE) {
|
||||||
stropt = value;
|
stropt = value;
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
if (!strcmp(stropt, "sigrok")) {
|
if (!strcmp(stropt, "sigrok")) {
|
||||||
|
@ -499,7 +499,7 @@ SR_PRIV struct sr_dev_plugin demo_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define NUM_PROBES 8
|
#define NUM_PROBES 8
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
// SR_HWCAP_OSCILLOSCOPE,
|
// SR_HWCAP_OSCILLOSCOPE,
|
||||||
// SR_HWCAP_PAT_GENERATOR,
|
// SR_HWCAP_PAT_GENERATOR,
|
||||||
|
@ -645,19 +645,19 @@ static int hw_get_status(int dev_index)
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
|
|
||||||
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
|
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
switch (capability) {
|
switch (hwcap) {
|
||||||
case SR_HWCAP_SAMPLERATE:
|
case SR_HWCAP_SAMPLERATE:
|
||||||
return mso_configure_rate(sdi, *(uint64_t *) value);
|
return mso_configure_rate(sdi, *(uint64_t *) value);
|
||||||
case SR_HWCAP_PROBECONFIG:
|
case SR_HWCAP_PROBECONFIG:
|
||||||
|
@ -839,7 +839,7 @@ SR_PRIV struct sr_dev_plugin link_mso19_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#define O_NONBLOCK FIONBIO
|
#define O_NONBLOCK FIONBIO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
SR_HWCAP_CAPTURE_RATIO,
|
SR_HWCAP_CAPTURE_RATIO,
|
||||||
|
@ -600,9 +600,9 @@ static int hw_get_status(int dev_index)
|
||||||
return sdi->status;
|
return sdi->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
||||||
|
@ -638,7 +638,7 @@ static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct ols_dev *ols;
|
struct ols_dev *ols;
|
||||||
|
@ -652,7 +652,7 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
switch (capability) {
|
switch (hwcap) {
|
||||||
case SR_HWCAP_SAMPLERATE:
|
case SR_HWCAP_SAMPLERATE:
|
||||||
tmp_u64 = value;
|
tmp_u64 = value;
|
||||||
ret = set_configuration_samplerate(sdi, *tmp_u64);
|
ret = set_configuration_samplerate(sdi, *tmp_u64);
|
||||||
|
@ -1048,7 +1048,7 @@ SR_PRIV struct sr_dev_plugin ols_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -36,7 +36,7 @@ static struct fx2_profile supported_fx2[] = {
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0 }
|
{ 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static libusb_context *usb_context = NULL;
|
||||||
|
|
||||||
static int new_saleae_logic_firmware = 0;
|
static int new_saleae_logic_firmware = 0;
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value);
|
static int hw_set_configuration(int dev_index, int hwcap, void *value);
|
||||||
static int hw_stop_acquisition(int dev_index, gpointer session_dev_id);
|
static int hw_stop_acquisition(int dev_index, gpointer session_dev_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -545,9 +545,9 @@ static int hw_get_status(int dev_index)
|
||||||
return SR_ST_NOT_FOUND;
|
return SR_ST_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t new_firmware_divider_value(uint64_t samplerate)
|
static uint8_t new_firmware_divider_value(uint64_t samplerate)
|
||||||
|
@ -628,7 +628,7 @@ static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct fx2_dev *fx2;
|
struct fx2_dev *fx2;
|
||||||
|
@ -639,12 +639,12 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
fx2 = sdi->priv;
|
fx2 = sdi->priv;
|
||||||
|
|
||||||
if (capability == SR_HWCAP_SAMPLERATE) {
|
if (hwcap == SR_HWCAP_SAMPLERATE) {
|
||||||
tmp_u64 = value;
|
tmp_u64 = value;
|
||||||
ret = set_configuration_samplerate(sdi, *tmp_u64);
|
ret = set_configuration_samplerate(sdi, *tmp_u64);
|
||||||
} else if (capability == SR_HWCAP_PROBECONFIG) {
|
} else if (hwcap == SR_HWCAP_PROBECONFIG) {
|
||||||
ret = configure_probes(fx2, (GSList *) value);
|
ret = configure_probes(fx2, (GSList *) value);
|
||||||
} else if (capability == SR_HWCAP_LIMIT_SAMPLES) {
|
} else if (hwcap == SR_HWCAP_LIMIT_SAMPLES) {
|
||||||
tmp_u64 = value;
|
tmp_u64 = value;
|
||||||
fx2->limit_samples = *tmp_u64;
|
fx2->limit_samples = *tmp_u64;
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
@ -901,7 +901,7 @@ SR_PRIV struct sr_dev_plugin saleae_logic_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
|
@ -63,7 +63,7 @@ static model_t zeroplus_models[] = {
|
||||||
{0x7016, "LAP-C(162000)", 16, 2048, 200},
|
{0x7016, "LAP-C(162000)", 16, 2048, 200},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_LOGIC_ANALYZER,
|
SR_HWCAP_LOGIC_ANALYZER,
|
||||||
SR_HWCAP_SAMPLERATE,
|
SR_HWCAP_SAMPLERATE,
|
||||||
SR_HWCAP_PROBECONFIG,
|
SR_HWCAP_PROBECONFIG,
|
||||||
|
@ -166,7 +166,7 @@ struct zp {
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value);
|
static int hw_set_configuration(int dev_index, int hwcap, void *value);
|
||||||
|
|
||||||
static unsigned int get_memory_size(int type)
|
static unsigned int get_memory_size(int type)
|
||||||
{
|
{
|
||||||
|
@ -563,9 +563,9 @@ static int hw_get_status(int dev_index)
|
||||||
return SR_ST_NOT_FOUND;
|
return SR_ST_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
||||||
|
@ -597,7 +597,7 @@ static int set_configuration_samplerate(struct sr_dev_inst *sdi,
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
uint64_t *tmp_u64;
|
uint64_t *tmp_u64;
|
||||||
|
@ -613,7 +613,7 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (capability) {
|
switch (hwcap) {
|
||||||
case SR_HWCAP_SAMPLERATE:
|
case SR_HWCAP_SAMPLERATE:
|
||||||
tmp_u64 = value;
|
tmp_u64 = value;
|
||||||
return set_configuration_samplerate(sdi, *tmp_u64);
|
return set_configuration_samplerate(sdi, *tmp_u64);
|
||||||
|
@ -739,7 +739,7 @@ SR_PRIV struct sr_dev_plugin zeroplus_logic_cube_plugin_info = {
|
||||||
.closedev = hw_closedev,
|
.closedev = hw_closedev,
|
||||||
.get_dev_info = hw_get_dev_info,
|
.get_dev_info = hw_get_dev_info,
|
||||||
.get_status = hw_get_status,
|
.get_status = hw_get_status,
|
||||||
.get_capabilities = hw_get_capabilities,
|
.hwcap_get_all = hw_hwcap_get_all,
|
||||||
.set_configuration = hw_set_configuration,
|
.set_configuration = hw_set_configuration,
|
||||||
.start_acquisition = hw_start_acquisition,
|
.start_acquisition = hw_start_acquisition,
|
||||||
.stop_acquisition = hw_stop_acquisition,
|
.stop_acquisition = hw_stop_acquisition,
|
||||||
|
|
12
hwplugin.c
12
hwplugin.c
|
@ -270,11 +270,11 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
|
||||||
*/
|
*/
|
||||||
SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap)
|
SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap)
|
||||||
{
|
{
|
||||||
int *capabilities, i;
|
int *hwcaps, i;
|
||||||
|
|
||||||
capabilities = plugin->get_capabilities();
|
hwcaps = plugin->hwcap_get_all();
|
||||||
for (i = 0; capabilities[i]; i++) {
|
for (i = 0; hwcaps[i]; i++) {
|
||||||
if (capabilities[i] == hwcap)
|
if (hwcaps[i] == hwcap)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; sr_hwcap_options[i].capability; i++) {
|
for (i = 0; sr_hwcap_options[i].hwcap; i++) {
|
||||||
if (sr_hwcap_options[i].capability == hwcap)
|
if (sr_hwcap_options[i].hwcap == hwcap)
|
||||||
return &sr_hwcap_options[i];
|
return &sr_hwcap_options[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct session_vdev {
|
||||||
|
|
||||||
static char *sessionfile = NULL;
|
static char *sessionfile = NULL;
|
||||||
static GSList *dev_insts = NULL;
|
static GSList *dev_insts = NULL;
|
||||||
static int capabilities[] = {
|
static int hwcaps[] = {
|
||||||
SR_HWCAP_CAPTUREFILE,
|
SR_HWCAP_CAPTUREFILE,
|
||||||
SR_HWCAP_CAPTURE_UNITSIZE,
|
SR_HWCAP_CAPTURE_UNITSIZE,
|
||||||
0,
|
0,
|
||||||
|
@ -227,12 +227,12 @@ static int hw_get_status(int dev_index)
|
||||||
* @return A pointer to the (hardware) capabilities of this virtual session
|
* @return A pointer to the (hardware) capabilities of this virtual session
|
||||||
* driver. This could be NULL, if no such capabilities exist.
|
* driver. This could be NULL, if no such capabilities exist.
|
||||||
*/
|
*/
|
||||||
static int *hw_get_capabilities(void)
|
static int *hw_hwcap_get_all(void)
|
||||||
{
|
{
|
||||||
return capabilities;
|
return hwcaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hw_set_configuration(int dev_index, int capability, void *value)
|
static int hw_set_configuration(int dev_index, int hwcap, void *value)
|
||||||
{
|
{
|
||||||
struct session_vdev *vdev;
|
struct session_vdev *vdev;
|
||||||
uint64_t *tmp_u64;
|
uint64_t *tmp_u64;
|
||||||
|
@ -240,7 +240,7 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
if (!(vdev = get_vdev_by_index(dev_index)))
|
if (!(vdev = get_vdev_by_index(dev_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
switch (capability) {
|
switch (hwcap) {
|
||||||
case SR_HWCAP_SAMPLERATE:
|
case SR_HWCAP_SAMPLERATE:
|
||||||
tmp_u64 = value;
|
tmp_u64 = value;
|
||||||
vdev->samplerate = *tmp_u64;
|
vdev->samplerate = *tmp_u64;
|
||||||
|
@ -262,7 +262,7 @@ static int hw_set_configuration(int dev_index, int capability, void *value)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sr_err("session driver: %s: unknown capability %d requested",
|
sr_err("session driver: %s: unknown capability %d requested",
|
||||||
__func__, capability);
|
__func__, hwcap);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ SR_PRIV struct sr_dev_plugin session_driver = {
|
||||||
NULL,
|
NULL,
|
||||||
hw_get_dev_info,
|
hw_get_dev_info,
|
||||||
hw_get_status,
|
hw_get_status,
|
||||||
hw_get_capabilities,
|
hw_hwcap_get_all,
|
||||||
hw_set_configuration,
|
hw_set_configuration,
|
||||||
hw_start_acquisition,
|
hw_start_acquisition,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
6
sigrok.h
6
sigrok.h
|
@ -270,7 +270,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sr_hwcap_option {
|
struct sr_hwcap_option {
|
||||||
int capability;
|
int hwcap;
|
||||||
int type;
|
int type;
|
||||||
char *description;
|
char *description;
|
||||||
char *shortname;
|
char *shortname;
|
||||||
|
@ -351,8 +351,8 @@ struct sr_dev_plugin {
|
||||||
int (*closedev) (int dev_index);
|
int (*closedev) (int dev_index);
|
||||||
void *(*get_dev_info) (int dev_index, int dev_info_id);
|
void *(*get_dev_info) (int dev_index, int dev_info_id);
|
||||||
int (*get_status) (int dev_index);
|
int (*get_status) (int dev_index);
|
||||||
int *(*get_capabilities) (void);
|
int *(*hwcap_get_all) (void);
|
||||||
int (*set_configuration) (int dev_index, int capability, void *value);
|
int (*set_configuration) (int dev_index, int hwcap, void *value);
|
||||||
int (*start_acquisition) (int dev_index, gpointer session_dev_id);
|
int (*start_acquisition) (int dev_index, gpointer session_dev_id);
|
||||||
int (*stop_acquisition) (int dev_index, gpointer session_dev_id);
|
int (*stop_acquisition) (int dev_index, gpointer session_dev_id);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue