Commit Graph

55 Commits

Author SHA1 Message Date
Bert Vermeulen c73d2ea421 sr: adjust copyright year 2012-02-13 14:31:51 +01:00
Uwe Hermann 133a37bfba Use g_try_malloc/g_free/g_strdup consistently.
Avoid plain malloc()/free() in sr/srd, especially in the API calls.
Also avoid g_malloc*() in favor of g_try_malloc*().

Use g_strdup() instead of strdup() so that we can use g_free()
consistently everywhere.

Exceptions: Stuff that is allocated via other libs (not using glib),
should also be properly free'd using the respective free-ing function
(instead of g_free()). Examples: Stuff allocated by libusb, libftdi, etc.

Also, use sr_err() instead of sr_warn() for actual errors. sr_warn() is
meant for non-fatal/uncritical warnings.
2012-02-11 22:34:16 +01:00
Uwe Hermann 5c64390e5a sr/cli/gtk: Remove analog left-overs from API.
This will come back in some form or another later, but for now
don't clutter the API with non-working stuff. Removing stuff from APIs
is not possible without breaking the API, adding stuff later is simpler.
2012-02-05 15:05:12 +01:00
Uwe Hermann ca070ed9a0 sr: Make more symbols private via static/SR_PRIV.
Additional zeroplus fixes:

 - Remove unneeded function prototypes from .h files.

 - Remove unused variables and/or use standard libusb #defines instead.

 - Remove unused GL_* error code #defines.
2012-02-02 21:46:10 +01:00
Uwe Hermann 185ae2c5c9 sr: zeroplus: Remove unused gl_open()/gl_close().
Merge the missing function calls into zeroplus.c's init functions.
2012-02-02 21:46:10 +01:00
Bert Vermeulen 0146970797 sr: remove unused time/duration fields from datafeed packets 2012-02-01 02:59:41 +01:00
Uwe Hermann 69890f7399 sr: Eliminate usb/serial instances from API.
The API should be generic and only provide sr_device_instance_new() and
friends, but not sr_usb_device_instance_new(), sr_serial_device_instance_new(),
or others for other device types we may have in the future. The
frontends shouldn't have to know or care about this implementation detail.

This also fixes the problem that parts of sigrok.h contained
'#ifdef HAVE_LIBUSB_1_0' and such, which is even less desirable for the API.

The usb/serial instance specifics are now private, and each driver that
needs them keeps a pointer in its driver-specific context.
2012-01-31 02:04:35 +01:00
Uwe Hermann c31e9ef49b sr: zp: Add missing <string.h> #include. 2012-01-31 01:54:08 +01:00
Uwe Hermann bf43ea2317 sr: zeroplus: Use device-specific context.
Make the zeroplus driver use a "struct zp" with per-device-instance
data (such as samplerate, trigger settings, and so on), like the other
drivers do.

