Commit Graph

134 Commits

Author SHA1 Message Date
Daniel Elstner 782b16447b log: Remove sr_log_logdomain_{get,set} from the API
The confusingly named sr_log_logdomain_set() simply set a global
string prefixed to the log message by the default log callback.
This is pretty much useless, misleadingly named, and not used by
either sigrok-cli or PulseView.
2015-09-13 12:08:54 +02:00
Bert Vermeulen b05409d792 Remove SR_OK_CONTINUE.
This brings error reporting back to the usual: either return codes
are SR_OK (0) or they are < 1 indicating an error.

This fixes bug #633.
2015-08-31 16:23:10 +02:00
Bert Vermeulen 75772c721d Change SR_T_MQLIST to SR_T_MQ.
The need to make this a list no longer applies.

SR_T_MQ is thus a type consisting of a tuple with two elements: the first
item is the MQ (type G_VARIANT_TYPE_UINT32), and the second is the MQ
flags value (G_VARIANT_TYPE_UINT64).
2015-08-30 20:40:56 +02:00
Uwe Hermann ca7dbb5616 Various key lists: Add reminders of what needs updates upon changes. 2015-08-28 16:32:14 +02:00
Uwe Hermann 29ae6f0880 hwdriver.c: Fix key order, add missing items. 2015-08-28 16:29:07 +02:00
Uwe Hermann 28af4c714e 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.
2015-08-28 11:43:04 +02:00
Bert Vermeulen a1f7c854c5 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.
2015-08-26 01:54:34 +02:00
Bert Vermeulen 0176c92fea Add key info tables for MQ and MQflags. 2015-08-26 01:54:34 +02:00
Bert Vermeulen 2fb60e2329 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.
2015-08-26 01:08:42 +02:00
Daniel Elstner b2478a23db 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.
2015-08-16 18:28:13 +02:00
Daniel Elstner c1aae90038 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.
2015-08-16 18:28:12 +02:00
Soeren Apel 3cd4b38174 Introduce OutputFlag 2015-08-15 23:53:12 +02:00
Uwe Hermann dff0a89435 Doxygen consistency fixes (@foo instead of \foo). 2015-08-15 17:19:42 +02:00
Soeren Apel 81b3ce374c Add filename field to sr_output and make it accessible
This fixes parts of bug #570.
2015-07-30 19:21:42 +02:00
Soeren Apel 41812aca43 Fix #442 by renaming sr_dev_driver.priv to .context 2015-07-10 01:22:15 +02:00
Uwe Hermann f54ebe0c06 modbus: Minor typos, cosmetics and consistency fixes. 2015-06-07 20:40:32 +02:00
Aurelien Jacobs e77e32a3be libsigrok.h: add new type of device: ELECTRONIC_LOAD. 2015-06-07 20:15:08 +02:00
Aurelien Jacobs c4b7838922 libsigrok.h: Add SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE. 2015-06-07 20:15:07 +02:00
Aurelien Jacobs daa3901205 Add a modbus communication helper module. 2015-05-12 13:22:34 +02:00
Aurelien Jacobs 7a0b98b544 Rename SR_CONF_OUTPUT_* to SR_CONF_*.
All those options are currently applied only to power-supplies
but they could apply as well to electronic loads, except for the
fact that electronic loads channels are called inputs and not
outputs.
Also when you think about an SMU (or any kind of 4-quadrants
power-supply), their channels can both source and sink current,
so they can be considered as input as much as output.
Those SR_CONF_* are thus renamed so that they can be used in all
those situations.
2015-05-12 13:22:34 +02:00
Alexandru Gagniuc a77585d4ae global: Add configuration key for output frequency target
This will be used to set up the output frequency of AC sources.
2015-05-06 19:41:46 +02:00
Uwe Hermann 032da34b78 sr_driver_list() now takes a context pointer.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.

The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).

