libsigrokdecode.git
19 months agocounter: Let user decide how to handle the initial dead_cycles state
Soeren Apel [Sat, 11 Aug 2018 21:14:45 +0000 (23:14 +0200)]
counter: Let user decide how to handle the initial dead_cycles state

edge_off and word_off are not included in the if block because a user may
want to use edge_off to dismiss unwanted clocks instead of dead_cycles.

19 months agocounter: Introduce option to ignore edges
Gerhard Sittig [Sat, 11 Aug 2018 20:59:47 +0000 (22:59 +0200)]
counter: Introduce option to ignore edges

19 months agocounter: Use initial counter values also after a reset
Soeren Apel [Sat, 11 Aug 2018 19:12:16 +0000 (21:12 +0200)]
counter: Use initial counter values also after a reset

19 months agospi: Create the out_bitrate annotation unconditionally
Josef Gajdusek [Fri, 17 Aug 2018 14:35:50 +0000 (16:35 +0200)]
spi: Create the out_bitrate annotation unconditionally

The start() method is called before the metadata() method, which results in the
the out_bitrate instance variable never getting created and ending up as an
AttributeError when decoding.

(observed with sigrok-cli and VCD file as the input)

19 months agoedid: Shorten two code snippets.
Uwe Hermann [Wed, 29 Aug 2018 18:44:17 +0000 (20:44 +0200)]
edid: Shorten two code snippets.

19 months agoedid: Add support for extension blocks, cleanups
Stefan Brüns [Sat, 25 Aug 2018 18:19:21 +0000 (20:19 +0200)]
edid: Add support for extension blocks, cleanups

Extension blocks are widely used by e.g. HDMI to signal support for
audio, colorspaces and much more.

Cleanups:
- support short forms for annotations
- join overlapping annotations, these were unreadable in PV, and the
  positions were inaccurate (aligned to bytes instead of bits, no
  notion of used bits in split fields).

19 months agoinstall: unbreak installation with Python 3.7 (os.errno)
Gerhard Sittig [Sat, 25 Aug 2018 13:20:10 +0000 (15:20 +0200)]
install: unbreak installation with Python 3.7 (os.errno)

The os.errno module has not been an official feature. Python 3.7
removed the corresponding import. This broke the installation of
decoders. Prefer 'errno' over 'os.errno'.

19 months agoconfigure.ac: Also check for Python 3.7.
Uwe Hermann [Sun, 12 Aug 2018 18:02:22 +0000 (20:02 +0200)]
configure.ac: Also check for Python 3.7.

19 months agocounter: add support for user specified initial counter values
Gerhard Sittig [Tue, 12 Jun 2018 17:06:15 +0000 (19:06 +0200)]
counter: add support for user specified initial counter values

Introduce options for the initial edge and word counter values. Default
to 0 for compatibility with the previous implementation. This fixes
bug #1229.

19 months agomdio: accept MDIO READ without previous ADDRESS command
Gerhard Sittig [Wed, 1 Aug 2018 16:35:57 +0000 (18:35 +0200)]
mdio: accept MDIO READ without previous ADDRESS command

Fix a Python string formatting issue, where the format string disagreed
with the argument list. A READ command could unexpectedly terminate the
decoder instance when there was no previous ADDRESS command.

This fixes bug #1258.

20 months agouart: rephrase data bits to data value conversion
Gerhard Sittig [Sun, 1 Jul 2018 13:30:30 +0000 (15:30 +0200)]
uart: rephrase data bits to data value conversion

Use the already available .databits[] information which holds sample data
and bit time edge positions, and the common bitpack() routine. This shall
increase readability of the bits to value conversion.

[ best viewed with more context, like 'git diff -U5' ]

20 months agocommon: rephrase bitpack(), use list comprehension Python idiom
Gerhard Sittig [Sun, 1 Jul 2018 13:26:09 +0000 (15:26 +0200)]
common: rephrase bitpack(), use list comprehension Python idiom

