Commit Graph

56 Commits

Author SHA1 Message Date
Bert Vermeulen 6b8d6f93bb Get rid of obsolete SR_DI_NUM_PROBES and SR_DI_PROBE_NAMES.
Frontends should use the probe list in the device's sr_dev_inst
to get this information.
2013-01-15 17:42:23 +01:00
Bert Vermeulen 6936ee4206 remove datastore functionality
Keeping a copy of acquired data is up to the frontend, not libsigrok.
2013-01-08 14:14:44 +01:00
Joel Holdsworth bf53457d1d Pass sr_datafeed_packets and payloads with const pointers
This patch marks packet structures and their payloads as const.
This indicates to packet receivers that modifications to these are
not allowed. In general all pointers should be marked const unless
modification of the referenced data is explicitly allowed.
2012-12-20 07:51:21 +00:00
Alexandru Gagniuc 801c7800c6 linsigrok.h: Document meaning of SR_UNIT_CONCENTRATION
Having concentration as a unit is vague, as it can be expressed in
many ways. In the context of sigrok, concentration means a normalized
number from 0 to 1.

Document its meaning.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-16 18:50:23 +01:00
Bert Vermeulen ef4344e7f4 add relative humidity MQ 2012-12-16 18:38:44 +01:00
Bert Vermeulen 4f3bd685e6 add MQ/units for carbon monoxide concentration 2012-12-15 10:50:22 +01:00
Alexandru Gagniuc c69049091e libsigrok.h: Don't store subdriver in sr_dev_driver
Not all drivers use subdrivers. The only reason the subdriver field was
introduced was to accomodate the model of serial-dmm.

The sr_dev_driver struct is available to the frontend. Exposing the subdriver
field creates the problem of exposing knowledge of libsigrok's internal driver
layout, even though the drivers are designed to be a flat list to the frontend.

Store the subdriver in the dev_context struct of serial-dmm.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-13 23:16:34 +01:00
Uwe Hermann 06b7a8af7e serial-dmm: Simplify code a bit.
Store/use the receive_data() function and a pointer to the driver struct
in the dmms[] array. Use a ".subdriver" entry in the driver struct.
Use a macro to simplify hw_init() wrappers.
2012-12-13 01:30:43 +01:00
Bert Vermeulen 402704445e add thermometer and hygrometer HWCAPs 2012-12-04 23:58:03 +01:00
Peter Stuge 34f06b903e Add a struct sr_context * parameter to hw_init() 2012-12-03 12:07:40 +01:00
Bert Vermeulen 2244356d10 comment fix 2012-11-11 03:12:10 +01:00
Bert Vermeulen 69b07d14db allow for intermediate stage in stopping acquisition
In the case of USB drivers, a driver's dev_acquisition_stop() cannot
simply remove its fd sources from the session and close its devices:
a USB transfer might still be underway, and it needs to be finished
(and its memory freed) properly.

An sr_dev_inst->status value is added: SR_ST_STOPPING, which should
be set when the driver's dev_acquisition_stop() is called, and acts
as a marker for the USB event handler to wind up its operations.

In order for dev_acquisition_stop() to be able to set the sdi status,
however, it needs to be unconstified.
2012-11-06 15:16:22 +01:00
Alexandru Gagniuc 24d04d1e3d Avoid future ABI breakage by hardcoding enum values.
Whenever we added a field to the enums in libsigrok.h, we were running
the risk of breaking ABI compatibility. Any reordering of existing values
or the addition of entries other than at the bottom of the list would
cause an ABI breakage.

By hardcoding the values we ensure that any added field will have an
unused value, and will not take a value previously used by a different
flag. By doing this, we avoid confusing frontends compiled with an
earlier API.

We use 10000 as the first entry of each enum, and each "category" gets
an explicit number (10000, 20000, 30000, and so on).

Also avoid making the first value of an enum zero. A value of zero is
used as terminator item in some lists.

