Commit Graph

35 Commits

Author SHA1 Message Date
Uwe Hermann 218e629fa4 sr_init(): Sanity-check input/output modules. 2013-03-10 18:27:19 +01:00
Uwe Hermann 6fab7b8f53 Driver struct cleanups.
- Explicitly list .config_get in all drivers for consistency, and set it
   to NULL if unused (whether or not a driver implements it is optional).

 - List all 'struct sr_dev_driver' entries in the same order in all drivers.

 - Move the check whether .config_set/.config_list exist (i.e., are non-NULL)
   into sanity_check_all_drivers().
2013-02-07 10:58:35 +01:00
Bert Vermeulen 6a4710fac2 drivers: Trim unused config_get() calls
None of the driver config_get/set/list calls are required.
2013-01-25 16:05:48 +01:00
Bert Vermeulen 035a1078fd drivers: rename and reorganize config get/set
The driver API calls info_get() and dev_config_set() have been renamed
to config_get() and config_set(), respectively.
2013-01-24 19:19:09 +01:00
Peter Stuge 63c07e48c6 backend.c: Return a sigrok error in sr_init() on libusb_init() errors 2012-12-05 01:34:15 +01:00
Peter Stuge 123d97b177 backend.c: Fix memory leak in sr_init() error path
Commit 785b9ff290 added libusb init into
sr_init() which can generate an error. In this case, the already
allocated struct sr_context would have leaked.
2012-12-05 01:34:15 +01:00
Uwe Hermann 55a6daf59f sr_init(): Add driver sanity checks.
After sr_init() has successfully run, we can be sure that all drivers
define all the API calls, so we don't have to do these checks later
in the individual API functions / wrappers.

If there are one or more drivers with missing API functions (or driver
name / longname, and so on), sr_init() will fail. This helps catch this
kind of developer error early on.
2012-12-02 17:14:45 +01:00
Uwe Hermann 545f978639 config.h usage cleanups.
- Drop config.h #include from files that don't actually use any of
   its contents (at the moment).

 - Add comment for those that do need it.
2012-10-24 00:41:21 +02:00
Uwe Hermann afe2f28e65 Doxygen: Explain init/shutdown, add small example. 2012-10-22 11:56:19 +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 f21193fa03 Doxygen: Move error handling stuff to error.c.
Also, add an overview mini-section to the main page instead.
2012-10-22 11:56:18 +02:00
Uwe Hermann 7b870c38e3 Doxygen: Initial groups and topic short descriptions. 2012-10-22 11:56:18 +02:00
Uwe Hermann 5b30cca719 Doxygen: Add initial main page documentation section. 2012-10-22 11:56:17 +02:00
Uwe Hermann 8e2d43cc97 backend.c: Revert accidentally committed test code. 2012-10-22 10:17:38 +02:00
Uwe Hermann c46762a285 sr_init/sr_exit: Improve docs, add error checks. 2012-10-21 22:40:43 +02:00
Peter Stuge 785b9ff290 Add and init libusb_context * in struct sr_context when using libusb-1.0
This allows hardware drivers to use a common libusb_context.
2012-10-21 20:23:36 +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
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
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
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
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
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 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 cd009d5561 sr_exit(): Return int to be able to report errors. 2011-03-03 20:24:24 +01:00
Uwe Hermann 8233ff53ae Make load_hwplugins() private. 2011-02-20 21:16:22 +01:00
Uwe Hermann 2bf4aca64a Add sr_ prefix for device related API functions. 2011-02-08 22:28:02 +01:00
Uwe Hermann 01d9dc35ad Consistently use _exit prefix for functions. 2011-01-30 19:26:32 +01:00
Uwe Hermann a00ba01228 Change all sigrok_ prefixes to sr_. 2011-01-30 18:32:55 +01:00
Uwe Hermann 484760d1a8 Cosmetics. 2011-01-15 15:57:54 +01:00
Uwe Hermann 1b452b8510 libsigrok: Coding style fixes. 2010-04-15 20:07:16 +02:00
Uwe Hermann a1bb33afbd Start of code base layout restructuring. 2010-04-02 20:27:54 +02:00