Commit Graph

190 Commits

Author SHA1 Message Date
Bert Vermeulen f0de2dd0fa Remove SR_CONF_MAX_UNCOMPRESSED_SAMPLES again.
The maximum sample size that can be set on a device is now published
by sr_config_list(SR_CONF_LIMIT_SAMPLES). This returns a tuple of
uint64_t representing minimum and maximum number of samples.
2014-01-19 17:18:59 +01:00
Aurelien Jacobs d87c1766f2 change a bunch of functions from SR_PRIV to static
None of those functions are called across compilation units.
2014-01-14 23:39:23 +01:00
Bert Vermeulen f649fe8f8e zeroplus-logic-cube: List all keys in device options. 2014-01-09 16:26:58 +01:00
Bert Vermeulen 67055d4c18 zeroplus-logic-cube: Publish SR_CONF_MAX_UNCOMPRESSED_SAMPLES. 2014-01-09 14:30:20 +01:00
Russ Dill 7142d6b9d5 zeroplus: Add voltage threshold support
It doesn't currently mesh well with libsigrok, but at least the support is there.
2014-01-03 15:09:11 +01:00
Russ Dill 42ceb77726 zeroplus: Major rework of sample buffer processing
The sample buffer is a still a bit of a mystery, but this should help.
The variables in play:

triggerbar/ramsize_trigger - These two variables added together indicate
how many samples we want captured. ramsize_trigger - triggerbar
indicades how many samples must be captured. The ratio between the two
is determined by capture ratio.

memory_size - This indicates the number of samples in the circular
capture buffer. stop_address, now_address, and trigger_address are
pointers within the zeroplus that wrap based on this size.

now_address - The address that the zeroplus was about to write to when
it finished capturing, and now the address that will be read from when
reads are done from the capture buffer

stop_address - The address that the zeroplus last wrote to when it
completed capture.

trigger_address - The sample address for which the trigger occured.

status - This one is a bit tricky. Some testing has shown that if the
zeroplus has captured memory_size or less samples, the STATUS_READY bit
is set. For all captures generated with more samples than this,
STATUS_READY was cleared. However, boundary conditions are difficult to
test and values such as, memory_size + 1 have not been tested. We use
this to determine if the capture has wrapped through the sample buffer.

More testing is required, but this improves behavior in a number of
cases, specifically capturing sample amounts that are not a power of 2
of the sample buffer size. Before, random data was passed to libsigrok.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:11 +01:00
Russ Dill a864a05b25 zeroplus: Add getters for memory configuration
This is needed at capture readback time to determine how many samples to read
in.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:10 +01:00
Russ Dill aad031928e zeroplus: Modify analyzer_read_start to just prep for bulk reads.
Let the capture loop manage which samples are thrown out rather
than throwing out two here.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:10 +01:00
Russ Dill bc059b42a2 zeroplus: Always set DONT_CARE_TRIGGERBAR to 1
Experimentation with the windows driver has found no situation where
this is set to anything other than 1. The zerominus software also never
sets this to anything other than one. Revert the code change made in
0ab0cb942f.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:10 +01:00
Russ Dill 4c1433d172 zeroplus: Ignore capture ratio if there is no trigger
If there is no trigger, don't try to capture anything before it. There
won't be any because we trigger immediately.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:10 +01:00
Russ Dill 05f853b5c3 zeroplus: Add missing config_get for SR_CONF_CAPTURE_RATIO
Without this, latest pulseview gets an assert and dies.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:10 +01:00
Russ Dill 5db0c668fa zeroplus: Support all 32 channels of 32 channel models
This will need some additional work when support is added for compression
modes since group D is disabled for RLE compression and C and D are
disabled for "double" compression.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
2014-01-03 15:09:10 +01:00
Martin Ling 3544f848e0 Centralise duplicated logging helper defines. 2013-12-27 12:54:05 +01:00
Russ Dill b9a5614dbf zeroplus: Rework triggerbar/trigger address logic
This reworks the triggerbar/trigger address logic to match the values sent
by the windows app for all models (The zerominus tool was used to reprogram
the USB device ID on a single device). Additionally, the DONT_CARE_TRIGGERBAR
register is always set by the windows app and does not seem to indicate that
these registers are "don't care"'s.
2013-12-05 01:09:51 +01:00
Russ Dill c38e64c742 zeroplus: Clip sampling sizes larger that our sample memory
Otherwise, we'll return a non-sensical result for our memory_size
enumeration.
2013-12-05 01:09:51 +01:00
Russ Dill 3e43da1f70 zeroplus: Add support for additional memory sizes
The zeroplus can have up to a 8M SRAM. Avoid some extensive if/else
blocks by noting that all sizes except the first are related by their power
of 2.
2013-12-05 01:09:51 +01:00
Russ Dill e93fb98b8a zeroplus: Rename max_memory_size to max_sample_depth
This private variable is measured in samples, not bytes. Avoid confusion
by renaming it.
2013-12-05 01:09:51 +01:00
Russ Dill d20844e28b zeroplus: Just wait until not busy on data capture
While captures using a trigger do set the STATUS_READY bit, immediate
captures do not set the STATUS_READY bit, they just clear the STATUS_BUSY
bit. This was confirmed with packet captures using the "official" driver/app.
2013-12-05 00:41:22 +01:00
Russ Dill 60cc6f8579 zeroplus: Add usb IDs for 32 channel models, but only use 16 channels
The code needs some work to support 32 channels. Until then, support
the 32 channel models, but only allow the use of 16 channels.
2013-12-05 00:41:22 +01:00
Martin Ling 8f996b8948 probe_groups: API changes required to implement probe groups. 2013-11-08 01:03:16 +01:00
Uwe Hermann 3b412e3a30 s/clear_instances/dev_clear/.
Consistently use the same name for the dev_clear() API callback
everywhere.
2013-06-02 16:56:41 +02:00
Uwe Hermann f6beaac55c std: Drop hw_ from function names.
The per-driver API calls no longer have a hw_ prefix (e.g. hw_init()
became init() and so on), so drop the 'hw_' from the std versions
for those API callbacks too.
2013-06-02 16:46:18 +02:00
Uwe Hermann 6078d2c996 Use consistent API callback function names.
This now matches what the 'new-driver' tool generates.
2013-05-10 20:01:37 +02:00
Uwe Hermann 8111446ae0 zeroplus: Properly set inst_type to SR_INST_USB. 2013-05-10 19:16:25 +02:00
Uwe Hermann d6445cb0da zeroplus: Use std_dev_clear(). 2013-05-10 19:06:47 +02:00
Uwe Hermann 2a052cc4d6 Use consistent naming for internal libtool helper libs.
This now also matches what the 'new-driver' tool generates.
2013-05-10 17:44:01 +02:00
Uwe Hermann 9e165e742f Use consistent HW_ name prefixes everywhere.
Older drivers used LA_* previously, we now use HW_* everywhere though.
2013-05-10 17:18:42 +02:00
Uwe Hermann 29a27196a1 s/DRIVER_LOG_DOMAIN/LOG_PREFIX/.
This is more correct anyway, and also a bit shorter and more readable.
2013-05-03 21:59:32 +02:00
Bert Vermeulen 50c604f50b Don't automatically clear known instances from USB drivers on scan
This invalidates previously returned sr_dev_inst pointers, which a
frontend may be holding. It's the frontend's responsibility to clear
the list of instances a driver keeps track of by calling

	sr_dev_clear(driver);