Also, add a few more error checks.
2012-01-29 19:19:38 +01:00
Uwe Hermann 73017cf914 sr: zeroplus: Fix a segfault. 2012-01-28 23:29:28 +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 cb93f8a927 Other method to avoid "unused var" compiler warnings.
The '(void)varname' method is nicer than 'varname = varname' and also
prevents warnings when compiling sigrok with clang instead of gcc.
2011-11-24 22:57:48 +01:00
Uwe Hermann 6bb5c5fadf Consistently use __func__ instead of __FUNCTION__.
The __func__ form is standardized and more portable.
2011-11-17 23:47:45 +01:00
Bert Vermeulen 9c939c5132 use new datafeed packet format 2011-06-19 14:28:50 +02:00
Uwe Hermann 340cfac0f0 log messages: Use device name, not vendor name.
There can be multiple devices from the same vendor, obviously.
2011-05-05 13:06:14 +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 e519ba8645 Hardware drivers: Use names for struct entries. 2011-04-19 00:18:06 +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
Uwe Hermann c91404191e Add SR_HZ macro for consistency. 2011-03-03 20:24:24 +01:00
Uwe Hermann 59df0c77e2 Add SR_ prefix to the KHZ/MHZ/GHZ macros. 2011-03-03 20:24:24 +01:00
Uwe Hermann 4cea9eb20d Make ARRAY_SIZE/ARRAY_AND_SIZE private.
This is not libsigrok-specific and should not be part of our API.
2011-02-20 21:16:26 +01:00
Uwe Hermann 54ac5277c5 Constify some more 'char *' parameters. 2011-02-20 21:16:26 +01:00
Uwe Hermann 29cbfeaf5c Mark some private stuff 'static'. 2011-02-20 21:16:20 +01:00
Uwe Hermann 60679b18e6 Add sr_ prefix to 'struct samplerates'. 2011-02-08 22:28:01 +01:00
Uwe Hermann 8a2efef2d5 Add sr_ prefix to session related API functions. 2011-02-08 22:28:00 +01:00
Uwe Hermann 1afe89897c Add sr_ prefix for 'struct probe'. 2011-02-08 22:27:58 +01:00
Uwe Hermann 22b0238344 Fix build when no libusb-LA is compiled.
Until now the build would break if the user doesn't enable at least one
of the libusb1.0-based LAs. I.e., you could not compile only OLS, or
only the demo driver.
2011-02-02 10:25:52 +01:00
Uwe Hermann 5a2326a71b SR_ prefix for all public enums. 2011-01-30 18:32:59 +01:00
Uwe Hermann 6c29007211 Prefixes for *_device_instance. 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 9f8274a544 Add a field for the full name of a device.
Also, show this long/full name in 'sigrok-cli -V'.
2011-01-30 18:32:58 +01:00
Uwe Hermann b9c735a275 Prefix datafeed structs with sr_. 2011-01-30 18:32:57 +01:00
Uwe Hermann d32d961d17 get_sr_device_instance() -> sr_get_device_instance(). 2011-01-30 18:32:56 +01:00
Uwe Hermann a00ba01228 Change all sigrok_ prefixes to sr_. 2011-01-30 18:32:55 +01:00
Uwe Hermann e46b8fb154 Change SIGROK_ prefix to SR_. 2011-01-30 18:32:53 +01:00
Uwe Hermann 17e1afcb81 Whitespace and consistency fixes.
Also, drop a <poll.h> #include. It's unused anyway, and breaks the build
on MinGW/Windows as there is no poll.h there.
2011-01-13 23:52:25 +01:00
Daniel Ribeiro c2616fb9fa update plugins and cli to use new DF_HEADER 2011-01-10 15:12:38 -02:00
Bert Vermeulen 4c046c6bcc change all DF_LOGIC* to a single DF_LOGIC type
The datafeed packet has a new field 'unitsize' to denote the number of
bytes per sample in the payload.
2011-01-09 06:32:38 +01:00
Uwe Hermann 5e2ddeb098 Fix two more compiler warnings noticed on amd64. 2011-01-08 03:51:31 +01:00
Bert Vermeulen a143e4e5dd don't push configuration to device until acq time 2010-08-12 04:57:09 +02:00
Bert Vermeulen 2458ea6514 use flexible sample limit specification (k/m/g)
HWCAP_LIMIT_SAMPLES is now passed to the driver as *uint64
2010-05-19 21:34:22 +02:00
Uwe Hermann 9a5c6dcf49 Factor out opendev2/opendev3. 2010-05-18 00:05:10 +02:00
Uwe Hermann 9a4988343f Oops, bugfixes. 2010-04-15 23:24:44 +02:00
Uwe Hermann 408e719989 Refactoring and code simplifications. 2010-04-15 23:21:30 +02:00
Uwe Hermann fed16f06e2 Saleae/Zeroplus: Coding style fixes. 2010-04-15 22:59:43 +02:00
Uwe Hermann fdd20b5239 Add ARRAY_SIZE helper. 2010-04-13 00:34:20 +02:00