__all__ = ['Error', 'Context', 'Driver', 'Device', 'Session', 'Packet', 'Log',
'LogLevel', 'PacketType', 'Quantity', 'Unit', 'QuantityFlag', 'ConfigKey',
- 'ProbeType', 'Probe', 'ProbeGroup', 'InputFormat', 'OutputFormat',
+ 'ProbeType', 'Probe', 'ChannelGroup', 'InputFormat', 'OutputFormat',
'InputFile', 'Output']
class Error(Exception):
device.struct = struct
device.context = context
device._probes = None
- device._probe_groups = None
+ device._channel_groups = None
context._devices[address] = device
return context._devices[address]
return self._probes
@property
- def probe_groups(self):
- if self._probe_groups is None:
- self._probe_groups = {}
- probe_group_list = self.struct.probe_groups
- while (probe_group_list):
- probe_group_ptr = void_ptr_to_sr_probe_group_ptr(
- probe_group_list.data)
- self._probe_groups[probe_group_ptr.name] = ProbeGroup(self,
- probe_group_ptr)
- probe_group_list = probe_group_list.next
- return self._probe_groups
+ def channel_groups(self):
+ if self._channel_groups is None:
+ self._channel_groups = {}
+ channel_group_list = self.struct.channel_groups
+ while (channel_group_list):
+ channel_group_ptr = void_ptr_to_sr_channel_group_ptr(
+ channel_group_list.data)
+ self._channel_groups[channel_group_ptr.name] = ChannelGroup(self,
+ channel_group_ptr)
+ channel_group_list = channel_group_list.next
+ return self._channel_groups
class HardwareDevice(Device):
def name(self):
return self.struct.name
-class ProbeGroup(object):
+class ChannelGroup(object):
def __init__(self, device, struct):
self.device = device
self.struct = struct
- self._probes = None
+ self._channels = None
def __iter__(self):
- return iter(self.probes)
+ return iter(self.channels)
def __getattr__(self, name):
key = config_key(name)
except Error as error:
if error.errno == SR_ERR_NA:
raise NotImplementedError(
- "Probe group does not implement %s" % name)
+ "Channel group does not implement %s" % name)
else:
raise AttributeError
value = gvariant_ptr_ptr_value(data)
try:
key = config_key(name)
except AttributeError:
- super(ProbeGroup, self).__setattr__(name, value)
+ super(ChannelGroup, self).__setattr__(name, value)
return
check(sr_config_set(self.device.struct, self.struct,
key.id, python_to_gvariant(value)))
return self.struct.name
@property
- def probes(self):
- if self._probes is None:
- self._probes = []
- probe_list = self.struct.probes
- while (probe_list):
- probe_ptr = void_ptr_to_sr_probe_ptr(probe_list.data)
- self._probes.append(Probe(self, probe_ptr))
- probe_list = probe_list.next
- return self._probes
+ def channels(self):
+ if self._channels is None:
+ self._channels = []
+ channel_list = self.struct.channels
+ while (channel_list):
+ channel_ptr = void_ptr_to_sr_probe_ptr(channel_list.data)
+ self._channels.append(Probe(self, probe_ptr))
+ channel_list = channel_list.next
+ return self._channels
class Session(object):
%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_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 {
int call_format_match(const char *filename) {
sdi->model = model ? g_strdup(model) : NULL;
sdi->version = version ? g_strdup(version) : NULL;
sdi->probes = NULL;
- sdi->probe_groups = NULL;
+ sdi->channel_groups = NULL;
sdi->conn = NULL;
sdi->priv = NULL;
}
g_slist_free(sdi->probes);
- if (sdi->probe_groups)
- g_slist_free(sdi->probe_groups);
+ if (sdi->channel_groups)
+ g_slist_free(sdi->channel_groups);
g_free(sdi->vendor);
g_free(sdi->model);
return "device closed but should be open";
case SR_ERR_TIMEOUT:
return "timeout occurred";
- case SR_ERR_PROBE_GROUP:
- return "no probe group specified";
+ case SR_ERR_CHANNEL_GROUP:
+ return "no channel group specified";
default:
return "unknown error";
}
return "SR_ERR_DEV_CLOSED";
case SR_ERR_TIMEOUT:
return "SR_ERR_TIMEOUT";
- case SR_ERR_PROBE_GROUP:
- return "SR_PROBE_GROUP";
+ case SR_ERR_CHANNEL_GROUP:
+ return "SR_ERR_CHANNEL_GROUP";
default:
return "unknown error code";
}
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
GVariant *gvar;
GVariantBuilder gvb;
int i;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
}
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;
const char *tmp_str;
unsigned int i;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
int ret;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
GVariantBuilder gvb;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
struct dev_context *devc;
struct sr_config *src;
struct sr_probe *probe;
- struct sr_probe_group *pg;
+ struct sr_channel_group *pg;
struct sr_serial_dev_inst *serial;
GSList *l, *devices;
struct pps_model *model;
snprintf(channel, 10, "CH%d", i + 1);
probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, channel);
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->probes = g_slist_append(NULL, probe);
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));
}
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 sr_probe *probe;
devc = sdi->priv;
ret = SR_OK;
- if (!probe_group) {
- /* No probe group: global options. */
+ if (!channel_group) {
+ /* No channel group: global options. */
switch (key) {
case SR_CONF_OUTPUT_CHANNEL:
*data = g_variant_new_string(channel_modes[devc->channel_mode]);
return SR_ERR_NA;
}
} else {
- /* We only ever have one channel per probe group in this driver. */
- probe = probe_group->probes->data;
+ /* We only ever have one channel per channel group in this driver. */
+ probe = channel_group->probes->data;
channel = probe->index;
switch (key) {
}
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 sr_probe *probe;
ret = SR_OK;
devc = sdi->priv;
- if (!probe_group) {
- /* No probe group: global options. */
+ if (!channel_group) {
+ /* No channel group: global options. */
switch (key) {
case SR_CONF_OUTPUT_CHANNEL:
sval = g_variant_get_string(data, NULL);
return SR_ERR_NA;
}
} else {
- /* Probe group specified: per-channel options. */
- /* We only ever have one channel per probe group in this driver. */
- probe = probe_group->probes->data;
+ /* Channel group specified: per-channel options. */
+ /* We only ever have one channel per channel group in this driver. */
+ probe = channel_group->probes->data;
channel = probe->index;
switch (key) {
}
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 sr_probe *probe;
devc = sdi->priv;
ret = SR_OK;
- if (!probe_group) {
- /* No probe group: global options. */
+ if (!channel_group) {
+ /* No channel group: global options. */
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
return SR_ERR_NA;
}
} else {
- /* Probe group specified: per-channel options. */
+ /* Channel group specified: per-channel options. */
if (!sdi)
return SR_ERR_ARG;
- /* We only ever have one channel per probe group in this driver. */
- probe = probe_group->probes->data;
+ /* We only ever have one channel per channel group in this driver. */
+ probe = channel_group->probes->data;
channel = probe->index;
switch (key) {
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
int ret;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
GVariant *range[2];
uint64_t low, high;
int tmp, ret;
- (void)probe_group;
+ (void)channel_group;
if (!sdi)
return SR_ERR_ARG;
}
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;
uint64_t tmp_u64, low, high;
int tmp, ret;
const char *tmp_str;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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];
GVariantBuilder gvb;
int ret;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
switch (key) {
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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];
GVariantBuilder gvb;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
double dblval;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
switch (key) {
/* Logic */
int32_t num_logic_probes;
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;
unsigned char logic_data[LOGIC_BUFSIZE];
/* Analog */
int32_t num_analog_probes;
- GSList *analog_probe_groups;
+ GSList *analog_channel_groups;
};
static const int32_t scanopts[] = {
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;
double t, frequency;
unsigned int num_samples, i;
int last_end;
- ag = probe_group->priv;
+ ag = channel_group->priv;
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],
- probe_group->name);
+ channel_group->name);
switch (ag->pattern) {
case PATTERN_SQUARE:
struct dev_context *devc;
struct sr_dev_inst *sdi;
struct sr_probe *probe;
- struct sr_probe_group *pg;
+ struct sr_channel_group *pg;
struct sr_config *src;
struct analog_gen *ag;
GSList *devices, *l;
devc->logic_unitsize = (devc->num_logic_probes + 7) / 8;
devc->logic_pattern = PATTERN_SIGROK;
devc->num_analog_probes = num_analog_probes;
- devc->analog_probe_groups = NULL;
+ devc->analog_channel_groups = NULL;
- /* Logic probes, all in one probe group. */
- if (!(pg = g_try_malloc(sizeof(struct sr_probe_group))))
+ /* Logic probes, all in one channel group. */
+ if (!(pg = g_try_malloc(sizeof(struct sr_channel_group))))
return NULL;
pg->name = g_strdup("Logic");
pg->probes = NULL;
sdi->probes = g_slist_append(sdi->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;
for (i = 0; i < num_analog_probes; i++) {
return NULL;
sdi->probes = g_slist_append(sdi->probes, probe);
- /* Every analog probe gets its own probe group. */
- if (!(pg = g_try_malloc(sizeof(struct sr_probe_group))))
+ /* Every analog probe gets its own channel group. */
+ if (!(pg = g_try_malloc(sizeof(struct sr_channel_group))))
return NULL;
pg->name = g_strdup(probe_name);
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))))
return NULL;
ag->packet.probes = pg->probes;
ag->pattern = pattern;
pg->priv = ag;
- sdi->probe_groups = g_slist_append(sdi->probe_groups, pg);
- devc->analog_probe_groups = g_slist_append(devc->analog_probe_groups, pg);
+ sdi->channel_groups = g_slist_append(sdi->channel_groups, pg);
+ devc->analog_channel_groups = g_slist_append(devc->analog_channel_groups, pg);
if (++pattern == ARRAY_SIZE(analog_pattern_str))
pattern = 0;
}
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 sr_probe *probe;
*data = g_variant_new_uint64(devc->limit_msec);
break;
case SR_CONF_PATTERN_MODE:
- if (!probe_group)
- return SR_ERR_PROBE_GROUP;
- probe = probe_group->probes->data;
+ if (!channel_group)
+ return SR_ERR_CHANNEL_GROUP;
+ probe = channel_group->probes->data;
if (probe->type == SR_PROBE_LOGIC) {
pattern = devc->logic_pattern;
*data = g_variant_new_string(logic_pattern_str[pattern]);
} else if (probe->type == SR_PROBE_ANALOG) {
- ag = probe_group->priv;
+ ag = channel_group->priv;
pattern = ag->pattern;
*data = g_variant_new_string(analog_pattern_str[pattern]);
} else
}
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 analog_gen *ag;
sr_dbg("Setting time limit to %" PRIu64"ms", devc->limit_msec);
break;
case SR_CONF_PATTERN_MODE:
- if (!probe_group)
- return SR_ERR_PROBE_GROUP;
+ if (!channel_group)
+ return SR_ERR_CHANNEL_GROUP;
stropt = g_variant_get_string(data, NULL);
- probe = probe_group->probes->data;
+ probe = channel_group->probes->data;
pattern = -1;
if (probe->type == SR_PROBE_LOGIC) {
for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) {
}
if (pattern == -1)
return SR_ERR_ARG;
- sr_dbg("Setting analog pattern for probe group %s to %s",
- probe_group->name,
+ sr_dbg("Setting analog pattern for channel group %s to %s",
+ channel_group->name,
analog_pattern_str[pattern]);
- ag = probe_group->priv;
+ ag = channel_group->priv;
ag->pattern = pattern;
} else
return SR_ERR_BUG;
}
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;
GVariant *gvar;
if (!sdi)
return SR_ERR_ARG;
- if (!probe_group) {
+ if (!channel_group) {
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
return SR_ERR_NA;
}
} else {
- probe = probe_group->probes->data;
+ probe = channel_group->probes->data;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_logic logic;
- struct sr_probe_group *pg;
+ struct sr_channel_group *pg;
struct analog_gen *ag;
GSList *l;
uint64_t logic_todo, analog_todo, expected_samplenum, analog_samples, sending_now;
/* Analog, one probe at a time */
if (devc->num_analog_probes > 0 && analog_todo > 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;
ag = pg->priv;
packet.type = SR_DF_ANALOG;
* help here as well */
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);
ag->packet.num_samples = analog_samples;
sr_session_send(sdi, &packet);
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);
}
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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 sr_usb_dev_inst *usb;
char str[128];
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_CONN:
}
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;
int ret;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
}
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;
GVariantBuilder gvb;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
/** Get value of configuration item */
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;
struct dev_context *devc;
(void)sdi;
(void)data;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
- (void)probe_group;
+ (void)channel_group;
if (!sdi || !(devc = sdi->priv))
return SR_ERR_ARG;
/** Implementation of config_list, auxiliary function for common parts, */
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
/** 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,
- const struct sr_probe_group *probe_group)
+ const struct sr_channel_group *channel_group)
{
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
hwcaps_sm, ARRAY_SIZE(hwcaps_sm), sizeof(int32_t));
break;
default:
- return config_list_common(key, data, sdi, probe_group);
+ return config_list_common(key, data, sdi, channel_group);
}
return SR_OK;
/** Implementation of config_list for Metrahit 2x bidirectional mode */
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
hwcaps_bd, ARRAY_SIZE(hwcaps_bd), sizeof(int32_t));
break;
default:
- return config_list_common(key, data, sdi, probe_group);
+ return config_list_common(key, data, sdi, channel_group);
}
return SR_OK;
/** @copydoc sr_dev_driver.config_set
*/
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;
uint8_t params[9];
uint8_t msg[42];
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
/* Forward declarations */
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 dump_msg14(guchar* buf, gboolean raw);
SR_PRIV int gmc_decode_model_bd(uint8_t mcode);
return SR_OK;
}
-static int check_probe_group(struct dev_context *devc,
- const struct sr_probe_group *probe_group)
+static int check_channel_group(struct dev_context *devc,
+ const struct sr_channel_group *channel_group)
{
unsigned int i;
struct scope_config *model;
model = devc->model_config;
- if (!probe_group)
+ if (!channel_group)
return PG_NONE;
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;
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;
- sr_err("Invalid probe group specified.");
+ sr_err("Invalid channel group specified.");
return PG_INVALID;
}
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;
unsigned int i;
if (!sdi || !(devc = sdi->priv))
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;
ret = SR_ERR_NA;
break;
case SR_CONF_NUM_VDIV:
if (pg_type == PG_NONE) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
} else if (pg_type == PG_ANALOG) {
for (i = 0; i < model->analog_channels; ++i) {
- if (probe_group != &devc->analog_groups[i])
+ if (channel_group != &devc->analog_groups[i])
continue;
*data = g_variant_new_int32(model->num_ydivs);
ret = SR_OK;
break;
case SR_CONF_COUPLING:
if (pg_type == PG_NONE) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
} else if (pg_type == PG_ANALOG) {
for (i = 0; i < model->analog_channels; ++i) {
- if (probe_group != &devc->analog_groups[i])
+ if (channel_group != &devc->analog_groups[i])
continue;
*data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]);
ret = SR_OK;
}
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;
unsigned int i, j;
if (!sdi || !(devc = sdi->priv))
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;
model = devc->model_config;
break;
case SR_CONF_VDIV:
if (pg_type == PG_NONE) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
}
g_variant_get(data, "(tt)", &p, &q);
q != (*model->vdivs)[i][1])
continue;
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;
state->analog_channels[j - 1].vdiv = i;
g_ascii_formatd(float_str, sizeof(float_str), "%E", (float) p / q);
break;
case SR_CONF_COUPLING:
if (pg_type == PG_NONE) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
}
tmp = g_variant_get_string(data, NULL);
if (strcmp(tmp, (*model->coupling_options)[i]) != 0)
continue;
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;
state->analog_channels[j-1].coupling = i;
}
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;
struct dev_context *devc;
if (!sdi || !(devc = sdi->priv))
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;
model = devc->model_config;
break;
case SR_CONF_COUPLING:
if (pg_type == PG_NONE)
- return SR_ERR_PROBE_GROUP;
+ return SR_ERR_CHANNEL_GROUP;
*data = g_variant_new_strv(*model->coupling_options,
g_strv_length((char **)*model->coupling_options));
break;
break;
case SR_CONF_VDIV:
if (pg_type == PG_NONE)
- return SR_ERR_PROBE_GROUP;
+ return SR_ERR_CHANNEL_GROUP;
*data = build_tuples(model->vdivs, model->num_vdivs);
break;
default:
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)))
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)))
return SR_ERR_MALLOC;
(char *)(*scope_models[model_index].analog_names)[i];
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]);
}
- /* Add digital probe groups. */
+ /* Add digital channel groups. */
for (i = 0; i < scope_models[model_index].digital_pods; ++i) {
g_snprintf(tmp, 25, "POD%d", i);
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]);
}
void *model_config;
void *model_state;
- struct sr_probe_group *analog_groups;
- struct sr_probe_group *digital_groups;
+ struct sr_channel_group *analog_groups;
+ struct sr_channel_group *digital_groups;
GSList *enabled_probes;
GSList *current_probe;
}
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;
char str[128];
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_CONN:
}
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;
double tmp_double;
const char *tmp_str;
char **targets;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
GVariant *tuple, *rational[2];
GVariantBuilder gvb;
unsigned int i;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
int ret;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
devc = sdi->priv;
}
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;
int ret;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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];
GVariantBuilder gvb;
int ret;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
}
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)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
GVariantBuilder gvb;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
}
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;
GVariant *rational[2];
const uint64_t *si;
- (void)probe_group;
+ (void)channel_group;
devc = sdi->priv;
switch (key) {
}
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;
uint64_t p, q;
int tmp, ret;
const char *tmp_str;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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];
GVariantBuilder gvb;
unsigned int i;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
}
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 sr_usb_dev_inst *usb;
int ret;
char str[128];
- (void)probe_group;
+ (void)channel_group;
devc = sdi->priv;
switch (id) {
}
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;
int ret;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
struct dev_context *devc;
int trigger_pos;
double pos;
- (void)probe_group;
+ (void)channel_group;
devc = sdi->priv;
if (sdi->status != SR_ST_ACTIVE)
}
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;
GVariantBuilder gvb;
- (void)probe_group;
+ (void)channel_group;
(void)sdi;
switch (key) {
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (!sdi)
return SR_ERR_ARG;
}
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;
uint16_t flag;
int ret;
const char *stropt;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
GVariant *gvar, *grange[2];
GVariantBuilder gvb;
int num_channels, i;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
sdi->probes = g_slist_append(sdi->probes, probe);
devc->analog_groups[i].name = channel_name;
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->digital_group.probes, probe);
}
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);
}
}
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 sr_probe *probe;
if (!sdi || !(devc = sdi->priv))
return SR_ERR_ARG;
- /* If a probe group is specified, it must be a valid one. */
- if (probe_group && !g_slist_find(sdi->probe_groups, probe_group)) {
- sr_err("Invalid probe group specified.");
+ /* If a channel group is specified, it must be a valid one. */
+ if (channel_group && !g_slist_find(sdi->channel_groups, channel_group)) {
+ sr_err("Invalid channel group specified.");
return SR_ERR;
}
- if (probe_group) {
- probe = g_slist_nth_data(probe_group->probes, 0);
+ if (channel_group) {
+ probe = g_slist_nth_data(channel_group->probes, 0);
if (!probe)
return SR_ERR;
if (probe->type == SR_PROBE_ANALOG) {
}
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;
uint64_t p, q;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- /* If a probe group is specified, it must be a valid one. */
- if (probe_group && !g_slist_find(sdi->probe_groups, probe_group)) {
- sr_err("Invalid probe group specified.");
+ /* If a channel group is specified, it must be a valid one. */
+ if (channel_group && !g_slist_find(sdi->channel_groups, channel_group)) {
+ sr_err("Invalid channel group specified.");
return SR_ERR;
}
ret = SR_ERR_ARG;
break;
case SR_CONF_VDIV:
- if (!probe_group) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ if (!channel_group) {
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
}
g_variant_get(data, "(tt)", &p, &q);
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++) {
if (vdivs[j][0] != p || vdivs[j][1] != q)
continue;
}
return SR_ERR_NA;
case SR_CONF_COUPLING:
- if (!probe_group) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ if (!channel_group) {
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
}
tmp_str = g_variant_get_string(data, NULL);
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++) {
if (!strcmp(tmp_str, coupling[j])) {
g_free(devc->coupling[i]);
}
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];
GVariantBuilder gvb;
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
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,
hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
return SR_OK;
if (!sdi || !(devc = sdi->priv))
return SR_ERR_ARG;
- /* If a probe group is specified, it must be a valid one. */
- if (probe_group) {
- if (probe_group != &devc->analog_groups[0]
- && probe_group != &devc->analog_groups[1]) {
- sr_err("Invalid probe group specified.");
+ /* If a channel group is specified, it must be a valid one. */
+ if (channel_group) {
+ if (channel_group != &devc->analog_groups[0]
+ && channel_group != &devc->analog_groups[1]) {
+ sr_err("Invalid channel group specified.");
return SR_ERR;
}
}
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- if (!probe_group) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ if (!channel_group) {
+ sr_err("No channel group specified.");
+ 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,
NULL, 0, sizeof(int32_t));
return SR_OK;
} else {
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,
analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(int32_t));
return SR_OK;
}
break;
case SR_CONF_COUPLING:
- if (!probe_group) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ if (!channel_group) {
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
}
*data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
break;
if (!devc)
/* Can't know this until we have the exact model. */
return SR_ERR_ARG;
- if (!probe_group) {
- sr_err("No probe group specified.");
- return SR_ERR_PROBE_GROUP;
+ if (!channel_group) {
+ sr_err("No channel group specified.");
+ return SR_ERR_CHANNEL_GROUP;
}
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
for (i = 0; i < NUM_VDIV; i++) {
const uint64_t (*vdivs)[2];
uint64_t num_vdivs;
- /* Probe groups */
- struct sr_probe_group analog_groups[MAX_ANALOG_PROBES];
- struct sr_probe_group digital_group;
+ /* Channel groups */
+ struct sr_channel_group analog_groups[MAX_ANALOG_PROBES];
+ struct sr_channel_group digital_group;
/* Acquisition settings */
GSList *enabled_analog_probes;
}
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 sr_usb_dev_inst *usb;
int ret;
unsigned int i;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
switch (key) {
}
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;
gdouble low, high;
int ret;
unsigned int i;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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];
GVariantBuilder gvb;
unsigned int i;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
ret = SR_OK;
switch (key) {
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
size_t idx;
- (void)probe_group;
+ (void)channel_group;
if (!sdi)
return SR_ERR_ARG;
}
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;
struct dev_context *devc;
int idx;
- (void)probe_group;
+ (void)channel_group;
devc = sdi->priv;
if (!devc)
}
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;
GVariantBuilder gvb;
(void)sdi;
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
devc = sdi->priv;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
devc = sdi->priv;
switch (key) {
}
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;
int ret;
const char *tmp_str;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
}
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;
char str[128];
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_CONN:
}
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;
gint64 now;
int ret;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
gdouble low, high;
- (void)probe_group;
+ (void)channel_group;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
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;
GVariant *gvar, *grange[2];
double v;
GVariant *range[2];
- (void)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
* @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.
* 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.
* @param[in] key The configuration key (SR_CONF_*).
* @param[in,out] data Pointer to a GVariant where the value will be stored.
*/
SR_API int sr_config_get(const struct sr_dev_driver *driver,
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 ret;
if (!driver->config_get)
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,
* caller will need to unref when done with it. */
g_variant_ref_sink(*data);
* Set value of a configuration key in a 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.
* @param[in] key The configuration key (SR_CONF_*).
* @param data The new value for the key, as a GVariant with GVariantType
* that it's not applicable.
*/
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 ret;
else if (!sdi->driver->config_set)
ret = SR_ERR_ARG;
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);
* @param[in] driver The sr_dev_driver struct to query.
* @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.
- * @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.
* @param[in] key The configuration key (SR_CONF_*).
* @param[in,out] data A pointer to a GVariant where the list will be stored.
*/
SR_API int sr_config_list(const struct sr_dev_driver *driver,
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 ret;
ret = SR_ERR;
else if (!driver->config_list)
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);
return ret;
SR_ERR_NA = -6, /**< Not applicable. */
SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */
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
};
/** Structure for groups of probes that have common properties. */
-struct sr_probe_group {
- /** Name of the probe group. */
+struct sr_channel_group {
+ /** Name of the channel group. */
char *name;
/** List of sr_probe structs of the probes belonging to this group. */
GSList *probes;
char *version;
/** List of probes. */
GSList *probes;
- /** List of sr_probe_group structs */
- GSList *probe_groups;
+ /** List of sr_channel_group structs */
+ GSList *channel_groups;
/** Device instance connection data (used?) */
void *conn;
/** Device instance private data (used?) */
*/
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);
/** Set value of a configuration key in driver or a given device instance.
* @see sr_config_set(). */
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);
/** Probe status change.
* @see sr_dev_probe_enable(), sr_dev_trigger_set(). */
int (*config_probe_set) (const struct sr_dev_inst *sdi,
*/
int (*config_list) (int info_id, GVariant **data,
const struct sr_dev_inst *sdi,
- const struct sr_probe_group *probe_group);
+ const struct sr_channel_group *channel_group);
/* Device-specific */
/** Open device */
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,
const struct sr_dev_inst *sdi,
- const struct sr_probe_group *probe_group,
+ const struct sr_channel_group *channel_group,
int key, GVariant **data);
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);
SR_API int sr_config_commit(const struct sr_dev_inst *sdi);
SR_API int sr_config_list(const struct sr_dev_driver *driver,
const struct sr_dev_inst *sdi,
- const struct sr_probe_group *probe_group,
+ const struct sr_channel_group *channel_group,
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_name_get(const char *optname);
}
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;
- (void)probe_group;
+ (void)channel_group;
switch (id) {
case SR_CONF_SAMPLERATE:
}
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;
- (void)probe_group;
+ (void)channel_group;
vdev = sdi->priv;
}
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)probe_group;
+ (void)channel_group;
switch (key) {
case SR_CONF_DEVICE_OPTIONS: