Rename various *PROBE* macros to *CHANNEL*.

This fixes parts of bug #259.
This commit is contained in:
Uwe Hermann 2014-03-24 22:39:42 +01:00
parent 56d0d24535
commit 3f239f0803
72 changed files with 206 additions and 206 deletions

View File

@ -26,7 +26,7 @@ import itertools
__all__ = ['Error', 'Context', 'Driver', 'Device', 'Session', 'Packet', 'Log',
'LogLevel', 'PacketType', 'Quantity', 'Unit', 'QuantityFlag', 'ConfigKey',
'ProbeType', 'Probe', 'ChannelGroup', 'InputFormat', 'OutputFormat',
'ChannelType', 'Channel', 'ChannelGroup', 'InputFormat', 'OutputFormat',
'InputFile', 'Output']
class Error(Exception):
@ -173,7 +173,7 @@ class Device(object):
device = super(Device, cls).__new__(cls)
device.struct = struct
device.context = context
device._probes = None
device._channels = None
device._channel_groups = None
context._devices[address] = device
return context._devices[address]
@ -191,15 +191,15 @@ class Device(object):
return self.struct.version
@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_channel_ptr(probe_list.data)
self._probes[probe_ptr.name] = 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_channel_ptr(channel_list.data)
self._channels[channel_ptr.name] = Channel(self, channel_ptr)
channel_list = channel_list.next
return self._channels
@property
def channel_groups(self):
@ -244,7 +244,7 @@ class HardwareDevice(Device):
return
check(sr_config_set(self.struct, None, key.id, python_to_gvariant(value)))
class Probe(object):
class Channel(object):
def __init__(self, device, struct):
self.device = device
@ -252,7 +252,7 @@ class Probe(object):
@property
def type(self):
return ProbeType(self.struct.type)
return ChannelType(self.struct.type)
@property
def enabled(self):
@ -307,7 +307,7 @@ class ChannelGroup(object):
channel_list = self.struct.channels
while (channel_list):
channel_ptr = void_ptr_to_sr_channel_ptr(channel_list.data)
self._channels.append(Probe(self, probe_ptr))
self._channels.append(Channel(self, channel_ptr))
channel_list = channel_list.next
return self._channels
@ -606,7 +606,7 @@ class ConfigKey(EnumValue):
class DataType(EnumValue):
pass
class ProbeType(EnumValue):
class ChannelType(EnumValue):
pass
for symbol_name in dir(lowlevel):
@ -618,7 +618,7 @@ for symbol_name in dir(lowlevel):
('SR_MQFLAG_', QuantityFlag),
('SR_CONF_', ConfigKey),
('SR_T_', DataType),
('SR_PROBE_', ProbeType)]:
('SR_CHANNEL_', ChannelType)]:
if symbol_name.startswith(prefix):
name = symbol_name[len(prefix):]
value = getattr(lowlevel, symbol_name)

View File

@ -143,7 +143,7 @@ SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int channelnum,
if (!state != !was_enabled && sdi->driver
&& sdi->driver->config_probe_set) {
ret = sdi->driver->config_probe_set(
sdi, ch, SR_PROBE_SET_ENABLED);
sdi, ch, SR_CHANNEL_SET_ENABLED);
/* Roll back change if it wasn't applicable. */
if (ret == SR_ERR_ARG)
ch->enabled = was_enabled;
@ -195,7 +195,7 @@ SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int channelnum,
if (sdi->driver && sdi->driver->config_probe_set) {
ret = sdi->driver->config_probe_set(
sdi, ch, SR_PROBE_SET_TRIGGER);
sdi, ch, SR_CHANNEL_SET_TRIGGER);
/* Roll back change if it wasn't applicable. */
if (ret == SR_ERR_ARG) {
g_free(ch->trigger);

View File

@ -141,7 +141,7 @@ static GSList *scan(GSList *options)
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);

View File

@ -159,7 +159,7 @@ static void alsa_scan_handle_dev(GSList **devices,
for (i = 0; i < devc->num_channels; i++) {
snprintf(p_name, sizeof(p_name), "Ch_%d", i);
if (!(ch = sr_channel_new(i, SR_PROBE_ANALOG, TRUE, p_name)))
if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE, p_name)))
goto scan_error_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
}

View File