Remove explicit "DUMMY" (terminator) enum entries, they're not needed.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-11-02 19:00:37 +01:00
Bert Vermeulen fc19c288b5 add support for sound pressure level measurements 2012-11-02 15:24:30 +01:00
Uwe Hermann 1f345a21d2 Doxygen: libsigrok.h: Explain #include file usage. 2012-10-22 11:56:19 +02:00
Uwe Hermann a02d77bce9 Doxygen: Various fixes in libsigrok.h. 2012-10-22 11:56:18 +02:00
Uwe Hermann 393fb9cb18 Doxygen: Add @file items for the relevant files.
These short descriptions are shown in the "Files" section of the
Doxygen output.
2012-10-22 11:56:18 +02:00
Uwe Hermann 3c0839d524 Doxygen: Various improvements in libsigrok.h.
- Turn SR_OK/SR_ERR_* and SR_LOG_* into proper enums.

 - Use /**< Foo. */ for Doxygen comments that are on the same line as
   the (e.g.) enum entry they document. If the comment is not on the
   same line (but rather directly above the enum entry) a simple
   /** Foo. */ comment is sufficient.

 - Use /** */ instead of /* */ in some places, so that Doxygen actually uses
   the respective comments.

 - Various smaller cosmetic fixes or cleanups.
2012-10-22 11:56:18 +02:00
Uwe Hermann 9c5332d291 Doxygen: Fix a bunch of warnings and outdated docs. 2012-10-22 11:56:18 +02:00
Peter Stuge b8072700c1 Add a struct sr_context * parameter to sr_init() and sr_exit() 2012-10-21 20:23:14 +02:00
Uwe Hermann 026c822d8c Move 'struct drv_context' to sigrok-internal.h.
It's not meant to be visible to frontends.
2012-10-21 16:40:13 +02:00
Bert Vermeulen 777bbd5b98 add SR_HWOPT_* documentation 2012-10-18 22:59:32 +02:00
Bert Vermeulen 6b86923463 add SR_UNIT_DECIBEL_VOLT (dBu) 2012-10-16 23:33:54 +02:00
Alexandru Gagniuc b82a17d370 libsigrok.h: Add measured quantity and units used by Radioshack 22-812
The Radioshack 22-812 can measure parameters such as transistor gain,
dbm, etc. Add those to libsigrok.h.

The SR_UNIT_UNITLESS is for quantities that do not have units. Any
ratio or gain are just factors, whic do not have units. Specifically,
a transistor's gain, or hFE, is a unitless quantity.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-10-15 17:32:58 +02:00
Bert Vermeulen 96b3b3d568 sr: add support for conductance measurements in Siemens 2012-09-25 19:53:05 +02:00
Bert Vermeulen aa839a5c4f sr: add support for pulse width measurements 2012-09-25 19:53:05 +02:00
Bert Vermeulen e9022f596d sr: make struct drv_context global 2012-09-11 21:27:26 +02:00
Bert Vermeulen f45b759014 sr: add recv/cleanup calls to output module API
The new output module callbacks will be init, recv and cleanup. The
existing data  and event callbacks still work, but will be phased out
as existing modules get converted.

The recv() callback gets a copy of every packet on the session bus,
and thus has visibility of all metadata, allowing it to properly
output any acquired data.
2012-09-08 02:31:08 +02:00
Bert Vermeulen 02e864d0bf sr: added mqflags field to sr_datafeed_analog 2012-08-18 16:23:08 +02:00
Bert Vermeulen edb000eb2f sr: add fahrenheit and boolean MQ units 2012-08-18 16:23:08 +02:00
Bert Vermeulen 64591be2f2 sr: add continuity MQ 2012-08-18 16:23:08 +02:00
Bert Vermeulen 811deee4af sr/drivers: add API calls sr_dev_inst_list() and sr_dev_inst_clear()
These are used to list the device instances currently known to the driver,
and clear that list.

