From: Uwe Hermann Date: Mon, 24 Mar 2014 21:39:42 +0000 (+0100) Subject: Rename various *PROBE* macros to *CHANNEL*. X-Git-Tag: libsigrok-0.3.0~106 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3f239f0803b9fbc073dd7abe9fc7b2a0c606fbb6;p=libsigrok.git Rename various *PROBE* macros to *CHANNEL*. This fixes parts of bug #259. --- diff --git a/bindings/python/sigrok/core/classes.py b/bindings/python/sigrok/core/classes.py index d5038a0c..d4e209f3 100644 --- a/bindings/python/sigrok/core/classes.py +++ b/bindings/python/sigrok/core/classes.py @@ -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) diff --git a/device.c b/device.c index 04adcccf..4cdae580 100644 --- a/device.c +++ b/device.c @@ -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); diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index bbe4c71f..ccc2f65c 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -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); diff --git a/hardware/alsa/protocol.c b/hardware/alsa/protocol.c index 987e7a7e..6975d2fb 100644 --- a/hardware/alsa/protocol.c +++ b/hardware/alsa/protocol.c @@ -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); } diff --git a/hardware/appa-55ii/api.c b/hardware/appa-55ii/api.c index 8bbe45a0..76460783 100644 --- a/hardware/appa-55ii/api.c +++ b/hardware/appa-55ii/api.c @@ -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); diff --git a/hardware/appa-55ii/protocol.c b/hardware/appa-55ii/protocol.c index aa77a961..708262bd 100644 --- a/hardware/appa-55ii/protocol.c +++ b/hardware/appa-55ii/protocol.c @@ -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) diff --git a/hardware/appa-55ii/protocol.h b/hardware/appa-55ii/protocol.h index 38a35564..fa3c2476 100644 --- a/hardware/appa-55ii/protocol.h +++ b/hardware/appa-55ii/protocol.h @@ -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 diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index d32e9128..5ec30837 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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); diff --git a/hardware/atten-pps3xxx/api.c b/hardware/atten-pps3xxx/api.c index e74c40de..3b9f0025 100644 --- a/hardware/atten-pps3xxx/api.c +++ b/hardware/atten-pps3xxx/api.c @@ -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); diff --git a/hardware/brymen-bm86x/api.c b/hardware/brymen-bm86x/api.c index 1c7aaa2f..169721d4 100644 --- a/hardware/brymen-bm86x/api.c +++ b/hardware/brymen-bm86x/api.c @@ -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); diff --git a/hardware/brymen-dmm/api.c b/hardware/brymen-dmm/api.c index 52b49a18..ca4a742c 100644 --- a/hardware/brymen-dmm/api.c +++ b/hardware/brymen-dmm/api.c @@ -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); diff --git a/hardware/cem-dt-885x/api.c b/hardware/cem-dt-885x/api.c index 7170c6f7..1b56227e 100644 --- a/hardware/cem-dt-885x/api.c +++ b/hardware/cem-dt-885x/api.c @@ -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); diff --git a/hardware/center-3xx/api.c b/hardware/center-3xx/api.c index 68fa1d55..ddac1540 100644 --- a/hardware/center-3xx/api.c +++ b/hardware/center-3xx/api.c @@ -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); diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 75757c24..896ee74a 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -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); diff --git a/hardware/chronovu-la8/protocol.c b/hardware/chronovu-la8/protocol.c index 85d21d99..587849e9 100644 --- a/hardware/chronovu-la8/protocol.c +++ b/hardware/chronovu-la8/protocol.c @@ -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, }; diff --git a/hardware/chronovu-la8/protocol.h b/hardware/chronovu-la8/protocol.h index 2887ba03..5136b770 100644 --- a/hardware/chronovu-la8/protocol.h +++ b/hardware/chronovu-la8/protocol.h @@ -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 diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index cd3b8ce8..f6588272 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -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); diff --git a/hardware/conrad-digi-35-cpu/api.c b/hardware/conrad-digi-35-cpu/api.c index 7a21fb77..2f24d189 100644 --- a/hardware/conrad-digi-35-cpu/api.c +++ b/hardware/conrad-digi-35-cpu/api.c @@ -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); diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 3573d50e..07ae253a 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -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 diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index f2453aa2..e0dee04b 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -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); diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index eabf6bd7..b1b338f7 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -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); diff --git a/hardware/gmc-mh-1x-2x/api.c b/hardware/gmc-mh-1x-2x/api.c index 2f05993e..ec12ab2f 100644 --- a/hardware/gmc-mh-1x-2x/api.c +++ b/hardware/gmc-mh-1x-2x/api.c @@ -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); diff --git a/hardware/hameg-hmo/api.c b/hardware/hameg-hmo/api.c index bfc0f62a..f348f87a 100644 --- a/hardware/hameg-hmo/api.c +++ b/hardware/hameg-hmo/api.c @@ -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; } } diff --git a/hardware/hameg-hmo/protocol.c b/hardware/hameg-hmo/protocol.c index 6348da18..afa6efe3 100644 --- a/hardware/hameg-hmo/protocol.c +++ b/hardware/hameg-hmo/protocol.c @@ -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); diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 92451605..76696d57 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -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); diff --git a/hardware/ikalogic-scanalogic2/api.c b/hardware/ikalogic-scanalogic2/api.c index 9ff4a285..e586011e 100644 --- a/hardware/ikalogic-scanalogic2/api.c +++ b/hardware/ikalogic-scanalogic2/api.c @@ -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; diff --git a/hardware/ikalogic-scanalogic2/protocol.c b/hardware/ikalogic-scanalogic2/protocol.c index dd460d42..b99709c6 100644 --- a/hardware/ikalogic-scanalogic2/protocol.c +++ b/hardware/ikalogic-scanalogic2/protocol.c @@ -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; } diff --git a/hardware/ikalogic-scanalogic2/protocol.h b/hardware/ikalogic-scanalogic2/protocol.h index 26adeedb..3b411e69 100644 --- a/hardware/ikalogic-scanalogic2/protocol.h +++ b/hardware/ikalogic-scanalogic2/protocol.h @@ -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; diff --git a/hardware/ikalogic-scanaplus/api.c b/hardware/ikalogic-scanaplus/api.c index 369aed47..e8550977 100644 --- a/hardware/ikalogic-scanaplus/api.c +++ b/hardware/ikalogic-scanaplus/api.c @@ -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); diff --git a/hardware/kecheng-kc-330b/api.c b/hardware/kecheng-kc-330b/api.c index 21d202f5..57dafdfc 100644 --- a/hardware/kecheng-kc-330b/api.c +++ b/hardware/kecheng-kc-330b/api.c @@ -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); diff --git a/hardware/lascar-el-usb/protocol.c b/hardware/lascar-el-usb/protocol.c index 5347e1eb..050b42bb 100644 --- a/hardware/lascar-el-usb/protocol.c +++ b/hardware/lascar-el-usb/protocol.c @@ -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); } diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index 9e0273ae..384b52c4 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -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; diff --git a/hardware/link-mso19/protocol.h b/hardware/link-mso19/protocol.h index 48502c5a..809d7f87 100644 --- a/hardware/link-mso19/protocol.h +++ b/hardware/link-mso19/protocol.h @@ -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" diff --git a/hardware/mic-985xx/api.c b/hardware/mic-985xx/api.c index 09cd7d60..2709c530 100644 --- a/hardware/mic-985xx/api.c +++ b/hardware/mic-985xx/api.c @@ -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); } diff --git a/hardware/norma-dmm/api.c b/hardware/norma-dmm/api.c index 7a98f958..13a40512 100644 --- a/hardware/norma-dmm/api.c +++ b/hardware/norma-dmm/api.c @@ -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); diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index 8284db15..bcc41ed2 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -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; diff --git a/hardware/openbench-logic-sniffer/protocol.c b/hardware/openbench-logic-sniffer/protocol.c index 89f68429..45304473 100644 --- a/hardware/openbench-logic-sniffer/protocol.c +++ b/hardware/openbench-logic-sniffer/protocol.c @@ -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++; } diff --git a/hardware/openbench-logic-sniffer/protocol.h b/hardware/openbench-logic-sniffer/protocol.h index 111ac69f..98831b58 100644 --- a/hardware/openbench-logic-sniffer/protocol.h +++ b/hardware/openbench-logic-sniffer/protocol.h @@ -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); diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index 0ed76e52..57bfd033 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -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); diff --git a/hardware/rigol-ds/protocol.c b/hardware/rigol-ds/protocol.c index ac177f14..97cb353c 100644 --- a/hardware/rigol-ds/protocol.c +++ b/hardware/rigol-ds/protocol.c @@ -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. */ diff --git a/hardware/rigol-ds/protocol.h b/hardware/rigol-ds/protocol.h index 458ae3be..0117628c 100644 --- a/hardware/rigol-ds/protocol.h +++ b/hardware/rigol-ds/protocol.h @@ -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 */ diff --git a/hardware/saleae-logic16/api.c b/hardware/saleae-logic16/api.c index 3759b825..cfd50225 100644 --- a/hardware/saleae-logic16/api.c +++ b/hardware/saleae-logic16/api.c @@ -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); diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index f69fe4be..96138743 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -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); diff --git a/hardware/sysclk-lwla/api.c b/hardware/sysclk-lwla/api.c index ac1932a4..de5929fe 100644 --- a/hardware/sysclk-lwla/api.c +++ b/hardware/sysclk-lwla/api.c @@ -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; diff --git a/hardware/sysclk-lwla/protocol.c b/hardware/sysclk-lwla/protocol.c index 75b38063..7bb1948d 100644 --- a/hardware/sysclk-lwla/protocol.c +++ b/hardware/sysclk-lwla/protocol.c @@ -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 { diff --git a/hardware/sysclk-lwla/protocol.h b/hardware/sysclk-lwla/protocol.h index 309a5977..d77db0f7 100644 --- a/hardware/sysclk-lwla/protocol.h +++ b/hardware/sysclk-lwla/protocol.h @@ -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. diff --git a/hardware/teleinfo/api.c b/hardware/teleinfo/api.c index a81af6e9..0a490729 100644 --- a/hardware/teleinfo/api.c +++ b/hardware/teleinfo/api.c @@ -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); diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index d2f6cceb..d112b195 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -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; diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index 7aed4e13..0ab3152b 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -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); diff --git a/hardware/uni-t-ut32x/api.c b/hardware/uni-t-ut32x/api.c index cc09a4bc..b38d2fb0 100644 --- a/hardware/uni-t-ut32x/api.c +++ b/hardware/uni-t-ut32x/api.c @@ -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; diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index 55c074d9..74523ed7 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -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); diff --git a/hardware/zeroplus-logic-cube/api.c b/hardware/zeroplus-logic-cube/api.c index 4bc25a97..a7fdc8f3 100644 --- a/hardware/zeroplus-logic-cube/api.c +++ b/hardware/zeroplus-logic-cube/api.c @@ -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); diff --git a/hwdriver.c b/hwdriver.c index f198e863..ee13d6e5 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -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}, diff --git a/input/binary.c b/input/binary.c index 50d1f958..e0d4c1dd 100644 --- a/input/binary.c +++ b/input/binary.c @@ -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); } diff --git a/input/chronovu_la8.c b/input/chronovu_la8.c index d340ece8..dcedcf8c 100644 --- a/input/chronovu_la8.c +++ b/input/chronovu_la8.c @@ -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); } diff --git a/input/csv.c b/input/csv.c index 2af4eeb1..6dd06f48 100644 --- a/input/csv.c +++ b/input/csv.c @@ -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."); diff --git a/input/vcd.c b/input/vcd.c index 2b68fc50..6759d73e 100644 --- a/input/vcd.c +++ b/input/vcd.c @@ -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; } diff --git a/input/wav.c b/input/wav.c index 7f5f97bf..1c3f050a 100644 --- a/input/wav.c +++ b/input/wav.c @@ -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); } diff --git a/libsigrok-internal.h b/libsigrok-internal.h index 123a23f7..4d508c5b 100644 --- a/libsigrok-internal.h +++ b/libsigrok-internal.h @@ -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, diff --git a/libsigrok.h b/libsigrok.h index 9c69474e..bd2202ed 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -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, diff --git a/output/chronovu_la8.c b/output/chronovu_la8.c index b4c6903e..32065fd0 100644 --- a/output/chronovu_la8.c +++ b/output/chronovu_la8.c @@ -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; diff --git a/output/csv.c b/output/csv.c index 6b3af1c3..2c82b928 100644 --- a/output/csv.c +++ b/output/csv.c @@ -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; diff --git a/output/gnuplot.c b/output/gnuplot.c index 968b5e37..2800d55a 100644 --- a/output/gnuplot.c +++ b/output/gnuplot.c @@ -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; diff --git a/output/ols.c b/output/ols.c index b5993162..28c01338 100644 --- a/output/ols.c +++ b/output/ols.c @@ -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; diff --git a/output/text/ascii.c b/output/text/ascii.c index 4a6b4f08..7ad3fec3 100644 --- a/output/text/ascii.c +++ b/output/text/ascii.c @@ -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 diff --git a/output/text/bits.c b/output/text/bits.c index af319692..7eafecdf 100644 --- a/output/text/bits.c +++ b/output/text/bits.c @@ -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 diff --git a/output/text/hex.c b/output/text/hex.c index e976e9ba..14fc6d1a 100644 --- a/output/text/hex.c +++ b/output/text/hex.c @@ -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; diff --git a/output/text/text.c b/output/text/text.c index e32e843d..fad68a5d 100644 --- a/output/text/text.c +++ b/output/text/text.c @@ -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; diff --git a/output/vcd.c b/output/vcd.c index 59198357..a9d51f83 100644 --- a/output/vcd.c +++ b/output/vcd.c @@ -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; diff --git a/session_driver.c b/session_driver.c index 5018298d..36e5c0c2 100644 --- a/session_driver.c +++ b/session_driver.c @@ -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: diff --git a/session_file.c b/session_file.c index 8413d509..8ff74cbd 100644 --- a/session_file.c +++ b/session_file.c @@ -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; diff --git a/tests/lib.c b/tests/lib.c index b3dc8190..fa823c7a 100644 --- a/tests/lib.c +++ b/tests/lib.c @@ -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;