Replace 'probe group' with 'channel group' everywhere.
The name 'probe' (and thus 'probe group') is a relic from the times when sigrok was mostly about logic analyzers. Nowadays we support a lot more device types where 'probe' is not really a good term and 'channel' is much better suited. This fixes parts of bug #259.
This commit is contained in:
parent
3fd2dca207
commit
660e398fe9
|
@ -26,7 +26,7 @@ import itertools
|
||||||
|
|
||||||
__all__ = ['Error', 'Context', 'Driver', 'Device', 'Session', 'Packet', 'Log',
|
__all__ = ['Error', 'Context', 'Driver', 'Device', 'Session', 'Packet', 'Log',
|
||||||
'LogLevel', 'PacketType', 'Quantity', 'Unit', 'QuantityFlag', 'ConfigKey',
|
'LogLevel', 'PacketType', 'Quantity', 'Unit', 'QuantityFlag', 'ConfigKey',
|
||||||
'ProbeType', 'Probe', 'ProbeGroup', 'InputFormat', 'OutputFormat',
|
'ProbeType', 'Probe', 'ChannelGroup', 'InputFormat', 'OutputFormat',
|
||||||
'InputFile', 'Output']
|
'InputFile', 'Output']
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
|
@ -174,7 +174,7 @@ class Device(object):
|
||||||
device.struct = struct
|
device.struct = struct
|
||||||
device.context = context
|
device.context = context
|
||||||
device._probes = None
|
device._probes = None
|
||||||
device._probe_groups = None
|
device._channel_groups = None
|
||||||
context._devices[address] = device
|
context._devices[address] = device
|
||||||
return context._devices[address]
|
return context._devices[address]
|
||||||
|
|
||||||
|
@ -202,17 +202,17 @@ class Device(object):
|
||||||
return self._probes
|
return self._probes
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def probe_groups(self):
|
def channel_groups(self):
|
||||||
if self._probe_groups is None:
|
if self._channel_groups is None:
|
||||||
self._probe_groups = {}
|
self._channel_groups = {}
|
||||||
probe_group_list = self.struct.probe_groups
|
channel_group_list = self.struct.channel_groups
|
||||||
while (probe_group_list):
|
while (channel_group_list):
|
||||||
probe_group_ptr = void_ptr_to_sr_probe_group_ptr(
|
channel_group_ptr = void_ptr_to_sr_channel_group_ptr(
|
||||||
probe_group_list.data)
|
channel_group_list.data)
|
||||||
self._probe_groups[probe_group_ptr.name] = ProbeGroup(self,
|
self._channel_groups[channel_group_ptr.name] = ChannelGroup(self,
|
||||||
probe_group_ptr)
|
channel_group_ptr)
|
||||||
probe_group_list = probe_group_list.next
|
channel_group_list = channel_group_list.next
|
||||||
return self._probe_groups
|
return self._channel_groups
|
||||||
|
|
||||||
class HardwareDevice(Device):
|
class HardwareDevice(Device):
|
||||||
|
|
||||||
|
@ -262,15 +262,15 @@ class Probe(object):
|
||||||
def name(self):
|
def name(self):
|
||||||
return self.struct.name
|
return self.struct.name
|
||||||
|
|
||||||
class ProbeGroup(object):
|
class ChannelGroup(object):
|
||||||
|
|
||||||
def __init__(self, device, struct):
|
def __init__(self, device, struct):
|
||||||
self.device = device
|
self.device = device
|
||||||
self.struct = struct
|
self.struct = struct
|
||||||
self._probes = None
|
self._channels = None
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self.probes)
|
return iter(self.channels)
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
key = config_key(name)
|
key = config_key(name)
|
||||||
|
@ -281,7 +281,7 @@ class ProbeGroup(object):
|
||||||
except Error as error:
|
except Error as error:
|
||||||
if error.errno == SR_ERR_NA:
|
if error.errno == SR_ERR_NA:
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
"Probe group does not implement %s" % name)
|
"Channel group does not implement %s" % name)
|
||||||
else:
|
else:
|
||||||
raise AttributeError
|
raise AttributeError
|
||||||
value = gvariant_ptr_ptr_value(data)
|
value = gvariant_ptr_ptr_value(data)
|
||||||
|
@ -291,7 +291,7 @@ class ProbeGroup(object):
|
||||||
try:
|
try:
|
||||||
key = config_key(name)
|
key = config_key(name)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
super(ProbeGroup, self).__setattr__(name, value)
|
super(ChannelGroup, self).__setattr__(name, value)
|
||||||
return
|
return
|
||||||
check(sr_config_set(self.device.struct, self.struct,
|
check(sr_config_set(self.device.struct, self.struct,
|
||||||
key.id, python_to_gvariant(value)))
|
key.id, python_to_gvariant(value)))
|
||||||
|
@ -301,15 +301,15 @@ class ProbeGroup(object):
|
||||||
return self.struct.name
|
return self.struct.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def probes(self):
|
def channels(self):
|
||||||
if self._probes is None:
|
if self._channels is None:
|
||||||
self._probes = []
|
self._channels = []
|
||||||
probe_list = self.struct.probes
|
channel_list = self.struct.channels
|
||||||
while (probe_list):
|
while (channel_list):
|
||||||
probe_ptr = void_ptr_to_sr_probe_ptr(probe_list.data)
|
channel_ptr = void_ptr_to_sr_probe_ptr(channel_list.data)
|
||||||
self._probes.append(Probe(self, probe_ptr))
|
self._channels.append(Probe(self, probe_ptr))
|
||||||
probe_list = probe_list.next
|
channel_list = channel_list.next
|
||||||
return self._probes
|
return self._channels
|
||||||
|
|
||||||
class Session(object):
|
class Session(object):
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ gchar *g_string_free(GString *string, gboolean free_segment);
|
||||||
%pointer_cast(void *, struct sr_datafeed_logic *, void_ptr_to_sr_datafeed_logic_ptr)
|
%pointer_cast(void *, struct sr_datafeed_logic *, void_ptr_to_sr_datafeed_logic_ptr)
|
||||||
%pointer_cast(void *, struct sr_datafeed_analog *, void_ptr_to_sr_datafeed_analog_ptr)
|
%pointer_cast(void *, struct sr_datafeed_analog *, void_ptr_to_sr_datafeed_analog_ptr)
|
||||||
%pointer_cast(void *, struct sr_probe *, void_ptr_to_sr_probe_ptr)
|
%pointer_cast(void *, struct sr_probe *, void_ptr_to_sr_probe_ptr)
|
||||||
%pointer_cast(void *, struct sr_probe_group *, void_ptr_to_sr_probe_group_ptr)
|
%pointer_cast(void *, struct sr_channel_group *, void_ptr_to_sr_channel_group_ptr)
|
||||||
|
|
||||||
%extend sr_input_format {
|
%extend sr_input_format {
|
||||||
int call_format_match(const char *filename) {
|
int call_format_match(const char *filename) {
|
||||||
|
|
6
device.c
6
device.c
|
@ -285,7 +285,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
|
||||||
sdi->model = model ? g_strdup(model) : NULL;
|
sdi->model = model ? g_strdup(model) : NULL;
|
||||||
sdi->version = version ? g_strdup(version) : NULL;
|
sdi->version = version ? g_strdup(version) : NULL;
|
||||||
sdi->probes = NULL;
|
sdi->probes = NULL;
|
||||||
sdi->probe_groups = NULL;
|
sdi->channel_groups = NULL;
|
||||||
sdi->conn = NULL;
|
sdi->conn = NULL;
|
||||||
sdi->priv = NULL;
|
sdi->priv = NULL;
|
||||||
|
|
||||||
|
@ -309,8 +309,8 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
g_slist_free(sdi->probes);
|
g_slist_free(sdi->probes);
|
||||||
|
|
||||||
if (sdi->probe_groups)
|
if (sdi->channel_groups)
|
||||||
g_slist_free(sdi->probe_groups);
|
g_slist_free(sdi->channel_groups);
|
||||||
|
|
||||||
g_free(sdi->vendor);
|
g_free(sdi->vendor);
|
||||||
g_free(sdi->model);
|
g_free(sdi->model);
|
||||||
|
|
8
error.c
8
error.c
|
@ -76,8 +76,8 @@ SR_API const char *sr_strerror(int error_code)
|
||||||
return "device closed but should be open";
|
return "device closed but should be open";
|
||||||
case SR_ERR_TIMEOUT:
|
case SR_ERR_TIMEOUT:
|
||||||
return "timeout occurred";
|
return "timeout occurred";
|
||||||
case SR_ERR_PROBE_GROUP:
|
case SR_ERR_CHANNEL_GROUP:
|
||||||
return "no probe group specified";
|
return "no channel group specified";
|
||||||
default:
|
default:
|
||||||
return "unknown error";
|
return "unknown error";
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,8 @@ SR_API const char *sr_strerror_name(int error_code)
|
||||||
return "SR_ERR_DEV_CLOSED";
|
return "SR_ERR_DEV_CLOSED";
|
||||||
case SR_ERR_TIMEOUT:
|
case SR_ERR_TIMEOUT:
|
||||||
return "SR_ERR_TIMEOUT";
|
return "SR_ERR_TIMEOUT";
|
||||||
case SR_ERR_PROBE_GROUP:
|
case SR_ERR_CHANNEL_GROUP:
|
||||||
return "SR_PROBE_GROUP";
|
return "SR_ERR_CHANNEL_GROUP";
|
||||||
default:
|
default:
|
||||||
return "unknown error code";
|
return "unknown error code";
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,11 +170,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -208,10 +208,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -129,11 +129,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -148,11 +148,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -174,14 +174,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
|
@ -138,11 +138,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
|
@ -162,13 +162,13 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -206,10 +206,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -745,11 +745,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -767,12 +767,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -801,13 +801,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
|
@ -88,7 +88,7 @@ static GSList *scan(GSList *options, int modelid)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
struct sr_probe_group *pg;
|
struct sr_channel_group *pg;
|
||||||
struct sr_serial_dev_inst *serial;
|
struct sr_serial_dev_inst *serial;
|
||||||
GSList *l, *devices;
|
GSList *l, *devices;
|
||||||
struct pps_model *model;
|
struct pps_model *model;
|
||||||
|
@ -169,11 +169,11 @@ static GSList *scan(GSList *options, int modelid)
|
||||||
snprintf(channel, 10, "CH%d", i + 1);
|
snprintf(channel, 10, "CH%d", i + 1);
|
||||||
probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel);
|
probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel);
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
pg = g_malloc(sizeof(struct sr_probe_group));
|
pg = g_malloc(sizeof(struct sr_channel_group));
|
||||||
pg->name = g_strdup(channel);
|
pg->name = g_strdup(channel);
|
||||||
pg->probes = g_slist_append(NULL, probe);
|
pg->probes = g_slist_append(NULL, probe);
|
||||||
pg->priv = NULL;
|
pg->priv = NULL;
|
||||||
sdi->probe_groups = g_slist_append(sdi->probe_groups, pg);
|
sdi->channel_groups = g_slist_append(sdi->channel_groups, pg);
|
||||||
}
|
}
|
||||||
|
|
||||||
devc = g_malloc0(sizeof(struct dev_context));
|
devc = g_malloc0(sizeof(struct dev_context));
|
||||||
|
@ -206,7 +206,7 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
|
@ -218,8 +218,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
/* No probe group: global options. */
|
/* No channel group: global options. */
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_OUTPUT_CHANNEL:
|
case SR_CONF_OUTPUT_CHANNEL:
|
||||||
*data = g_variant_new_string(channel_modes[devc->channel_mode]);
|
*data = g_variant_new_string(channel_modes[devc->channel_mode]);
|
||||||
|
@ -231,8 +231,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* We only ever have one channel per probe group in this driver. */
|
/* We only ever have one channel per channel group in this driver. */
|
||||||
probe = probe_group->probes->data;
|
probe = channel_group->probes->data;
|
||||||
channel = probe->index;
|
channel = probe->index;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -275,7 +275,7 @@ static int find_str(const char *str, const char **strings, int array_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
|
@ -289,8 +289,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
/* No probe group: global options. */
|
/* No channel group: global options. */
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_OUTPUT_CHANNEL:
|
case SR_CONF_OUTPUT_CHANNEL:
|
||||||
sval = g_variant_get_string(data, NULL);
|
sval = g_variant_get_string(data, NULL);
|
||||||
|
@ -321,9 +321,9 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Probe group specified: per-channel options. */
|
/* Channel group specified: per-channel options. */
|
||||||
/* We only ever have one channel per probe group in this driver. */
|
/* We only ever have one channel per channel group in this driver. */
|
||||||
probe = probe_group->probes->data;
|
probe = channel_group->probes->data;
|
||||||
channel = probe->index;
|
channel = probe->index;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -359,7 +359,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
|
@ -379,8 +379,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
/* No probe group: global options. */
|
/* No channel group: global options. */
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
|
@ -399,11 +399,11 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Probe group specified: per-channel options. */
|
/* Channel group specified: per-channel options. */
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
/* We only ever have one channel per probe group in this driver. */
|
/* We only ever have one channel per channel group in this driver. */
|
||||||
probe = probe_group->probes->data;
|
probe = channel_group->probes->data;
|
||||||
channel = probe->index;
|
channel = probe->index;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -183,11 +183,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc = sdi->priv;
|
struct dev_context *devc = sdi->priv;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
|
@ -204,11 +204,11 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -235,10 +235,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -150,12 +150,12 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -181,10 +181,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -166,14 +166,14 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GVariant *range[2];
|
GVariant *range[2];
|
||||||
uint64_t low, high;
|
uint64_t low, high;
|
||||||
int tmp, ret;
|
int tmp, ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
@ -238,7 +238,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint64_t tmp_u64, low, high;
|
uint64_t tmp_u64, low, high;
|
||||||
|
@ -246,7 +246,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
int tmp, ret;
|
int tmp, ret;
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -328,7 +328,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *tuple, *range[2];
|
GVariant *tuple, *range[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
@ -336,7 +336,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -161,11 +161,11 @@ static int cleanup(int idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -191,10 +191,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -263,11 +263,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -287,11 +287,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -333,13 +333,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar, *grange[2];
|
GVariant *gvar, *grange[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
|
@ -130,11 +130,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -168,10 +168,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -122,12 +122,12 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
double dblval;
|
double dblval;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -165,12 +165,12 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -118,12 +118,12 @@ struct dev_context {
|
||||||
/* Logic */
|
/* Logic */
|
||||||
int32_t num_logic_probes;
|
int32_t num_logic_probes;
|
||||||
unsigned int logic_unitsize;
|
unsigned int logic_unitsize;
|
||||||
/* There is only ever one logic probe group, so its pattern goes here. */
|
/* There is only ever one logic channel group, so its pattern goes here. */
|
||||||
uint8_t logic_pattern;
|
uint8_t logic_pattern;
|
||||||
unsigned char logic_data[LOGIC_BUFSIZE];
|
unsigned char logic_data[LOGIC_BUFSIZE];
|
||||||
/* Analog */
|
/* Analog */
|
||||||
int32_t num_analog_probes;
|
int32_t num_analog_probes;
|
||||||
GSList *analog_probe_groups;
|
GSList *analog_channel_groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int32_t scanopts[] = {
|
static const int32_t scanopts[] = {
|
||||||
|
@ -171,7 +171,7 @@ static int init(struct sr_context *sr_ctx)
|
||||||
return std_init(sr_ctx, di, LOG_PREFIX);
|
return std_init(sr_ctx, di, LOG_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void generate_analog_pattern(const struct sr_probe_group *probe_group, uint64_t sample_rate)
|
static void generate_analog_pattern(const struct sr_channel_group *channel_group, uint64_t sample_rate)
|
||||||
{
|
{
|
||||||
struct analog_gen *ag;
|
struct analog_gen *ag;
|
||||||
double t, frequency;
|
double t, frequency;
|
||||||
|
@ -179,12 +179,12 @@ static void generate_analog_pattern(const struct sr_probe_group *probe_group, ui
|
||||||
unsigned int num_samples, i;
|
unsigned int num_samples, i;
|
||||||
int last_end;
|
int last_end;
|
||||||
|
|
||||||
ag = probe_group->priv;
|
ag = channel_group->priv;
|
||||||
num_samples = ANALOG_BUFSIZE / sizeof(float);
|
num_samples = ANALOG_BUFSIZE / sizeof(float);
|
||||||
|
|
||||||
sr_dbg("Generating %s pattern for probe group %s",
|
sr_dbg("Generating %s pattern for channel group %s",
|
||||||
analog_pattern_str[ag->pattern],
|
analog_pattern_str[ag->pattern],
|
||||||
probe_group->name);
|
channel_group->name);
|
||||||
|
|
||||||
switch (ag->pattern) {
|
switch (ag->pattern) {
|
||||||
case PATTERN_SQUARE:
|
case PATTERN_SQUARE:
|
||||||
|
@ -257,7 +257,7 @@ static GSList *scan(GSList *options)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
struct sr_probe_group *pg;
|
struct sr_channel_group *pg;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
struct analog_gen *ag;
|
struct analog_gen *ag;
|
||||||
GSList *devices, *l;
|
GSList *devices, *l;
|
||||||
|
@ -300,10 +300,10 @@ static GSList *scan(GSList *options)
|
||||||
devc->logic_unitsize = (devc->num_logic_probes + 7) / 8;
|
devc->logic_unitsize = (devc->num_logic_probes + 7) / 8;
|
||||||
devc->logic_pattern = PATTERN_SIGROK;
|
devc->logic_pattern = PATTERN_SIGROK;
|
||||||
devc->num_analog_probes = num_analog_probes;
|
devc->num_analog_probes = num_analog_probes;
|
||||||
devc->analog_probe_groups = NULL;
|
devc->analog_channel_groups = NULL;
|
||||||
|
|
||||||
/* Logic probes, all in one probe group. */
|
/* Logic probes, all in one channel group. */
|
||||||
if (!(pg = g_try_malloc(sizeof(struct sr_probe_group))))
|
if (!(pg = g_try_malloc(sizeof(struct sr_channel_group))))
|
||||||
return NULL;
|
return NULL;
|
||||||
pg->name = g_strdup("Logic");
|
pg->name = g_strdup("Logic");
|
||||||
pg->probes = NULL;
|
pg->probes = NULL;
|
||||||
|
@ -315,9 +315,9 @@ static GSList *scan(GSList *options)
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
pg->probes = g_slist_append(pg->probes, probe);
|
pg->probes = g_slist_append(pg->probes, probe);
|
||||||
}
|
}
|
||||||
sdi->probe_groups = g_slist_append(NULL, pg);
|
sdi->channel_groups = g_slist_append(NULL, pg);
|
||||||
|
|
||||||
/* Analog probes, probe groups and pattern generators. */
|
/* Analog probes, channel groups and pattern generators. */
|
||||||
|
|
||||||
pattern = 0;
|
pattern = 0;
|
||||||
for (i = 0; i < num_analog_probes; i++) {
|
for (i = 0; i < num_analog_probes; i++) {
|
||||||
|
@ -327,13 +327,13 @@ static GSList *scan(GSList *options)
|
||||||
return NULL;
|
return NULL;
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
|
|
||||||
/* Every analog probe gets its own probe group. */
|
/* Every analog probe gets its own channel group. */
|
||||||
if (!(pg = g_try_malloc(sizeof(struct sr_probe_group))))
|
if (!(pg = g_try_malloc(sizeof(struct sr_channel_group))))
|
||||||
return NULL;
|
return NULL;
|
||||||
pg->name = g_strdup(probe_name);
|
pg->name = g_strdup(probe_name);
|
||||||
pg->probes = g_slist_append(NULL, probe);
|
pg->probes = g_slist_append(NULL, probe);
|
||||||
|
|
||||||
/* Every probe group gets a generator struct. */
|
/* Every channel group gets a generator struct. */
|
||||||
if (!(ag = g_try_malloc(sizeof(struct analog_gen))))
|
if (!(ag = g_try_malloc(sizeof(struct analog_gen))))
|
||||||
return NULL;
|
return NULL;
|
||||||
ag->packet.probes = pg->probes;
|
ag->packet.probes = pg->probes;
|
||||||
|
@ -344,8 +344,8 @@ static GSList *scan(GSList *options)
|
||||||
ag->pattern = pattern;
|
ag->pattern = pattern;
|
||||||
pg->priv = ag;
|
pg->priv = ag;
|
||||||
|
|
||||||
sdi->probe_groups = g_slist_append(sdi->probe_groups, pg);
|
sdi->channel_groups = g_slist_append(sdi->channel_groups, pg);
|
||||||
devc->analog_probe_groups = g_slist_append(devc->analog_probe_groups, pg);
|
devc->analog_channel_groups = g_slist_append(devc->analog_channel_groups, pg);
|
||||||
|
|
||||||
if (++pattern == ARRAY_SIZE(analog_pattern_str))
|
if (++pattern == ARRAY_SIZE(analog_pattern_str))
|
||||||
pattern = 0;
|
pattern = 0;
|
||||||
|
@ -383,7 +383,7 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
|
@ -405,14 +405,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
*data = g_variant_new_uint64(devc->limit_msec);
|
*data = g_variant_new_uint64(devc->limit_msec);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_PATTERN_MODE:
|
case SR_CONF_PATTERN_MODE:
|
||||||
if (!probe_group)
|
if (!channel_group)
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
probe = probe_group->probes->data;
|
probe = channel_group->probes->data;
|
||||||
if (probe->type == SR_PROBE_LOGIC) {
|
if (probe->type == SR_PROBE_LOGIC) {
|
||||||
pattern = devc->logic_pattern;
|
pattern = devc->logic_pattern;
|
||||||
*data = g_variant_new_string(logic_pattern_str[pattern]);
|
*data = g_variant_new_string(logic_pattern_str[pattern]);
|
||||||
} else if (probe->type == SR_PROBE_ANALOG) {
|
} else if (probe->type == SR_PROBE_ANALOG) {
|
||||||
ag = probe_group->priv;
|
ag = channel_group->priv;
|
||||||
pattern = ag->pattern;
|
pattern = ag->pattern;
|
||||||
*data = g_variant_new_string(analog_pattern_str[pattern]);
|
*data = g_variant_new_string(analog_pattern_str[pattern]);
|
||||||
} else
|
} else
|
||||||
|
@ -432,7 +432,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct analog_gen *ag;
|
struct analog_gen *ag;
|
||||||
|
@ -463,10 +463,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
sr_dbg("Setting time limit to %" PRIu64"ms", devc->limit_msec);
|
sr_dbg("Setting time limit to %" PRIu64"ms", devc->limit_msec);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_PATTERN_MODE:
|
case SR_CONF_PATTERN_MODE:
|
||||||
if (!probe_group)
|
if (!channel_group)
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
stropt = g_variant_get_string(data, NULL);
|
stropt = g_variant_get_string(data, NULL);
|
||||||
probe = probe_group->probes->data;
|
probe = channel_group->probes->data;
|
||||||
pattern = -1;
|
pattern = -1;
|
||||||
if (probe->type == SR_PROBE_LOGIC) {
|
if (probe->type == SR_PROBE_LOGIC) {
|
||||||
for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) {
|
for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) {
|
||||||
|
@ -495,10 +495,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
if (pattern == -1)
|
if (pattern == -1)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
sr_dbg("Setting analog pattern for probe group %s to %s",
|
sr_dbg("Setting analog pattern for channel group %s to %s",
|
||||||
probe_group->name,
|
channel_group->name,
|
||||||
analog_pattern_str[pattern]);
|
analog_pattern_str[pattern]);
|
||||||
ag = probe_group->priv;
|
ag = channel_group->priv;
|
||||||
ag->pattern = pattern;
|
ag->pattern = pattern;
|
||||||
} else
|
} else
|
||||||
return SR_ERR_BUG;
|
return SR_ERR_BUG;
|
||||||
|
@ -511,7 +511,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
|
@ -528,7 +528,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
|
@ -545,7 +545,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
probe = probe_group->probes->data;
|
probe = channel_group->probes->data;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
|
@ -617,7 +617,7 @@ static int prepare_data(int fd, int revents, void *cb_data)
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_logic logic;
|
struct sr_datafeed_logic logic;
|
||||||
struct sr_probe_group *pg;
|
struct sr_channel_group *pg;
|
||||||
struct analog_gen *ag;
|
struct analog_gen *ag;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
uint64_t logic_todo, analog_todo, expected_samplenum, analog_samples, sending_now;
|
uint64_t logic_todo, analog_todo, expected_samplenum, analog_samples, sending_now;
|
||||||
|
@ -657,7 +657,7 @@ static int prepare_data(int fd, int revents, void *cb_data)
|
||||||
/* Analog, one probe at a time */
|
/* Analog, one probe at a time */
|
||||||
if (devc->num_analog_probes > 0 && analog_todo > 0) {
|
if (devc->num_analog_probes > 0 && analog_todo > 0) {
|
||||||
sending_now = 0;
|
sending_now = 0;
|
||||||
for (l = devc->analog_probe_groups; l; l = l->next) {
|
for (l = devc->analog_channel_groups; l; l = l->next) {
|
||||||
pg = l->data;
|
pg = l->data;
|
||||||
ag = pg->priv;
|
ag = pg->priv;
|
||||||
packet.type = SR_DF_ANALOG;
|
packet.type = SR_DF_ANALOG;
|
||||||
|
@ -669,7 +669,7 @@ static int prepare_data(int fd, int revents, void *cb_data)
|
||||||
* help here as well */
|
* help here as well */
|
||||||
|
|
||||||
analog_samples = MIN(analog_todo, ag->num_samples);
|
analog_samples = MIN(analog_todo, ag->num_samples);
|
||||||
/* Whichever probe group gets there first. */
|
/* Whichever channel group gets there first. */
|
||||||
sending_now = MAX(sending_now, analog_samples);
|
sending_now = MAX(sending_now, analog_samples);
|
||||||
ag->packet.num_samples = analog_samples;
|
ag->packet.num_samples = analog_samples;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
|
@ -714,7 +714,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = devc->analog_probe_groups; l; l = l->next) {
|
for (l = devc->analog_channel_groups; l; l = l->next) {
|
||||||
generate_analog_pattern(l->data, devc->cur_samplerate);
|
generate_analog_pattern(l->data, devc->cur_samplerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,11 +204,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -242,10 +242,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -347,13 +347,13 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
char str[128];
|
char str[128];
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_CONN:
|
case SR_CONF_CONN:
|
||||||
|
@ -381,12 +381,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -407,13 +407,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -423,18 +423,18 @@ static int cleanup_2x_bd232(void)
|
||||||
|
|
||||||
/** Get value of configuration item */
|
/** Get value of configuration item */
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)data;
|
(void)data;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
@ -460,10 +460,10 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
|
|
||||||
/** Implementation of config_list, auxiliary function for common parts, */
|
/** Implementation of config_list, auxiliary function for common parts, */
|
||||||
static int config_list_common(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list_common(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
@ -479,10 +479,10 @@ static int config_list_common(int key, GVariant **data, const struct sr_dev_inst
|
||||||
|
|
||||||
/** Implementation of config_list for Metrahit 1x/2x send mode */
|
/** Implementation of config_list for Metrahit 1x/2x send mode */
|
||||||
static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
@ -490,7 +490,7 @@ static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sd
|
||||||
hwcaps_sm, ARRAY_SIZE(hwcaps_sm), sizeof(int32_t));
|
hwcaps_sm, ARRAY_SIZE(hwcaps_sm), sizeof(int32_t));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return config_list_common(key, data, sdi, probe_group);
|
return config_list_common(key, data, sdi, channel_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -498,10 +498,10 @@ static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sd
|
||||||
|
|
||||||
/** Implementation of config_list for Metrahit 2x bidirectional mode */
|
/** Implementation of config_list for Metrahit 2x bidirectional mode */
|
||||||
static int config_list_bd(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list_bd(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
@ -509,7 +509,7 @@ static int config_list_bd(int key, GVariant **data, const struct sr_dev_inst *sd
|
||||||
hwcaps_bd, ARRAY_SIZE(hwcaps_bd), sizeof(int32_t));
|
hwcaps_bd, ARRAY_SIZE(hwcaps_bd), sizeof(int32_t));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return config_list_common(key, data, sdi, probe_group);
|
return config_list_common(key, data, sdi, channel_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
|
|
@ -1492,13 +1492,13 @@ SR_PRIV const char *gmc_model_str(enum model mcode)
|
||||||
/** @copydoc sr_dev_driver.config_set
|
/** @copydoc sr_dev_driver.config_set
|
||||||
*/
|
*/
|
||||||
SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint8_t params[9];
|
uint8_t params[9];
|
||||||
uint8_t msg[42];
|
uint8_t msg[42];
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
|
@ -120,7 +120,7 @@ struct dev_context {
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group);
|
const struct sr_channel_group *channel_group);
|
||||||
SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf);
|
SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf);
|
||||||
SR_PRIV void dump_msg14(guchar* buf, gboolean raw);
|
SR_PRIV void dump_msg14(guchar* buf, gboolean raw);
|
||||||
SR_PRIV int gmc_decode_model_bd(uint8_t mcode);
|
SR_PRIV int gmc_decode_model_bd(uint8_t mcode);
|
||||||
|
|
|
@ -183,32 +183,32 @@ static int cleanup(void)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_probe_group(struct dev_context *devc,
|
static int check_channel_group(struct dev_context *devc,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct scope_config *model;
|
struct scope_config *model;
|
||||||
|
|
||||||
model = devc->model_config;
|
model = devc->model_config;
|
||||||
|
|
||||||
if (!probe_group)
|
if (!channel_group)
|
||||||
return PG_NONE;
|
return PG_NONE;
|
||||||
|
|
||||||
for (i = 0; i < model->analog_channels; ++i)
|
for (i = 0; i < model->analog_channels; ++i)
|
||||||
if (probe_group == &devc->analog_groups[i])
|
if (channel_group == &devc->analog_groups[i])
|
||||||
return PG_ANALOG;
|
return PG_ANALOG;
|
||||||
|
|
||||||
for (i = 0; i < model->digital_pods; ++i)
|
for (i = 0; i < model->digital_pods; ++i)
|
||||||
if (probe_group == &devc->digital_groups[i])
|
if (channel_group == &devc->digital_groups[i])
|
||||||
return PG_DIGITAL;
|
return PG_DIGITAL;
|
||||||
|
|
||||||
sr_err("Invalid probe group specified.");
|
sr_err("Invalid channel group specified.");
|
||||||
|
|
||||||
return PG_INVALID;
|
return PG_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int ret, pg_type;
|
int ret, pg_type;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -219,7 +219,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
if ((pg_type = check_probe_group(devc, probe_group)) == PG_INVALID)
|
if ((pg_type = check_channel_group(devc, channel_group)) == PG_INVALID)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
ret = SR_ERR_NA;
|
ret = SR_ERR_NA;
|
||||||
|
@ -238,11 +238,11 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_NUM_VDIV:
|
case SR_CONF_NUM_VDIV:
|
||||||
if (pg_type == PG_NONE) {
|
if (pg_type == PG_NONE) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
} else if (pg_type == PG_ANALOG) {
|
} else if (pg_type == PG_ANALOG) {
|
||||||
for (i = 0; i < model->analog_channels; ++i) {
|
for (i = 0; i < model->analog_channels; ++i) {
|
||||||
if (probe_group != &devc->analog_groups[i])
|
if (channel_group != &devc->analog_groups[i])
|
||||||
continue;
|
continue;
|
||||||
*data = g_variant_new_int32(model->num_ydivs);
|
*data = g_variant_new_int32(model->num_ydivs);
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
@ -286,11 +286,11 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_COUPLING:
|
case SR_CONF_COUPLING:
|
||||||
if (pg_type == PG_NONE) {
|
if (pg_type == PG_NONE) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
} else if (pg_type == PG_ANALOG) {
|
} else if (pg_type == PG_ANALOG) {
|
||||||
for (i = 0; i < model->analog_channels; ++i) {
|
for (i = 0; i < model->analog_channels; ++i) {
|
||||||
if (probe_group != &devc->analog_groups[i])
|
if (channel_group != &devc->analog_groups[i])
|
||||||
continue;
|
continue;
|
||||||
*data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]);
|
*data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]);
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
@ -332,7 +332,7 @@ static GVariant *build_tuples(const uint64_t (*array)[][2], unsigned int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int ret, pg_type;
|
int ret, pg_type;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
@ -348,7 +348,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
if ((pg_type = check_probe_group(devc, probe_group)) == PG_INVALID)
|
if ((pg_type = check_channel_group(devc, channel_group)) == PG_INVALID)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
model = devc->model_config;
|
model = devc->model_config;
|
||||||
|
@ -378,8 +378,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_VDIV:
|
case SR_CONF_VDIV:
|
||||||
if (pg_type == PG_NONE) {
|
if (pg_type == PG_NONE) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_variant_get(data, "(tt)", &p, &q);
|
g_variant_get(data, "(tt)", &p, &q);
|
||||||
|
@ -389,7 +389,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
q != (*model->vdivs)[i][1])
|
q != (*model->vdivs)[i][1])
|
||||||
continue;
|
continue;
|
||||||
for (j = 1; j <= model->analog_channels; ++j) {
|
for (j = 1; j <= model->analog_channels; ++j) {
|
||||||
if (probe_group != &devc->analog_groups[j - 1])
|
if (channel_group != &devc->analog_groups[j - 1])
|
||||||
continue;
|
continue;
|
||||||
state->analog_channels[j - 1].vdiv = i;
|
state->analog_channels[j - 1].vdiv = i;
|
||||||
g_ascii_formatd(float_str, sizeof(float_str), "%E", (float) p / q);
|
g_ascii_formatd(float_str, sizeof(float_str), "%E", (float) p / q);
|
||||||
|
@ -461,8 +461,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_COUPLING:
|
case SR_CONF_COUPLING:
|
||||||
if (pg_type == PG_NONE) {
|
if (pg_type == PG_NONE) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = g_variant_get_string(data, NULL);
|
tmp = g_variant_get_string(data, NULL);
|
||||||
|
@ -471,7 +471,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
if (strcmp(tmp, (*model->coupling_options)[i]) != 0)
|
if (strcmp(tmp, (*model->coupling_options)[i]) != 0)
|
||||||
continue;
|
continue;
|
||||||
for (j = 1; j <= model->analog_channels; ++j) {
|
for (j = 1; j <= model->analog_channels; ++j) {
|
||||||
if (probe_group != &devc->analog_groups[j - 1])
|
if (channel_group != &devc->analog_groups[j - 1])
|
||||||
continue;
|
continue;
|
||||||
state->analog_channels[j-1].coupling = i;
|
state->analog_channels[j-1].coupling = i;
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int pg_type;
|
int pg_type;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
@ -513,7 +513,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
if ((pg_type = check_probe_group(devc, probe_group)) == PG_INVALID)
|
if ((pg_type = check_channel_group(devc, channel_group)) == PG_INVALID)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
||||||
model = devc->model_config;
|
model = devc->model_config;
|
||||||
|
@ -535,7 +535,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_COUPLING:
|
case SR_CONF_COUPLING:
|
||||||
if (pg_type == PG_NONE)
|
if (pg_type == PG_NONE)
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
*data = g_variant_new_strv(*model->coupling_options,
|
*data = g_variant_new_strv(*model->coupling_options,
|
||||||
g_strv_length((char **)*model->coupling_options));
|
g_strv_length((char **)*model->coupling_options));
|
||||||
break;
|
break;
|
||||||
|
@ -552,7 +552,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
break;
|
break;
|
||||||
case SR_CONF_VDIV:
|
case SR_CONF_VDIV:
|
||||||
if (pg_type == PG_NONE)
|
if (pg_type == PG_NONE)
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
*data = build_tuples(model->vdivs, model->num_vdivs);
|
*data = build_tuples(model->vdivs, model->num_vdivs);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -604,11 +604,11 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devc->analog_groups = g_try_malloc0(sizeof(struct sr_probe_group) *
|
if (!(devc->analog_groups = g_try_malloc0(sizeof(struct sr_channel_group) *
|
||||||
scope_models[model_index].analog_channels)))
|
scope_models[model_index].analog_channels)))
|
||||||
return SR_ERR_MALLOC;
|
return SR_ERR_MALLOC;
|
||||||
|
|
||||||
if (!(devc->digital_groups = g_try_malloc0(sizeof(struct sr_probe_group) *
|
if (!(devc->digital_groups = g_try_malloc0(sizeof(struct sr_channel_group) *
|
||||||
scope_models[model_index].digital_pods)))
|
scope_models[model_index].digital_pods)))
|
||||||
return SR_ERR_MALLOC;
|
return SR_ERR_MALLOC;
|
||||||
|
|
||||||
|
@ -623,15 +623,15 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
|
||||||
(char *)(*scope_models[model_index].analog_names)[i];
|
(char *)(*scope_models[model_index].analog_names)[i];
|
||||||
devc->analog_groups[i].probes = g_slist_append(NULL, probe);
|
devc->analog_groups[i].probes = g_slist_append(NULL, probe);
|
||||||
|
|
||||||
sdi->probe_groups = g_slist_append(sdi->probe_groups,
|
sdi->channel_groups = g_slist_append(sdi->channel_groups,
|
||||||
&devc->analog_groups[i]);
|
&devc->analog_groups[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add digital probe groups. */
|
/* Add digital channel groups. */
|
||||||
for (i = 0; i < scope_models[model_index].digital_pods; ++i) {
|
for (i = 0; i < scope_models[model_index].digital_pods; ++i) {
|
||||||
g_snprintf(tmp, 25, "POD%d", i);
|
g_snprintf(tmp, 25, "POD%d", i);
|
||||||
devc->digital_groups[i].name = g_strdup(tmp);
|
devc->digital_groups[i].name = g_strdup(tmp);
|
||||||
sdi->probe_groups = g_slist_append(sdi->probe_groups,
|
sdi->channel_groups = g_slist_append(sdi->channel_groups,
|
||||||
&devc->digital_groups[i < 8 ? 0 : 1]);
|
&devc->digital_groups[i < 8 ? 0 : 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,8 @@ struct dev_context {
|
||||||
void *model_config;
|
void *model_config;
|
||||||
void *model_state;
|
void *model_state;
|
||||||
|
|
||||||
struct sr_probe_group *analog_groups;
|
struct sr_channel_group *analog_groups;
|
||||||
struct sr_probe_group *digital_groups;
|
struct sr_channel_group *digital_groups;
|
||||||
|
|
||||||
GSList *enabled_probes;
|
GSList *enabled_probes;
|
||||||
GSList *current_probe;
|
GSList *current_probe;
|
||||||
|
|
|
@ -423,12 +423,12 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
char str[128];
|
char str[128];
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_CONN:
|
case SR_CONF_CONN:
|
||||||
|
@ -456,7 +456,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
double tmp_double;
|
double tmp_double;
|
||||||
|
@ -466,7 +466,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
char **targets;
|
char **targets;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -587,14 +587,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GVariant *tuple, *rational[2];
|
GVariant *tuple, *rational[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -308,12 +308,12 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
@ -333,12 +333,12 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
uint64_t samplerate, limit_samples, capture_ratio;
|
uint64_t samplerate, limit_samples, capture_ratio;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -366,14 +366,14 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar, *grange[2];
|
GVariant *gvar, *grange[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
|
|
||||||
|
|
|
@ -280,10 +280,10 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -298,11 +298,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -335,13 +335,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
|
@ -249,13 +249,13 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GVariant *rational[2];
|
GVariant *rational[2];
|
||||||
const uint64_t *si;
|
const uint64_t *si;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -298,7 +298,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint64_t p, q;
|
uint64_t p, q;
|
||||||
|
@ -306,7 +306,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
int tmp, ret;
|
int tmp, ret;
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -378,14 +378,14 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *tuple, *rational[2];
|
GVariant *tuple, *rational[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
|
@ -159,14 +159,14 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
int ret;
|
int ret;
|
||||||
char str[128];
|
char str[128];
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
@ -195,12 +195,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -235,10 +235,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -276,11 +276,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -298,7 +298,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
@ -307,7 +307,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
int trigger_pos;
|
int trigger_pos;
|
||||||
double pos;
|
double pos;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
|
@ -369,12 +369,12 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -163,11 +163,11 @@ static int cleanup(int idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -193,10 +193,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -185,11 +185,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -223,10 +223,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -213,11 +213,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
@ -252,7 +252,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint16_t flag;
|
uint16_t flag;
|
||||||
|
@ -260,7 +260,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
int ret;
|
int ret;
|
||||||
const char *stropt;
|
const char *stropt;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -349,14 +349,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GVariant *gvar, *grange[2];
|
GVariant *gvar, *grange[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
int num_channels, i;
|
int num_channels, i;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -339,7 +339,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
devc->analog_groups[i].name = channel_name;
|
devc->analog_groups[i].name = channel_name;
|
||||||
devc->analog_groups[i].probes = g_slist_append(NULL, probe);
|
devc->analog_groups[i].probes = g_slist_append(NULL, probe);
|
||||||
sdi->probe_groups = g_slist_append(sdi->probe_groups,
|
sdi->channel_groups = g_slist_append(sdi->channel_groups,
|
||||||
&devc->analog_groups[i]);
|
&devc->analog_groups[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
||||||
devc->digital_group.probes, probe);
|
devc->digital_group.probes, probe);
|
||||||
}
|
}
|
||||||
devc->digital_group.name = "LA";
|
devc->digital_group.name = "LA";
|
||||||
sdi->probe_groups = g_slist_append(sdi->probe_groups,
|
sdi->channel_groups = g_slist_append(sdi->channel_groups,
|
||||||
&devc->digital_group);
|
&devc->digital_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ static int digital_frame_size(const struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
|
@ -491,14 +491,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
/* If a probe group is specified, it must be a valid one. */
|
/* If a channel group is specified, it must be a valid one. */
|
||||||
if (probe_group && !g_slist_find(sdi->probe_groups, probe_group)) {
|
if (channel_group && !g_slist_find(sdi->channel_groups, channel_group)) {
|
||||||
sr_err("Invalid probe group specified.");
|
sr_err("Invalid channel group specified.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probe_group) {
|
if (channel_group) {
|
||||||
probe = g_slist_nth_data(probe_group->probes, 0);
|
probe = g_slist_nth_data(channel_group->probes, 0);
|
||||||
if (!probe)
|
if (!probe)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
if (probe->type == SR_PROBE_ANALOG) {
|
if (probe->type == SR_PROBE_ANALOG) {
|
||||||
|
@ -588,7 +588,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint64_t p, q;
|
uint64_t p, q;
|
||||||
|
@ -604,9 +604,9 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
/* If a probe group is specified, it must be a valid one. */
|
/* If a channel group is specified, it must be a valid one. */
|
||||||
if (probe_group && !g_slist_find(sdi->probe_groups, probe_group)) {
|
if (channel_group && !g_slist_find(sdi->channel_groups, channel_group)) {
|
||||||
sr_err("Invalid probe group specified.");
|
sr_err("Invalid channel group specified.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,13 +676,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
ret = SR_ERR_ARG;
|
ret = SR_ERR_ARG;
|
||||||
break;
|
break;
|
||||||
case SR_CONF_VDIV:
|
case SR_CONF_VDIV:
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
g_variant_get(data, "(tt)", &p, &q);
|
g_variant_get(data, "(tt)", &p, &q);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (probe_group == &devc->analog_groups[i]) {
|
if (channel_group == &devc->analog_groups[i]) {
|
||||||
for (j = 0; j < ARRAY_SIZE(vdivs); j++) {
|
for (j = 0; j < ARRAY_SIZE(vdivs); j++) {
|
||||||
if (vdivs[j][0] != p || vdivs[j][1] != q)
|
if (vdivs[j][0] != p || vdivs[j][1] != q)
|
||||||
continue;
|
continue;
|
||||||
|
@ -697,13 +697,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
case SR_CONF_COUPLING:
|
case SR_CONF_COUPLING:
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
tmp_str = g_variant_get_string(data, NULL);
|
tmp_str = g_variant_get_string(data, NULL);
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (probe_group == &devc->analog_groups[i]) {
|
if (channel_group == &devc->analog_groups[i]) {
|
||||||
for (j = 0; j < ARRAY_SIZE(coupling); j++) {
|
for (j = 0; j < ARRAY_SIZE(coupling); j++) {
|
||||||
if (!strcmp(tmp_str, coupling[j])) {
|
if (!strcmp(tmp_str, coupling[j])) {
|
||||||
g_free(devc->coupling[i]);
|
g_free(devc->coupling[i]);
|
||||||
|
@ -738,7 +738,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *tuple, *rational[2];
|
GVariant *tuple, *rational[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
@ -752,7 +752,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
|
hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
} else if (key == SR_CONF_DEVICE_OPTIONS && probe_group == NULL) {
|
} else if (key == SR_CONF_DEVICE_OPTIONS && channel_group == NULL) {
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
|
hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -762,28 +762,28 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
if (!sdi || !(devc = sdi->priv))
|
if (!sdi || !(devc = sdi->priv))
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
/* If a probe group is specified, it must be a valid one. */
|
/* If a channel group is specified, it must be a valid one. */
|
||||||
if (probe_group) {
|
if (channel_group) {
|
||||||
if (probe_group != &devc->analog_groups[0]
|
if (channel_group != &devc->analog_groups[0]
|
||||||
&& probe_group != &devc->analog_groups[1]) {
|
&& channel_group != &devc->analog_groups[1]) {
|
||||||
sr_err("Invalid probe group specified.");
|
sr_err("Invalid channel group specified.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
if (probe_group == &devc->digital_group) {
|
if (channel_group == &devc->digital_group) {
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
NULL, 0, sizeof(int32_t));
|
NULL, 0, sizeof(int32_t));
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (probe_group == &devc->analog_groups[i]) {
|
if (channel_group == &devc->analog_groups[i]) {
|
||||||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||||
analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(int32_t));
|
analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(int32_t));
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
@ -793,9 +793,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SR_CONF_COUPLING:
|
case SR_CONF_COUPLING:
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
*data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
|
*data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
|
||||||
break;
|
break;
|
||||||
|
@ -803,9 +803,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
if (!devc)
|
if (!devc)
|
||||||
/* Can't know this until we have the exact model. */
|
/* Can't know this until we have the exact model. */
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
if (!probe_group) {
|
if (!channel_group) {
|
||||||
sr_err("No probe group specified.");
|
sr_err("No channel group specified.");
|
||||||
return SR_ERR_PROBE_GROUP;
|
return SR_ERR_CHANNEL_GROUP;
|
||||||
}
|
}
|
||||||
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
|
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
|
||||||
for (i = 0; i < NUM_VDIV; i++) {
|
for (i = 0; i < NUM_VDIV; i++) {
|
||||||
|
|
|
@ -97,9 +97,9 @@ struct dev_context {
|
||||||
const uint64_t (*vdivs)[2];
|
const uint64_t (*vdivs)[2];
|
||||||
uint64_t num_vdivs;
|
uint64_t num_vdivs;
|
||||||
|
|
||||||
/* Probe groups */
|
/* Channel groups */
|
||||||
struct sr_probe_group analog_groups[MAX_ANALOG_PROBES];
|
struct sr_channel_group analog_groups[MAX_ANALOG_PROBES];
|
||||||
struct sr_probe_group digital_group;
|
struct sr_channel_group digital_group;
|
||||||
|
|
||||||
/* Acquisition settings */
|
/* Acquisition settings */
|
||||||
GSList *enabled_analog_probes;
|
GSList *enabled_analog_probes;
|
||||||
|
|
|
@ -428,7 +428,7 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
@ -437,7 +437,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -482,14 +482,14 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
gdouble low, high;
|
gdouble low, high;
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -525,7 +525,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar, *range[2];
|
GVariant *gvar, *range[2];
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
@ -533,7 +533,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -460,11 +460,11 @@ static int cleanup(int dmm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -493,10 +493,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -265,12 +265,12 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
size_t idx;
|
size_t idx;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
@ -337,13 +337,13 @@ static int lookup_index(GVariant *value, const char *const *table, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
if (!devc)
|
if (!devc)
|
||||||
|
@ -477,13 +477,13 @@ static int config_commit(const struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
GVariant *gvar;
|
GVariant *gvar;
|
||||||
GVariantBuilder gvb;
|
GVariantBuilder gvb;
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -178,11 +178,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -209,10 +209,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -129,11 +129,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -154,10 +154,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -272,11 +272,11 @@ static int cleanup(int dmm)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
@ -307,10 +307,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -200,11 +200,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -225,13 +225,13 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -266,11 +266,11 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
|
@ -202,12 +202,12 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
char str[128];
|
char str[128];
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_CONN:
|
case SR_CONF_CONN:
|
||||||
|
@ -225,13 +225,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
gint64 now;
|
gint64 now;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -264,10 +264,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_SCAN_OPTIONS:
|
case SR_CONF_SCAN_OPTIONS:
|
||||||
|
|
|
@ -467,11 +467,11 @@ static int cleanup(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -508,12 +508,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
gdouble low, high;
|
gdouble low, high;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
@ -541,7 +541,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
GVariant *gvar, *grange[2];
|
GVariant *gvar, *grange[2];
|
||||||
|
@ -549,7 +549,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
double v;
|
double v;
|
||||||
GVariant *range[2];
|
GVariant *range[2];
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
18
hwdriver.c
18
hwdriver.c
|
@ -587,7 +587,7 @@ SR_PRIV void sr_config_free(struct sr_config *src)
|
||||||
* @param[in] sdi (optional) If the key is specific to a device, this must
|
* @param[in] sdi (optional) If the key is specific to a device, this must
|
||||||
* contain a pointer to the struct sr_dev_inst to be checked.
|
* contain a pointer to the struct sr_dev_inst to be checked.
|
||||||
* Otherwise it must be NULL.
|
* Otherwise it must be NULL.
|
||||||
* @param[in] probe_group The probe group on the device for which to list the
|
* @param[in] channel_group The channel group on the device for which to list the
|
||||||
* values, or NULL.
|
* values, or NULL.
|
||||||
* @param[in] key The configuration key (SR_CONF_*).
|
* @param[in] key The configuration key (SR_CONF_*).
|
||||||
* @param[in,out] data Pointer to a GVariant where the value will be stored.
|
* @param[in,out] data Pointer to a GVariant where the value will be stored.
|
||||||
|
@ -604,7 +604,7 @@ SR_PRIV void sr_config_free(struct sr_config *src)
|
||||||
*/
|
*/
|
||||||
SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group,
|
const struct sr_channel_group *channel_group,
|
||||||
int key, GVariant **data)
|
int key, GVariant **data)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -615,7 +615,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||||
if (!driver->config_get)
|
if (!driver->config_get)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
||||||
if ((ret = driver->config_get(key, data, sdi, probe_group)) == SR_OK) {
|
if ((ret = driver->config_get(key, data, sdi, channel_group)) == SR_OK) {
|
||||||
/* Got a floating reference from the driver. Sink it here,
|
/* Got a floating reference from the driver. Sink it here,
|
||||||
* caller will need to unref when done with it. */
|
* caller will need to unref when done with it. */
|
||||||
g_variant_ref_sink(*data);
|
g_variant_ref_sink(*data);
|
||||||
|
@ -628,7 +628,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||||
* Set value of a configuration key in a device instance.
|
* Set value of a configuration key in a device instance.
|
||||||
*
|
*
|
||||||
* @param[in] sdi The device instance.
|
* @param[in] sdi The device instance.
|
||||||
* @param[in] probe_group The probe group on the device for which to list the
|
* @param[in] channel_group The channel group on the device for which to list the
|
||||||
* values, or NULL.
|
* values, or NULL.
|
||||||
* @param[in] key The configuration key (SR_CONF_*).
|
* @param[in] key The configuration key (SR_CONF_*).
|
||||||
* @param data The new value for the key, as a GVariant with GVariantType
|
* @param data The new value for the key, as a GVariant with GVariantType
|
||||||
|
@ -642,7 +642,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||||
* that it's not applicable.
|
* that it's not applicable.
|
||||||
*/
|
*/
|
||||||
SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group,
|
const struct sr_channel_group *channel_group,
|
||||||
int key, GVariant *data)
|
int key, GVariant *data)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -654,7 +654,7 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
||||||
else if (!sdi->driver->config_set)
|
else if (!sdi->driver->config_set)
|
||||||
ret = SR_ERR_ARG;
|
ret = SR_ERR_ARG;
|
||||||
else
|
else
|
||||||
ret = sdi->driver->config_set(key, data, sdi, probe_group);
|
ret = sdi->driver->config_set(key, data, sdi, channel_group);
|
||||||
|
|
||||||
g_variant_unref(data);
|
g_variant_unref(data);
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ SR_API int sr_config_commit(const struct sr_dev_inst *sdi)
|
||||||
* @param[in] driver The sr_dev_driver struct to query.
|
* @param[in] driver The sr_dev_driver struct to query.
|
||||||
* @param[in] sdi (optional) If the key is specific to a device, this must
|
* @param[in] sdi (optional) If the key is specific to a device, this must
|
||||||
* contain a pointer to the struct sr_dev_inst to be checked.
|
* contain a pointer to the struct sr_dev_inst to be checked.
|
||||||
* @param[in] probe_group The probe group on the device for which to list the
|
* @param[in] channel_group The channel group on the device for which to list the
|
||||||
* values, or NULL.
|
* values, or NULL.
|
||||||
* @param[in] key The configuration key (SR_CONF_*).
|
* @param[in] key The configuration key (SR_CONF_*).
|
||||||
* @param[in,out] data A pointer to a GVariant where the list will be stored.
|
* @param[in,out] data A pointer to a GVariant where the list will be stored.
|
||||||
|
@ -705,7 +705,7 @@ SR_API int sr_config_commit(const struct sr_dev_inst *sdi)
|
||||||
*/
|
*/
|
||||||
SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group,
|
const struct sr_channel_group *channel_group,
|
||||||
int key, GVariant **data)
|
int key, GVariant **data)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -714,7 +714,7 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
else if (!driver->config_list)
|
else if (!driver->config_list)
|
||||||
ret = SR_ERR_ARG;
|
ret = SR_ERR_ARG;
|
||||||
else if ((ret = driver->config_list(key, data, sdi, probe_group)) == SR_OK)
|
else if ((ret = driver->config_list(key, data, sdi, channel_group)) == SR_OK)
|
||||||
g_variant_ref_sink(*data);
|
g_variant_ref_sink(*data);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
16
libsigrok.h
16
libsigrok.h
|
@ -73,7 +73,7 @@ enum {
|
||||||
SR_ERR_NA = -6, /**< Not applicable. */
|
SR_ERR_NA = -6, /**< Not applicable. */
|
||||||
SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */
|
SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */
|
||||||
SR_ERR_TIMEOUT = -8, /**< A timeout occurred. */
|
SR_ERR_TIMEOUT = -8, /**< A timeout occurred. */
|
||||||
SR_ERR_PROBE_GROUP= -9, /**< A probe group must be specified. */
|
SR_ERR_PROBE_GROUP= -9, /**< A channel group must be specified. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: When adding entries here, don't forget to also update the
|
* Note: When adding entries here, don't forget to also update the
|
||||||
|
@ -620,8 +620,8 @@ struct sr_probe {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Structure for groups of probes that have common properties. */
|
/** Structure for groups of probes that have common properties. */
|
||||||
struct sr_probe_group {
|
struct sr_channel_group {
|
||||||
/** Name of the probe group. */
|
/** Name of the channel group. */
|
||||||
char *name;
|
char *name;
|
||||||
/** List of sr_probe structs of the probes belonging to this group. */
|
/** List of sr_probe structs of the probes belonging to this group. */
|
||||||
GSList *probes;
|
GSList *probes;
|
||||||
|
@ -921,8 +921,8 @@ struct sr_dev_inst {
|
||||||
char *version;
|
char *version;
|
||||||
/** List of probes. */
|
/** List of probes. */
|
||||||
GSList *probes;
|
GSList *probes;
|
||||||
/** List of sr_probe_group structs */
|
/** List of sr_channel_group structs */
|
||||||
GSList *probe_groups;
|
GSList *channel_groups;
|
||||||
/** Device instance connection data (used?) */
|
/** Device instance connection data (used?) */
|
||||||
void *conn;
|
void *conn;
|
||||||
/** Device instance private data (used?) */
|
/** Device instance private data (used?) */
|
||||||
|
@ -986,12 +986,12 @@ struct sr_dev_driver {
|
||||||
*/
|
*/
|
||||||
int (*config_get) (int id, GVariant **data,
|
int (*config_get) (int id, GVariant **data,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group);
|
const struct sr_channel_group *channel_group);
|
||||||
/** Set value of a configuration key in driver or a given device instance.
|
/** Set value of a configuration key in driver or a given device instance.
|
||||||
* @see sr_config_set(). */
|
* @see sr_config_set(). */
|
||||||
int (*config_set) (int id, GVariant *data,
|
int (*config_set) (int id, GVariant *data,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group);
|
const struct sr_channel_group *channel_group);
|
||||||
/** Probe status change.
|
/** Probe status change.
|
||||||
* @see sr_dev_probe_enable(), sr_dev_trigger_set(). */
|
* @see sr_dev_probe_enable(), sr_dev_trigger_set(). */
|
||||||
int (*config_probe_set) (const struct sr_dev_inst *sdi,
|
int (*config_probe_set) (const struct sr_dev_inst *sdi,
|
||||||
|
@ -1004,7 +1004,7 @@ struct sr_dev_driver {
|
||||||
*/
|
*/
|
||||||
int (*config_list) (int info_id, GVariant **data,
|
int (*config_list) (int info_id, GVariant **data,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group);
|
const struct sr_channel_group *channel_group);
|
||||||
|
|
||||||
/* Device-specific */
|
/* Device-specific */
|
||||||
/** Open device */
|
/** Open device */
|
||||||
|
|
6
proto.h
6
proto.h
|
@ -72,15 +72,15 @@ SR_API int sr_driver_init(struct sr_context *ctx,
|
||||||
SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
|
SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
|
||||||
SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
SR_API int sr_config_get(const struct sr_dev_driver *driver,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group,
|
const struct sr_channel_group *channel_group,
|
||||||
int key, GVariant **data);
|
int key, GVariant **data);
|
||||||
SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
SR_API int sr_config_set(const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group,
|
const struct sr_channel_group *channel_group,
|
||||||
int key, GVariant *data);
|
int key, GVariant *data);
|
||||||
SR_API int sr_config_commit(const struct sr_dev_inst *sdi);
|
SR_API int sr_config_commit(const struct sr_dev_inst *sdi);
|
||||||
SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
SR_API int sr_config_list(const struct sr_dev_driver *driver,
|
||||||
const struct sr_dev_inst *sdi,
|
const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group,
|
const struct sr_channel_group *channel_group,
|
||||||
int key, GVariant **data);
|
int key, GVariant **data);
|
||||||
SR_API const struct sr_config_info *sr_config_info_get(int key);
|
SR_API const struct sr_config_info *sr_config_info_get(int key);
|
||||||
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
|
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
|
||||||
|
|
|
@ -211,11 +211,11 @@ static int dev_close(struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct session_vdev *vdev;
|
struct session_vdev *vdev;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
@ -233,11 +233,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
struct session_vdev *vdev;
|
struct session_vdev *vdev;
|
||||||
|
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
vdev = sdi->priv;
|
vdev = sdi->priv;
|
||||||
|
|
||||||
|
@ -270,10 +270,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_probe_group *probe_group)
|
const struct sr_channel_group *channel_group)
|
||||||
{
|
{
|
||||||
(void)sdi;
|
(void)sdi;
|
||||||
(void)probe_group;
|
(void)channel_group;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_DEVICE_OPTIONS:
|
case SR_CONF_DEVICE_OPTIONS:
|
||||||
|
|
Loading…
Reference in New Issue