Commit Graph

12 Commits

Author SHA1 Message Date
Daniel Elstner 2cfd16a316 sysclk-lwla: Streamline packet output logic.
(process_sample_data): When expanding run-length samples into
session packets, calculate the number of samples to write in
advance while honoring all constraints.  This is cleaner than
checking constraints within the expansion loop.  Also, the new
logic always fills up packets exactly to whatever limit applies
first, thereby removing the need for truncation after the fact.
2014-01-18 17:36:23 +01:00
Daniel Elstner 29d587670d sysclk-lwla: Implement SR_CONF_LIMIT_MSEC.
Allow the acquisition to be constrained by time in addition to
a sample count limit.  Since the LWLA protocol actually provides
only a duration natively, implement the sample count limit on top
of the new duration limit.

With this change, limiting an acquisition in external clock mode
should finally work properly.
2014-01-18 16:08:39 +01:00
Daniel Elstner 0b92c32cb8 sysclk-lwla: Make use of the probe index again.
(configure_probes): sr_probe::index has been un-deprecated,
so use it instead of relying on the list order.
2014-01-15 21:44:59 +01:00
Daniel Elstner d02d475442 sysclk-lwla: Bypass divider in external clock mode.
(lwla_setup_acquisition): Set the clock divider bypass
flag to 1 for the external clock modes as well.
(capture_setup): Set the clock divide count to 0 if an
external clock source is selected.
2014-01-15 21:44:59 +01:00
Daniel Elstner 313c7a7da2 sysclk-lwla: Utility functions clean-up and semantic fixes.
(lwla_send_bitstream): Unref the mapped file earlier in order
to simplify the error handling.
(lwla_receive_reply): Do not treat a reply buffer length of
zero as silent no-op.  That logic was left over from an earlier
iteration, before the distinction between reply buffer size and
expected read length was introduced.
2014-01-15 21:44:59 +01:00
Daniel Elstner 60e2fa0a03 sysclk-lwla: Remove unused dev_context::next_state. 2014-01-15 21:44:59 +01:00
Daniel Elstner 945e4343e2 sysclk-lwla: Avoid warning due to bogus range check.
(lwla_set_clock_source): Checking whether an enum value is greater
than or equal to zero apparently results in a warning with some
compilers.  Assign the enum to an unsigned variable to avoid this,
and return SR_ERR_BUG if the range is exceeded, as this indicates
a bug in the driver code itself.
2014-01-15 21:43:54 +01:00
Uwe Hermann 1f98295dfa sysclk-lwla: Fix probe name issue.
The g_ascii_formatd() function expects the "format" argument to start
with a '%' character, e.g. it should be "%f" or such (this is not
clearly documented in the glib API docs, but visible from the source code).

The usage of "CH%f" for example will trigger an assertion and thus make the
LWLA device unusable in practice (e.g. in PulseView on Windows no probenames
would be shown, and sampling wouldn't work).

Example:
  GLib-CRITICAL **: g_ascii_formatd: assertion 'format[0] == '%'' failed

(not exposed in all glib versions or builds of glib on all distros
apparently, some may need G_MESSAGES_DEBUG=all or other measures)

From the glib g_ascii_formatd() code:
  g_return_val_if_fail (format[0] == '%', NULL);

We now use g_snprintf() instead for simplicity. This has been tested to
fix this specific issue (i.e. the probenames now do show up in PulseView).

This closes bug #270.
2014-01-14 19:52:26 +01:00
Daniel Elstner 7ebe9b9e7e sysclk-lwla: Honor SR_CONF_CONN at scan time. 2014-01-14 19:33:31 +01:00
Daniel Elstner 8a3ddd8815 sysclk-lwla: Fix calculation of the running sample count.
Field 7 of the status response is actually a duration in
milliseconds at all samplerates but 125 MHz.
2014-01-14 19:33:31 +01:00
Daniel Elstner 5874e88d83 sysclk-lwla: Implement support for the LWLA1034. 2014-01-14 19:33:31 +01:00
Daniel Elstner aeaad0b0b5 sysclk-lwla: Initial driver skeleton. 2014-01-14 19:33:31 +01:00