21 months agojtag_ejtag: Simplify some code snippets.
Uwe Hermann [Thu, 21 Jun 2018 20:39:55 +0000 (22:39 +0200)]
jtag_ejtag: Simplify some code snippets.

21 months agojtag_ejtag: Fix short/long annotation order.
Uwe Hermann [Thu, 21 Jun 2018 20:09:55 +0000 (22:09 +0200)]
jtag_ejtag: Fix short/long annotation order.

The list of annotation strings is sorted from longest to shortest.

21 months agojtag_ejtag: Add short description in __init__.py.
Uwe Hermann [Thu, 21 Jun 2018 19:55:55 +0000 (21:55 +0200)]
jtag_ejtag: Add short description in __init__.py.

21 months agojtag_ejtag: Move bin2int() to common/srdhelper.
Uwe Hermann [Thu, 21 Jun 2018 19:49:14 +0000 (21:49 +0200)]
jtag_ejtag: Move bin2int() to common/srdhelper.

Also, rename from bin_to_int to bin2int() for consistency.

21 months agojtag_ejtag: Simplify two code snippets.
Uwe Hermann [Thu, 21 Jun 2018 19:43:22 +0000 (21:43 +0200)]
jtag_ejtag: Simplify two code snippets.

21 months agojtag_ejtag: Shorten variable names to ss/es.
Uwe Hermann [Thu, 21 Jun 2018 19:41:22 +0000 (21:41 +0200)]
jtag_ejtag: Shorten variable names to ss/es.

These abbreviations are commonly-used in all other PDs.

21 months agoAdd MIPS EJTAG decoder
Vlad Ivanov [Fri, 4 May 2018 06:57:53 +0000 (09:57 +0300)]
Add MIPS EJTAG decoder

Signed-off-by: Vlad Ivanov <vlad.ivanov@lab-systems.ru>
21 months agocfp: Add reset() method.
Uwe Hermann [Sun, 10 Jun 2018 14:28:12 +0000 (16:28 +0200)]
cfp: Add reset() method.

21 months agocfp: Use the Python in/range keywords.
Uwe Hermann [Sun, 10 Jun 2018 14:25:40 +0000 (16:25 +0200)]
cfp: Use the Python in/range keywords.

21 months agocfp: Shorten two variable names.
Uwe Hermann [Sun, 10 Jun 2018 14:21:34 +0000 (16:21 +0200)]
cfp: Shorten two variable names.

21 months agocfp: Factor out self.putx().
Uwe Hermann [Sun, 10 Jun 2018 14:20:04 +0000 (16:20 +0200)]
cfp: Factor out self.putx().

This improves readability and avoids some duplication.

21 months agocfp: Reduce indentation level.
Uwe Hermann [Sun, 10 Jun 2018 14:15:48 +0000 (16:15 +0200)]
cfp: Reduce indentation level.

21 months agocfp: Drop unneeded annotation prefix; plural fixes.
Uwe Hermann [Sun, 10 Jun 2018 14:10:16 +0000 (16:10 +0200)]
cfp: Drop unneeded annotation prefix; plural fixes.

21 months agocfp: Drop unused self.out_python.
Uwe Hermann [Sun, 10 Jun 2018 14:09:40 +0000 (16:09 +0200)]
cfp: Drop unused self.out_python.

21 months agocfp: Fix incorrect copy-paste description.
Uwe Hermann [Sun, 10 Jun 2018 14:09:21 +0000 (16:09 +0200)]
cfp: Fix incorrect copy-paste description.

21 months agoRevert "mdio: Add 'TURNAROUND' long/full annotation." in order to comply with the...
Elias Oenal [Fri, 18 May 2018 14:49:17 +0000 (16:49 +0200)]
Revert "mdio: Add 'TURNAROUND' long/full annotation." in order to comply with the naming used in the Ethernet standard.

This reverts commit 30d775b095a4b76e5fa755b19d5521affa3c053c.

