Commit Graph

124 Commits

Author SHA1 Message Date
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 a56f148094 sr: new API call sr_dev_config_set()
This is a wrapper around the driver dev_config_set() call, to avoid
frontends needing visibility into drivers.
2012-08-05 15:53:04 +02:00
Bert Vermeulen d3cff734e5 sr: properly free probes when freeing their device instance 2012-08-04 12:03:05 +02:00
Bert Vermeulen e8d3d6c843 sr: properly initialize and check on device instance driver field 2012-08-03 11:29:00 +02:00
Bert Vermeulen 48a486cd3e sr: code organization cleanup
Device-specific functions (public and private) go in device.c,
more general driver-related code in hwdriver.c
2012-08-03 11:29:00 +02:00
Bert Vermeulen a5f2e70712 sr: comments/docs 2012-08-03 11:28:59 +02:00
Bert Vermeulen 37e8b4c4f7 sr: change sr_dev_probe_name_set() to use sdi 2012-08-03 11:28:59 +02:00
Bert Vermeulen a10ddf9ba0 sr: remove dead/obsolete code 2012-08-03 11:28:59 +02:00
Bert Vermeulen c7ee3ddb94 sr: cosmetic changes 2012-08-03 11:27:31 +02:00
Bert Vermeulen a5b35a167a sr: convert sr_dev_has_hwcap() to use sdi 2012-08-03 11:27:31 +02:00
Bert Vermeulen be5bf44d28 sr: add sr_dev_probe_enable(), abstraction wrapper around device probes 2012-08-03 11:27:31 +02:00
Bert Vermeulen 58453e5876 sr: change sr_dev_trigger_set() to use sdi 2012-08-03 11:27:31 +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 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
Joel Holdsworth 915f7cc87a sr: Made hwcap const 2012-05-31 19:51:09 +01:00
Uwe Hermann bf978d3553 sr: sr_parse_triggerstring docs/improvements.
Also fix smaller typos and cosmetics.
2012-04-10 23:25:56 +02:00
Uwe Hermann 01c3e9dbd5 sr: s/_clear/_remove_all/ for consistency. 2012-03-31 11:33:43 +02:00
Uwe Hermann 8ec95d2282 sr/srd: Small fixes, constifications, doc updates. 2012-03-21 23:20:09 +01:00
Uwe Hermann d6eb0c333c sr: Fix handling of virtual devices.
I.e., handling of sessions which use input from files (not from actual
logic analyzer hardware).
2012-03-18 12:57:34 +01:00
Uwe Hermann 0abee5076f sr: Fix some TODOs, improve comments/docs. 2012-03-04 15:10:12 +01:00
Uwe Hermann cfe064d8e7 sr/cli/gtk/qt: s/hw/driver/ in some places. 2012-03-01 23:49:25 +01:00
Uwe Hermann 2f8cf27409 sr: s/sr_dev_probe_name/sr_dev_probe_name_set/. 2012-03-01 23:49:24 +01:00
Uwe Hermann c09f0b578c sr/cli/gtk/qt/: s/plugin/driver/. 2012-02-28 23:52:30 +01:00
Uwe Hermann 050e9219d6 sr: No need for dynamic hardware driver registration.
We don't need or allow run-time registration of hardware
drivers/plugins, they're added at compile-time.
2012-02-23 00:28:20 +01:00
Uwe Hermann 5097b0d091 sr/cli/gtk/qt: s/get_dev_info/dev_info_get/. 2012-02-18 11:41:21 +01:00
Uwe Hermann ffedd0bf5d sr/cli/gtk: s/capability/hwcap/. 2012-02-18 00:17:18 +01:00
Uwe Hermann bb7ef79377 sr/cli/gtk/qt: s/device/dev/ in many places.
Also, a few s/instance/inst/ occurences.
2012-02-17 23:47:00 +01:00
Uwe Hermann 44dae53925 sr: Random cosmetics, fix/amend Doxygen comments. 2012-02-17 22:40:51 +01:00
Bert Vermeulen 93a04e3be9 sr: rename all sr_hwplugin(s)_* functions to sr_hw_* 2012-02-15 03:18:48 +01:00
Bert Vermeulen da1466d677 sr: rename more functions to sr_thing_action format
Also improved the interface to find capabilities in a hardware plugin.
2012-02-14 00:23:51 +01:00
Bert Vermeulen c532476aa7 sr: rename hwplugin functions to sr_thing_action format 2012-02-13 19:56:24 +01:00
Bert Vermeulen c73d2ea421 sr: adjust copyright year 2012-02-13 14:31:51 +01:00
Bert Vermeulen 031685005b sr: rename all sr_device_* functions to sr_dev_* 2012-02-13 14:00:47 +01:00
Bert Vermeulen a1645fcd81 sr: more API cleanup and documentation 2012-02-13 03:36:32 +01:00
Bert Vermeulen 6cfa474a80 sr: rm unused sr_device_clear() and sr_device_probe_clear() 2012-02-12 22:36:19 +01:00
Uwe Hermann 1a081ca67d sr: Mark API functions with SR_API/SR_PRIV.
Use SR_API to mark public API symbols, and SR_PRIV for private symbols.