Drivers that don't necessarily clear their list of instances on every scan,
such as genericdmm, need to provide these to the frontend to keep instance
management sane.
2012-08-06 00:59:25 +02:00
Bert Vermeulen 014359e329 sr/drivers: obsolete SR_HWCAP_PROBECONFIG
Since probes now live in a struct sr_dev_inst owned by the driver, it
already knows about them. Instead of a frontend telling the driver to
configure probes, all driver now do this just before starting acquisition.
2012-08-05 18:56:12 +02:00
Bert Vermeulen 2cbeb2b7fb sr: drivers should remove their sources from the session when done 2012-08-03 11:29:01 +02:00
Bert Vermeulen c259726a16 sr: driver struct gets a more generic *priv instead of GSList *instances
It's up to the driver to keep its GSList of struct sr_dev_inst * in there.
Anything else the driver wants to keep driver-global should also go in
there, such as libusb_context.
2012-08-03 11:29:00 +02:00
Bert Vermeulen 6f57fd9694 sr: remove obsolete SR_DI_INST 2012-08-03 11:29:00 +02:00
Bert Vermeulen 87ca93c504 sr/drivers: add proper probe list to instances of all drivers 2012-08-03 11:29:00 +02:00
Bert Vermeulen 47a98b6e2c sr: remove obsolete driver API call dev_info_get() 2012-08-03 11:28:59 +02:00
Bert Vermeulen 9e90dcba9c sr/drivers: remove driver API call dev_status_get()
It's obsolete: no frontend ever used it, and neither did libsigrok.
The sdi->status field is only used internally by some drivers, and
should probably be moved to the driver-specific context structs.
2012-08-03 11:27:31 +02:00
Bert Vermeulen 3ffb6964a1 sr/drivers: change driver dev_acquisition_start/_stop calls to use sdi 2012-08-03 11:27:31 +02:00
Bert Vermeulen 25a0f108f4 sr/drivers: change driver dev_open/dev_close calls to use sdi 2012-08-03 11:27:31 +02:00
Bert Vermeulen 5c3c1241d2 sr: change input/output modules to use struct sr_dev_inst * 2012-08-03 11:27:31 +02:00
Bert Vermeulen 6f4b1868e8 sr/drivers: use sr_dev_inst instead of device index for dev_config_set()
All driver API calls using device index as a parameter will instead use a
const struct sr_dev_inst.
2012-08-03 10:27:39 +02:00
Bert Vermeulen be34a1c746 sr: deprecate driver API call hwcap_get_all()
This is now handled with a call to info_get(SR_DI_HWCAPS). This brings
it in line with the new driver opts: info_get(SR_DI_HWOPTS).
2012-08-03 10:27:37 +02:00
Bert Vermeulen f92f4eab23 sr: add new driver API call info_get()
This will replace dev_info_get(), and will be used to fetch both
driver and device instance-specific information. The sr_dev_inst
argument is NULL in case of a driver info fetch. In line with the
libsigrok wrapper, this function returns an error code, using the
supplied void ** to return the requested data.
2012-08-03 10:27:37 +02:00
Bert Vermeulen 9e41fdba40 sr: add driver field to sr_dev_inst, to bring it on a par with sr_dev. 2012-08-03 10:27:37 +02:00
Bert Vermeulen 8bfdc8c4a5 sr: split driver options into separate list 2012-08-03 10:27:37 +02:00
Bert Vermeulen dd34b8d3c4 sr: add GSList of instances to the driver struct
This gives the driver a private place to keep its instances, without
polluting the global namespace.
2012-08-03 10:27:37 +02:00
Bert Vermeulen 47211d65b4 sr: add probe list to device instance
There is no point in libsigrok copying probe lists around. The driver now
builds a list of probes according to the model device it found, and will
make that available to a frontend. The frontend thus has a reference of
what the driver has, including default names, and doesn't need libsigrok
to provide an unnecessary level of abstraction.

The sr_probe_new() library-private function is a helper for drivers.
2012-08-03 10:27:37 +02:00
Bert Vermeulen 80bf042635 sr: split driver init into init() and scan()
init() now only does whatever administrative stuff it needs (typically not
much), and returns an error code.

scan() can be called multiple times during the life of an application, and
returns a GSList of struct sr_dev_inst * of devices found during that scan.
The instances are a copy of the ones stored in the driver's own instance
list, to be freed by the caller with g_slist_free() only.

The scan() call can be passed a GSList of struct sr_hwopt *, to direct the
scanning.
2012-08-03 10:27:37 +02:00