usb_power_delivery: better PD 3.0 support and other changes
- better PD 3.0 support
- display PD revision in output
- different flags for source and sink PDO's and RDO's
[Note: This commit is the remaining set of manually merged changes of the
recent commits from Peetz0r <redacted> and the
improvements from davidanger <redacted> over at
https://github.com/davidanger/libsigrokdecode]
Uwe Hermann [Thu, 30 Aug 2018 18:46:43 +0000 (20:46 +0200)]
srd_exit(): Fix a -Wcast-function-type compiler warning.
srd.c: In function ‘srd_exit’:
srd.c:310:28: warning: cast between incompatible function types from ‘int (*)(struct srd_session *)’ to ‘void (*)(void *, void *)’ [-Wcast-function-type]
g_slist_foreach(sessions, (GFunc)srd_session_destroy, NULL);
^
Uwe Hermann [Thu, 30 Aug 2018 18:42:05 +0000 (20:42 +0200)]
srd_decoder_unload_all(): Fix a -Wcast-function-type compiler warning.
decoder.c: In function ‘srd_decoder_unload_all’:
decoder.c:1080:27: warning: cast between incompatible function types from ‘int (*)(struct srd_decoder *)’ to ‘void (*)(void *, void *)’ [-Wcast-function-type]
g_slist_foreach(pd_list, (GFunc)srd_decoder_unload, NULL);
^
Gerhard Sittig [Wed, 15 Aug 2018 21:09:11 +0000 (23:09 +0200)]
log: add a public srd_log_callback_get() API routine
Allow applications to query the currently registered log callback. So
they can either restore the previously registered routine, or register
another routine _and_ log to the previously registered routine as well.
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)
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).
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'.
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.
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' ]
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.
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.
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.
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.
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.)
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.
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;
^
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)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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.