Variables and functions marked 'static' are private already and don't
need SR_PRIV. However, functions which are not static (because they need
to be used in other libsigrok-internal files) but are also not meant to
be part of the public libsigrok API, must use SR_PRIV.

This uses the 'visibility' feature of gcc (requires gcc >= 4.0).

Details: http://gcc.gnu.org/wiki/Visibility
2012-02-02 00:03:17 +01:00
Anatoly Sokolov fd9836bfab Add sr_device_get_info 2012-01-30 13:56:38 +01:00
Uwe Hermann 66410a8617 sr: g_free()/g_string_free() can handle NULL input. 2012-01-19 00:32:02 +01:00
Uwe Hermann c37d2b1ba1 probe names: Fix cosmetics, add docs, fix off-by-one. 2011-12-29 19:50:14 +01:00
Kristoffer Sjöberg 464d12c72a Move the probe naming to the creator of the device, and let each driver name its own probes. 2011-12-29 17:04:31 +01:00
Uwe Hermann b7f09cf86d libsigrok: Fix #includes.
In the lib, we should only #include "sigrok.h" or "sigrok-internal.h",
but not the (possibly installed and thus different/older versions) via
<sigrok.h> or <sigrok-internal.h>.

Frontends should of course use <sigrok.h> and <sigrok-internal.h>.
2011-12-28 23:07:08 +01:00
Uwe Hermann a0ecd83bc6 Make more variables/functions static and non-global.
The 'GSList *devices' from device.c was actually really global (i.e.,
listed in sigrok.h), which is now fixed.
2011-12-28 22:55:21 +01:00
Uwe Hermann c5d660ae24 Drop unused 'global' struct/variable.
The libs shouldn't have any (externally visible) globals anyway.
2011-12-28 21:38:56 +01:00
Uwe Hermann 08d4cc1d14 device: Make some parameters const. 2011-12-28 21:34:37 +01:00
Uwe Hermann 0e3b143994 device: Change some functions to return int.
The callers of these functions are yet to be changed so that they
actually check the return values and handle errors appropriately.
2011-12-28 17:26:19 +01:00
Uwe Hermann 94799bc4dc device: Add Doxygen comments, improve error handling.
- Add Doxygen comments for all functions (some TODOs remain).

 - Check return code of more functions, handle invalid input.
2011-12-28 16:55:24 +01:00
Bert Vermeulen 8722c31e26 better cleanup of device/plugin resources 2011-06-05 01:51:49 +02:00
Uwe Hermann 697785d1ae libsigrok: closedev() now has a return code.
This is useful to allow frontends to react upon close failures in a
way they see fit (e.g. a popup in the GUI, or error message in the CLI).
They can also still ignore the error if they want, of course.
2011-05-05 13:06:14 +02:00
Uwe Hermann 86f5e3d826 libsigrok: Rename open/close to opendev/closedev. 2011-05-05 13:06:11 +02:00
Uwe Hermann f38bdf5678 Change left-over SIGROK_* to SR_*. 2011-04-26 23:57:16 +02:00
Uwe Hermann b53738baf7 Replace g_malloc{0,} with g_try_malloc{0,}.
The g_malloc()/g_malloc0() versions exit/segfault if not enough memory
is available, which is not a good thing in libsigrok.