21 months agoAdd a CFP decoder.
Elias Oenal [Fri, 18 May 2018 14:48:50 +0000 (16:48 +0200)]
Add a CFP decoder.

22 months agocounter: Drop unneeded tuple braces.
Uwe Hermann [Wed, 30 May 2018 06:20:10 +0000 (08:20 +0200)]
counter: Drop unneeded tuple braces.

(minor readability / consistency improvement)

22 months agocounter: emit wider annotations for data and word counts
Gerhard Sittig [Sun, 27 May 2018 07:56:49 +0000 (09:56 +0200)]
counter: emit wider annotations for data and word counts

Track the start of a data or word cycle. Avoid narrow ss=es annotations
which may be tedious to inspect by users in GUI applications. This
resolves the issue initially reported in bug #1210.

22 months agocounter: prepare for variable width annotations
Gerhard Sittig [Sun, 27 May 2018 07:46:01 +0000 (09:46 +0200)]
counter: prepare for variable width annotations

Explicitly pass a start sample number to the .putc() method, to prepare
annotations where ss differs from es. This is motivated by bug #1210.
Stick with the narrow ss=es annotations for backwards compatibility.

22 months agocounter: explicit string formatting for annotation text
Gerhard Sittig [Sun, 27 May 2018 07:41:19 +0000 (09:41 +0200)]
counter: explicit string formatting for annotation text

Replace str() conversion with explicit number text formatting, for
improved awareness and easier future adjustment during maintenance.

22 months agocounter: use local variables instead of instance variables
Gerhard Sittig [Sun, 27 May 2018 07:35:25 +0000 (09:35 +0200)]
counter: use local variables instead of instance variables

Since values get accessed within the .decode() method exclusively, we need
not store data in instance variables of the decoder object. Use another
variable for the "reset edge" option as well for consistency.

22 months agocounter: move some init code to the start of decode()
Gerhard Sittig [Sun, 27 May 2018 07:27:08 +0000 (09:27 +0200)]
counter: move some init code to the start of decode()

Since PD API v3 the .decode() method is called exactly once, and
contains a main loop itself. Move initialization code that sets up
.decode() related logic to the start of the .decode() routine.

22 months agocounter: use symbolic names for input pins, wait conditions, annotation rows
Gerhard Sittig [Sun, 27 May 2018 07:18:09 +0000 (09:18 +0200)]
counter: use symbolic names for input pins, wait conditions, annotation rows

Replace magic numbers by symbolic references to (fixed and optional)
decoder input signals, .wait() conditions, as well as annotation rows.

Move some empty lines, to better reflect which code lines form groups of
similar activity ("blocks" that logically belong together).

22 months agocounter: explicit option text to .wait() edge mapping
Gerhard Sittig [Sun, 27 May 2018 07:06:48 +0000 (09:06 +0200)]
counter: explicit option text to .wait() edge mapping

The previous implementation used the fact that libsigrok's internal API
happens to use the first letter of the user visible English option text.
Two locations mapped edge choices to API literals in different ways.
Unify them, introduce an explicit option text to literal value mapping.

(Many if not all decoder implementations do that. More adjustment to use
common code could be beneficial.)

22 months agoatsha204a: Add the reset() method.
Uwe Hermann [Fri, 25 May 2018 23:51:06 +0000 (01:51 +0200)]
atsha204a: Add the reset() method.

22 months agoatsha204a: Rename a few methods for consistency.
Uwe Hermann [Fri, 25 May 2018 23:49:58 +0000 (01:49 +0200)]
atsha204a: Rename a few methods for consistency.

22 months agoatsha204a: Shorten a few more code chunks, add helpers.
Uwe Hermann [Fri, 25 May 2018 23:47:26 +0000 (01:47 +0200)]
atsha204a: Shorten a few more code chunks, add helpers.