if it wants a completely new scan done.
2013-04-27 18:27:32 +02:00
Bert Vermeulen e73ffd4238 Enforce open device before config_set()/dev_acquisition_start() 2013-04-24 22:03:50 +02:00
Uwe Hermann 50985c2019 GPL headers: Use correct project name. 2013-04-23 22:24:30 +02:00
Bert Vermeulen 609bfd753c zeroplus-logic-cube: Use sr_dev_inst to store connection handle 2013-04-22 15:00:04 +02:00
Bert Vermeulen bd6fbf628a drivers: return SR_ERR_NA on unsupported config key
Fixes bug 89.
2013-04-16 11:00:55 +02:00
Jan Luebbe 9e5670d0ab zeroplus-logic-cube: add USB ID for LAP-16128U 2013-04-14 17:06:57 +02:00
Bert Vermeulen 3316e149d0 zeroplus-logic-cube: fix samplerate setting 2013-04-11 18:32:07 +02:00
Bert Vermeulen 8386096f01 zeroplus-logic-cube: Adjust to GVariant-based sr_config_* functions 2013-04-11 18:32:07 +02:00
Uwe Hermann 17548571cc zeroplus: Only report supported samplerates.
The currently supported model LAP-C(16032) doesn't support the
samplerates 150MHz and 200MHz which some of the other models have.

Thus, do not report these samplerates to the frontends. E.g. sigrok-cli
should not show them via --show and GUIs should not list them in their
"Samplerates" drop-down.
2013-02-08 23:19:50 +01:00
Uwe Hermann e495a676eb zeroplus: Cosmetics, small fixes, drop unneeded stuff. 2013-02-08 23:19:50 +01:00
Uwe Hermann 58c5f2ed17 zeroplus: Split into api.c and protocol.c. 2013-02-08 21:53:50 +01:00
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 961009b0c4 hw_dev_close(): Move common checks to wrapper.
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.
2013-02-05 18:46:33 +01:00
Uwe Hermann 0e94d524c1 Shorten/simplify hw_dev_list() implementations. 2013-02-05 18:27:05 +01:00
Uwe Hermann 6d1161142d zeroplus: Use message logging helpers. 2013-02-01 00:24:40 +01:00
Uwe Hermann d3b38ad389 Drivers: Explicitly list sr_samplerates fields.
This makes it a bit easier to understand which value means what, just
from looking at the driver code.
2013-01-29 12:56:02 +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 c0eea11c45 sr_driver_init(): 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, change one SR_ERR to the more correct SR_ERR_MALLOC, and assign
sr_ctx in the rigol-ds1xx2's hw_init() function, like all the other
drivers do.
2013-01-29 12:56:02 +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 c50277a6ec Deprecate SR_DI_TRIGGER_TYPES.
This is replaced by SR_CONF_TRIGGER_TYPE.
2013-01-25 11:52:27 +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