@ -111,10 +111,10 @@ static GSList *scan(GSList *options)
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "T1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T1")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "T2")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T2")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -93,7 +93,7 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf)
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_channel *ch;
float values[APPA_55II_NUM_PROBES], *val_ptr;
float values[APPA_55II_NUM_CHANNELS], *val_ptr;
int i;
devc = sdi->priv;
@ -109,7 +109,7 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf)
analog.mqflags = appa_55ii_flags(buf);
analog.data = values;
for (i = 0; i < APPA_55II_NUM_PROBES; i++) {
for (i = 0; i < APPA_55II_NUM_CHANNELS; i++) {
ch = g_slist_nth_data(sdi->channels, i);
if (!ch->enabled)
continue;
@ -139,7 +139,7 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi)
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_channel *ch;
float values[APPA_55II_NUM_PROBES], *val_ptr;
float values[APPA_55II_NUM_CHANNELS], *val_ptr;
const uint8_t *buf;
int16_t temp;
int offset, i;
@ -160,7 +160,7 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi)
analog.unit = SR_UNIT_CELSIUS;
analog.data = values;
for (i = 0; i < APPA_55II_NUM_PROBES; i++) {
for (i = 0; i < APPA_55II_NUM_CHANNELS; i++) {
temp = RL16(buf + 12 + 2 * i);
ch = g_slist_nth_data(sdi->channels, i);
if (!ch->enabled)

View File

@ -27,7 +27,7 @@
#define LOG_PREFIX "appa-55ii"
#define APPA_55II_NUM_PROBES 2
#define APPA_55II_NUM_CHANNELS 2
#define APPA_55II_BUF_SIZE (4 + 32 + 1)
#define DEFAULT_DATA_SOURCE DATA_SOURCE_LIVE

View File

@ -38,7 +38,7 @@
#define USB_MODEL_NAME "SIGMA"
#define USB_MODEL_VERSION ""
#define TRIGGER_TYPE "rf10"
#define NUM_PROBES 16
#define NUM_CHANNELS 16
SR_PRIV struct sr_dev_driver asix_sigma_driver_info;
static struct sr_dev_driver *di = &asix_sigma_driver_info;
@ -62,7 +62,7 @@ static const uint64_t samplerates[] = {
* http://tools.asix.net/img/sigma_sigmacab_pins_720.jpg
* (the cable has two additional GND pins, and a TI and TO pin)
*/
static const char *channel_names[NUM_PROBES + 1] = {
static const char *channel_names[NUM_CHANNELS + 1] = {
"1", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "11", "12", "13", "14", "15", "16",
NULL,
@ -464,7 +464,7 @@ static GSList *scan(GSList *options)
sdi->driver = di;
for (i = 0; channel_names[i]; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
channel_names[i])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -167,7 +167,7 @@ static GSList *scan(GSList *options, int modelid)
sdi->conn = serial;
for (i = 0; i < MAX_CHANNELS; i++) {
snprintf(channel, 10, "CH%d", i + 1);
ch = sr_channel_new(i, SR_PROBE_ANALOG, TRUE, channel);
ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE, channel);
sdi->channels = g_slist_append(sdi->channels, ch);
cg = g_malloc(sizeof(struct sr_channel_group));
cg->name = g_strdup(channel);

View File

@ -86,10 +86,10 @@ static GSList *scan(GSList *options)
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P2")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P2")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -89,7 +89,7 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm)
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -126,7 +126,7 @@ static GSList *scan(GSList *options)
sdi->inst_type = SR_INST_SERIAL;
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "SPL")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);

View File

@ -103,7 +103,7 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
sdi->driver = center_devs[idx].di;
for (i = 0; i < center_devs[idx].num_channels; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_ANALOG,
if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG,
TRUE, channel_names[i])))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -154,7 +154,7 @@ static GSList *scan(GSList *options)
sdi->priv = devc;
for (i = 0; chronovu_la8_channel_names[i]; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
chronovu_la8_channel_names[i])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -25,7 +25,7 @@
#include "protocol.h"
/* Probes are numbered 0-7. */
SR_PRIV const char *chronovu_la8_channel_names[NUM_PROBES + 1] = {
SR_PRIV const char *chronovu_la8_channel_names[NUM_CHANNELS + 1] = {
"0", "1", "2", "3", "4", "5", "6", "7",
NULL,
};

View File

@ -35,7 +35,7 @@
#define USB_MODEL_NAME "LA8"
#define USB_MODEL_VERSION ""
#define NUM_PROBES 8
#define NUM_CHANNELS 8
#define TRIGGER_TYPE "01"
#define SDRAM_SIZE (8 * 1024 * 1024)
#define MIN_NUM_SAMPLES 1

View File

@ -97,7 +97,7 @@ static GSList *scan(GSList *options)
sdi->inst_type = SR_INST_SERIAL;
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);

View File