22 months agoatsha204a: Shorten self.opcode to op in a few places.
Uwe Hermann [Fri, 25 May 2018 23:13:51 +0000 (01:13 +0200)]
atsha204a: Shorten self.opcode to op in a few places.

22 months agoatsha204a: Use the Python 'in' keyword to improve readability.
Uwe Hermann [Fri, 25 May 2018 22:32:14 +0000 (00:32 +0200)]
atsha204a: Use the Python 'in' keyword to improve readability.

22 months agoatsha204a: Shorten output_tx_bytes()/output_rx_bytes() a bit.
Uwe Hermann [Fri, 25 May 2018 22:26:20 +0000 (00:26 +0200)]
atsha204a: Shorten output_tx_bytes()/output_rx_bytes() a bit.

22 months agoAdd decoder for Microchip ATSHA204A crypto module
Michalis Pappas [Thu, 26 Apr 2018 16:35:40 +0000 (19:35 +0300)]
Add decoder for Microchip ATSHA204A crypto module

22 months agoAdd ON Semi CAT24C256, CAT24M01.
whitequark [Mon, 21 May 2018 15:55:19 +0000 (15:55 +0000)]
Add ON Semi CAT24C256, CAT24M01.

22 months agoDecoder_put(): Avoid a g_malloc()/g_free() pair per binary out.
Uwe Hermann [Sat, 19 May 2018 00:37:14 +0000 (02:37 +0200)]
Decoder_put(): Avoid a g_malloc()/g_free() pair per binary out.

22 months agoDecoder_put(): Avoid a g_malloc()/g_free() pair per annotation.
Uwe Hermann [Fri, 18 May 2018 22:19:54 +0000 (00:19 +0200)]
Decoder_put(): Avoid a g_malloc()/g_free() pair per annotation.

22 months agosrd_inst_find_by_obj(): Minor performance improvement.
Uwe Hermann [Fri, 18 May 2018 18:14:19 +0000 (20:14 +0200)]
srd_inst_find_by_obj(): Minor performance improvement.

Handle the most common case of one session and one decoder first so
we can exit early. This has a small, but measurable performance benefit.

22 months agosrd_*inst_find_by_obj(): Suggest inlining for performance reasons.
Uwe Hermann [Fri, 18 May 2018 18:11:38 +0000 (20:11 +0200)]
srd_*inst_find_by_obj(): Suggest inlining for performance reasons.

This has a small, but measurable performance benefit.

22 months agosrd_*inst_find_by_obj(): Move functions, make them static.
Uwe Hermann [Fri, 18 May 2018 17:50:16 +0000 (19:50 +0200)]
srd_*inst_find_by_obj(): Move functions, make them static.

These functions are only used in type_decoder.c. Move them there and
make them static.

22 months agosample_matches(): Force inlining for performance reasons.
Uwe Hermann [Fri, 18 May 2018 07:01:40 +0000 (09:01 +0200)]
sample_matches(): Force inlining for performance reasons.

22 months agoSimplify code by dropping session_is_valid().
Uwe Hermann [Thu, 17 May 2018 23:02:13 +0000 (01:02 +0200)]
Simplify code by dropping session_is_valid().

A simple NULL check is sufficient here, max_session_id is being
properly handled by srd_init(), srd_exit(), srd_session_new().

This might also have a small performance benefit.

22 months agoconvert_meta(): Use g_variant_type_equal().
Uwe Hermann [Thu, 17 May 2018 22:27:57 +0000 (00:27 +0200)]
convert_meta(): Use g_variant_type_equal().

22 months agoDoxyfile: Exclude the build/ directory.
Uwe Hermann [Thu, 17 May 2018 22:17:08 +0000 (00:17 +0200)]
Doxyfile: Exclude the build/ directory.

22 months agoAdd srd_searchpaths_get() API docs.
Uwe Hermann [Thu, 17 May 2018 22:13:42 +0000 (00:13 +0200)]
Add srd_searchpaths_get() API docs.