This fixes bug #565.
2015-04-07 02:09:56 +02:00
Martin Ling 61e6e2da45 Make sr_session_new() and sr_session_load() require a context. 2015-03-26 01:02:40 +01:00
Uwe Hermann f3f19d1131 Fix a bunch of typos. 2015-03-24 18:01:18 +01:00
Martin Ling 4f840ce965 Pass driver struct pointer to driver callbacks.
This lays the groundwork for subdrivers to share callbacks without
needing a separate wrapper function for each subdriver.
2015-03-21 13:09:40 +01:00
Uwe Hermann ded3e5087c libsigrok.h: Add SR_MQ_POWER_FACTOR and SR_MQ_APPARENT_POWER. 2015-03-20 20:58:43 +01:00
Martin Ling 6f1346fbd7 Change API of channel accessor functions to take struct sr_channel *. 2015-03-19 21:57:31 +00:00
Martin Ling 837b08660a Add sdi pointer to struct sr_channel. 2015-03-19 21:41:51 +00:00
Martin Ling bf622e6d00 Rename SR_CONF_NUM_TIMEBASE to SR_CONF_NUM_HDIV. 2015-03-02 12:24:12 +01:00
Martin Ling b9c10ae18b Add SR_MQ_COUNT for event count measurements. 2015-03-01 23:26:33 +00:00
Bartosz Golaszewski d3c81725ae SR_CONF_PROBE_FACTOR: New option.
Add new configuration option allowing to modify the probe factor
for oscilloscopes and power-monitors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-16 01:20:07 +01:00
Aurelien Jacobs 2617c81a4b Remove the inline qualification from sr_rational_set().
Inlining can only happen in the same compilation unit where the
function was defined, so there is no sense declaring an inline
function in a header if this function is not defined in this
same header.

This fixes the following gcc-5 warning:

In file included from include/libsigrok/libsigrok.h:1066:0,
                 from src/version.c:21:
include/libsigrok/proto.h:36:20: warning: inline function 'sr_rational_set' declared but never defined
 SR_API inline void sr_rational_set(struct sr_rational *r, uint64_t p, uint64_t q);
                    ^
2015-02-12 11:24:11 +01:00
Bartosz Golaszewski 3c5582595a SR_ERR_IO: new error code
Add new error code which can be used to notify the user about
general input/output errors.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-02-11 16:25:30 +01:00
Uwe Hermann 988357ca2f transform: Add a basic set of API calls. 2015-02-11 12:23:02 +01:00
Uwe Hermann 790320f605 transform: Add struct sr_transform and struct sr_transform_module. 2015-02-11 12:23:02 +01:00
Uwe Hermann 4fb0a5f8a0 in/out: Minor consistency renames.
- 'struct sr_input *' variables are consistently named 'in'.
 - 'struct sr_input_module *' variables are consistently named 'imod'.

 - 'struct sr_output *' variables are consistently named 'o'.
 - 'struct sr_output_module *' variables are consistently named 'omod'.
2015-01-27 18:05:30 +01:00
Joel Holdsworth 8a174d2342 output: Added preferred file extension field
This fixes parts of bug #541.
2015-01-27 18:05:29 +01:00
Joel Holdsworth c7bc82ffa1 input: Added preferred file extension field
This fixes parts of bug #541.
2015-01-27 18:05:25 +01:00
Bartosz Golaszewski 9ed444e622 new config options: averaging
Add new config options to libsigrok - 'averaging', which allows to
enable averaging of samples and 'avg_samples' for setting the number
of samples to be averaged over in each cycle.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2015-01-25 18:00:40 +01:00
Aurelien Jacobs 24287ea9e3 Add a public API to list available serial ports. 2015-01-03 17:51:51 +01:00
Bert Vermeulen 90cefe0cc7 Add sr_rational_set() convenience function. 2014-11-23 17:48:29 +01:00
Uwe Hermann 54ab1dcdc4 Add missing entries to sr_config_info_data[].
Newly added keys:

 - SR_CONF_SAMPLE_INTERVAL
 - SR_CONF_NUM_TIMEBASE
 - SR_CONF_NUM_VDIV
 - SR_CONF_CENTER_FREQUENCY
 - SR_CONF_DEVICE_MODE
 - SR_CONF_SCAN_OPTIONS
 - SR_CONF_DEVICE_OPTIONS
 - SR_CONF_DEVICE_MODE
 - SR_CONF_TEST_MODE

