Uwe Hermann [Thu, 27 Aug 2015 18:44:23 +0000 (20:44 +0200)]
Add a few scale related flags.
- SR_MQ_MASS: Mass, as measured by scales / balances.
- SR_UNIT_*: Various units of mass.
- SR_MQFLAG_UNSTABLE: A flag denoting that a value has not
yet stabilized (settled). E.g. when placing an object on a scale
it'll take a few moments until a stable reading is available.
Measurement values marked with SR_MQFLAG_UNSTABLE denote that they
are "unsettled", unstable values (not yet stabilized).
The absence of SR_MQFLAG_UNSTABLE denotes that the value is stable.
- SR_CONF_SCALE: A device class for weighing scales / balances.
Daniel Elstner [Wed, 26 Aug 2015 11:55:53 +0000 (13:55 +0200)]
Build: Define feature test macro _DEFAULT_SOURCE
This basically makes glibc expose the same set of features as
if gcc was invoked without any restricting -std=c* option. Unlike
_GNU_SOURCE however, it does not enable GNU-specific extensions.
So, with this macro defined the behavior of Linux with glibc
should match that of other platforms.
Daniel Elstner [Wed, 26 Aug 2015 11:13:39 +0000 (13:13 +0200)]
Build: Use TESTS prefix instead of CHECK for flag variables
In order to avoid confusion of the flags-gathering pkg-config
result with the actual test for the availability of "check",
change the pkg-config output variable prefix from CHECK to TESTS.
Bert Vermeulen [Sun, 16 Aug 2015 23:43:22 +0000 (01:43 +0200)]
Add SR_T_MQLIST.
This type consists of an array, with each item a two-member tuple,
representing an MQ/MQflags pair: the first item is the MQ (type
G_VARIANT_TYPE_UINT32), and the second is the MQ flags value
(G_VARIANT_TYPE_UINT64).
A GVariant of type SR_T_MQLIST can thus always represent more than
one MQ/MQflag pair.
Bert Vermeulen [Sun, 16 Aug 2015 23:30:14 +0000 (01:30 +0200)]
Replace sr_config_info with sr_key_info.
The tables defined with this struct can now be used for information
on items other than config keys.
Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.
Daniel Elstner [Mon, 24 Aug 2015 20:06:27 +0000 (22:06 +0200)]
Build: Leave LIBS alone during configure
Put the extra libraries into SR_EXTRA_LIBS instead of LIBS.
Create an SR_CHECK_LIBS macro to make that easy. Substitute
SR_EXTRA_LIBS into libsigrok.pc, too.
Daniel Elstner [Mon, 24 Aug 2015 07:25:37 +0000 (09:25 +0200)]
Build: Add private copy of C++11 check macro
Place a copy of ax_cxx_compile_stdcxx_11.m4 from the Autoconf
macro archive into our private m4/ directory. This is cleaner
than trying to parse M4 file versions etc. Plus, the macro is
now always available.
Daniel Elstner [Sun, 23 Aug 2015 19:17:36 +0000 (21:17 +0200)]
Build: Reduce autogen.sh to a trivial stub
Use autoreconf instead of invoking the various Auto tools
separately. Get rid of the Darwin-specific guesswork -- it
does not make sense to handle this at the level of libsigrok.
People should set up their ACLOCAL_PATH themselves as appropriate
for their own system; just as they already need to set up various
other paths.
Daniel Elstner [Sun, 23 Aug 2015 19:08:54 +0000 (21:08 +0200)]
Build: Check for accepted compiler flags
Introduce the SR_CHECK_COMPILE_FLAGS macro and use it to check
for additional compiler flags. Put the accepted flags into the
separate substitution variable SR_EXTRA_CFLAGS.
With this and the preceding changes, bug #578 should now be fixed.
Daniel Elstner [Sun, 23 Aug 2015 13:02:30 +0000 (15:02 +0200)]
Build: Make compiler warnings configurable
Use the SR_ARG_ENABLE_WARNINGS macro to configure and check for
the availability of compiler warning flags. Maintain separate
sets of warning flags for C and C++.
The configure option --enable-warnings=[min|max|fatal|no] can
be used to set the compiler warning level for all languages.
The default level is "max".
Daniel Elstner [Sun, 23 Aug 2015 12:52:00 +0000 (14:52 +0200)]
Build: Move custom Autoconf macros to separate file
Place custom Autoconf macros which other sigrok modules may
re-use into a separate file m4/sigrok.m4. Also, introduce new
macros for defining the package and library versions, and for
gathering compiler warning flags.
Daniel Elstner [Fri, 21 Aug 2015 22:07:48 +0000 (00:07 +0200)]
Build: Do not omit first argument to m4_warn()
It seems that contrary to what the documentation says, leaving
the category argument to m4_warn() empty is not allowed. Use
the "unsupported" category for lack of a better choice.
Daniel Elstner [Tue, 18 Aug 2015 16:06:08 +0000 (18:06 +0200)]
Build: Avoid $< in explicit rules
Although useful, makes other than GNU make do not like this.
Name the prerequisite explicitly instead, and circumvent any
VPATH substitution other makes may do.
Daniel Elstner [Mon, 17 Aug 2015 00:08:39 +0000 (02:08 +0200)]
Build: Make dependency on git change more robust
It can sometimes happen that .git/HEAD or .git/refs/head/*, which
are added as config.status dependencies during configure, do not
exist anymore at build time. For instance, when the current branch
is deleted after switching to a different one.
Wrap the dependencies inside $(wildcard ...) to avoid this problem.
Note that this is a GNU make feature. However, it should be fine
as it is only used for git builds. Even if a non-GNU make is used,
the construct will hopefully just expand to nothing.
Daniel Elstner [Sat, 15 Aug 2015 00:28:54 +0000 (02:28 +0200)]
Build: Simplify the hardware driver selection
Replace DRIVER() and DRIVER2() by a single SR_DRIVER() macro.
Derive the names of shell variables and preprocessor defines
programatically to cut down on repetition.
Daniel Elstner [Sat, 15 Aug 2015 16:33:05 +0000 (18:33 +0200)]
Build: Do not distribute generated headers
version.h and enums.hpp are generated at build time and should
not be included in the distribution tarball. This seems to have
triggered a weird error when doing a VPATH build of the dist
tarball.
Daniel Elstner [Sat, 15 Aug 2015 16:10:50 +0000 (18:10 +0200)]
Build: Pass nostdinc option to automake
It seems automake automatically adds the directory containing
the generated version.h to the include path. Use nostdinc to
disable default includes altogether.
Daniel Elstner [Sat, 15 Aug 2015 14:10:36 +0000 (16:10 +0200)]
Build: Prefix directory to include of enums.hpp
This fixes a build problem due to the reduced include search paths
introduced by my recent changes. Also fix a couple of other
includes to use angle brackets.
Daniel Elstner [Fri, 14 Aug 2015 19:01:59 +0000 (21:01 +0200)]
Build: Append git revision hash to version
Append the git revision hash to the libsigrok package version,
unless HEAD exactly matches a release tag. Note that this does
not affect the version known to autoconf -- e.g. source tarballs
created by make dist will not receive a revision suffix.
Changes to git HEAD automatically trigger a reconfiguration.
Uncommitted changes do not, which is why I left out the -dirty
suffix.
Daniel Elstner [Fri, 14 Aug 2015 16:03:47 +0000 (18:03 +0200)]
Build: Delay expansion of $datadir in FIRMWARE_DIR
Make it so that $(datadir) is resolved at make time, as per
autotools recommendations. Note that $datadir is not fully
resolved at configure time to begin with, i.e. part of it
already was evaluated at make time.
Daniel Elstner [Fri, 14 Aug 2015 15:53:06 +0000 (17:53 +0200)]
Build: Make version.h a configuration header
Use the proper tool for the job and make libsigrok/version.h
a secondary configuration header, so that autoconf's AC_DEFINE
machinery can be used to generate it. Note that the header
template is still hand-written, enabling fine control of the
content.
Daniel Elstner [Wed, 12 Aug 2015 23:18:51 +0000 (01:18 +0200)]
Build: Set local include directories in Makefile.am
Move the include flags for files in the source tree from
configure.ac to Makefile.am where they belong. Also use
AM_CPPFLAGS instead of CFLAGS/CXXFLAGS to make sure the
files in the build/source tree are always picked up first.
Also, remove the include/libsigrok sub-directory from the
search path, thereby making the <libsigrok/> prefix mandatory
when building libsigrok itself. This matches the convention
already imposed on users of the library.
libsigrok: demo: close pipes on dev_acquisition_stop()
Fixes a bug where new acquisition failes due to leftover pipes from
previous acquisitions:
sr: demo: dev_acquisition_start: pipe() failed
Indeed, PulseView had 2024 pipes opened. With this fix, it stabilizes at
33 with sampling thread active.
baylibre-acme: Add a workaround for slow data acquisition.
At high sampling rates and maximum channels we are not able to acquire
samples fast enough, even though frontends still think that samples
arrive on time. This causes visible shifts in frontend plots.
To compensate for the delay introduce the following workaround: check
if we are late (if any clock events have been missed) and resend the
last frame n times (n == number of missed clock events).
Daniel Lezcano [Thu, 4 Jun 2015 17:01:27 +0000 (19:01 +0200)]
baylibre-acme: Use timerfd instead of a fake pipe.
Currently baylibre-acme uses a fake pipe as the input channel required by
libsigrok API and calls sleep() in the data acquisition callback to create
intervals between measurements.
Switch to a more elegant approach: use Linux' timerfd and set a periodic
timer equal to the sampling rate. Then read the data every time the timer
expires.
Signed-off-by: Daniel Lezcano <redacted> Signed-off-by: Bartosz Golaszewski <redacted>
Daniel Lezcano [Wed, 27 May 2015 18:22:02 +0000 (20:22 +0200)]
baylibre-acme: Optimize reading of values from sysfs.
Opening a file has a cost (security, allocation, syscalls). The
read_sample() function always does an open/read/close sequence.
In order to optimize that, let's open the file at the moment the
acquisition starts, close it when the acquisition stops and make
read_sample() only lseek() to the beginning of the file and read
the value.
Signed-off-by: Daniel Lezcano <redacted> Signed-off-by: Bartosz Golaszewski <redacted>
Daniel Elstner [Wed, 24 Jun 2015 17:16:49 +0000 (19:16 +0200)]
sysclk-lwla: Do not create channels in reverse order
This was originally done as an optimization in combination with a list
reversal which has since been removed from the code. Thus, un-reverse
the channels so that the UI lists them in the correct order again.