Age | Commit message (Collapse) | Author |
|
Rephrase the conditions which drive the I2C decoder's progress. Remove
self.state and its space separated string literals which were tedious to
search for, and which "lent themselves" to magic string matching. Use
other existing conditions instead, which also reduces redundancy.
Defer the "forgetting data bits" until after ACK was seen. Comment on
the motivation to keep the "protocol violating" implementation, which
misses error conditions that happen on the wire, but happens to support
heavily undersampled captures to an astonishing degree.
Also addresses minor style nits: Prefer to think of "dominant ACK" and
"recessive NAK". Rephrase a byte shift for the first address byte. Emit
the first warning annotation for the row which was declared before but
was not used so far.
|
|
It's unfortunate how the symbol / bit value handlers of the I2C decoder
keep redundantly accessing the .samplenum property. Ideally they should
just get an ss, es, value tuple, while the determination of these params
should be kept in the .decode() main loop.
Prepare the internal implementation to that approach, but enforce an
absolutely backwards compatible behaviour for now. This was verified by
the test suite. The data bit handler still keeps updating previous bits'
end positions when another bit is seen. Which assumes back to back bits
which strictly speaking does not match the protocol's definition. The
unfortunate application of the second last bit time's width to the last
bit time and the ACK slot is kept as well. And the code path needed to
be kept within the bit handler, because the second last bit's width only
becomes available when the last bit _was_ handled. Which means that the
main loop cannot provide a useful es value which matches the previous
implementation's behaviour.
|
|
The first address byte in an I2C transfer always carries the R/W bit.
Always shift this byte regardless of 7/10 bit addresses, and always emit
separate annotations for the address value part and the R/W bit part.
|
|
Eliminate how the I2C decoder's put methods take data as arguments and
hiddenly take ss/es from instance variables. This improves readability
during review. Rename .putx() to .putg() to match other decoders (emits
graphical annotations, in contrast to Python and binary).
Document the surprising BITS pdata order, stacked decoders get LSB first
sequences. To keep awareness during maintenance. Keep an explicit copy
of the LSB bits to simplify the implementation of the data byte handler
(sample numbers remain available at indices in their reception order).
|
|
The I2C decoder used to track the bitrate of the observed traffic
(number of address and data bits in a transfer). It's uncertain where
this output went (is meta still supported, are applications using it?),
and it appears to not be covered in tests. Improve the logic still.
Adjust the location of the emitted annotation. It used to start at the
most recently observed data byte, which looks suspicious. Output was
attempted when STOP was seen, even if the start was not observed. The
calculation dropped data before a repeated start. The implementation
kept data around after it became obsolete.
Break a long formula across several text lines. Use the fact that Python
division yields floating point results.
Add a comment in the ACK/NAK bit handler. It references data which was
gathered when accumulating data bits. Could be acceptable but must be
remained aware of.
|
|
Slightly unobfuscate how the I2C decoder invokes put methods. Present
the annotation class and the list of texts for different zoom levels
for readability. Also keep the data value presentation in that table
so that it holds all texts which users will see during decoder use.
Eliminate how the data bits used to bypass that table in the past.
This commit does not address the unfortunate self.ss/es coupling of
decoding code paths and annotation emitting helpers, which complicates
review of the decoder's implemented logic.
|
|
Collect all bits of a byte time in a Python list (as was done before).
Eliminate the bit counter and the value accumulator, use the list's
length during accumulation and common conversion support after the
accumulation instead.
Also comment on the non-trivial start/end sample number update logic.
The decoder implementation likes to claim data validity outside of the
high SCL phase, which does not agree with the strict I2C protocol idea.
Increases usability though (data visibility at zoom levels). This and
backwards compatibility makes us keep the logic, as long as we remain
aware of its implications.
Comment on the rather unexpected LSB first emission of annotations and
stacked layer data passing, while the I2C protocol itself is MSB first.
|
|
Slave addresses can be of 7bit or 10bit type, which occupies one or two
bytes at the start of the frame. Detect when a 10bit address is seen,
and classify the following byte as yet another address byte (which the
previous implementation incorrectly classified as data byte).
This commit only accumulates the address value and adjusts the class of
annotations. It does not introduce new annotation classes or rows, to
not change the decoder in incompatible ways.
|
|
Use longer names for variables and adjust their data types to improve
readability of the "is write?", "is repeated start?" conditions. Use a
boolean when the condition is known, and preset to None when the state
is yet uncertain. Rename .bits[] to .data_bits[] to reflect that they
exclusively hold the byte's bits and not the ACK/NAK bit.
|
|
|
|
|
|
|
|
Absence of a samplerate for the input stream should not be fatal. The
protocol decodes fine, we just cannot determine a bitrate for frames.
This addresses part of bug 1076.
|
|
Nobody has seen any such slave in the wild, yet. In the very unlikely
case that someone actually sees or needs this, patches are welcome
though (together with sample .sr files).
|
|
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 previous implementation of the I2C decoder used to retrieve and not
process the first sample of the input stream. Remove this instruction.
|
|
This allows frontends to set the assumed initial pins (i.e., the assumed
state of the pins before the first sample of a capture) to user-specified
values.
The assumed initial pins can be either low, or high, or "use same value
as the first sample of the capture".
The special self.initial_pins decoder attribute is now removed.
|
|
Some PDs were using a temporary workaround for (as it turned out) a
refcounting issue that was fixed in 066fbafdc3ba734a73b5f7fcfa1dbae67ddebf8a.
|
|
Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.
|
|
|
|
The previous **kwargs some PDs had is not actually ever used, so drop it.
|
|
This is more consistent with annotation syntax and looks slightly
better in most cases.
|
|
Use self.ss/self.es, or if there's a need to differentiate
them a bit more, use self.ss_<suffix>/self.es_<suffix> consistently.
Also, drop some unused variables.
|
|
Anything else in the pd.py files doesn't have to be imported/exposed.
|
|
Drop them from the libsigrokdecode repository.
|
|
|
|
- No newlines at the end of files.
- No trailing ';' characters.
- Comparison with None: Use 'is None' or 'is not None'.
- Comparison with True/False: Use 'if cond:' or 'if not cond:'.
- Various minor whitespace fixes.
|
|
Also, use the "if not self.samplerate" form, which catches both the case
where self.samplerate is None, as well as the case where it is 0.
|
|
Also remove some dead code.
|
|
|
|
Older libsigrokdecode versions are no longer able to use the current
versions of the PDs (various changes in syntax etc).
|
|
Variables of type 'struct srd_channel *' are consistently named 'pdch' to
make them easily distinguishable from libsigrok's 'struct sr_channel *'
variables that are consistently named 'ch'.
|
|
|
|
Annotation entries also consist of a tuple, not a list.
|
|
|
|
Each option consists of a dictionary with the following keys:
id The option id, which is passed in when setting a value.
desc A description of the option, suitable for display.
def The default value for this option.
values (optional) If present, a tuple containing values the option
may take. They must be of the same type as the default.
Valid types for the options are UTF-8-encoded strings, integers, and
floating point values.
|
|
|
|
The output type is now called OUTPUT_PYTHON, adapt all PDs to that.
|
|
The single comment re-stating the PD's name / description / purpose in
each pd.py file is not really needed, that info is available in the
Decoder class' attributes already.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This adds a tool in the tests directory, called pdtest. It uses the
"test/" directory in every PD directory, if present, to run the
PD against dumps found in the sigrok-dumps repository, and compares
the output against ".output" files in the "test/" directory. The file
"test/test.conf" is used to configure which tests to run.
A separate tool (tests/runtc.c) is used to run the actual decoding and
report output.
To get an overview of the options, run tests/pdtest without any options.
|
|
This automatically figures out the files to install for each protocol
decoder, without involving autotools.
All python files (filenames ending in .py) are always installed. If a
protocol decoder requires installation of a non-python file, a small
file called 'config' can be created in that protocol decoder's
directory, with the following content:
# comments are ok
extra-install vendorlist.txt commands.txt
|
|
|
|
|
|
|