Also, keep the same ordering and grouping as in libsigrok.h.
2014-11-22 17:02:57 +01:00
Martin Ling a24da9a813 Make sr_analog_*_to_string() functions allocate the necessary buffers. 2014-11-19 17:34:19 +01:00
Bert Vermeulen a5892391b0 Add analog helper sr_analog_unit_to_string(). 2014-11-18 01:16:27 +01:00
Bert Vermeulen c2a25ebb8f Add analog helper sr_analog_float_to_string(). 2014-11-18 01:15:41 +01:00
Bert Vermeulen fb019a0e4d Add sr_analog_to_float(). 2014-11-13 22:51:39 +01:00
Bert Vermeulen d2e0f58539 Add SR_DF_ANALOG2 and related structs.
New structs:
 - sr_rational
 - sr_datafeed_analog2
 - sr_analog_encoding
 - sr_analog_meaning
 - sr_analog_spec
2014-11-13 22:35:54 +01:00
Uwe Hermann e705ce3bf6 Add sr_dev_inst_user_new(), sr_dev_inst_channel_add(). 2014-11-11 22:16:12 +01:00
Uwe Hermann 2f5f97056a Constify the sdi parameter of all sr_dev_inst_*() getters. 2014-11-11 12:44:37 +01:00
Uwe Hermann 96727ef016 Make 'struct sr_dev_inst' opaque. 2014-11-11 12:24:08 +01:00
Uwe Hermann e437da2b86 Add sr_dev_inst_channels_get() and sr_dev_inst_channel_groups_get(). 2014-11-11 11:59:23 +01:00
Janne Huttunen a42a39ac37 Export LCR meter 'auto' bits as config keys instead of mqflags.
The automatic selections of the measured quantity and equivalent circuit
model are more part of the configuration of the meter than attributes
of the measurement result. To reflect this, model them as config keys
instead of mqflags. This allows a driver that supports remote control to
implement 'set' method for them and has the additional benefit of saveing
two flag bits.
2014-10-21 12:23:20 +02:00
Bert Vermeulen 99d090d8e5 Fix typos. 2014-10-18 23:21:37 +02:00
Janne Huttunen c7c8994c20 Rename "SERIAL" -> "SERIES".
Use the more correct term "SERIES" for the corresponding equivalent
circuit model.
2014-10-17 12:13:51 +02:00
Soeren Apel 0157fdce99 Provide getters for sr_dev_inst member access 2014-10-17 03:02:52 +02:00
Bert Vermeulen ca95e90fb3 Use SR_CONF_OUTPUT_VOLTAGE_TARGET and _CURRENT_LIMIT.
These describe them better; the two are fundamentally different
things to set.
2014-10-15 12:03:00 +02:00
Uwe Hermann b9a348f56c Rename SR_CONF_LCR_METER to SR_CONF_LCRMETER.
(to be consistent with some other key names)
2014-10-13 11:39:15 +02:00
Janne Huttunen 0f5b241ec9 Add config key for output frequency.
Add a config key for getting/setting the output frequency. The value
will be an uint64 and measured in hertz.
2014-10-12 23:18:02 +02:00
Janne Huttunen 0ffce50d44 Add config key for LCR meter type.
Add a config key that can be used to indicate that the device is
an LCR meter.
2014-10-12 23:18:02 +02:00
Janne Huttunen ae27f28165 Add two new 'auto' flags.
Add flags for indicating that the meter has selected the measured
quantitiy and/or the used measurement model automatically. These
are similar to the existing auto-range flag.
2014-10-12 23:18:02 +02:00
Janne Huttunen 23601f2c7e Add quantity and flag for difference measurements.
Add 'SR_MQ_DIFFERENCE' quantity for reporting relative difference
between the current measurement and the reference value. The value
of this quantity will normally be reported in percents. Add also
the flag 'SR_MQFLAG_REFERENCE' for indicating that the reported
value is not the current measurement but the reference value instead.
2014-10-12 23:18:02 +02:00
Janne Huttunen 87d8124577 Add measured quantities for LCR meters.
Add parallel and serial model inductance, capacitance and resistance
for LCR meter measurements. Add also secondary quantities many LCR
meters calculate, namely dissipation factor, quality factor and phase
angle.
2014-10-12 23:18:02 +02:00
Janne Huttunen 01789adc72 Add two new units.
Add degrees and henrys to the list of supported units. Degree is
an unit of plane angle where one degree is 1/360th of a full circle.
Henry is the SI unit of inductance.
2014-10-12 23:18:02 +02:00
Bert Vermeulen d5cc282ff8 input: sr_input_free() is now a void function.
Its backend, input_module.cleanup(), is now also a void function.
2014-09-30 01:49:58 +02:00
Bert Vermeulen 7066fd4660 input: Add sr_input_end().
This signifies to the module instance no more input will come. This
will cause the module to process any data it may have buffered. The
SR_DF_END packet will also typically be sent at this time.
2014-09-30 01:49:58 +02:00
Soeren Apel 1b9e567b08 Removal of sdi->index, step 1: remove it from headers and helper funcs 2014-09-30 01:42:58 +02:00
Soeren Apel 2fe6210af6 Add serial_num and connection_id fields to sr_dev_inst 2014-09-24 00:40:03 +02:00
Bert Vermeulen 5827f61b64 Publish config key capabilities.
Every driver now publishes its device option config keys, i.e. the
list fetched with sr_config_list(SR_CONF_DEVICE_OPTIONS), with a
set of flags indicating which methods are implemented by the driver
for that key.

