return NULL;
}
-static int get_probes(const struct srd_decoder *d, const char *attr,
- GSList **pl)
+static int get_channels(const struct srd_decoder *d, const char *attr,
+ GSList **pdchl)
{
- PyObject *py_probelist, *py_entry;
- struct srd_probe *p;
- int ret, num_probes, i;
+ PyObject *py_channellist, *py_entry;
+ struct srd_channel *pdch;
+ int ret, num_channels, i;
if (!PyObject_HasAttrString(d->py_dec, attr))
- /* No probes of this type specified. */
+ /* No channels of this type specified. */
return SRD_OK;
- py_probelist = PyObject_GetAttrString(d->py_dec, attr);
- if (!PyTuple_Check(py_probelist)) {
+ py_channellist = PyObject_GetAttrString(d->py_dec, attr);
+ if (!PyTuple_Check(py_channellist)) {
srd_err("Protocol decoder %s %s attribute is not a tuple.",
d->name, attr);
return SRD_ERR_PYTHON;
}
- if ((num_probes = PyTuple_Size(py_probelist)) == 0)
- /* Empty probelist. */
+ if ((num_channels = PyTuple_Size(py_channellist)) == 0)
+ /* Empty channellist. */
return SRD_OK;
ret = SRD_OK;
- for (i = 0; i < num_probes; i++) {
- py_entry = PyTuple_GetItem(py_probelist, i);
+ for (i = 0; i < num_channels; i++) {
+ py_entry = PyTuple_GetItem(py_channellist, i);
if (!PyDict_Check(py_entry)) {
srd_err("Protocol decoder %s %s attribute is not "
"a list with dict elements.", d->name, attr);
break;
}
- if (!(p = g_try_malloc(sizeof(struct srd_probe)))) {
- srd_err("Failed to g_malloc() struct srd_probe.");
+ if (!(pdch = g_try_malloc(sizeof(struct srd_channel)))) {
+ srd_err("Failed to g_malloc() struct srd_channel.");
ret = SRD_ERR_MALLOC;
break;
}
- if ((py_dictitem_as_str(py_entry, "id", &p->id)) != SRD_OK) {
+ if ((py_dictitem_as_str(py_entry, "id", &pdch->id)) != SRD_OK) {
ret = SRD_ERR_PYTHON;
break;
}
- if ((py_dictitem_as_str(py_entry, "name", &p->name)) != SRD_OK) {
+ if ((py_dictitem_as_str(py_entry, "name", &pdch->name)) != SRD_OK) {
ret = SRD_ERR_PYTHON;
break;
}
- if ((py_dictitem_as_str(py_entry, "desc", &p->desc)) != SRD_OK) {
+ if ((py_dictitem_as_str(py_entry, "desc", &pdch->desc)) != SRD_OK) {
ret = SRD_ERR_PYTHON;
break;
}
- p->order = i;
+ pdch->order = i;
- *pl = g_slist_append(*pl, p);
+ *pdchl = g_slist_append(*pdchl, pdch);
}
- Py_DecRef(py_probelist);
+ Py_DecRef(py_channellist);
return ret;
}
struct srd_decoder *d;
int ret, i, j;
char **ann, **bin, *ann_row_id, *ann_row_desc;
- struct srd_probe *p;
+ struct srd_channel *pdch;
GSList *l, *ann_classes;
struct srd_decoder_annotation_row *ann_row;
if (get_options(d) != SRD_OK)
goto err_out;
- /* Check and import required probes. */
- if (get_probes(d, "probes", &d->probes) != SRD_OK)
+ /* Check and import required channels. */
+ if (get_channels(d, "channels", &d->channels) != SRD_OK)
goto err_out;
- /* Check and import optional probes. */
- if (get_probes(d, "optional_probes", &d->opt_probes) != SRD_OK)
+ /* Check and import optional channels. */
+ if (get_channels(d, "optional_channels", &d->opt_channels) != SRD_OK)
goto err_out;
/*
- * Fix order numbers for the optional probes.
+ * Fix order numbers for the optional channels.
*
* Example:
- * Required probes: r1, r2, r3. Optional: o1, o2, o3, o4.
- * 'order' fields in the d->probes list = 0, 1, 2.
- * 'order' fields in the d->opt_probes list = 3, 4, 5, 6.
+ * Required channels: r1, r2, r3. Optional: o1, o2, o3, o4.
+ * 'order' fields in the d->channels list = 0, 1, 2.
+ * 'order' fields in the d->opt_channels list = 3, 4, 5, 6.
*/
- for (l = d->opt_probes; l; l = l->next) {
- p = l->data;
- p->order += g_slist_length(d->probes);
+ for (l = d->opt_channels; l; l = l->next) {
+ pdch = l->data;
+ pdch->order += g_slist_length(d->channels);
}
/* Convert annotation class attribute to GSList of char **. */
return doc;
}
-static void free_probes(GSList *probelist)
+static void free_channels(GSList *channellist)
{
GSList *l;
- struct srd_probe *p;
+ struct srd_channel *pdch;
- if (probelist == NULL)
+ if (channellist == NULL)
return;
- for (l = probelist; l; l = l->next) {
- p = l->data;
- g_free(p->id);
- g_free(p->name);
- g_free(p->desc);
- g_free(p);
+ for (l = channellist; l; l = l->next) {
+ pdch = l->data;
+ g_free(pdch->id);
+ g_free(pdch->name);
+ g_free(pdch->desc);
+ g_free(pdch);
}
- g_slist_free(probelist);
+ g_slist_free(channellist);
}
/**
}
g_slist_free(dec->options);
- free_probes(dec->probes);
- free_probes(dec->opt_probes);
+ free_channels(dec->channels);
+ free_channels(dec->opt_channels);
g_free(dec->id);
g_free(dec->name);
g_free(dec->longname);
license = 'gplv2+'
inputs = ['logic']
outputs = ['can']
- probes = (
+ channels = (
{'id': 'can_rx', 'name': 'CAN RX', 'desc': 'CAN bus line'},
)
options = (
license = 'gplv2+'
inputs = ['logic']
outputs = ['dcf77']
- probes = (
+ channels = (
{'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
)
annotations = (
test tv
- protocol-decoder i2c probe scl=0 probe sda=1
+ protocol-decoder i2c channel scl=0 channel sda=1
protocol-decoder edid
stack i2c edid
input i2c/edid/samsung_le46b620r3p.sr
'''
This protocol decoder tries to guess the bitrate / baudrate of the
-communication on the specified probe. Typically this will be used to
+communication on the specified channel. Typically this will be used to
guess / detect the baudrate used in a UART communication snippet, but it
could also be used to guess bitrates of certain other protocols or buses.
bitrate or baudrate will not necessarily have the expected result.
The precision of the estimated bitrate / baudrate will also depend on the
-samplerate used to sample the respective probe. For good results it is
+samplerate used to sample the respective channel. For good results it is
recommended to use a logic analyzer samplerate that is much higher than
-the expected bitrate/baudrate that might be used on the probe.
+the expected bitrate/baudrate that might be used on the channel.
'''
from .pd import *
license = 'gplv2+'
inputs = ['logic']
outputs = ['guess_bitrate']
- probes = (
+ channels = (
{'id': 'data', 'name': 'Data', 'desc': 'Data line'},
)
annotations = (
license = 'gplv2+'
inputs = ['logic']
outputs = ['i2c']
- probes = (
+ channels = (
{'id': 'scl', 'name': 'SCL', 'desc': 'Serial clock line'},
{'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'},
)
test rtc
- protocol-decoder i2c probe scl=0 probe sda=1
+ protocol-decoder i2c channel scl=0 channel sda=1
input i2c/rtc_dallas_ds1307/rtc_ds1307_200khz.sr
output i2c annotation class data-read match rtc_ds1307_200khz_data_read.output
output i2c annotation class data-write match rtc_ds1307_200khz_data_write.output
output i2c python match rtc_ds1307_200khz.python
test motherboard
- protocol-decoder i2c probe scl=0 probe sda=3
+ protocol-decoder i2c channel scl=0 channel sda=3
input i2c/gigabyte_6vle-vxl_i2c/gigabyte_6vle_vxl_i2c.sr
output i2c annotation match gigabyte_6vle_vxl_i2c.output
output i2c python match gigabyte_6vle_vxl_i2c.python
test xfp
- protocol-decoder i2c probe scl=0 probe sda=1
+ protocol-decoder i2c channel scl=0 channel sda=1
input i2c/network-transceivers/xfp.sr
output i2c binary class data-read match xfp_data_read.binary
output i2c binary class data-write match xfp_data_write.binary
license = 'gplv2+'
inputs = ['logic']
outputs = ['i2s']
- probes = (
+ channels = (
{'id': 'sck', 'name': 'SCK', 'desc': 'Bit clock line'},
{'id': 'ws', 'name': 'WS', 'desc': 'Word select line'},
{'id': 'sd', 'name': 'SD', 'desc': 'Serial data line'},
license = 'gplv2+'
inputs = ['logic']
outputs = ['ir_nec']
- probes = (
+ channels = (
{'id': 'ir', 'name': 'IR', 'desc': 'Data line'},
)
options = (
license = 'gplv2+'
inputs = ['logic']
outputs = ['ir_rc5']
- probes = (
+ channels = (
{'id': 'ir', 'name': 'IR', 'desc': 'IR data line'},
)
options = (
license = 'gplv2+'
inputs = ['logic']
outputs = ['jtag']
- probes = (
+ channels = (
{'id': 'tdi', 'name': 'TDI', 'desc': 'Test data input'},
{'id': 'tdo', 'name': 'TDO', 'desc': 'Test data output'},
{'id': 'tck', 'name': 'TCK', 'desc': 'Test clock'},
{'id': 'tms', 'name': 'TMS', 'desc': 'Test mode select'},
)
- optional_probes = (
+ optional_channels = (
{'id': 'trst', 'name': 'TRST#', 'desc': 'Test reset'},
{'id': 'srst', 'name': 'SRST#', 'desc': 'System reset'},
{'id': 'rtck', 'name': 'RTCK', 'desc': 'Return clock signal'},
self.oldpins = pins
# Get individual pin values into local variables.
- # Unused probes will have a value of > 1.
+ # Unused channels will have a value of > 1.
(tdi, tdo, tck, tms, trst, srst, rtck) = pins
# We only care about TCK edges (either rising or falling).
license = 'gplv2+'
inputs = ['logic']
outputs = ['lpc']
- probes = (
+ channels = (
{'id': 'lframe', 'name': 'LFRAME#', 'desc': 'Frame'},
{'id': 'lclk', 'name': 'LCLK', 'desc': 'Clock'},
{'id': 'lad0', 'name': 'LAD[0]', 'desc': 'Addr/control/data 0'},
{'id': 'lad2', 'name': 'LAD[2]', 'desc': 'Addr/control/data 2'},
{'id': 'lad3', 'name': 'LAD[3]', 'desc': 'Addr/control/data 3'},
)
- optional_probes = (
+ optional_channels = (
{'id': 'lreset', 'name': 'LRESET#', 'desc': 'Reset'},
{'id': 'ldrq', 'name': 'LDRQ#', 'desc': 'Encoded DMA / bus master request'},
{'id': 'serirq', 'name': 'SERIRQ', 'desc': 'Serialized IRQ'},
test probe
- protocol-decoder spi probe cs=0 probe miso=1 probe clk=2 probe mosi=3
+ protocol-decoder spi channel cs=0 channel miso=1 channel clk=2 channel mosi=3
protocol-decoder mx25lxx05d
stack spi mx25lxx05d
input spi/mx25l1605d/mx25l1605d_probe.sr
- overdrive available: 2MHz minimum, 5MHz suggested
- overdrive not available: 400kHz minimum, 1MHz suggested
-Probes:
+Channels:
1-Wire requires a single signal, but some master implementations might have a
separate signal used to deliver power to the bus during temperature conversion
as an example. This power signal is currently not used.
license = 'gplv2+'
inputs = ['logic']
outputs = ['onewire_link']
- probes = (
+ channels = (
{'id': 'owr', 'name': 'OWR', 'desc': '1-Wire signal line'},
)
- optional_probes = (
+ optional_channels = (
{'id': 'pwr', 'name': 'PWR', 'desc': '1-Wire power supply pin'},
)
options = (
'''
This protocol decoder can decode synchronous parallel buses with various
-number of data bits/probes and one (optional) clock line.
+number of data bits/channels and one (optional) clock line.
If no clock line is supplied, the decoder works slightly differently in
-that it interprets every transition on any of the supplied data probes
+that it interprets every transition on any of the supplied data channels
like there had been a clock transition.
-It is required to use the lowest data probes, and use consecutive ones.
-For example, for a 4-bit sync parallel bus, probes D0/D1/D2/D3 (and CLK)
+It is required to use the lowest data channels, and use consecutive ones.
+For example, for a 4-bit sync parallel bus, channels D0/D1/D2/D3 (and CLK)
should be used. Using combinations like D7/D12/D3/D15 is not supported.
For an 8-bit bus you should use D0-D7, for a 16-bit bus use D0-D15 and so on.
'''
word <worditemcount> is 7, and so on.
'''
-def probe_list(num_probes):
+def channel_list(num_channels):
l = [{'id': 'clk', 'name': 'CLK', 'desc': 'Clock line'}]
- for i in range(num_probes):
+ for i in range(num_channels):
d = {'id': 'd%d' % i, 'name': 'D%d' % i, 'desc': 'Data line %d' % i}
l.append(d)
return tuple(l)
license = 'gplv2+'
inputs = ['logic']
outputs = ['parallel']
- optional_probes = probe_list(8)
+ optional_channels = channel_list(8)
options = (
{'id': 'clock_edge', 'desc': 'Clock edge to sample on',
'default': 'rising', 'values': ('rising', 'falling')},
- 'DATA': <data1> contains the MISO data, <data2> contains the MOSI data.
The data is _usually_ 8 bits (but can also be fewer or more bits).
Both data items are Python numbers (not strings), or None if the respective
- probe was not supplied.
+ channel was not supplied.
- 'BITS': <data1>/<data2> contain a list of bit values in this MISO/MOSI data
item, and for each of those also their respective start-/endsample numbers.
- 'CS CHANGE': <data1> is the old CS# pin value, <data2> is the new value.
license = 'gplv2+'
inputs = ['logic']
outputs = ['spi']
- probes = (
+ channels = (
{'id': 'clk', 'name': 'CLK', 'desc': 'Clock'},
)
- optional_probes = (
+ optional_channels = (
{'id': 'miso', 'name': 'MISO', 'desc': 'Master in, slave out'},
{'id': 'mosi', 'name': 'MOSI', 'desc': 'Master out, slave in'},
{'id': 'cs', 'name': 'CS#', 'desc': 'Chip-select'},
test atmega32_00
- protocol-decoder spi probe cs=0 probe mosi=1 probe clk=2
+ protocol-decoder spi channel cs=0 channel mosi=1 channel clk=2
input spi/spi_atmega32/spi_atmega32_00.sr
output spi annotation class mosi-data match atmega32_00_mosi.output
output spi annotation class miso-data match atmega32_00_miso.output
test mx25l1605d_probe
- protocol-decoder spi probe cs=0 probe miso=1 probe clk=2 probe mosi=3
+ protocol-decoder spi channel cs=0 channel miso=1 channel clk=2 channel mosi=3
input spi/mx25l1605d/mx25l1605d_probe.sr
output spi annotation class mosi-data match mx25l1605d_probe_mosi.output
output spi annotation class miso-data match mx25l1605d_probe_miso.output
license = 'gplv2+'
inputs = ['logic']
outputs = ['tlc5620']
- probes = (
+ channels = (
{'id': 'clk', 'name': 'CLK', 'desc': 'Serial interface clock'},
{'id': 'data', 'name': 'DATA', 'desc': 'Serial interface data'},
)
- optional_probes = (
+ optional_channels = (
{'id': 'load', 'name': 'LOAD', 'desc': 'Serial interface load control'},
{'id': 'ldac', 'name': 'LDAC', 'desc': 'Load DAC'},
)
license = 'gplv2+'
inputs = ['logic']
outputs = ['uart']
- optional_probes = (
+ optional_channels = (
# Allow specifying only one of the signals, e.g. if only one data
# direction exists (or is relevant).
{'id': 'rx', 'name': 'RX', 'desc': 'UART receive line'},
test trekstor_ebr30_a
- protocol-decoder uart probe rx=1
+ protocol-decoder uart channel rx=1
input uart/trekstor_ebr30_a/trekstor_ebr30_a_uart.sr
output uart annotation class rx-data match trekstor_rx.output
output uart annotation class tx-data match trekstor_tx.output
license = 'gplv2+'
inputs = ['logic']
outputs = ['usb_signalling']
- probes = (
+ channels = (
{'id': 'dp', 'name': 'D+', 'desc': 'USB D+ signal'},
{'id': 'dm', 'name': 'D-', 'desc': 'USB D- signal'},
)
def reduce_bus(bus):
if 0xFF in bus:
- return None # unassigned bus probes
+ return None # unassigned bus channels
else:
return reduce(lambda a, b: (a << 1) | b, reversed(bus))
license = 'gplv3+'
inputs = ['logic']
outputs = ['z80']
- probes = tuple({
+ channels = tuple({
'id': 'd%d' % i,
'name': 'D%d' % i,
'desc': 'Data bus line %d' % i
{'id': 'rd', 'name': '/RD', 'desc': 'Memory or I/O read'},
{'id': 'wr', 'name': '/WR', 'desc': 'Memory or I/O write'},
)
- optional_probes = (
+ optional_channels = (
{'id': 'mreq', 'name': '/MREQ', 'desc': 'Memory request'},
{'id': 'iorq', 'name': '/IORQ', 'desc': 'I/O request'},
) + tuple({
return ret;
}
-/* Helper GComparefunc for g_slist_find_custom() in srd_inst_probe_set_all() */
-static gint compare_probe_id(const struct srd_probe *a, const char *probe_id)
+/* Helper GComparefunc for g_slist_find_custom() in srd_inst_channel_set_all() */
+static gint compare_channel_id(const struct srd_channel *pdch,
+ const char *channel_id)
{
- return strcmp(a->id, probe_id);
+ return strcmp(pdch->id, channel_id);
}
/**
- * Set all probes in a decoder instance.
+ * Set all channels in a decoder instance.
*
- * This function sets _all_ probes for the specified decoder instance, i.e.,
- * it overwrites any probes that were already defined (if any).
+ * This function sets _all_ channels for the specified decoder instance, i.e.,
+ * it overwrites any channels that were already defined (if any).
*
* @param di Decoder instance.
- * @param new_probes A GHashTable of probes to set. Key is probe name, value is
- * the probe number. Samples passed to this instance will be
- * arranged in this order.
+ * @param new_channels A GHashTable of channels to set. Key is channel name,
+ * value is the channel number. Samples passed to this
+ * instance will be arranged in this order.
* @param unit_size Number of bytes per sample in the data stream to be passed
- * to the decoder. The highest probe index specified in the
- * probe map must lie within a sample unit.
+ * to the decoder. The highest channel index specified in the
+ * channel map must lie within a sample unit.
*
* @return SRD_OK upon success, a (negative) error code otherwise.
*
* @since 0.1.0
*/
-SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di,
- GHashTable *new_probes, int unit_size)
+SRD_API int srd_inst_channel_set_all(struct srd_decoder_inst *di,
+ GHashTable *new_channels, int unit_size)
{
- GVariant *probe_val;
+ GVariant *channel_val;
GList *l;
GSList *sl;
- struct srd_probe *p;
- int *new_probemap, new_probenum, num_required_probes, i;
- char *probe_id;
+ struct srd_channel *pdch;
+ int *new_channelmap, new_channelnum, num_required_channels, i;
+ char *channel_id;
- srd_dbg("set probes called for instance %s with list of %d probes",
- di->inst_id, g_hash_table_size(new_probes));
+ srd_dbg("set channels called for instance %s with list of %d channels",
+ di->inst_id, g_hash_table_size(new_channels));
- if (g_hash_table_size(new_probes) == 0)
- /* No probes provided. */
+ if (g_hash_table_size(new_channels) == 0)
+ /* No channels provided. */
return SRD_OK;
- if (di->dec_num_probes == 0) {
- /* Decoder has no probes. */
- srd_err("Protocol decoder %s has no probes to define.",
+ if (di->dec_num_channels == 0) {
+ /* Decoder has no channels. */
+ srd_err("Protocol decoder %s has no channels to define.",
di->decoder->name);
return SRD_ERR_ARG;
}
- new_probemap = NULL;
+ new_channelmap = NULL;
- if (!(new_probemap = g_try_malloc(sizeof(int) * di->dec_num_probes))) {
- srd_err("Failed to g_malloc() new probe map.");
+ if (!(new_channelmap = g_try_malloc(sizeof(int) * di->dec_num_channels))) {
+ srd_err("Failed to g_malloc() new channel map.");
return SRD_ERR_MALLOC;
}
/*
- * For now, map all indexes to probe -1 (can be overridden later).
- * This -1 is interpreted as an unspecified probe later.
+ * For now, map all indexes to channel -1 (can be overridden later).
+ * This -1 is interpreted as an unspecified channel later.
*/
- for (i = 0; i < di->dec_num_probes; i++)
- new_probemap[i] = -1;
-
- for (l = g_hash_table_get_keys(new_probes); l; l = l->next) {
- probe_id = l->data;
- probe_val = g_hash_table_lookup(new_probes, probe_id);
- if (!g_variant_is_of_type(probe_val, G_VARIANT_TYPE_INT32)) {
- /* Probe name was specified without a value. */
- srd_err("No probe number was specified for %s.",
- probe_id);
- g_free(new_probemap);
+ for (i = 0; i < di->dec_num_channels; i++)
+ new_channelmap[i] = -1;
+
+ for (l = g_hash_table_get_keys(new_channels); l; l = l->next) {
+ channel_id = l->data;
+ channel_val = g_hash_table_lookup(new_channels, channel_id);
+ if (!g_variant_is_of_type(channel_val, G_VARIANT_TYPE_INT32)) {
+ /* Channel name was specified without a value. */
+ srd_err("No channel number was specified for %s.",
+ channel_id);
+ g_free(new_channelmap);
return SRD_ERR_ARG;
}
- new_probenum = g_variant_get_int32(probe_val);
- if (new_probenum >= 8 * unit_size) {
- srd_err("Probe index %d not within data unit (%d bit).",
- new_probenum, 8 * unit_size);
- g_free(new_probemap);
+ new_channelnum = g_variant_get_int32(channel_val);
+ if (new_channelnum >= 8 * unit_size) {
+ srd_err("Channel index %d not within data unit (%d bit).",
+ new_channelnum, 8 * unit_size);
+ g_free(new_channelmap);
return SRD_ERR_ARG;
}
- if (!(sl = g_slist_find_custom(di->decoder->probes, probe_id,
- (GCompareFunc)compare_probe_id))) {
- /* Fall back on optional probes. */
- if (!(sl = g_slist_find_custom(di->decoder->opt_probes,
- probe_id, (GCompareFunc) compare_probe_id))) {
- srd_err("Protocol decoder %s has no probe "
- "'%s'.", di->decoder->name, probe_id);
- g_free(new_probemap);
+ if (!(sl = g_slist_find_custom(di->decoder->channels, channel_id,
+ (GCompareFunc)compare_channel_id))) {
+ /* Fall back on optional channels. */
+ if (!(sl = g_slist_find_custom(di->decoder->opt_channels,
+ channel_id, (GCompareFunc) compare_channel_id))) {
+ srd_err("Protocol decoder %s has no channel "
+ "'%s'.", di->decoder->name, channel_id);
+ g_free(new_channelmap);
return SRD_ERR_ARG;
}
}
- p = sl->data;
- new_probemap[p->order] = new_probenum;
- srd_dbg("Setting probe mapping: %s (index %d) = probe %d.",
- p->id, p->order, new_probenum);
+ pdch = sl->data;
+ new_channelmap[pdch->order] = new_channelnum;
+ srd_dbg("Setting channel mapping: %s (index %d) = channel %d.",
+ pdch->id, pdch->order, new_channelnum);
}
di->data_unitsize = unit_size;
- srd_dbg("Final probe map:");
- num_required_probes = g_slist_length(di->decoder->probes);
- for (i = 0; i < di->dec_num_probes; i++) {
- srd_dbg(" - index %d = probe %d (%s)", i, new_probemap[i],
- (i < num_required_probes) ? "required" : "optional");
+ srd_dbg("Final channel map:");
+ num_required_channels = g_slist_length(di->decoder->channels);
+ for (i = 0; i < di->dec_num_channels; i++) {
+ srd_dbg(" - index %d = channel %d (%s)", i, new_channelmap[i],
+ (i < num_required_channels) ? "required" : "optional");
}
- /* Report an error if not all required probes were specified. */
- for (i = 0; i < num_required_probes; i++) {
- if (new_probemap[i] != -1)
+ /* Report an error if not all required channels were specified. */
+ for (i = 0; i < num_required_channels; i++) {
+ if (new_channelmap[i] != -1)
continue;
- p = g_slist_nth(di->decoder->probes, i)->data;
- srd_err("Required probe '%s' (index %d) was not specified.",
- p->id, i);
+ pdch = g_slist_nth(di->decoder->channels, i)->data;
+ srd_err("Required channel '%s' (index %d) was not specified.",
+ pdch->id, i);
return SRD_ERR;
}
- g_free(di->dec_probemap);
- di->dec_probemap = new_probemap;
+ g_free(di->dec_channelmap);
+ di->dec_channelmap = new_channelmap;
return SRD_OK;
}
di->inst_id = g_strdup(decoder_id);
/*
- * Prepare a default probe map, where samples come in the
+ * Prepare a default channel map, where samples come in the
* order in which the decoder class defined them.
*/
- di->dec_num_probes = g_slist_length(di->decoder->probes) +
- g_slist_length(di->decoder->opt_probes);
- if (di->dec_num_probes) {
- if (!(di->dec_probemap =
- g_try_malloc(sizeof(int) * di->dec_num_probes))) {
- srd_err("Failed to g_malloc() probe map.");
+ di->dec_num_channels = g_slist_length(di->decoder->channels) +
+ g_slist_length(di->decoder->opt_channels);
+ if (di->dec_num_channels) {
+ if (!(di->dec_channelmap =
+ g_try_malloc(sizeof(int) * di->dec_num_channels))) {
+ srd_err("Failed to g_malloc() channel map.");
g_free(di);
return NULL;
}
- for (i = 0; i < di->dec_num_probes; i++)
- di->dec_probemap[i] = i;
- di->data_unitsize = (di->dec_num_probes + 7) / 8;
+ for (i = 0; i < di->dec_num_channels; i++)
+ di->dec_channelmap[i] = i;
+ di->data_unitsize = (di->dec_num_channels + 7) / 8;
/*
* Will be used to prepare a sample at every iteration
* of the instance's decode() method.
*/
- if (!(di->probe_samples = g_try_malloc(di->dec_num_probes))) {
+ if (!(di->channel_samples = g_try_malloc(di->dec_num_channels))) {
srd_err("Failed to g_malloc() sample buffer.");
- g_free(di->dec_probemap);
+ g_free(di->dec_channelmap);
g_free(di);
return NULL;
}
if (PyErr_Occurred())
srd_exception_catch("failed to create %s instance: ",
decoder_id);
- g_free(di->dec_probemap);
+ g_free(di->dec_channelmap);
g_free(di);
return NULL;
}
if (options && srd_inst_option_set(di, options) != SRD_OK) {
- g_free(di->dec_probemap);
+ g_free(di->dec_channelmap);
g_free(di);
return NULL;
}
Py_DecRef(di->py_inst);
g_free(di->inst_id);
- g_free(di->dec_probemap);
+ g_free(di->dec_channelmap);
g_slist_free(di->next_di);
for (l = di->pd_output; l; l = l->next) {
pdo = l->data;
*/
char *license;
- /** List of probes required by this decoder. */
- GSList *probes;
+ /** List of channels required by this decoder. */
+ GSList *channels;
- /** List of optional probes for this decoder. */
- GSList *opt_probes;
+ /** List of optional channels for this decoder. */
+ GSList *opt_channels;
/**
* List of NULL-terminated char[], containing descriptions of the
};
/**
- * Structure which contains information about one protocol decoder probe.
- * For example, I2C has two probes, SDA and SCL.
+ * Structure which contains information about one protocol decoder channel.
+ * For example, I2C has two channels, SDA and SCL.
*/
-struct srd_probe {
- /** The ID of the probe. Must be non-NULL. */
+struct srd_channel {
+ /** The ID of the channel. Must be non-NULL. */
char *id;
- /** The name of the probe. Must not be NULL. */
+ /** The name of the channel. Must not be NULL. */
char *name;
- /** The description of the probe. Must not be NULL. */
+ /** The description of the channel. Must not be NULL. */
char *desc;
- /** The index of the probe, i.e. its order in the list of probes. */
+ /** The index of the channel, i.e. its order in the list of channels. */
int order;
};
PyObject *py_inst;
char *inst_id;
GSList *pd_output;
- int dec_num_probes;
- int *dec_probemap;
+ int dec_num_channels;
+ int *dec_channelmap;
int data_unitsize;
- uint8_t *probe_samples;
+ uint8_t *channel_samples;
GSList *next_di;
};
/* instance.c */
SRD_API int srd_inst_option_set(struct srd_decoder_inst *di,
GHashTable *options);
-SRD_API int srd_inst_probe_set_all(struct srd_decoder_inst *di,
- GHashTable *probes, int unit_size);
+SRD_API int srd_inst_channel_set_all(struct srd_decoder_inst *di,
+ GHashTable *channels, int unit_size);
SRD_API struct srd_decoder_inst *srd_inst_new(struct srd_session *sess,
const char *id, GHashTable *options);
SRD_API int srd_inst_stack(struct srd_session *sess,
/**
* Send a chunk of logic sample data to a running decoder session.
*
- * If no probe map has been set up, the logic samples must be arranged
- * in probe order, in the least amount of space possible. The default
- * probe set consists of all required probes + all optional probes.
+ * If no channel map has been set up, the logic samples must be arranged
+ * in channel order, in the least amount of space possible. The default
+ * channel set consists of all required channels + all optional channels.
*
* The size of a sample in inbuf is the unit size passed to
- * srd_inst_probe_set_all(). If no probe map has been configured, it is
- * the minimum number of bytes needed to store the default probes.
+ * srd_inst_channel_set_all(). If no channel map has been configured, it is
+ * the minimum number of bytes needed to store the default channels.
*
* @param sess The session to use.
* @param start_samplenum The sample number of the first sample in this chunk.
raise E_syntax
pd_spec = {
'name': f.pop(0),
- 'probes': [],
+ 'channels': [],
'options': [],
}
while len(f):
if '=' not in b:
raise E_syntax
opt, val = b.split('=')
- if a == 'probe':
+ if a == 'channel':
try:
val = int(val)
except:
raise E_syntax
- pd_spec['probes'].append([opt, val])
+ pd_spec['channels'].append([opt, val])
elif a == 'option':
pd_spec['options'].append([opt, val])
else:
# Set up PD stack for this test.
for spd in tc['pdlist']:
args.extend(['-P', spd['name']])
- for label, probe in spd['probes']:
- args.extend(['-p', "%s=%d" % (label, probe)])
+ for label, channel in spd['channels']:
+ args.extend(['-p', "%s=%d" % (label, channel)])
for option, value in spd['options']:
args.extend(['-o', "%s=%s" % (option, value)])
args.extend(['-i', os.path.join(dumps_dir, tc['input'])])
print("Testcase: %s/%s" % (tc['pd'], tc['name']))
for pd in tc['pdlist']:
print(" Protocol decoder: %s" % pd['name'])
- for label, probe in pd['probes']:
- print(" Probe %s=%d" % (label, probe))
+ for label, channel in pd['channels']:
+ print(" Channel %s=%d" % (label, channel))
for option, value in pd['options']:
print(" Option %s=%d" % (option, value))
if 'stack' in tc:
int statistics = FALSE;
char *coverage_report;
-struct probe {
+struct channel {
char *name;
- int probe;
+ int channel;
};
struct option {
struct pd {
char *name;
- GSList *probes;
+ GSList *channels;
GSList *options;
};
printf("Usage: runtc [-dPpoiOf]\n");
printf(" -d Debug\n");
printf(" -P <protocol decoder>\n");
- printf(" -p <probename=probenum> (optional)\n");
- printf(" -o <probeoption=value> (optional)\n");
+ printf(" -p <channelname=channelnum> (optional)\n");
+ printf(" -o <channeloption=value> (optional)\n");
printf(" -i <input file>\n");
printf(" -O <output-pd:output-type[:output-class]>\n");
printf(" -f <output file> (optional)\n");
struct srd_decoder_inst *di, *prev_di;
srd_pd_output_callback_t cb;
struct pd *pd;
- struct probe *probe;
+ struct channel *channel;
struct option *option;
GVariant *gvar;
- GHashTable *probes, *opts;
+ GHashTable *channels, *opts;
GSList *pdl, *l;
int idx;
- int max_probe;
+ int max_channel;
char **decoder_class;
if (op->outfile) {
return FALSE;
g_hash_table_destroy(opts);
- /* Map probes. */
- if (pd->probes) {
- probes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+ /* Map channels. */
+ if (pd->channels) {
+ channels = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
(GDestroyNotify)g_variant_unref);
- max_probe = 0;
- for (l = pd->probes; l; l = l->next) {
- probe = l->data;
- if (probe->probe > max_probe)
- max_probe = probe->probe;
- gvar = g_variant_new_int32(probe->probe);
+ max_channel = 0;
+ for (l = pd->channels; l; l = l->next) {
+ channel = l->data;
+ if (channel->channel > max_channel)
+ max_channel = channel->channel;
+ gvar = g_variant_new_int32(channel->channel);
g_variant_ref_sink(gvar);
- g_hash_table_insert(probes, probe->name, gvar);
+ g_hash_table_insert(channels, channel->name, gvar);
}
- if (srd_inst_probe_set_all(di, probes,
- (max_probe + 8) / 8) != SRD_OK)
+ if (srd_inst_channel_set_all(di, channels,
+ (max_channel + 8) / 8) != SRD_OK)
return FALSE;
- g_hash_table_destroy(probes);
+ g_hash_table_destroy(channels);
}
/* If this is not the first decoder in the list, stack it
PyObject *coverage;
GSList *pdlist;
struct pd *pd;
- struct probe *probe;
+ struct channel *channel;
struct option *option;
struct output *op;
int ret;
case 'P':
pd = g_malloc(sizeof(struct pd));
pd->name = g_strdup(optarg);
- pd->probes = pd->options = NULL;
+ pd->channels = pd->options = NULL;
pdlist = g_slist_append(pdlist, pd);
break;
case 'p':
usage(NULL);
}
if (c == 'p') {
- probe = malloc(sizeof(struct probe));
- probe->name = g_strdup(kv[0]);
- probe->probe = strtoul(kv[1], 0, 10);
+ channel = malloc(sizeof(struct channel));
+ channel->name = g_strdup(kv[0]);
+ channel->channel = strtoul(kv[1], 0, 10);
/* Apply to last PD. */
- pd->probes = g_slist_append(pd->probes, probe);
+ pd->channels = g_slist_append(pd->channels, channel);
} else {
option = malloc(sizeof(struct option));
option->key = g_strdup(kv[0]);
* and 0x00 values, so the PD doesn't need to do any bitshifting.
*/
sample_pos = logic->inbuf + logic->itercnt * logic->di->data_unitsize;
- for (i = 0; i < logic->di->dec_num_probes; i++) {
- /* A probemap value of -1 means "unused optional probe". */
- if (logic->di->dec_probemap[i] == -1) {
- /* Value of unused probe is 0xff, instead of 0 or 1. */
- logic->di->probe_samples[i] = 0xff;
+ for (i = 0; i < logic->di->dec_num_channels; i++) {
+ /* A channelmap value of -1 means "unused optional channel". */
+ if (logic->di->dec_channelmap[i] == -1) {
+ /* Value of unused channel is 0xff, instead of 0 or 1. */
+ logic->di->channel_samples[i] = 0xff;
} else {
- byte_offset = logic->di->dec_probemap[i] / 8;
- bit_offset = logic->di->dec_probemap[i] % 8;
+ byte_offset = logic->di->dec_channelmap[i] / 8;
+ bit_offset = logic->di->dec_channelmap[i] % 8;
sample = *(sample_pos + byte_offset) & (1 << bit_offset) ? 1 : 0;
- logic->di->probe_samples[i] = sample;
+ logic->di->channel_samples[i] = sample;
}
}
PyLong_FromUnsignedLongLong(logic->start_samplenum +
logic->itercnt);
PyList_SetItem(logic->sample, 0, py_samplenum);
- py_samples = PyBytes_FromStringAndSize((const char *)logic->di->probe_samples,
- logic->di->dec_num_probes);
+ py_samples = PyBytes_FromStringAndSize((const char *)logic->di->channel_samples,
+ logic->di->dec_num_channels);
PyList_SetItem(logic->sample, 1, py_samples);
Py_INCREF(logic->sample);
logic->itercnt++;