Instead, we use the g_try_malloc()/g_try_malloc0() variants, which
return NULL if not enough memory is available, so that the caller can
handle the error properly.
2011-04-16 18:08:15 +02:00
Uwe Hermann b08024a836 libsigrok: Introduce sr_dbg/sr_info/sr_warn/sr_err.
We should use these (internal) functions in libsigrok exclusively from
now on, i.e. no more use of glib's g_debug() etc.

These functions are only for libsigrok, the frontends use whatever
logging mechanism is suitable there.
2011-04-14 10:11:08 +02:00
Bert Vermeulen f437ea3fe2 small warning fix 2011-04-03 06:18:05 +02:00
Uwe Hermann 8225e92175 Constify a few more 'char *' parameters. 2011-02-20 21:16:23 +01:00
Uwe Hermann ee4b6342af Add sr_ prefix to list_hwplugins(). 2011-02-20 21:16:22 +01:00
Uwe Hermann 218557b85a Quickfix for a segfault with file input via -i.
Stuff like

  ./bin/sigrok-cli -i rnd.dd -a transitioncounter

would segfault (rnd.dd consists of random bytes) because device->plugin
was NULL and was being dereferenced.

Thanks Olivier Fauchon <olivier@aixmarseille.com> for reporting.
2011-02-13 11:27:52 +01:00
Uwe Hermann 03dbc020cd Rename probe_find() to sr_device_probe_find(). 2011-02-08 22:28:03 +01:00
Uwe Hermann 2bf4aca64a Add sr_ prefix for device related API functions. 2011-02-08 22:28:02 +01:00
Uwe Hermann 1afe89897c Add sr_ prefix for 'struct probe'. 2011-02-08 22:27:58 +01:00
Bert Vermeulen b8c2f85f56 session_driver: remove unneeded callbacks 2011-02-01 00:06:32 +01:00
Bert Vermeulen dd56a9320d fix device probe adding 2011-01-31 23:44:18 +01:00
Bert Vermeulen 7d65887435 implement session loading based on a virtual device driver 2011-01-31 22:34:14 +01:00
Uwe Hermann 5a2326a71b SR_ prefix for all public enums. 2011-01-30 18:32:59 +01:00
Uwe Hermann 5c2d46d1db Prefix device structs with sr_. 2011-01-30 18:32:58 +01:00
Uwe Hermann a00ba01228 Change all sigrok_ prefixes to sr_. 2011-01-30 18:32:55 +01:00
Bert Vermeulen e54bcdc5d1 cli: don't initialize and scan for hardware unless needed
If the -d <plugin> option is used, only initialize the specified plugin.
2011-01-24 02:49:14 +01:00
Bert Vermeulen 6ea7e23526 Revert "re-enable filter and datastore for DF_LOGIC"
This reverts commit 23da86dfc0a89c7ab951fea31a318a493830eb69.
2011-01-22 14:18:31 +01:00
Daniel Ribeiro 62eeeb171b re-enable filter and datastore for DF_LOGIC
This definitely isn't the proper fix, but it should allow DF_LOGIC
and DF_ANALOG to coexist.
2011-01-21 18:04:09 -02:00
Uwe Hermann 5e2ddeb098 Fix two more compiler warnings noticed on amd64. 2011-01-08 03:51:31 +01:00
Uwe Hermann 757b8c628a Cosmetics, whitespace, simplifications.
Reduce code nesting a bit, constify some strings.
2011-01-08 01:49:47 +01:00
Bert Vermeulen 873080cc03 allow devices without a plugin
this is needed to support file loading: we want a device struct
so we can enumerate probes from the file, but there is no plugin
since the data come in from a device.
2010-05-07 23:52:47 +02:00
Uwe Hermann 1b452b8510 libsigrok: Coding style fixes. 2010-04-15 20:07:16 +02:00
Uwe Hermann afc8e4deb6 Fix all warnings and re-enable -Wextra. 2010-04-09 22:18:46 +02:00
Uwe Hermann a1bb33afbd Start of code base layout restructuring. 2010-04-02 20:27:54 +02:00