The config keys are OR'ed with any combination of SR_CONF_GET,
SR_CONF_SET and SR_CONF_LIST. These are defined as the high bits
of the uint32_t config key. Clients can OR config keys with
SR_CONF_MASK to strip out these bits. This mask will be kept up to
date if other bits are added to the capabilities list; clients MUST
therefore use SR_CONF_MASK for this.

Some keys don't have capability bits added, such as the informative
device type keys (SR_CONF_MULTIMETER, SR_CONF_OSCILLOSCOPE, ...) and
SR_CONF_CONTINUOUS.

Scan options do not have capabilities bits.
2014-09-17 15:36:11 +02:00
Bert Vermeulen 584560f142 Change type of SR_CONF keys to uint32_t. 2014-09-16 21:22:41 +02:00
Bert Vermeulen 379d260965 Add private storage pointer to struct sr_channel. 2014-09-08 12:45:21 +02:00
Bert Vermeulen a1eaa9e066 Revamp PPS-related config keys. 2014-09-08 12:45:21 +02:00
Bert Vermeulen 4f979115a4 input: sr_input_scan_*() now return a status code.
SR_OK: a match was found.
SR_ERR: no match.
SR_ERR_DATA: a match was found but the module cannot handle the input.
SR_OK_CONTINUE: some module didn't have enough data to be sure.
2014-08-28 00:22:13 +02:00
Bert Vermeulen b7f446051c Add SR_ERR_DATA. 2014-08-28 00:19:21 +02:00
Bert Vermeulen 3e2cd21115 Add second positive status code: SR_OK_CONTINUE.
Errors are thus always < 0, SR_OK == 0, and "OK but..." status
codes are > 0.
2014-08-26 01:55:41 +02:00
Bert Vermeulen bd0bfaafd8 input: Actually return a NULL-terminated array. 2014-08-26 01:55:41 +02:00
Bert Vermeulen 20e8882106 input: Frontends don't need to see SR_INPUT_META_*. 2014-08-26 01:55:41 +02:00
Bert Vermeulen 17bfaca62a input: Introduce new input module API.
This is a work in progress.
2014-08-26 01:55:41 +02:00
Bert Vermeulen d514d35dab input: make sr_input{_module} opaque to clients. 2014-08-26 01:55:41 +02:00
Bert Vermeulen d4c937749a input: s/format/module in all naming. 2014-08-26 01:55:41 +02:00
Bert Vermeulen fc74643098 output: Actually return a NULL-terminated array.
This returned an array of structs with an NULL-ed element at the end.
The drivers still do this, but the wrappers now make and free a NULL-
terminated array around it.

sr_output_options_free() now takes the pointer returned by
sr_output_options_get(), instead of the module owning it.
2014-08-15 20:23:52 +02:00
Bert Vermeulen cff7d8d60d Add config key for amplitude.
This is intended for setting (or getting) the amplitude of a source
which doesn't really have an MQ associated with it, such as the demo
driver's analog channels.
2014-07-28 15:40:19 +02:00
Bert Vermeulen a755b0e122 output: Finish output module API wrappers.
The sr_output and sr_output_module structs are now no longer accessible
from the client.
2014-07-26 03:57:17 +02:00
Martin Ling 00ebcbf48a Change prototype of sr_trigger_new to take const char *. 2014-07-17 18:39:17 +01:00
Martin Ling 63d0fb7528 Move public headers into include/libsigrok.
This is needed so that the C++ bindings, the header for which
references "libsigrok/libsigrok.h", can have a valid include
directory passed to build them before the headers are installed.
2014-07-17 18:30:49 +01:00