ngscopeclient 0.1-dev+51fbda87c
ThunderScopeOscilloscope.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
37#ifndef ThunderScopeOscilloscope_h
38#define ThunderScopeOscilloscope_h
39
40#include "RemoteBridgeOscilloscope.h"
41#include "../xptools/HzClock.h"
42
49{
50public:
53
54 //not copyable or assignable
56 ThunderScopeOscilloscope& operator=(const ThunderScopeOscilloscope& rhs) =delete;
57
58public:
59
60 //Device information
61 virtual unsigned int GetInstrumentTypes() const override;
62 virtual void FlushConfigCache() override;
63
64 //Channel configuration
65 virtual std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) override;
66 virtual double GetChannelAttenuation(size_t i) override;
67 virtual void SetChannelAttenuation(size_t i, double atten) override;
68 virtual unsigned int GetChannelBandwidthLimit(size_t i) override;
69 virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override;
70 virtual std::vector<unsigned int> GetChannelBandwidthLimiters(size_t i) override;
71 virtual OscilloscopeChannel* GetExternalTrigger() override;
72 virtual bool CanEnableChannel(size_t i) override;
73 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
74 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override;
75
76 //Triggering
77 virtual Oscilloscope::TriggerMode PollTrigger() override;
78 virtual bool AcquireData() override;
79
80 // Captures
81 virtual void Start() override;
82 virtual void StartSingleTrigger() override;
83 virtual void ForceTrigger() override;
84
85 //Timebase
86 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() override;
87 virtual std::vector<uint64_t> GetSampleRatesInterleaved() override;
88 virtual std::set<InterleaveConflict> GetInterleaveConflicts() override;
89 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
90 virtual std::vector<uint64_t> GetSampleDepthsInterleaved() override;
91 virtual bool IsInterleaving() override;
92 virtual bool SetInterleaving(bool combine) override;
93
94protected:
96
97 std::string GetChannelColor(size_t i);
98
101
103 std::map<size_t, double> m_channelAttenuations;
104
107
110
113
116
119
122
124 std::vector<std::unique_ptr<AcceleratorBuffer<int16_t> > > m_analogRawWaveformBuffers;
125
127 std::shared_ptr<QueueHandle> m_queue;
128
130 std::unique_ptr<vk::raii::CommandPool> m_pool;
131
133 std::unique_ptr<vk::raii::CommandBuffer> m_cmdBuf;
134
136 std::unique_ptr<ComputePipeline> m_conversionPipeline;
137
140
142 std::vector<unsigned int> m_bandwidthLimits;
143
144public:
145
146 static std::string GetDriverNameInternal();
147 OSCILLOSCOPE_INITPROC(ThunderScopeOscilloscope);
148};
149
150#endif
A parameter to a filter.
Definition: FilterParameter.h:86
Clock that measures rate at which it is called; windowed average.
Definition: HzClock.h:52
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
TriggerMode
Definition: Oscilloscope.h:411
An oscilloscope connected over a SDK-to-SCPI bridge that follows our pattern (i.e....
Definition: RemoteBridgeOscilloscope.h:40
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
Driver for talking to the TS.NET server controlling a ThunderScope.
Definition: ThunderScopeOscilloscope.h:49
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition: ThunderScopeOscilloscope.cpp:591
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: ThunderScopeOscilloscope.cpp:235
size_t m_analogChannelCount
Number of analog channels (always 4 at the moment)
Definition: ThunderScopeOscilloscope.h:100
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: ThunderScopeOscilloscope.cpp:230
HzClock m_receiveClock
Counter of average trigger rate.
Definition: ThunderScopeOscilloscope.h:121
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: ThunderScopeOscilloscope.cpp:285
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition: ThunderScopeOscilloscope.cpp:598
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: ThunderScopeOscilloscope.cpp:241
std::unique_ptr< vk::raii::CommandBuffer > m_cmdBuf
Command buffer for sample conversion.
Definition: ThunderScopeOscilloscope.h:133
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: ThunderScopeOscilloscope.cpp:507
virtual std::vector< unsigned int > GetChannelBandwidthLimiters(size_t i) override
Gets the set of available bandwidth limiters for an input channel.
Definition: ThunderScopeOscilloscope.cpp:272
FilterParameter m_diag_hardwareWFMHz
Number of WFM/s acquired by hardware.
Definition: ThunderScopeOscilloscope.h:106
void ResetPerCaptureDiagnostics()
Reset performance counters at the start of a capture.
Definition: ThunderScopeOscilloscope.cpp:171
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: ThunderScopeOscilloscope.cpp:563
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: ThunderScopeOscilloscope.cpp:519
ThunderScopeOscilloscope(SCPITransport *transport)
Initialize the driver.
Definition: ThunderScopeOscilloscope.cpp:56
FilterParameter m_diag_receivedWFMHz
Number of WFM/s recieved by the driver.
Definition: ThunderScopeOscilloscope.h:109
static std::string GetDriverNameInternal()
Return the driver name "thunderscope".
Definition: ThunderScopeOscilloscope.cpp:225
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: ThunderScopeOscilloscope.cpp:499
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: ThunderScopeOscilloscope.cpp:216
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition: ThunderScopeOscilloscope.cpp:549
std::string GetChannelColor(size_t i)
Color the channels based on our standard color sequence (blue-red-green-yellow)
Definition: ThunderScopeOscilloscope.cpp:184
virtual bool AcquireData() override
Pull data from the instrument.
Definition: ThunderScopeOscilloscope.cpp:298
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: ThunderScopeOscilloscope.cpp:211
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: ThunderScopeOscilloscope.cpp:620
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: ThunderScopeOscilloscope.cpp:513
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition: ThunderScopeOscilloscope.cpp:604
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: ThunderScopeOscilloscope.cpp:259
FilterParameter m_diag_droppedPercent
Percentage of waveforms which were dropped.
Definition: ThunderScopeOscilloscope.h:118
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: ThunderScopeOscilloscope.cpp:610
FilterParameter m_diag_droppedWFMs
Number of waveforms dropped because some part of the pipeline couldn't keep up.
Definition: ThunderScopeOscilloscope.h:115
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: ThunderScopeOscilloscope.cpp:291
FilterParameter m_diag_totalWFMs
Number of waveforms acquired during this session.
Definition: ThunderScopeOscilloscope.h:112
std::unique_ptr< vk::raii::CommandPool > m_pool
Command pool from which m_cmdBuf was allocated.
Definition: ThunderScopeOscilloscope.h:130
virtual bool CanEnableChannel(size_t i) override
Determines if a channel can be enabled.
Definition: ThunderScopeOscilloscope.cpp:666
std::vector< unsigned int > m_bandwidthLimits
Bandwidth limiters.
Definition: ThunderScopeOscilloscope.h:142
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: ThunderScopeOscilloscope.cpp:253
std::unique_ptr< ComputePipeline > m_conversionPipeline
Compute pipeline for converting raw ADC codes to float32 samples.
Definition: ThunderScopeOscilloscope.h:136
std::map< size_t, double > m_channelAttenuations
Map of channel numbers to attenuation levels.
Definition: ThunderScopeOscilloscope.h:103
std::shared_ptr< QueueHandle > m_queue
Vulkan queue used for sample conversion.
Definition: ThunderScopeOscilloscope.h:127
AcceleratorBuffer< uint32_t > m_clippingBuffer
Buffer for storing channel clip state.
Definition: ThunderScopeOscilloscope.h:139
std::vector< std::unique_ptr< AcceleratorBuffer< int16_t > > > m_analogRawWaveformBuffers
Buffers for storing raw ADC samples before converting to fp32.
Definition: ThunderScopeOscilloscope.h:124