@ -101,7 +101,7 @@ static GSList *scan(GSList *options)
sdi->conn = serial;
sdi->priv = NULL;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "CH1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -34,8 +34,8 @@
#define LOG_PREFIX "demo"
#define DEFAULT_NUM_LOGIC_PROBES 8
#define DEFAULT_NUM_ANALOG_PROBES 4
#define DEFAULT_NUM_LOGIC_CHANNELS 8
#define DEFAULT_NUM_ANALOG_CHANNELS 4
/* The size in bytes of chunks to send through the session bus. */
#define LOGIC_BUFSIZE 4096
@ -127,8 +127,8 @@ struct dev_context {
};
static const int32_t scanopts[] = {
SR_CONF_NUM_LOGIC_PROBES,
SR_CONF_NUM_ANALOG_PROBES,
SR_CONF_NUM_LOGIC_CHANNELS,
SR_CONF_NUM_ANALOG_CHANNELS,
};
static const int devopts[] = {
@ -265,15 +265,15 @@ static GSList *scan(GSList *options)
drvc = di->priv;
num_logic_channels = DEFAULT_NUM_LOGIC_PROBES;
num_analog_channels = DEFAULT_NUM_ANALOG_PROBES;
num_logic_channels = DEFAULT_NUM_LOGIC_CHANNELS;
num_analog_channels = DEFAULT_NUM_ANALOG_CHANNELS;
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
case SR_CONF_NUM_LOGIC_PROBES:
case SR_CONF_NUM_LOGIC_CHANNELS:
num_logic_channels = g_variant_get_int32(src->data);
break;
case SR_CONF_NUM_ANALOG_PROBES:
case SR_CONF_NUM_ANALOG_CHANNELS:
num_analog_channels = g_variant_get_int32(src->data);
break;
}
@ -309,7 +309,7 @@ static GSList *scan(GSList *options)
cg->priv = NULL;
for (i = 0; i < num_logic_channels; i++) {
sprintf(channel_name, "D%d", i);
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE, channel_name)))
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name)))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
cg->channels = g_slist_append(cg->channels, ch);
@ -322,7 +322,7 @@ static GSList *scan(GSList *options)
for (i = 0; i < num_analog_channels; i++) {
sprintf(channel_name, "A%d", i);
if (!(ch = sr_channel_new(i + num_logic_channels,
SR_PROBE_ANALOG, TRUE, channel_name)))
SR_CHANNEL_ANALOG, TRUE, channel_name)))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -407,20 +407,20 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
if (!cg)
return SR_ERR_CHANNEL_GROUP;
ch = cg->channels->data;
if (ch->type == SR_PROBE_LOGIC) {
if (ch->type == SR_CHANNEL_LOGIC) {
pattern = devc->logic_pattern;
*data = g_variant_new_string(logic_pattern_str[pattern]);
} else if (ch->type == SR_PROBE_ANALOG) {
} else if (ch->type == SR_CHANNEL_ANALOG) {
ag = cg->priv;
pattern = ag->pattern;
*data = g_variant_new_string(analog_pattern_str[pattern]);
} else
return SR_ERR_BUG;
break;
case SR_CONF_NUM_LOGIC_PROBES:
case SR_CONF_NUM_LOGIC_CHANNELS:
*data = g_variant_new_int32(devc->num_logic_channels);
break;
case SR_CONF_NUM_ANALOG_PROBES:
case SR_CONF_NUM_ANALOG_CHANNELS:
*data = g_variant_new_int32(devc->num_analog_channels);
break;
default:
@ -467,7 +467,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
stropt = g_variant_get_string(data, NULL);
ch = cg->channels->data;
pattern = -1;
if (ch->type == SR_PROBE_LOGIC) {
if (ch->type == SR_CHANNEL_LOGIC) {
for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) {
if (!strcmp(stropt, logic_pattern_str[i])) {
pattern = i;
@ -485,7 +485,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
memset(devc->logic_data, 0xff, LOGIC_BUFSIZE);
sr_dbg("Setting logic pattern to %s",
logic_pattern_str[pattern]);
} else if (ch->type == SR_PROBE_ANALOG) {
} else if (ch->type == SR_CHANNEL_ANALOG) {
for (i = 0; i < ARRAY_SIZE(analog_pattern_str); i++) {
if (!strcmp(stropt, analog_pattern_str[i])) {
pattern = i;
@ -550,10 +550,10 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(int32_t));
break;
case SR_CONF_PATTERN_MODE:
if (ch->type == SR_PROBE_LOGIC)
if (ch->type == SR_CHANNEL_LOGIC)
*data = g_variant_new_strv(logic_pattern_str,
ARRAY_SIZE(logic_pattern_str));
else if (ch->type == SR_PROBE_ANALOG)
else if (ch->type == SR_CHANNEL_ANALOG)
*data = g_variant_new_strv(analog_pattern_str,
ARRAY_SIZE(analog_pattern_str));
else

View File

@ -135,7 +135,7 @@ static GSList *fluke_scan(const char *conn, const char *serialcomm)
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);

View File

@ -197,7 +197,7 @@ static GSList *scan(GSList *options)
/* Fill in channellist according to this device's profile. */
num_logic_channels = prof->dev_caps & DEV_CAPS_16BIT ? 16 : 8;
for (j = 0; j < num_logic_channels; j++) {
if (!(ch = sr_channel_new(j, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
channel_names[j])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -240,7 +240,7 @@ static GSList *scan_1x_2x_rs232(GSList *options)
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = &gmc_mh_1x_2x_rs232_driver_info;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);
@ -343,7 +343,7 @@ static GSList *scan_2x_bd232(GSList *options)
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = &gmc_mh_2x_bd232_driver_info;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
goto exit_err;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);

View File

@ -575,12 +575,12 @@ SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi)
ch = devc->current_channel->data;
switch (ch->type) {
case SR_PROBE_ANALOG:
case SR_CHANNEL_ANALOG:
g_snprintf(command, sizeof(command),
(*model->scpi_dialect)[SCPI_CMD_GET_ANALOG_DATA],
ch->index + 1);
break;
case SR_PROBE_LOGIC:
case SR_CHANNEL_LOGIC:
g_snprintf(command, sizeof(command),
(*model->scpi_dialect)[SCPI_CMD_GET_DIG_DATA],
ch->index < 8 ? 1 : 2);
@ -604,13 +604,13 @@ static int hmo_check_channels(GSList *channels)
for (l = channels; l; l = l->next) {
ch = l->data;
switch (ch->type) {
case SR_PROBE_ANALOG:
case SR_CHANNEL_ANALOG:
if (ch->index == 2)
enabled_chan3 = TRUE;
else if (ch->index == 3)
enabled_chan4 = TRUE;
break;
case SR_PROBE_LOGIC:
case SR_CHANNEL_LOGIC:
if (ch->index < 8)
enabled_pod1 = TRUE;
else
@ -651,7 +651,7 @@ static int hmo_setup_channels(const struct sr_dev_inst *sdi)
for (l = sdi->channels; l; l = l->next) {
ch = l->data;
switch (ch->type) {
case SR_PROBE_ANALOG:
case SR_CHANNEL_ANALOG:
if (ch->enabled == state->analog_channels[ch->index].state)
break;
g_snprintf(command, sizeof(command),
@ -663,7 +663,7 @@ static int hmo_setup_channels(const struct sr_dev_inst *sdi)
state->analog_channels[ch->index].state = ch->enabled;
setup_changed = TRUE;
break;
case SR_PROBE_LOGIC:
case SR_CHANNEL_LOGIC:
/*
* A digital POD needs to be enabled for every group of
* 8 channels.
@ -728,10 +728,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
if (!ch->enabled)
continue;
/* Only add a single digital channel. */
if (ch->type != SR_PROBE_LOGIC || !digital_added) {
if (ch->type != SR_CHANNEL_LOGIC || !digital_added) {
devc->enabled_channels = g_slist_append(
devc->enabled_channels, ch);
if (ch->type == SR_PROBE_LOGIC)
if (ch->type == SR_CHANNEL_LOGIC)
digital_added = TRUE;
}
}

View File

@ -614,7 +614,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
/* Add analog channels. */
for (i = 0; i < scope_models[model_index].analog_channels; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_ANALOG, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
(*scope_models[model_index].analog_names)[i])))
return SR_ERR_MALLOC;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -637,7 +637,7 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
/* Add digital channels. */
for (i = 0; i < scope_models[model_index].digital_channels; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
(*scope_models[model_index].digital_names)[i])))
return SR_ERR_MALLOC;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -677,7 +677,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
ch = devc->current_channel->data;
switch (ch->type) {
case SR_PROBE_ANALOG:
case SR_CHANNEL_ANALOG:
if (sr_scpi_get_floatv(sdi->conn, NULL, &data) != SR_OK) {
if (data)
g_array_free(data, TRUE);
@ -700,7 +700,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
g_slist_free(analog.channels);
g_array_free(data, TRUE);
break;
case SR_PROBE_LOGIC:
case SR_CHANNEL_LOGIC:
if (sr_scpi_get_uint8v(sdi->conn, NULL, &data) != SR_OK) {
if (data)
g_free(data);

View File

@ -176,7 +176,7 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof
* a trigger source internal to the device.
*/
for (i = 0; channel_names[i]; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_ANALOG, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
channel_names[i])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -41,7 +41,7 @@ SR_PRIV const uint64_t sl2_samplerates[NUM_SAMPLERATES] = {
SR_MHZ(20),
};
static const char *channel_names[NUM_PROBES + 1] = {
static const char *channel_names[NUM_CHANNELS + 1] = {
"0", "1", "2", "3",
NULL,
};
@ -137,7 +137,7 @@ static GSList *scan(GSList *options)
sdi->conn = usb;
for (i = 0; channel_names[i]; i++) {
ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE,
ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
channel_names[i]);
sdi->channels = g_slist_append(sdi->channels, ch);
devc->channels[i] = ch;
@ -449,7 +449,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
* Count the number of enabled channels and number them for a sequential
* access.
*/
for (i = 0, j = 0; i < NUM_PROBES; i++) {
for (i = 0, j = 0; i < NUM_CHANNELS; i++) {
if (devc->channels[i]->enabled) {
devc->num_enabled_channels++;
devc->channel_map[j] = i;

View File

@ -89,7 +89,7 @@ static void process_sample_data(const struct sr_dev_inst *sdi)
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_logic logic;
uint8_t i, j, tmp, buffer[PACKET_NUM_SAMPLES], *ptr[NUM_PROBES];
uint8_t i, j, tmp, buffer[PACKET_NUM_SAMPLES], *ptr[NUM_CHANNELS];
uint16_t offset, n = 0;
int8_t k;
@ -526,7 +526,7 @@ SR_PRIV void sl2_configure_trigger(const struct sr_dev_inst *sdi)
* Set trigger to any edge on all channels if the trigger for each
* channel is set to any edge.
*/
if (num_triggers_anyedge == NUM_PROBES) {
if (num_triggers_anyedge == NUM_CHANNELS) {
devc->trigger_channel = TRIGGER_CHANNEL_ALL;
devc->trigger_type = TRIGGER_TYPE_ANYEDGE;
}

View File

@ -47,7 +47,7 @@
#define USB_HID_REPORT_TYPE_FEATURE 0x300
#define NUM_SAMPLERATES 11
#define NUM_PROBES 4
#define NUM_CHANNELS 4
#define TRIGGER_TYPES "rfc"
@ -152,7 +152,7 @@ struct dev_context {
void *cb_data;
/* Array to provide an index based access to all channels. */
const struct sr_channel *channels[NUM_PROBES];
const struct sr_channel *channels[NUM_CHANNELS];
struct libusb_transfer *xfer_in, *xfer_out;
@ -194,7 +194,7 @@ struct dev_context {
* channel except the last one. The samples of the last channel will be
* processed directly after they will be received.
*/
uint8_t sample_buffer[NUM_PROBES - 1][MAX_DEV_SAMPLE_BYTES];
uint8_t sample_buffer[NUM_CHANNELS - 1][MAX_DEV_SAMPLE_BYTES];
/* Expected number of sample packets for each channel. */
uint16_t num_sample_packets;
@ -212,7 +212,7 @@ struct dev_context {
unsigned int num_enabled_channels;
/* Array to provide a sequential access to all enabled channel indices. */
uint8_t channel_map[NUM_PROBES];
uint8_t channel_map[NUM_CHANNELS];
/* Indicates whether a transfer failed. */
gboolean transfer_error;

View File

@ -133,7 +133,7 @@ static GSList *scan(GSList *options)
sdi->priv = devc;
for (i = 0; channel_names[i]; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
channel_names[i])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -135,7 +135,7 @@ static GSList *scan(GSList *options)
sdi->driver = di;
sdi->inst_type = SR_INST_USB;
sdi->conn = l->data;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "SPL")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -330,18 +330,18 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config)
if (profile->logformat == LOG_TEMP_RH) {
/* Model this as two channels: temperature and humidity. */
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "Temp")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Temp")))
return NULL;
sdi->channels = g_slist_append(NULL, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "Hum")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Hum")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (profile->logformat == LOG_CO) {
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "CO")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CO")))
return NULL;
sdi->channels = g_slist_append(NULL, ch);
} else {
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(NULL, ch);
}

View File

@ -37,7 +37,7 @@ static const int32_t hwcaps[] = {
*
* See also: http://www.linkinstruments.com/images/mso19_1113.gif
*/
SR_PRIV const char *mso19_channel_names[NUM_PROBES + 1] = {
SR_PRIV const char *mso19_channel_names[NUM_CHANNELS + 1] = {
/* Note: DSO needs to be first. */
"DSO", "0", "1", "2", "3", "4", "5", "6", "7", NULL,
};
@ -216,9 +216,9 @@ static GSList *scan(GSList *options)
sdi->driver = di;
sdi->priv = devc;
for (i = 0; i < NUM_PROBES; i++) {
for (i = 0; i < NUM_CHANNELS; i++) {
struct sr_channel *ch;
ptype = (i == 0) ? SR_PROBE_ANALOG : SR_PROBE_LOGIC;
ptype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC;
if (!(ch = sr_channel_new(i, ptype, TRUE,
mso19_channel_names[i])))
return 0;

View File

@ -34,7 +34,7 @@
#define USB_VENDOR "3195"
#define USB_PRODUCT "f190"
#define NUM_PROBES (1 + 8)
#define NUM_CHANNELS (1 + 8)
#define NUM_TRIGGER_STAGES 4
#define TRIGGER_TYPE "01" //the first r/f is used for the whole group
#define SERIALCOMM "460800/8n1/flow=2"

View File

@ -101,12 +101,12 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
sdi->priv = devc;
sdi->driver = mic_devs[idx].di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "Temperature")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "Temperature")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (mic_devs[idx].has_humidity) {
if (!(ch = sr_channel_new(1, SR_PROBE_ANALOG, TRUE, "Humidity")))
if (!(ch = sr_channel_new(1, SR_CHANNEL_ANALOG, TRUE, "Humidity")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
}

View File

@ -128,7 +128,7 @@ static GSList *scan(GSList *options)
sdi->conn = serial;
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE,
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE,
"P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -62,7 +62,7 @@ static const char *patterns[] = {
};
/* Channels are numbered 0-31 (on the PCB silkscreen). */
SR_PRIV const char *ols_channel_names[NUM_PROBES + 1] = {
SR_PRIV const char *ols_channel_names[NUM_CHANNELS + 1] = {
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
"13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23",
"24", "25", "26", "27", "28", "29", "30", "31",
@ -177,7 +177,7 @@ static GSList *scan(GSList *options)
"Sump", "Logic Analyzer", "v1.0");
sdi->driver = di;
for (i = 0; i < 32; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
ols_channel_names[i])))
return 0;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -323,10 +323,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
case SR_CONF_SWAP:
if (g_variant_get_boolean(data)) {
sr_info("Enabling channel swapping.");
devc->flag_reg |= FLAG_SWAP_PROBES;
devc->flag_reg |= FLAG_SWAP_CHANNELS;
} else {
sr_info("Disabling channel swapping.");
devc->flag_reg &= ~FLAG_SWAP_PROBES;
devc->flag_reg &= ~FLAG_SWAP_CHANNELS;
}
ret = SR_OK;
break;

View File

@ -203,7 +203,7 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
case 0x00:
/* Number of usable channels */
for (ui = 0; ui < tmp_int; ui++) {
if (!(ch = sr_channel_new(ui, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
ols_channel_names[ui])))
return 0;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -241,7 +241,7 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
case 0x00:
/* Number of usable channels */
for (ui = 0; ui < tmp_c; ui++) {
if (!(ch = sr_channel_new(ui, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
ols_channel_names[ui])))
return 0;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -284,13 +284,13 @@ SR_PRIV int ols_set_samplerate(const struct sr_dev_inst *sdi,
sr_info("Enabling demux mode.");
devc->flag_reg |= FLAG_DEMUX;
devc->flag_reg &= ~FLAG_FILTER;
devc->max_channels = NUM_PROBES / 2;
devc->max_channels = NUM_CHANNELS / 2;
devc->cur_samplerate_divider = (CLOCK_RATE * 2 / samplerate) - 1;
} else {
sr_info("Disabling demux mode.");
devc->flag_reg &= ~FLAG_DEMUX;
devc->flag_reg |= FLAG_FILTER;
devc->max_channels = NUM_PROBES;
devc->max_channels = NUM_CHANNELS;
devc->cur_samplerate_divider = (CLOCK_RATE / samplerate) - 1;
}
@ -357,7 +357,7 @@ SR_PRIV int ols_receive_data(int fd, int revents, void *cb_data)
}
num_channels = 0;
for (i = NUM_PROBES; i > 0x02; i /= 2) {
for (i = NUM_CHANNELS; i > 0x02; i /= 2) {
if ((devc->flag_reg & i) == 0) {
num_channels++;
}

View File

@ -28,7 +28,7 @@
#define LOG_PREFIX "ols"
#define NUM_PROBES 32
#define NUM_CHANNELS 32
#define NUM_TRIGGER_STAGES 4
#define TRIGGER_TYPE "01"
#define SERIAL_SPEED B115200
@ -56,7 +56,7 @@
/* 12-13 unused, 14-15 RLE mode (we hardcode mode 0). */
#define FLAG_INTERNAL_TEST_MODE (1 << 11)
#define FLAG_EXTERNAL_TEST_MODE (1 << 10)
#define FLAG_SWAP_PROBES (1 << 9)
#define FLAG_SWAP_CHANNELS (1 << 9)
#define FLAG_RLE (1 << 8)
#define FLAG_SLOPE_FALLING (1 << 7)
#define FLAG_CLOCK_EXTERNAL (1 << 6)
@ -103,7 +103,7 @@ struct dev_context {
};
SR_PRIV extern const char *ols_channel_names[NUM_PROBES + 1];
SR_PRIV extern const char *ols_channel_names[NUM_CHANNELS + 1];
SR_PRIV int send_shortcommand(struct sr_serial_dev_inst *serial,
uint8_t command);

View File

@ -335,7 +335,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
for (i = 0; i < model->analog_channels; i++) {
if (!(channel_name = g_strdup_printf("CH%d", i + 1)))
return NULL;
ch = sr_channel_new(i, SR_PROBE_ANALOG, TRUE, channel_name);
ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE, channel_name);
sdi->channels = g_slist_append(sdi->channels, ch);
devc->analog_groups[i].name = channel_name;
devc->analog_groups[i].channels = g_slist_append(NULL, ch);
@ -347,7 +347,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
for (i = 0; i < 16; i++) {
if (!(channel_name = g_strdup_printf("D%d", i)))
return NULL;
ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE, channel_name);
ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name);
g_free(channel_name);
if (!ch)
return NULL;
@ -445,7 +445,7 @@ static int analog_frame_size(const struct sr_dev_inst *sdi)
for (l = sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type == SR_PROBE_ANALOG && ch->enabled)
if (ch->type == SR_CHANNEL_ANALOG && ch->enabled)
analog_channels++;
}
@ -501,7 +501,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
ch = g_slist_nth_data(cg->channels, 0);
if (!ch)
return SR_ERR;
if (ch->type == SR_PROBE_ANALOG) {
if (ch->type == SR_CHANNEL_ANALOG) {
if (ch->name[2] < '1' || ch->name[2] > '4')
return SR_ERR;
analog_channel = ch->name[2] - '1';
@ -880,7 +880,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
for (l = sdi->channels; l; l = l->next) {
ch = l->data;
sr_dbg("handling channel %s", ch->name);
if (ch->type == SR_PROBE_ANALOG) {
if (ch->type == SR_CHANNEL_ANALOG) {
if (ch->enabled)
devc->enabled_analog_channels = g_slist_append(
devc->enabled_analog_channels, ch);
@ -891,7 +891,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
return SR_ERR;
devc->analog_channels[ch->index] = ch->enabled;
}
} else if (ch->type == SR_PROBE_LOGIC) {
} else if (ch->type == SR_CHANNEL_LOGIC) {
if (ch->enabled) {
devc->enabled_digital_channels = g_slist_append(
devc->enabled_digital_channels, ch);

View File

@ -386,7 +386,7 @@ SR_PRIV int rigol_ds_channel_start(const struct sr_dev_inst *sdi)
sr_dbg("Starting reading data from channel %d", ch->index + 1);
if (devc->model->series->protocol <= PROTOCOL_V2) {
if (ch->type == SR_PROBE_LOGIC) {
if (ch->type == SR_CHANNEL_LOGIC) {
if (sr_scpi_send(sdi->conn, ":WAV:DATA? DIG") != SR_OK)
return SR_ERR;
} else {
@ -524,7 +524,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
ch = devc->channel_entry->data;
expected_data_bytes = ch->type == SR_PROBE_ANALOG ?
expected_data_bytes = ch->type == SR_CHANNEL_ANALOG ?
devc->analog_frame_size : devc->digital_frame_size;
if (devc->num_block_bytes == 0) {
@ -586,7 +586,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
devc->num_block_read += len;
if (ch->type == SR_PROBE_ANALOG) {
if (ch->type == SR_CHANNEL_ANALOG) {
vref = devc->vert_reference[ch->index];
vdiv = devc->vdiv[ch->index] / 25.6;
offset = devc->vert_offset[ch->index];
@ -658,7 +658,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
rigol_ds_config_set(sdi, ":WAV:END");
}
if (ch->type == SR_PROBE_ANALOG
if (ch->type == SR_CHANNEL_ANALOG
&& devc->channel_entry->next != NULL) {
/* We got the frame for this analog channel, but
* there's another analog channel. */

View File

@ -31,8 +31,8 @@
/* Size of acquisition buffers */
#define ACQ_BUFFER_SIZE 32768
#define MAX_ANALOG_PROBES 4
#define MAX_DIGITAL_PROBES 16
#define MAX_ANALOG_CHANNELS 4
#define MAX_DIGITAL_CHANNELS 16
enum protocol_version {
PROTOCOL_V1, /* VS5000 */
@ -98,7 +98,7 @@ struct dev_context {
uint64_t num_vdivs;
/* Channel groups */
struct sr_channel_group analog_groups[MAX_ANALOG_PROBES];
struct sr_channel_group analog_groups[MAX_ANALOG_CHANNELS];
struct sr_channel_group digital_group;
/* Acquisition settings */
@ -111,17 +111,17 @@ struct dev_context {
uint64_t digital_frame_size;
/* Device settings */
gboolean analog_channels[MAX_ANALOG_PROBES];
gboolean digital_channels[MAX_DIGITAL_PROBES];
gboolean analog_channels[MAX_ANALOG_CHANNELS];
gboolean digital_channels[MAX_DIGITAL_CHANNELS];
gboolean la_enabled;
float timebase;
float vdiv[MAX_ANALOG_PROBES];
int vert_reference[MAX_ANALOG_PROBES];
float vert_offset[MAX_ANALOG_PROBES];
float vdiv[MAX_ANALOG_CHANNELS];
int vert_reference[MAX_ANALOG_CHANNELS];
float vert_offset[MAX_ANALOG_CHANNELS];
char *trigger_source;
float horiz_triggerpos;
char *trigger_slope;
char *coupling[MAX_ANALOG_PROBES];
char *coupling[MAX_ANALOG_CHANNELS];
/* Operational state */

View File

@ -195,7 +195,7 @@ static GSList *scan(GSList *options)
sdi->driver = di;
for (j = 0; channel_names[j]; j++) {
if (!(ch = sr_channel_new(j, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
channel_names[j])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -405,7 +405,7 @@ static GSList *sdmm_scan(const char *conn, const char *serialcomm, int dmm)
sdi->priv = devc;
sdi->driver = dmms[dmm].di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
drvc->instances = g_slist_append(drvc->instances, sdi);

View File

@ -85,7 +85,7 @@ static GSList *gen_channel_list(int num_channels)
/* The LWLA series simply number channels from CH1 to CHxx. */
g_snprintf(name, sizeof(name), "CH%d", i);
ch = sr_channel_new(i - 1, SR_PROBE_LOGIC, TRUE, name);
ch = sr_channel_new(i - 1, SR_CHANNEL_LOGIC, TRUE, name);
list = g_slist_prepend(list, ch);
}
@ -118,7 +118,7 @@ static struct sr_dev_inst *dev_inst_new(int device_index)
devc->samplerate = DEFAULT_SAMPLERATE;
sdi->priv = devc;
sdi->channels = gen_channel_list(NUM_PROBES);
sdi->channels = gen_channel_list(NUM_CHANNELS);
return sdi;
}
@ -414,13 +414,13 @@ static int config_probe_set(const struct sr_dev_inst *sdi,
if (!devc)
return SR_ERR_DEV_CLOSED;
if (ch->index < 0 || ch->index >= NUM_PROBES) {
if (ch->index < 0 || ch->index >= NUM_CHANNELS) {
sr_err("Channel index %d out of range.", ch->index);
return SR_ERR_BUG;
}
channel_bit = (uint64_t)1 << ch->index;
if ((changes & SR_PROBE_SET_ENABLED) != 0) {
if ((changes & SR_CHANNEL_SET_ENABLED) != 0) {
/* Enable or disable input channel for this channel. */
if (ch->enabled)
devc->channel_mask |= channel_bit;
@ -428,7 +428,7 @@ static int config_probe_set(const struct sr_dev_inst *sdi,
devc->channel_mask &= ~channel_bit;
}
if ((changes & SR_PROBE_SET_TRIGGER) != 0) {
if ((changes & SR_CHANNEL_SET_TRIGGER) != 0) {
trigger_mask = devc->trigger_mask & ~channel_bit;
trigger_values = devc->trigger_values & ~channel_bit;
trigger_edge_mask = devc->trigger_edge_mask & ~channel_bit;

View File

@ -545,7 +545,7 @@ static int process_sample_data(const struct sr_dev_inst *sdi)
if (acq->rle == RLE_STATE_DATA) {
acq->sample = word & ALL_CHANNELS_MASK;
acq->run_len = ((word >> NUM_PROBES) & 1) + 1;
acq->run_len = ((word >> NUM_CHANNELS) & 1) + 1;
if (word & RLE_FLAG_LEN_FOLLOWS)
acq->rle = RLE_STATE_LEN;
} else {

View File

@ -37,16 +37,16 @@
#define USB_INTERFACE 0
#define USB_TIMEOUT 3000 /* ms */
#define NUM_PROBES 34
#define NUM_CHANNELS 34
#define TRIGGER_TYPES "01fr"
/* Bit mask covering all 34 channels.
*/
#define ALL_CHANNELS_MASK (((uint64_t)1 << NUM_PROBES) - 1)
#define ALL_CHANNELS_MASK (((uint64_t)1 << NUM_CHANNELS) - 1)
/** Unit and packet size for the sigrok logic datafeed.
*/
#define UNIT_SIZE ((NUM_PROBES + 7) / 8)
#define UNIT_SIZE ((NUM_CHANNELS + 7) / 8)
#define PACKET_LENGTH 10000 /* units */
/** Size of the acquisition buffer in device memory units.

View File

@ -107,54 +107,54 @@ static GSList *scan(GSList *options)
sdi->priv = devc;
sdi->driver = di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (devc->optarif == OPTARIF_BASE) {
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "BASE")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "BASE")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (devc->optarif == OPTARIF_HC) {
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HP")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HP")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HC")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HC")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (devc->optarif == OPTARIF_EJP) {
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HN")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HN")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HPM")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPM")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
} else if (devc->optarif == OPTARIF_BBR) {
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HPJB")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJB")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HPJW")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJW")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HPJR")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HPJR")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HCJB")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJB")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HCJW")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJW")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "HCJR")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "HCJR")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
}
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "IINST")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "IINST")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "PAPP")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "PAPP")))
goto scan_cleanup;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -106,7 +106,7 @@ static GSList *scan(GSList *options)
sdi->priv = devc;
sdi->driver = di;
ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1");
ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
if (!ch) {
sr_err("Failed to create channel.");
return NULL;

View File

@ -221,7 +221,7 @@ static GSList *scan(GSList *options, int dmm)
}
sdi->priv = devc;
sdi->driver = udmms[dmm].di;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -86,7 +86,7 @@ static GSList *scan(GSList *options)
sdi->inst_type = SR_INST_USB;
sdi->conn = l->data;
for (i = 0; i < 3; i++) {
if (!(ch = sr_channel_new(i, SR_PROBE_ANALOG, TRUE,
if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
channels[i]))) {
sr_dbg("Channel malloc failed.");
return NULL;

View File

@ -88,7 +88,7 @@ static GSList *scan(GSList *options)
return NULL;
sdi->priv = devc;
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, "P1")))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
return NULL;
sdi->channels = g_slist_append(NULL, ch);

View File

@ -316,7 +316,7 @@ static GSList *scan(GSList *options)
/* Fill in channellist according to this device's profile. */
for (j = 0; j < devc->num_channels; j++) {
if (!(ch = sr_channel_new(j, SR_PROBE_LOGIC, TRUE,
if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
channel_names[j])))
return NULL;
sdi->channels = g_slist_append(sdi->channels, ch);

View File

@ -96,9 +96,9 @@ static struct sr_config_info sr_config_info_data[] = {
"Power off", NULL},
{SR_CONF_DATA_SOURCE, SR_T_CHAR, "data_source",
"Data source", NULL},
{SR_CONF_NUM_LOGIC_PROBES, SR_T_INT32, "logic_probes",
{SR_CONF_NUM_LOGIC_CHANNELS, SR_T_INT32, "logic_probes",
"Number of logic probes", NULL},
{SR_CONF_NUM_ANALOG_PROBES, SR_T_INT32, "analog_probes",
{SR_CONF_NUM_ANALOG_CHANNELS, SR_T_INT32, "analog_probes",
"Number of analog probes", NULL},
{SR_CONF_OUTPUT_VOLTAGE, SR_T_FLOAT, "output_voltage",
"Current output voltage", NULL},

View File

@ -29,7 +29,7 @@
#define LOG_PREFIX "input/binary"
#define CHUNKSIZE (512 * 1024)
#define DEFAULT_NUM_PROBES 8
#define DEFAULT_NUM_CHANNELS 8
struct context {
uint64_t samplerate;
@ -47,7 +47,7 @@ static int init(struct sr_input *in, const char *filename)
{
struct sr_channel *ch;
int num_channels, i;
char name[SR_MAX_PROBENAME_LEN + 1];
char name[SR_MAX_CHANNELNAME_LEN + 1];
char *param;
struct context *ctx;
@ -58,7 +58,7 @@ static int init(struct sr_input *in, const char *filename)
return SR_ERR_MALLOC;
}
num_channels = DEFAULT_NUM_PROBES;
num_channels = DEFAULT_NUM_CHANNELS;
ctx->samplerate = 0;
if (in->param) {
@ -81,9 +81,9 @@ static int init(struct sr_input *in, const char *filename)
in->internal = ctx;
for (i = 0; i < num_channels; i++) {
snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i);
snprintf(name, SR_MAX_CHANNELNAME_LEN, "%d", i);
/* TODO: Check return value. */
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE, name)))
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, name)))
return SR_ERR;
in->sdi->channels = g_slist_append(in->sdi->channels, ch);
}

View File

@ -29,7 +29,7 @@
#define NUM_PACKETS 2048
#define PACKET_SIZE 4096
#define DEFAULT_NUM_PROBES 8
#define DEFAULT_NUM_CHANNELS 8
/**
* Convert the LA8 'divcount' value to the respective samplerate (in Hz).
@ -98,12 +98,12 @@ static int init(struct sr_input *in, const char *filename)
{
struct sr_channel *ch;
int num_channels, i;
char name[SR_MAX_PROBENAME_LEN + 1];
char name[SR_MAX_CHANNELNAME_LEN + 1];
char *param;
(void)filename;
num_channels = DEFAULT_NUM_PROBES;
num_channels = DEFAULT_NUM_CHANNELS;
if (in->param) {
param = g_hash_table_lookup(in->param, "numchannels");
@ -120,9 +120,9 @@ static int init(struct sr_input *in, const char *filename)
in->sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, NULL, NULL, NULL);
for (i = 0; i < num_channels; i++) {
snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i);
snprintf(name, SR_MAX_CHANNELNAME_LEN, "%d", i);
/* TODO: Check return value. */
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE, name)))
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, name)))
return SR_ERR;
in->sdi->channels = g_slist_append(in->sdi->channels, ch);
}

View File

@ -431,7 +431,7 @@ static int init(struct sr_input *in, const char *filename)
const char *param;
GIOStatus status;
gsize i, term_pos;
char channel_name[SR_MAX_PROBENAME_LEN + 1];
char channel_name[SR_MAX_CHANNELNAME_LEN + 1];
struct sr_channel *ch;
char **columns;
gsize num_columns;
@ -682,7 +682,7 @@ static int init(struct sr_input *in, const char *filename)
else
snprintf(channel_name, sizeof(channel_name), "%zu", i);
ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE, channel_name);
ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, channel_name);
if (!ch) {
sr_err("Channel creation failed.");

View File

@ -65,7 +65,7 @@
#define LOG_PREFIX "input/vcd"
#define DEFAULT_NUM_PROBES 8
#define DEFAULT_NUM_CHANNELS 8
#define CHUNKSIZE 1024
struct context {
@ -289,7 +289,7 @@ static int init(struct sr_input *in, const char *filename)
{
struct sr_channel *ch;
int num_channels, i;
char name[SR_MAX_PROBENAME_LEN + 1];
char name[SR_MAX_CHANNELNAME_LEN + 1];
char *param;
struct context *ctx;
@ -300,7 +300,7 @@ static int init(struct sr_input *in, const char *filename)
return SR_ERR_MALLOC;
}
num_channels = DEFAULT_NUM_PROBES;
num_channels = DEFAULT_NUM_CHANNELS;
ctx->samplerate = 0;
ctx->downsample = 1;
ctx->skip = -1;
@ -342,9 +342,9 @@ static int init(struct sr_input *in, const char *filename)
in->internal = ctx;
for (i = 0; i < num_channels; i++) {
snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i);
snprintf(name, SR_MAX_CHANNELNAME_LEN, "%d", i);
if (!(ch = sr_channel_new(i, SR_PROBE_LOGIC, TRUE, name))) {
if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, name))) {
release_context(ctx);
return SR_ERR;
}

View File

@ -114,7 +114,7 @@ static int init(struct sr_input *in, const char *filename)
for (i = 0; i < ctx->num_channels; i++) {
snprintf(channelname, 8, "CH%d", i + 1);
if (!(ch = sr_channel_new(0, SR_PROBE_ANALOG, TRUE, channelname)))
if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, channelname)))
return SR_ERR;
in->sdi->channels = g_slist_append(in->sdi->channels, ch);
}

View File

@ -227,9 +227,9 @@ SR_PRIV int sr_err(const char *format, ...);
/** Values for the changes argument of sr_dev_driver.config_probe_set. */
enum {
/** The enabled state of the probe has been changed. */
SR_PROBE_SET_ENABLED = 1 << 0,
SR_CHANNEL_SET_ENABLED = 1 << 0,
/** The trigger setup of the probe has been changed. */
SR_PROBE_SET_TRIGGER = 1 << 1,
SR_CHANNEL_SET_TRIGGER = 1 << 1,
};
SR_PRIV struct sr_channel *sr_channel_new(int index, int type,

View File

@ -81,7 +81,7 @@ enum {
*/
};
#define SR_MAX_PROBENAME_LEN 32
#define SR_MAX_CHANNELNAME_LEN 32
/* Handy little macros */
#define SR_HZ(n) (n)
@ -600,16 +600,16 @@ struct sr_output_format {
/** Constants for probe type. */
enum {
/** Probe type is logic probe. */
SR_PROBE_LOGIC = 10000,
SR_CHANNEL_LOGIC = 10000,
/** Probe type is analog probe. */
SR_PROBE_ANALOG,
SR_CHANNEL_ANALOG,
};
/** Information on single channel. */
struct sr_channel {
/** Number of channels, starting at 0. */
int index;
/** Channel type (SR_PROBE_LOGIC, ...) */
/** Channel type (SR_CHANNEL_LOGIC, ...) */
int type;
/** Is this channel enabled? */
gboolean enabled;
@ -804,10 +804,10 @@ enum {
SR_CONF_CENTER_FREQUENCY,
/** The device supports setting the number of logic probes. */
SR_CONF_NUM_LOGIC_PROBES,
SR_CONF_NUM_LOGIC_CHANNELS,
/** The device supports setting the number of analog probes. */
SR_CONF_NUM_ANALOG_PROBES,
SR_CONF_NUM_ANALOG_CHANNELS,
/** Output voltage. */
SR_CONF_OUTPUT_VOLTAGE,

View File

@ -108,7 +108,7 @@ static int init(struct sr_output *o)
/* Get the unitsize. */
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;

View File

@ -68,7 +68,7 @@ static int init(struct sr_output *o)
/* Get the number of channels, and the unitsize. */
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;
@ -102,7 +102,7 @@ static int init(struct sr_output *o)
ctx->num_enabled_channels, num_channels);
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;

View File

@ -80,7 +80,7 @@ static int init(struct sr_output *o)
ctx->num_enabled_channels = 0;
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;
@ -114,7 +114,7 @@ static int init(struct sr_output *o)
wbuf[0] = '\0';
for (i = 0, l = o->sdi->channels; l; l = l->next, i++) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;

View File

@ -71,7 +71,7 @@ static GString *gen_header(const struct sr_dev_inst *sdi, struct context *ctx)
num_enabled_channels = 0;
for (l = sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;

View File

@ -43,7 +43,7 @@ SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in,
uint8_t *outbuf;
ctx = o->internal;
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
max_linelen = SR_MAX_CHANNELNAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 8;
/*
* Calculate space needed for probes. Set aside 512 bytes for

View File

@ -43,7 +43,7 @@ SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in,
uint8_t *outbuf, c;
ctx = o->internal;
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
max_linelen = SR_MAX_CHANNELNAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 8;
/*
* Calculate space needed for probes. Set aside 512 bytes for

View File

@ -43,7 +43,7 @@ SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in,
uint8_t *outbuf;
ctx = o->internal;
max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
max_linelen = SR_MAX_CHANNELNAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 2;
outsize = length_in / ctx->unitsize * ctx->num_enabled_channels
/ ctx->samples_per_line * max_linelen + 512;

View File

@ -92,7 +92,7 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;

View File

@ -63,7 +63,7 @@ static int init(struct sr_output *o)
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;
@ -127,7 +127,7 @@ static int init(struct sr_output *o)
/* Wires / channels */
for (i = 0, l = o->sdi->channels; l; l = l->next, i++) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (!ch->enabled)
continue;

View File

@ -259,7 +259,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
case SR_CONF_CAPTURE_UNITSIZE:
vdev->unitsize = g_variant_get_uint64(data);
break;
case SR_CONF_NUM_LOGIC_PROBES:
case SR_CONF_NUM_LOGIC_CHANNELS:
vdev->num_probes = g_variant_get_uint64(data);
break;
default:

View File

@ -117,7 +117,7 @@ SR_API int sr_session_load(const char *filename)
int ret, channelnum, devcnt, i, j;
uint64_t tmp_u64, total_channels, enabled_channels, p;
char **sections, **keys, *metafile, *val;
char channelname[SR_MAX_PROBENAME_LEN + 1];
char channelname[SR_MAX_CHANNELNAME_LEN + 1];
if ((ret = sr_sessionfile_check(filename)) != SR_OK)
return ret;
@ -182,11 +182,11 @@ SR_API int sr_session_load(const char *filename)
g_variant_new_uint64(tmp_u64), sdi, NULL);
} else if (!strcmp(keys[j], "total probes")) {
total_channels = strtoull(val, NULL, 10);
sdi->driver->config_set(SR_CONF_NUM_LOGIC_PROBES,
sdi->driver->config_set(SR_CONF_NUM_LOGIC_CHANNELS,
g_variant_new_uint64(total_channels), sdi, NULL);
for (p = 0; p < total_channels; p++) {
snprintf(channelname, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
if (!(ch = sr_channel_new(p, SR_PROBE_LOGIC, TRUE,
snprintf(channelname, SR_MAX_CHANNELNAME_LEN, "%" PRIu64, p);
if (!(ch = sr_channel_new(p, SR_CHANNEL_LOGIC, TRUE,
channelname)))
return SR_ERR;
sdi->channels = g_slist_append(sdi->channels, ch);
@ -254,7 +254,7 @@ SR_API int sr_session_save(const char *filename, const struct sr_dev_inst *sdi,
cnt = 0;
for (l = sdi->channels; l; l = l->next) {
ch = l->data;
if (ch->type != SR_PROBE_LOGIC)
if (ch->type != SR_CHANNEL_LOGIC)
continue;
if (ch->enabled != TRUE)
continue;

View File

@ -220,7 +220,7 @@ GArray *srtest_get_enabled_logic_probes(const struct sr_dev_inst *sdi)
probes = g_array_new(FALSE, FALSE, sizeof(int));
for (l = sdi->probes; l; l = l->next) {
probe = l->data;
if (probe->type != SR_PROBE_LOGIC)
if (probe->type != SR_CHANNEL_LOGIC)
continue;
if (probe->enabled != TRUE)
continue;