From 4c180223a8ae12feb7bc3601e07e848fb9cdb493 Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Fri, 28 Dec 2018 11:41:41 +0100 Subject: [PATCH] Add PD tags handling and some tags --- decoder.c | 6 ++++++ decoders/ac97/pd.py | 1 + decoders/ade77xx/pd.py | 1 + decoders/adf435x/pd.py | 1 + decoders/adns5020/pd.py | 1 + decoders/am230x/pd.py | 1 + decoders/arm_etmv3/pd.py | 1 + decoders/arm_itm/pd.py | 1 + decoders/arm_tpiu/pd.py | 1 + decoders/atsha204a/pd.py | 1 + decoders/aud/pd.py | 1 + decoders/avr_isp/pd.py | 1 + decoders/avr_pdi/pd.py | 1 + decoders/can/pd.py | 1 + decoders/cec/pd.py | 1 + decoders/counter/pd.py | 1 + decoders/edid/pd.py | 1 + decoders/eeprom24xx/pd.py | 1 + decoders/eeprom93xx/pd.py | 1 + decoders/em4100/pd.py | 1 + decoders/em4305/pd.py | 1 + decoders/guess_bitrate/pd.py | 1 + decoders/i2c/pd.py | 1 + decoders/i2s/pd.py | 1 + decoders/jtag/pd.py | 1 + decoders/jtag_ejtag/pd.py | 1 + decoders/jtag_stm32/pd.py | 1 + decoders/maple_bus/pd.py | 1 + decoders/midi/pd.py | 1 + decoders/parallel/pd.py | 1 + decoders/ps2/pd.py | 1 + decoders/sdcard_sd/pd.py | 1 + decoders/sdcard_spi/pd.py | 1 + decoders/spi/pd.py | 1 + decoders/timing/pd.py | 1 + decoders/uart/pd.py | 1 + decoders/z80/pd.py | 1 + libsigrokdecode.h | 3 +++ 38 files changed, 45 insertions(+) diff --git a/decoder.c b/decoder.c index 2eb9a57..5239818 100644 --- a/decoder.c +++ b/decoder.c @@ -171,6 +171,7 @@ static void decoder_free(struct srd_decoder *dec) g_slist_free_full(dec->outputs, g_free); g_slist_free_full(dec->inputs, g_free); + g_slist_free_full(dec->tags, g_free); g_free(dec->license); g_free(dec->desc); g_free(dec->longname); @@ -802,6 +803,11 @@ SRD_API int srd_decoder_load(const char *module_name) goto err_out; } + if (py_attr_as_strlist(d->py_dec, "tags", &(d->tags)) != SRD_OK) { + fail_txt = "missing or malformed 'tags' attribute"; + goto err_out; + } + /* All options and their default values. */ if (get_options(d) != SRD_OK) { fail_txt = "cannot get options"; diff --git a/decoders/ac97/pd.py b/decoders/ac97/pd.py index 6cb7e93..8cb47a8 100644 --- a/decoders/ac97/pd.py +++ b/decoders/ac97/pd.py @@ -60,6 +60,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['ac97'] + tags = ['Logic', 'Audio'] channels = ( {'id': 'sync', 'name': 'SYNC', 'desc': 'Frame synchronization'}, {'id': 'clk', 'name': 'BIT_CLK', 'desc': 'Data bits clock'}, diff --git a/decoders/ade77xx/pd.py b/decoders/ade77xx/pd.py index 0dfd7c8..8945cdc 100644 --- a/decoders/ade77xx/pd.py +++ b/decoders/ade77xx/pd.py @@ -34,6 +34,7 @@ class Decoder(srd.Decoder): license = 'mit' inputs = ['spi'] outputs = ['ade77xx'] + tags = ['Logic', 'Sensors'] annotations = ( ('read', 'Register read commands'), ('write', 'Register write commands'), diff --git a/decoders/adf435x/pd.py b/decoders/adf435x/pd.py index dcc08de..098c3a6 100644 --- a/decoders/adf435x/pd.py +++ b/decoders/adf435x/pd.py @@ -96,6 +96,7 @@ class Decoder(srd.Decoder): license = 'gplv3+' inputs = ['spi'] outputs = ['adf435x'] + tags = ['Logic'] annotations = ( # Sent from the host to the chip. ('register', 'Register written to the device'), diff --git a/decoders/adns5020/pd.py b/decoders/adns5020/pd.py index cd72eca..74d7a23 100644 --- a/decoders/adns5020/pd.py +++ b/decoders/adns5020/pd.py @@ -47,6 +47,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['spi'] outputs = ['adns5020'] + tags = ['Logic', 'Sensors'] annotations = ( ('read', 'Register read commands'), ('write', 'Register write commands'), diff --git a/decoders/am230x/pd.py b/decoders/am230x/pd.py index 81c1f28..d3af8c5 100644 --- a/decoders/am230x/pd.py +++ b/decoders/am230x/pd.py @@ -42,6 +42,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['am230x'] + tags = ['Logic', 'Sensors'] channels = ( {'id': 'sda', 'name': 'SDA', 'desc': 'Single wire serial data line'}, ) diff --git a/decoders/arm_etmv3/pd.py b/decoders/arm_etmv3/pd.py index 5916824..b038604 100644 --- a/decoders/arm_etmv3/pd.py +++ b/decoders/arm_etmv3/pd.py @@ -135,6 +135,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['uart'] outputs = ['arm_etmv3'] + tags = ['Logic', 'MCU Debugging'] annotations = ( ('trace', 'Trace info'), ('branch', 'Branches'), diff --git a/decoders/arm_itm/pd.py b/decoders/arm_itm/pd.py index 5970f27..e284d27 100644 --- a/decoders/arm_itm/pd.py +++ b/decoders/arm_itm/pd.py @@ -45,6 +45,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['uart'] outputs = ['arm_itm'] + tags = ['Logic', 'MCU Debugging'] options = ( {'id': 'objdump', 'desc': 'objdump path', 'default': 'arm-none-eabi-objdump'}, diff --git a/decoders/arm_tpiu/pd.py b/decoders/arm_tpiu/pd.py index f50af65..cda3b09 100644 --- a/decoders/arm_tpiu/pd.py +++ b/decoders/arm_tpiu/pd.py @@ -28,6 +28,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['uart'] outputs = ['uart'] # Emulate uart output so that arm_itm/arm_etm can stack. + tags = ['Logic', 'MCU Debugging'] options = ( {'id': 'stream', 'desc': 'Stream index', 'default': 1}, {'id': 'sync_offset', 'desc': 'Initial sync offset', 'default': 0}, diff --git a/decoders/atsha204a/pd.py b/decoders/atsha204a/pd.py index a6a5a1d..e62122c 100644 --- a/decoders/atsha204a/pd.py +++ b/decoders/atsha204a/pd.py @@ -89,6 +89,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['i2c'] outputs = ['atsha204a'] + tags = ['Logic'] annotations = ( ('waddr', 'Word address'), ('count', 'Count'), diff --git a/decoders/aud/pd.py b/decoders/aud/pd.py index 30c32f5..ffd79ec 100644 --- a/decoders/aud/pd.py +++ b/decoders/aud/pd.py @@ -33,6 +33,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['aud'] + tags = ['Logic', 'MCU Debugging'] channels = ( {'id': 'audck', 'name': 'AUDCK', 'desc': 'AUD clock'}, {'id': 'naudsync', 'name': 'nAUDSYNC', 'desc': 'AUD sync'}, diff --git a/decoders/avr_isp/pd.py b/decoders/avr_isp/pd.py index 2530e8c..3d6d154 100644 --- a/decoders/avr_isp/pd.py +++ b/decoders/avr_isp/pd.py @@ -31,6 +31,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['spi'] outputs = ['avr_isp'] + tags = ['Logic', 'MCU Debugging'] annotations = ( ('pe', 'Programming enable'), ('rsb0', 'Read signature byte 0'), diff --git a/decoders/avr_pdi/pd.py b/decoders/avr_pdi/pd.py index 7fedbbd..184e632 100644 --- a/decoders/avr_pdi/pd.py +++ b/decoders/avr_pdi/pd.py @@ -120,6 +120,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['pdi'] + tags = ['Logic', 'MCU Debugging'] channels = ( {'id': 'reset', 'name': 'RESET', 'desc': 'RESET / PDI_CLK'}, {'id': 'data', 'name': 'DATA', 'desc': 'PDI_DATA'}, diff --git a/decoders/can/pd.py b/decoders/can/pd.py index d76d649..1084fe8 100644 --- a/decoders/can/pd.py +++ b/decoders/can/pd.py @@ -31,6 +31,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['can'] + tags = ['Logic', 'Bus'] channels = ( {'id': 'can_rx', 'name': 'CAN RX', 'desc': 'CAN bus line'}, ) diff --git a/decoders/cec/pd.py b/decoders/cec/pd.py index e4a40f3..da04997 100644 --- a/decoders/cec/pd.py +++ b/decoders/cec/pd.py @@ -56,6 +56,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['cec'] + tags = ['Logic', 'Bus', 'Video'] channels = ( {'id': 'cec', 'name': 'CEC', 'desc': 'CEC bus data'}, ) diff --git a/decoders/counter/pd.py b/decoders/counter/pd.py index 9ed30c8..4be08c3 100644 --- a/decoders/counter/pd.py +++ b/decoders/counter/pd.py @@ -31,6 +31,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = [] + tags = ['Logic', 'Tools'] channels = ( {'id': 'data', 'name': 'Data', 'desc': 'Data line'}, ) diff --git a/decoders/edid/pd.py b/decoders/edid/pd.py index 034c314..fe39c6d 100644 --- a/decoders/edid/pd.py +++ b/decoders/edid/pd.py @@ -81,6 +81,7 @@ class Decoder(srd.Decoder): license = 'gplv3+' inputs = ['i2c'] outputs = ['edid'] + tags = ['Logic', 'Video', 'Bus'] annotations = ( ('fields', 'EDID structure fields'), ('sections', 'EDID structure sections'), diff --git a/decoders/eeprom24xx/pd.py b/decoders/eeprom24xx/pd.py index 49c586d..6f32b54 100644 --- a/decoders/eeprom24xx/pd.py +++ b/decoders/eeprom24xx/pd.py @@ -29,6 +29,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['i2c'] outputs = ['eeprom24xx'] + tags = ['Logic', 'Memory'] options = ( {'id': 'chip', 'desc': 'Chip', 'default': 'generic', 'values': tuple(chips.keys())}, diff --git a/decoders/eeprom93xx/pd.py b/decoders/eeprom93xx/pd.py index d76b869..f0eed2c 100644 --- a/decoders/eeprom93xx/pd.py +++ b/decoders/eeprom93xx/pd.py @@ -28,6 +28,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['microwire'] outputs = ['eeprom93xx'] + tags = ['Logic', 'Memory'] options = ( {'id': 'addresssize', 'desc': 'Address size', 'default': 8}, {'id': 'wordsize', 'desc': 'Word size', 'default': 16}, diff --git a/decoders/em4100/pd.py b/decoders/em4100/pd.py index 778cfd1..5c919c8 100644 --- a/decoders/em4100/pd.py +++ b/decoders/em4100/pd.py @@ -31,6 +31,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['em4100'] + tags = ['Logic', 'Wireless'] channels = ( {'id': 'data', 'name': 'Data', 'desc': 'Data line'}, ) diff --git a/decoders/em4305/pd.py b/decoders/em4305/pd.py index 9fac9c6..c4e2640 100644 --- a/decoders/em4305/pd.py +++ b/decoders/em4305/pd.py @@ -31,6 +31,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['em4305'] + tags = ['Logic', 'Wireless'] channels = ( {'id': 'data', 'name': 'Data', 'desc': 'Data line'}, ) diff --git a/decoders/guess_bitrate/pd.py b/decoders/guess_bitrate/pd.py index 7a3121a..15d6d04 100644 --- a/decoders/guess_bitrate/pd.py +++ b/decoders/guess_bitrate/pd.py @@ -31,6 +31,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['guess_bitrate'] + tags = ['Logic', 'Tools'] channels = ( {'id': 'data', 'name': 'Data', 'desc': 'Data line'}, ) diff --git a/decoders/i2c/pd.py b/decoders/i2c/pd.py index e70c27d..f452bcb 100644 --- a/decoders/i2c/pd.py +++ b/decoders/i2c/pd.py @@ -70,6 +70,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['i2c'] + tags = ['Logic', 'Bus'] channels = ( {'id': 'scl', 'name': 'SCL', 'desc': 'Serial clock line'}, {'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'}, diff --git a/decoders/i2s/pd.py b/decoders/i2s/pd.py index e32fe6f..567badf 100644 --- a/decoders/i2s/pd.py +++ b/decoders/i2s/pd.py @@ -42,6 +42,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['i2s'] + tags = ['Logic', 'Bus', 'Audio'] channels = ( {'id': 'sck', 'name': 'SCK', 'desc': 'Bit clock line'}, {'id': 'ws', 'name': 'WS', 'desc': 'Word select line'}, diff --git a/decoders/jtag/pd.py b/decoders/jtag/pd.py index 2d349bc..16d0c47 100644 --- a/decoders/jtag/pd.py +++ b/decoders/jtag/pd.py @@ -62,6 +62,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['jtag'] + tags = ['Logic', 'MCU Debugging', 'Bus'] channels = ( {'id': 'tdi', 'name': 'TDI', 'desc': 'Test data input'}, {'id': 'tdo', 'name': 'TDO', 'desc': 'Test data output'}, diff --git a/decoders/jtag_ejtag/pd.py b/decoders/jtag_ejtag/pd.py index 5727722..5f026fa 100644 --- a/decoders/jtag_ejtag/pd.py +++ b/decoders/jtag_ejtag/pd.py @@ -197,6 +197,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['jtag'] outputs = ['jtag_ejtag'] + tags = ['Logic', 'MCU Debugging', 'Bus'] annotations = ( ('instruction', 'Instruction'), ) + regs_items['ann'] + ( diff --git a/decoders/jtag_stm32/pd.py b/decoders/jtag_stm32/pd.py index 593ce13..b3e1e46 100644 --- a/decoders/jtag_stm32/pd.py +++ b/decoders/jtag_stm32/pd.py @@ -147,6 +147,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['jtag'] outputs = ['jtag_stm32'] + tags = ['Logic', 'MCU Debugging', 'Bus'] annotations = ( ('item', 'Item'), ('field', 'Field'), diff --git a/decoders/maple_bus/pd.py b/decoders/maple_bus/pd.py index 8306061..fe2af3a 100644 --- a/decoders/maple_bus/pd.py +++ b/decoders/maple_bus/pd.py @@ -37,6 +37,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['maple_bus'] + tags = ['Logic', 'Bus'] channels = ( {'id': 'sdcka', 'name': 'SDCKA', 'desc': 'Data/clock line A'}, {'id': 'sdckb', 'name': 'SDCKB', 'desc': 'Data/clock line B'}, diff --git a/decoders/midi/pd.py b/decoders/midi/pd.py index feb581c..4965493 100644 --- a/decoders/midi/pd.py +++ b/decoders/midi/pd.py @@ -33,6 +33,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['uart'] outputs = ['midi'] + tags = ['Logic', 'Bus', 'Audio'] annotations = ( ('text-verbose', 'Human-readable text (verbose)'), ('text-sysreal-verbose', 'Human-readable SysReal text (verbose)'), diff --git a/decoders/parallel/pd.py b/decoders/parallel/pd.py index 0e81344..7151ab1 100644 --- a/decoders/parallel/pd.py +++ b/decoders/parallel/pd.py @@ -75,6 +75,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['parallel'] + tags = ['Logic', 'Bus'] optional_channels = channel_list(NUM_CHANNELS) options = ( {'id': 'clock_edge', 'desc': 'Clock edge to sample on', diff --git a/decoders/ps2/pd.py b/decoders/ps2/pd.py index 6ed04c8..c5c9406 100644 --- a/decoders/ps2/pd.py +++ b/decoders/ps2/pd.py @@ -34,6 +34,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['ps2'] + tags = ['Logic', 'Bus'] channels = ( {'id': 'clk', 'name': 'Clock', 'desc': 'Clock line'}, {'id': 'data', 'name': 'Data', 'desc': 'Data line'}, diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py index 9402f7e..6f9d2cb 100644 --- a/decoders/sdcard_sd/pd.py +++ b/decoders/sdcard_sd/pd.py @@ -29,6 +29,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['sdcard_sd'] + tags = ['Logic', 'Memory'] channels = ( {'id': 'cmd', 'name': 'CMD', 'desc': 'Command'}, {'id': 'clk', 'name': 'CLK', 'desc': 'Clock'}, diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index 7c59634..8ed7098 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -29,6 +29,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['spi'] outputs = ['sdcard_spi'] + tags = ['Logic', 'Memory'] annotations = \ tuple(('cmd%d' % i, 'CMD%d' % i) for i in range(64)) + \ tuple(('acmd%d' % i, 'ACMD%d' % i) for i in range(64)) + ( \ diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py index 85bb1cb..55bca63 100644 --- a/decoders/spi/pd.py +++ b/decoders/spi/pd.py @@ -82,6 +82,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['spi'] + tags = ['Logic', 'Bus'] channels = ( {'id': 'clk', 'name': 'CLK', 'desc': 'Clock'}, ) diff --git a/decoders/timing/pd.py b/decoders/timing/pd.py index 61eab1e..922c36d 100644 --- a/decoders/timing/pd.py +++ b/decoders/timing/pd.py @@ -54,6 +54,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['timing'] + tags = ['Logic', 'Tools'] channels = ( {'id': 'data', 'name': 'Data', 'desc': 'Data line'}, ) diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index 4bb68a4..fa1bca9 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -87,6 +87,7 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['uart'] + tags = ['Logic', 'Bus'] optional_channels = ( # Allow specifying only one of the signals, e.g. if only one data # direction exists (or is relevant). diff --git a/decoders/z80/pd.py b/decoders/z80/pd.py index b7ff9a5..bcfcdbd 100644 --- a/decoders/z80/pd.py +++ b/decoders/z80/pd.py @@ -72,6 +72,7 @@ class Decoder(srd.Decoder): license = 'gplv3+' inputs = ['logic'] outputs = ['z80'] + tags = ['Logic', 'MCU Debugging'] channels = tuple({ 'id': 'd%d' % i, 'name': 'D%d' % i, diff --git a/libsigrokdecode.h b/libsigrokdecode.h index 55620a7..84c80e4 100644 --- a/libsigrokdecode.h +++ b/libsigrokdecode.h @@ -161,6 +161,9 @@ struct srd_decoder { /** List of possible decoder output IDs. */ GSList *outputs; + /** List of tags associated with this decoder. */ + GSList *tags; + /** List of channels required by this decoder. */ GSList *channels; -- 2.30.2