Age | Commit message (Collapse) | Author |
|
Remove the redundant .itemcount variable, which exactly corresponds to
the length of the .items array.
Arrange retrieval of options and their evaluation closer to each other
for improved readability.
Use common logic to construct "words" from several multi-bit "items".
Arrange for endianess support by optionally reversing the array before
traversal.
|
|
Instead of implementing two main loops for operation in the presence and
in the absence of a clock line, use a common main loop which operates on
pre-determined wait conditions.
|
|
The list of a dictionary's keys need not reproduce in identical order
everywhere. Make sure to run all start-of-packet sequence checks in the
decoder implementation in a specific order on each machine, such that
annotations get emitted with identical content and in the same order for
each execution of the decoder.
This fixes the remaining part of bug #1090.
|
|
Use the dictionary's .get() method in combination with a default result
parameter, instead of an explicit "k in dictvar" test and a conditional
assignment.
|
|
Annotations of the USB power delivery decoder contain multiple text
fragments that correspond to several flags in bit fields. The Python
runtime did not guarantee an order of emission and made the test suite
fail.
Sort the order in which RDO and PDO flags related text fragments get
constructed and concatenated. Print text for higher bit positions first
as this might feel more intuitive to users.
This fixes part of bug #1090.
|
|
Move initialization code of protocol decoders from the constructor to a
new reset() helper method. The libsigrokdecode backend could run this
method several times to clear the decoder's internal state, before new
data from another acquisition gets fed to decode() calls.
|
|
The ssi32 decoder implements a reset() method which clears internally
accumulated data during decoding. Rename the method before all decoders
will grow a new reset() method that will be used for a different purpose.
|
|
The mrf24j40 decoder implements a reset() method which clears internally
accumulated data during decoding. Rename the method before all decoders
will grow a new reset() method that will be used for a different purpose.
|
|
The ade77xx decoder implements a reset() method which clears internally
accumulated data during decoding. Rename the method before all decoders
will grow a new reset() method that will be used for a different purpose.
|
|
The decoder's .reset() method seems to partially implement constructor's
assignments, but is not referenced anywhere. There is neither a direct
call site in the remainder of pd.py which uses the "reset" name, and
runtime computation only references "handle_*()" methods for commands
and responses.
Drop the unused .reset() method in the individual decoder before the
introduction of a common .reset() method approach for all decoders.
|
|
The am230x decoder implements a reset() method which clears internal
decoder state. Rename the method before all decoders will grow a new
reset() method that will be used for a different purpose.
|
|
|
|
This replaces the fixed timing margin with a percentage based tolerance
to better allow for timing inaccuracies, especially for longer timings
like the Leader and Repeat codes.
|
|
|
|
|
|
|
|
Using the format string 'I' with the default (implied) prefix '@'
results in both word size and endianness being platform dependent.
In this case standard size (32 bits) and little endianness is
required, so the prefix '<' needs to be used.
|
|
|
|
|
|
|
|
This is needed so that WORDS_BIGENDIAN is defined on big-endian
systems, which is needed by version.c .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This fixes (parts of) bug #1019.
|
|
|
|
|
|
|
|
According to the USB 2.0 spec, 8.5.3.4, a protocol stall condition lasts
until the next SETUP transfer. On reception of the SETUP, adjust the end
sample accordingly, and flush the previous CONTROL transfer.
|
|
Only try to acquire the GIL if the Python interpreter is actually
initialized, otherwise there'll be a segfault.
|
|
Check for falling edges (i.e. changes to dominant state) between bits of
a CAN frame, and adjust subsequent bit slots' sample points accordingly.
This is a simple implementation which could get improved later. But it
improves the decoder's reliability when the input signal's rate differs
from the nominal rate.
This fixes bug #990.
Reported-By: PeterMortensen via IRC
|
|
Consistently use .sample_point for the member variable that corresponds
to the 'sample_point' property. Use 'samplenum' in .get_sample_point()
to reflect that the routine returns a sample number. This eliminates the
'bitpos' identifier which was used for two different things.
|
|
|
|
With these additions, frontends can now call libsigrokdecode API
functions from different threads without running into threading issues.
The backend releases the GIL when it is performing tasks that might take
a while and it doesn't need to run Python/C API calls during that time.
This allows frontends to run multiple PD stacks (in multiple frontend
threads) "at the same time" in a time-sharing, "interlocked" manner.
Whenever one of the decoders is inside e.g. self.wait() it releases the
GIL and thus allows other decoders to do some work in the mean time.
The user-visible effect is that for use-cases such as running 3 different
decoder stacks at the same time for an acquisition, the user will not
have to wait for PD 1 to finish decoding, then wait for PD 2 to finish
decoding, and only *then* being able to see annotations from PD 3.
Instead, all three PDs will decode some chunks of data from time to
time, thus the user is able to inspect annotations from all 3 PDs while
the acquisition and decoding is still going on.
|
|
Also, drop the reference to gitorious.org (no longer available).
|
|
|
|
Make obvious that the start bit's value is 1 in the IDLE stage.
|
|
The 'fields' table of state and descriptions is not fully populated,
some slots are missing. Cope with lookup misses when unexpected input
data is not found in the table. Use different error text in annotations
for described but invalid states (the previous implementation used
"reserved / invalid"), and for states that are not described in the
table (introduce the "reserved / unknown" text for conditions that are
not covered by the decoder implementation).
The previous implementation missed the emission of some warnings. When a
"reserved / invalid" description was found, the subsequent exact match
for "reserved" failed and the warning was not emitted. Weaken the test
to emit warnings for either description that has "reserved" in it,
regardless of whether the text was found in the table or is not part of
the table at all.
|
|
|
|
Annotations generated by the onewire_network decoder started where bit 1
began, while it should align with the start of bit 0.
|
|
Getting the first edge outside of the loop in .decode() greatly
simplifies the logic, any other edge then is just an update of the
previously collected data, determined by always equal code.
|
|
The previous implementation of the I2C decoder used to retrieve and not
process the first sample of the input stream. Remove this instruction.
|
|
Telling .wait() to "skip one sample" slightly obfuscates the intent of
getting the next samples while no condition applies. Explicitly pass no
condition arguments instead, to better reflect the purpose. Coincidently
these .wait() calls will execute in slightly less expensive code paths
in the common code.
|
|
The Decoder.wait() method expects a list of dicts, or as a special form
a single dict, to specify the conditions to wait for. An empty dict or
an empty list mean "unconditional wait", requesting the very next sample.
Accept None as well as no arguments at all in Decoder.wait() calls. This
shall better reflect the intent and slightly unobfuscate PD code, as well
as avoid creation of potentially expensive Python objects at the call site.
|
|
The Decoder.wait() method works as expected when non-empty conditions
are specified by the caller. For empty conditions the implementation was
incomplete, and ended up in an infinite loop because the sample number
got stuck in the current location. Code review revealed more issues like
not getting more input data chunks when needed.
Detect when empty wait() conditions were specified, and re-use existing
code paths for match handling as much as possible. This is achieved by
the manual creation of a SKIP term with the appropriate count value.
It's assumed that naive decoder implementations will run this kind of
condition-less query for every individual sample, which means that
efficiency is important.
Make sample number 0 available to condition-less calls, too. Don't skip
the first sample in the input stream.
|
|
Rephrase how the 'WAIT IDLE' stage skips over all-low input signals.
Have the next high level on either line detected in common code.
|
|
Do reference the period's start and end sample numbers when the
duty cycle is written to the binary output stream. The previous
implementation inappropriately used the period counter instead.
|