Bert Vermeulen [Tue, 10 Dec 2013 16:17:38 +0000 (17:17 +0100)]
Add protocol decoder testing framework.
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.
Bert Vermeulen [Wed, 27 Nov 2013 15:47:04 +0000 (16:47 +0100)]
Automate protocol decoder installation.
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
Uwe Hermann [Tue, 19 Nov 2013 20:14:03 +0000 (21:14 +0100)]
Add a missing #include.
This causes compiler errors in some setups otherwise, e.g.:
CC libsigrokdecode_la-session.lo
session.c: In function 'srd_session_metadata_set':
session.c:195:46: error: expected ')' before 'PRIu64'
srd_dbg("Setting session %d samplerate to %"PRIu64".",
^
session.c: In function 'srd_session_send':
session.c:242:15: error: expected ')' before 'PRIu64'
"number %" PRIu64 ", %" PRIu64 " bytes at 0x%p",
^
Bert Vermeulen [Mon, 18 Nov 2013 09:44:28 +0000 (10:44 +0100)]
Don't try to load an already-loaded module
Python silently uses the existing module anyway, but the library
was counting it as an extra module. This was exposed by a test
case in the test suite.
Bert Vermeulen [Sun, 10 Nov 2013 11:42:11 +0000 (12:42 +0100)]
Implement OUTPUT_BINARY
This requires the PD to have a tuple in its class called 'binary',
which contains a list of strings describing the different binary
classes it can output. For the SPI decoder this might be 'MOSI' and
'MISO', for example.
The data is submitted to the frontend as struct srd_proto_data_binary,
which contains the class that data belongs to.
'id' defaults to the protocol decoder instance id, and only needs changing
if a decoder chain needs to fork.
'object-type' refers to a Python object, such as int or str.
After registering, the PD submits data as usual with Decoder.put(), with
the only argument a value of the registered object-type.
Bert Vermeulen [Wed, 30 Oct 2013 15:30:05 +0000 (16:30 +0100)]
Pass metadata to PDs only at runtime, not at decoder start
The SRD_CONF_NUM_PROBES metadata key was removed. It wasn't actually
used for anything, since this is trivially available via the configured
(or default) probe list.
The SRD_CONF_UNITSIZE key was removed. The unit size is instead derived
from the probe list: the number of probes packed into the least amount
of space possible defines the unit size.
PD changes:
* The start() method no longer takes a 'metadata' parameter.
* Metadata now comes in only via the metadata() method, which takes
a key and value. The only key defined so far is SRD_CONF_SAMPLERATE,
which is exported into the module namespace.
API changes:
* srd_session_send() now takes an end_samplenum parameter, and had its
options rearranged.
* srd_session_config_set() is now srd_session_metadata_set(). This keeps
"config" options for a future feature to allow PDs or frontends to
configure each other's options on the fly, up and down the stack.
Move all decoder instances and callbacks into a session struct
The struct srd_session also holds configuration parameters formerly
passed to srd_session_start().
The new call srd_session_new() takes a pointer where a newly allocated
pointer to struct srd_session will be stored. This pointer must be
passed as the first argument to all functions that require it.
The SRD_CONF_NUM_PROBES, SRD_CONF_UNITSIZE and SRD_CONF_SAMPLERATE
keys must be configured with srd_config_set() before srd_session_start()
is called.
A new call srd_session_destroy() is also available. This cleans up all
resources the session holds. This is also called from srd_exit() for
all sessions.
Uwe Hermann [Thu, 10 Oct 2013 20:44:02 +0000 (22:44 +0200)]
usb_signalling: Drop packet handling.
The usb_signalling PD should not care about packets, only symbols and bits.
The new (fixed) usb_packet PD constructs packets out of individual bits now.
Uwe Hermann [Fri, 4 Oct 2013 09:35:56 +0000 (11:35 +0200)]
usb_packet: Major rewrite, e.g. to prepare for GUI usage.
Restructure the PD into a state machine, output individual packet
components as separate annotations, define a protocol output format and
implement it (so that other PDs can stack on top of this one), and fix
various other isses in the PD.
Uwe Hermann [Sat, 28 Sep 2013 22:18:24 +0000 (00:18 +0200)]
usb_signalling: Fix decode of individual bits.
After a Start of Packet (SOP) has been detected, "sample" the individual
USB symbolѕ/bits in the middle of the respective bittime (depending on
whether full-speed or low-speed signalling is used).
This fixes various incorrectly decoded cases (bug #158).