Commit Graph

46 Commits

Author SHA1 Message Date
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
Bert Vermeulen b159add3d9 sr: move SR_HWOPT into its own enum, and create struct sr_hwopt
SR_HWOPT_* entries are driver options, not device instance parameters, so
they will never be mixed together.

Also, driver options are always passed in a GSList, where the data field
is a struct sr_hwopt.
2012-08-03 10:27:37 +02:00
Bert Vermeulen 61136ea603 sr: add new driver API call: scan()
This changes the semantics of the init() call as well. That now only
initializes the driver -- an administrative affair, no hardware gets
touched during this call. It returns a standard SR_OK or SR_ERR* code.

The scan() call does a discovery run for devices it knows, and returns
the number found. It can be called at any time.
2012-08-03 10:27:36 +02:00
Bert Vermeulen 40dda2c3a5 sr: remove unused argument from hardware driver function init()
It was actually used in one way: the session file loaded abused it for
passing in the filename -- something it definitely wasn't intended for.
This now uses the proper way to pass arguments to a driver: the new
SR_HWCAP_SESSIONFILE.

The OLS driver could also use it as an indication of the serial port to
use instead of actively probing all serial ports on the system, but there
wasn't any frontend code that passed in such a parameter, making it
entirely useless. That will soon be handled differently with the new
scan() API call, regardless.
2012-08-03 10:27:36 +02:00
Bert Vermeulen 3dafb92bde sr: fix struct sr_input for parameter passing 2012-07-29 02:16:17 +02:00
Lars-Peter Clausen b7e941113f sr: session: Moves sources to session struct
The sources really belong to the session, so move them into the session struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2012-07-10 20:14:06 +02:00
Bert Vermeulen 45c59c8bdd sr: moved sigrok.h so libsigrok/libsigrok.h
All frontends will have to include <libsigrok/libsigrok.h> from now on.
This header includes proto.h and version.h, both installed from the
distribution into $INCLUDE/libsigrok/ as well.

The only dynamically changed header is now version.h, which has both
libsigrok and libtool compile-time versions in it.
2012-07-05 01:17:28 +02:00
Renamed from sigrok.h.in (Browse further)