22 months agoDoxyfile: Update to a more recent Doxygen version.
Uwe Hermann [Thu, 17 May 2018 22:08:34 +0000 (00:08 +0200)]
Doxyfile: Update to a more recent Doxygen version.

22 months agoRandom whitespace/cosmetic/consistency fixes.
Uwe Hermann [Thu, 17 May 2018 22:01:05 +0000 (00:01 +0200)]
Random whitespace/cosmetic/consistency fixes.

22 months agotype_decoder.c: Fix a compiler warning (-Wswitch-default).
Uwe Hermann [Thu, 17 May 2018 21:25:42 +0000 (23:25 +0200)]
type_decoder.c: Fix a compiler warning (-Wswitch-default).

  type_decoder.c: In function ‘get_term_type’:
  type_decoder.c:486:2: warning: switch missing default case [-Wswitch-default]
    switch (v[0]) {
    ^~~~~~

22 months agoconfigure.ac: Add some more compiler warning options.
Uwe Hermann [Thu, 17 May 2018 20:50:45 +0000 (22:50 +0200)]
configure.ac: Add some more compiler warning options.

Add the -Wshadow -Wformat=2 -Wno-format-nonliteral -Wfloat-equal
compiler options (supported by both gcc and clang) to get notified
of more potential issues in the code.

22 months agosrd_decoder_load_all_zip_path(): Fix a compiler warning (-Wshadow).
Uwe Hermann [Wed, 16 May 2018 20:17:07 +0000 (22:17 +0200)]
srd_decoder_load_all_zip_path(): Fix a compiler warning (-Wshadow).

22 months agosrd_inst_channel_set_all(): Fix a compiler warning (-Wshadow).
Uwe Hermann [Wed, 16 May 2018 20:14:22 +0000 (22:14 +0200)]
srd_inst_channel_set_all(): Fix a compiler warning (-Wshadow).

  instance.c:266:11: warning: declaration of ‘l’ shadows a previous local [-Wshadow]
     GSList *l = g_slist_nth(di->decoder->channels, i);
             ^
  instance.c:206:9: note: shadowed declaration is here
    GList *l;
           ^

22 months agotype_decoder.c: Drop unneeded g_free() NULL check.
Uwe Hermann [Tue, 15 May 2018 22:28:56 +0000 (00:28 +0200)]
type_decoder.c: Drop unneeded g_free() NULL check.

22 months agoinstance.c: Fix a scan-build warning.
Uwe Hermann [Tue, 15 May 2018 22:24:56 +0000 (00:24 +0200)]
instance.c: Fix a scan-build warning.

  instance.c:278:25: warning: The left operand of '!=' is a garbage value
                  if (new_channelmap[i] != -1)
                      ~~~~~~~~~~~~~~~~~ ^

22 months agodecoder.c: Fix a scan-build warning.
Uwe Hermann [Tue, 15 May 2018 22:21:56 +0000 (00:21 +0200)]
decoder.c: Fix a scan-build warning.

  decoder.c:343:9: warning: Access to field 'ob_type' results in a dereference of a null pointer (loaded from variable 'py_default')
                                  if (Py_TYPE(py_default) != Py_TYPE(py_item)) {
                                      ^~~~~~~~~~~~~~~~~~~
  /usr/include/python3.6m/object.h:118:33: note: expanded from macro 'Py_TYPE'
  #define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

22 months agotype_decoder.c: Fix a scan-build warning.
Uwe Hermann [Tue, 15 May 2018 22:09:53 +0000 (00:09 +0200)]
type_decoder.c: Fix a scan-build warning.

  type_decoder.c:836:3: warning: Value stored to 'ret' is never read
                ret = process_samples_until_condition_match(di, &found_match);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

22 months agoinstance.c: Fix a memory leak reported by scan-build.
Uwe Hermann [Tue, 15 May 2018 22:13:07 +0000 (00:13 +0200)]
instance.c: Fix a memory leak reported by scan-build.

  instance.c:280:10: warning: Potential leak of memory pointed to by 'new_channelmap'
                  pdch = g_slist_nth(di->decoder->channels, i)->data;
                         ^~~~~~~~~~~

22 months agotype_decoder.c: Fix a memory leak reported by scan-build.
Uwe Hermann [Tue, 15 May 2018 23:27:30 +0000 (01:27 +0200)]
type_decoder.c: Fix a memory leak reported by scan-build.

  type_decoder.c:206:2: warning: Potential leak of memory pointed to by 'pdb'
          PyGILState_Release(gstate);
          ^~~~~~~~~~~~~~~~~~

22 months agotype_decoder.c: Fix a memory leak reported by scan-build.
Uwe Hermann [Tue, 15 May 2018 22:05:42 +0000 (00:05 +0200)]
type_decoder.c: Fix a memory leak reported by scan-build.

  type_decoder.c:197:10: warning: Potential leak of memory pointed to by 'pdb'
                 return SRD_ERR_MALLOC;
                        ^~~~~~~~~~~~~~

22 months agoConvert some g_malloc0() to g_malloc().
Uwe Hermann [Tue, 15 May 2018 21:57:31 +0000 (23:57 +0200)]
Convert some g_malloc0() to g_malloc().

For the converted calls there's no requirement for all struct fields
being memset()'d to zero, or all struct fields are explicitly set
later anyway.

22 months agoget_current_pinvalues(): Slightly simplify a code chunk.
Uwe Hermann [Tue, 15 May 2018 20:29:49 +0000 (22:29 +0200)]
get_current_pinvalues(): Slightly simplify a code chunk.

22 months agoutil.c: Add two missing PyGILState_Release() calls.
Uwe Hermann [Tue, 15 May 2018 20:29:24 +0000 (22:29 +0200)]
util.c: Add two missing PyGILState_Release() calls.

22 months agost7735: Merge reset_state() into reset().
Uwe Hermann [Sun, 13 May 2018 16:28:05 +0000 (18:28 +0200)]
st7735: Merge reset_state() into reset().

22 months agoSimple decoder for ST7735 TFT controller
Aleksander Alekseev [Sat, 5 May 2018 20:44:16 +0000 (23:44 +0300)]
Simple decoder for ST7735 TFT controller

22 months agomcs48: add reset method, make A12 optional, unassorted adjustment
Gerhard Sittig [Sat, 12 May 2018 20:21:39 +0000 (22:21 +0200)]
mcs48: add reset method, make A12 optional, unassorted adjustment

Add the reset() method which recently has become essential. Make the A12
"memory bank" address line optional. Use more Python idioms. Update
comments.

The control signals had to move, to avoid gaps between D7 and A8 as well
as between A11 and A12 in the GUI decoder properties dialog. With
dynamic assignment in the UI and with named references in the CLI this
shall not harm. Unmodified automated tests still pass.

The logic is prepared to handle data, address, and "bank" pin groups at
arbitrary locations, A[11:8] and D[7:0] need not be adjacent any longer.
Support for more than one memory bank pin is prepared, but the number of
bank pins needs to get determined at the start of decode(), when this
feature is to get added in the future.

22 months agoAdd new decoder: Intel MCS-48
fenugrec [Thu, 26 Apr 2018 22:35:39 +0000 (18:35 -0400)]
Add new decoder: Intel MCS-48

Decodes addresses and data read from an external ROM. The MCS-48
processors (8048, 8049, 8039, etc.) have an 8-bit data bus that latches
first the address then the data.

22 months agotype_decoder.c: Drop incorrect Py_DECREF() calls.
Uwe Hermann [Wed, 9 May 2018 00:38:51 +0000 (02:38 +0200)]
type_decoder.c: Drop incorrect Py_DECREF() calls.

22 months agotype_decoder: Fixup memory leak in Decoder.put() (meta, python)
Uwe Hermann [Tue, 8 May 2018 23:31:10 +0000 (01:31 +0200)]
type_decoder: Fixup memory leak in Decoder.put() (meta, python)

This fixes parts of bug #329.

22 months agotype_decoder: fixup memory leak in Decoder.put() (annotation, binary)
Gerhard Sittig [Tue, 8 May 2018 18:44:05 +0000 (20:44 +0200)]
type_decoder: fixup memory leak in Decoder.put() (annotation, binary)

The text presentation of decoder annotations' payload data was allocated
but not freed. As were the byte strings of binary output. Fix it.

This fixes parts of bug #329.

22 months agoDoxyfile: Set CREATE_SUBDIRS to NO.
Uwe Hermann [Sun, 6 May 2018 14:36:34 +0000 (16:36 +0200)]
Doxyfile: Set CREATE_SUBDIRS to NO.

The API docs for libsigrokdecode are relatively small, no need for
the many, many subdirectories this would otherwise create.

22 months agojtag_stm32: Always switch state on new instruction
George Hopkins [Thu, 30 Nov 2017 14:58:05 +0000 (15:58 +0100)]
jtag_stm32: Always switch state on new instruction

22 months agojtag_stm32: Fix handling of boundary scan TAP
George Hopkins [Thu, 30 Nov 2017 14:56:45 +0000 (15:56 +0100)]
jtag_stm32: Fix handling of boundary scan TAP

22 months agojtag: Fix shifting of registers
George Hopkins [Thu, 30 Nov 2017 14:41:02 +0000 (15:41 +0100)]
jtag: Fix shifting of registers

This fixes bug #1066.

22 months agospiflash: Add Adesto AT45DB161E metadata.
Uwe Hermann [Thu, 3 May 2018 13:15:34 +0000 (15:15 +0200)]
spiflash: Add Adesto AT45DB161E metadata.

22 months agospiflash: Add basic Adesto AT45DBxx support (WRITE1/2, STATUS).
Aleksander Alekseev [Thu, 3 May 2018 12:04:47 +0000 (14:04 +0200)]
spiflash: Add basic Adesto AT45DBxx support (WRITE1/2, STATUS).

23 months agodcf77: annotate unexpected bit numbers and values, do not abort execution
Gerhard Sittig [Mon, 16 Apr 2018 19:15:13 +0000 (21:15 +0200)]
dcf77: annotate unexpected bit numbers and values, do not abort execution

Improve robustness of the DCF77 decoder. Cope with "neiter 0 nor 1" bit
values (glitches can break the detection of pulse widths), as well as
unexpected bit numbers (more than 59 pulses per minute, can be a
follow-up error after e.g. glitches break one long pulse into two short
pulses). Do not process this invalid data, do emit error annotations.

23 months agodcf77: annotate invalid dow and month fields, do not abort execution
Gerhard Sittig [Sun, 22 Apr 2018 08:07:07 +0000 (10:07 +0200)]
dcf77: annotate invalid dow and month fields, do not abort execution

Emit error annotations for invalid day of the week or month numbers,
instead of aborting decoder execution with an exception.

Implementation detail: Neither the Python 'in' keyword nor a .get()
method are available. That's why we have to catch the IndexError
exception.

This fixes bug #1173.

23 months agodcf77, lpc: rephrase bit string formatting
Gerhard Sittig [Mon, 16 Apr 2018 19:12:16 +0000 (21:12 +0200)]
dcf77, lpc: rephrase bit string formatting

Create the text representation of a bit string by means of the builtin
.format() method and an appropriate specifier. Drop the non-obvious
sequence of bin() and slice and zfill() calls.

23 months agoinstance: return SRD_ERR_TERM_REQ when execution shall terminate
Gerhard Sittig [Mon, 23 Apr 2018 18:42:54 +0000 (20:42 +0200)]
instance: return SRD_ERR_TERM_REQ when execution shall terminate

The previous implementation internally noticed the "want terminate"
request, and skipped decoder execution to faster get to the end of the
input stream. But an OK return code was provided in that code path, and
more input data was sent by applications (sometimes for many seconds or
few minutes).

Do return a new SRD_ERR_TERM_REQ error code, such that applications can
tell failed execution from requested termination.

23 months agoinstance: drop an unneeded "want wait() to terminate" reset assignment
Gerhard Sittig [Mon, 23 Apr 2018 18:40:28 +0000 (20:40 +0200)]
instance: drop an unneeded "want wait() to terminate" reset assignment

It's uncertain why srd_inst_decode() which internally gets called by the
public srd_session_send() routine used to clear the want_wait_terminate
flag. This should be cleared upon decoder instance creation and state
reset, gets raised upon termination request, but shall not get cleared
in other spots, especially not upon the availability of new input data
while the stream shall be considered in the "about to terminate, skip
all subsequent execution" state.

23 months agolog: Move log level check so that it affects all handlers.
Uwe Hermann [Sat, 21 Apr 2018 22:17:49 +0000 (00:17 +0200)]
log: Move log level check so that it affects all handlers.

Before this change, the loglevel check would only be performed for the
default log handler in libsigrokdecode, but not for other handlers set
via srd_log_callback_set().

This fixes bug #698.

23 months agosrd_exception_catch(): Beautify traceback logging output.
Uwe Hermann [Fri, 20 Apr 2018 21:30:58 +0000 (23:30 +0200)]
srd_exception_catch(): Beautify traceback logging output.

23 months agoDecoder_register(): Drop an overly verbose log message.
Uwe Hermann [Fri, 20 Apr 2018 19:46:59 +0000 (21:46 +0200)]
Decoder_register(): Drop an overly verbose log message.

23 months agosrd_logv(): Add an explicit fflush().
Uwe Hermann [Fri, 20 Apr 2018 19:45:04 +0000 (21:45 +0200)]
srd_logv(): Add an explicit fflush().

23 months agoShow backtrace when decode() aborts due to an error.
Uwe Hermann [Fri, 20 Apr 2018 19:40:12 +0000 (21:40 +0200)]
Show backtrace when decode() aborts due to an error.

The backtrace printing was actually already there, but was emitted using
sr_dbg(), which doesn't show up by default for most users. Make it an
srd_err() so that most users will see it.

This fixes bug #1158.

23 months agocan: Fix incorrect stuff bit handling.
Uwe Hermann [Thu, 12 Apr 2018 07:02:38 +0000 (09:02 +0200)]
can: Fix incorrect stuff bit handling.

The decoder assumed a CRC cannot end with a stuffed bit but it actually can,
and the CRC delimiter then comes after the stuffed bit.

Patch by IRC/github user celeron55, wide testing by PeterMortensen, thanks!

23 months agoDrop overly verbose log messages about (un)loading PDs.
Uwe Hermann [Sun, 8 Apr 2018 17:53:56 +0000 (19:53 +0200)]
Drop overly verbose log messages about (un)loading PDs.

23 months agosda2506/qi: Add missing full stop in 'desc' field.
Uwe Hermann [Sun, 8 Apr 2018 17:29:14 +0000 (19:29 +0200)]
sda2506/qi: Add missing full stop in 'desc' field.

23 months agorc_encode: Use different annotation classes for code word addr/data.
Uwe Hermann [Sun, 8 Apr 2018 17:08:39 +0000 (19:08 +0200)]
rc_encode: Use different annotation classes for code word addr/data.

23 months agorc_encode: Use different annotation classes for different bits.
Uwe Hermann [Sun, 8 Apr 2018 17:02:35 +0000 (19:02 +0200)]
rc_encode: Use different annotation classes for different bits.

23 months agorc_encode: Add self.putx() helper.
Uwe Hermann [Sun, 8 Apr 2018 16:55:08 +0000 (18:55 +0200)]
rc_encode: Add self.putx() helper.