Commit Graph

79 Commits

Author SHA1 Message Date
Uwe Hermann 4afdfd4628 Add and use std_session_send_df_header().
This is a small helper function which sends the SR_DF_HEADER packet that
drivers usually emit in their hw_dev_acquisition_start() API callback.
It simplifies and shortens the hw_dev_acquisition_start() functions
quite a bit.

It also simplifies the input modules which send an SR_DF_HEADER packet, too.

This patch also automatically removes some unneeded malloc/free in some
drivers for the 'packet' and 'header' structs used for SR_DF_HEADER.
2013-02-07 10:46:28 +01:00
Uwe Hermann 0e94d524c1 Shorten/simplify hw_dev_list() implementations. 2013-02-05 18:27:05 +01:00
Uwe Hermann 063e7aef6d Factor out common hw_init() driver code.
Most drivers do pretty much the same things in their hw_init()
right now, so factor out that code to std_hw_init() in std.c.
2013-01-29 12:56:02 +01:00
Uwe Hermann 4b97c74e0b sr_driver_scan(): Improve checks.
Check the relevant arguments for != NULL before calling the actual
driver-specific function, so that the driver can safely assume those
arguments are non-NULL. This removes the need to duplicate these
checks in every driver.

Also, do some minor whitespace and consistency improvements.
2013-01-29 12:56:02 +01:00
Uwe Hermann cbc6f3b253 hantek-dso: Use message logging helpers. 2013-01-29 12:56:02 +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 9a6517d14b Deprecate SR_DI_HWCAPS.
This is replaced by SR_CONF_DEVICE_OPTIONS.
2013-01-25 15:01:49 +01:00
Bert Vermeulen 328bafabd4 Deprecate SR_DI_TRIGGER_SOURCES.
This is replaced by SR_CONF_TRIGGER_SOURCE.
2013-01-25 11:25:32 +01:00
Bert Vermeulen 41f5bd09b0 Deprecate SR_DI_TIMEBASES.
This is replaced by SR_CONF_TIMEBASE.
2013-01-25 11:22:20 +01:00
Bert Vermeulen 6e1fbcc41b Deprecate SR_DI_FILTERS.
This is replaced by SR_CONF_FILTER.
2013-01-25 11:19:12 +01:00
Bert Vermeulen e4f2b2adc1 Deprecate SR_DI_VDIVS.
This is replaced by SR_CONF_VDIV.
2013-01-25 11:13:49 +01:00
Bert Vermeulen 2a7b113d13 Deprecate SR_DI_COUPLING.
This is replaced by SR_CONF_COUPLING.
2013-01-25 11:04:27 +01:00
Bert Vermeulen 6d1ceffa95 Deprecate SR_DI_BUFFERSIZES.
This is replaced by SR_CONF_BUFFERSIZE.
2013-01-25 10:58:37 +01:00
Bert Vermeulen 123e131383 Deprecate SR_DI_CUR_SAMPLERATE.
This is replaced by SR_CONF_SAMPLERATE.
2013-01-25 03:17:36 +01:00
Bert Vermeulen a1c743fc51 drivers: implement config_list() 2013-01-25 02:37:26 +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
Bert Vermeulen 69e19dd769 Always interleave analog data with all enabled probes.
The new "probes" field in sr_datafeed_analog contains a copy
of all enabled struct sr_probe.
2013-01-23 03:40:44 +01:00
Bert Vermeulen 1953564a96 Rename SR_HWOPT_* and SR_HWCAP_* to SR_CONF_* 2013-01-21 23:32:50 +01:00
Bert Vermeulen 1987b8d63e drivers: use new sr_config struct
Sending an SR_DF_META packet at the start of every stream is not
mandatory; the frontend should ask for what it needs, and any extra
information the driver wants to send will come in due time.
2013-01-21 23:32:49 +01:00
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
Uwe Hermann 7869340103 Shorten probe_names[] arrays everywhere.
Also, NULL-terminate all of them.
2012-12-26 00:16:07 +01:00
Uwe Hermann a873c5940c Consistently use 'di' as variable name.
Use 'di' consistently in all drivers as the name for a local, static
pointer to the respective driver's 'struct sr_dev_driver'.
2012-12-18 00:52:39 +01:00
Peter Stuge 1740429d70 hardware: A few further USB error message fixups 2012-12-05 01:34:15 +01:00
Peter Stuge d4928d7102 hardware: Call libusb_error_name() in all USB-related error messages 2012-12-05 01:14:44 +01:00
Peter Stuge d4abb463a7 hardware: Make USB drivers use the libusb_context in struct sr_context 2012-12-03 12:07:40 +01:00
Peter Stuge 1ebe4b4e69 hw_init(): Save struct sr_context * parameter in struct drv_context 2012-12-03 12:07:40 +01:00
Peter Stuge 34f06b903e Add a struct sr_context * parameter to hw_init() 2012-12-03 12:07:40 +01:00
Uwe Hermann e98b7f1be0 hantek-dso: Use message logging helpers. 2012-11-10 19:42:37 +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
Uwe Hermann 886a52b6fb Return SR_ERR_MALLOC upon allocation errors.
Add some TODOs.
2012-10-30 20:25:54 +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
Bert Vermeulen e9022f596d sr: make struct drv_context global 2012-09-11 21:27:26 +02:00
Bert Vermeulen 19b0cce312 hantek-dso: use default libusb context 2012-09-11 21:16:16 +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 a3508e33f9 hantek-dso: remove sources from session when done 2012-08-03 11:29:01 +02:00
Bert Vermeulen 269971ddce hantek-dso: use driver-private storage for instances and 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 b35c829306 sr/drivers: fix off-by-one if frontend-initiated probe configuration 2012-08-03 11:29:00 +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 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 2ce9f04629 hantek-dso: don't use deprecated hwcap_get_all() driver API call 2012-08-03 10:27:39 +02:00
Bert Vermeulen b0c8d7ac7f hantek-dso: scan/info_get fixes 2012-08-03 10:27:39 +02:00
Bert Vermeulen 0b79bcbb9d hantek-dso: use new driver info_get() API call 2012-08-03 10:27:38 +02:00
Bert Vermeulen 39cfdd75f9 hantek-dso: use new scan API 2012-08-03 10:27:38 +02:00
Bert Vermeulen f8c617cf4c hantek-dso: instance list fix 2012-08-03 10:27:38 +02:00
Bert Vermeulen 982947f7a2 hantek-dso: use driver struct-based device instance list 2012-08-03 10:27:38 +02:00