ngscopeclient v0.2.1
Loading...
Searching...
No Matches
Oscilloscope.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2026 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
36#ifndef Oscilloscope_h
37#define Oscilloscope_h
38
39class Instrument;
40
41#include "SCPITransport.h"
42#include "WaveformPool.h"
43#include "../xptools/HzClock.h"
44
50class Oscilloscope : public virtual Instrument
51{
52public:
54 // Construction / destruction
55
57 virtual ~Oscilloscope();
58
65 virtual std::string IDPing() =0;
66
68 // Channel information
69
77
81 virtual bool IsChannelEnabled(size_t i) =0;
82
88 virtual void EnableChannel(size_t i) =0;
89
102 virtual bool CanEnableChannel(size_t i);
103
111 virtual void DisableChannel(size_t i) =0;
112
119
124 { return dynamic_cast<OscilloscopeChannel*>(GetChannelByHwName(name)); }
125
131 virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) =0;
132
138 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) =0;
139
145 virtual std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) =0;
146
155 virtual double GetChannelAttenuation(size_t i) =0;
156
163 virtual void SetChannelAttenuation(size_t i, double atten) =0;
164
170 virtual std::vector<unsigned int> GetChannelBandwidthLimiters(size_t i);
171
179 virtual unsigned int GetChannelBandwidthLimit(size_t i) =0;
180
187 virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) =0;
188
196
209 virtual float GetChannelVoltageRange(size_t i, size_t stream) =0;
210
224 virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) =0;
225
233 virtual bool CanAutoZero(size_t i);
234
240 virtual void AutoZero(size_t i);
241
249 virtual bool CanDegauss(size_t i);
250
256 virtual bool ShouldDegauss(size_t i);
257
263 virtual void Degauss(size_t i);
264
270 virtual bool CanAverage(size_t i);
271
277 virtual size_t GetNumAverages(size_t i);
278
285 virtual void SetNumAverages(size_t i, size_t navg);
286
295 virtual std::string GetProbeName(size_t i);
296
302 virtual bool HasInputMux(size_t i);
303
309 virtual size_t GetInputMuxSetting(size_t i);
310
316 virtual std::vector<std::string> GetInputMuxNames(size_t i);
317
324 virtual void SetInputMux(size_t i, size_t select);
325
332 virtual float GetChannelOffset(size_t i, size_t stream) =0;
333
341 virtual bool IsHighRateOffsetCapable(size_t i);
342
350 virtual void SetChannelOffset(size_t i, size_t stream, float offset) =0;
351
357 virtual bool CanInvert(size_t i);
358
365 virtual void Invert(size_t i, bool invert);
366
372 virtual bool IsInverted(size_t i);
373
374protected:
375
378
391
394
395public:
396 //Triggering
417
422
434 virtual bool PeekTriggerArmed();
435
446 bool WaitForTrigger(int timeout);
447
456 {
457 Trigger* old_trig = m_trigger;
458
459 //Set the new trigger and sync to hardware
460 m_trigger = trigger;
461 PushTrigger();
462
463 //Delete old trigger *after* pushing the new one.
464 //This prevents possible race conditions where we disable the current trigger channel before the new
465 //trigger is set.
466 if(old_trig != trigger)
467 delete old_trig;
468 }
469
473 virtual void PushTrigger() =0;
474
481 Trigger* GetTrigger(bool sync = false)
482 {
483 if(sync || (m_trigger == NULL) )
484 PullTrigger();
485 return m_trigger;
486 }
487
491 virtual std::vector<std::string> GetTriggerTypes();
492
496 virtual void PullTrigger() =0;
497
504 virtual void Start() =0;
505
509 virtual void StartSingleTrigger() =0;
510
514 virtual void Stop() =0;
515
521 virtual void ForceTrigger() =0;
522
526 virtual bool IsTriggerArmed() =0;
527
534 virtual void EnableTriggerOutput();
535
536public:
538 // Memory depth / sample rate control.
539
543 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() =0;
544
548 virtual std::vector<uint64_t> GetSampleRatesInterleaved() =0;
549
554
558 virtual bool IsInterleaving() =0;
559
567 virtual bool SetInterleaving(bool combine) =0;
568
572 virtual bool HasInterleavingControls();
573
577 virtual bool CanInterleave();
578
584 typedef std::pair<OscilloscopeChannel*, OscilloscopeChannel* > InterleaveConflict;
585 virtual std::set< InterleaveConflict > GetInterleaveConflicts() =0;
586
590 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() =0;
591
595 virtual std::vector<uint64_t> GetSampleDepthsInterleaved() =0;
596
601
605 virtual void SetSampleDepth(uint64_t depth) =0;
606
610 virtual void SetSampleRate(uint64_t rate) =0;
611
612 enum SamplingMode
613 {
614 REAL_TIME,
615 EQUIVALENT_TIME
616 };
617
623 virtual bool IsSamplingModeAvailable(SamplingMode mode);
624
630 virtual SamplingMode GetSamplingMode();
631
637 virtual void SetSamplingMode(SamplingMode mode);
638
648 virtual void SetUseExternalRefclk(bool external);
649
657 virtual void SetTriggerOffset(int64_t offset) =0;
658
663
674 virtual void SetDeskewForChannel(size_t channel, int64_t skew);
675
681 virtual int64_t GetDeskewForChannel(size_t channel);
682
684 // Sequenced triggering
685
687 // ADC bit depth configuration
688
689 typedef std::vector<OscilloscopeChannel*> AnalogBank;
690
696 virtual std::vector<AnalogBank> GetAnalogBanks();
697
701 virtual AnalogBank GetAnalogBank(size_t channel);
702
706 virtual bool IsADCModePerChannel();
707
711 virtual bool IsADCModeConfigurable();
712
721 virtual std::vector<std::string> GetADCModeNames(size_t channel);
722
726 virtual size_t GetADCMode(size_t channel);
727
731 virtual void SetADCMode(size_t channel, size_t mode);
732
734 // Logic analyzer configuration
735
736 typedef std::vector<OscilloscopeChannel*> DigitalBank;
737
743 virtual std::vector<DigitalBank> GetDigitalBanks();
744
748 virtual DigitalBank GetDigitalBank(size_t channel);
749
755 virtual bool IsDigitalHysteresisConfigurable();
756
762 virtual bool IsDigitalThresholdConfigurable();
763
767 virtual float GetDigitalHysteresis(size_t channel);
768
772 virtual float GetDigitalThreshold(size_t channel);
773
777 virtual void SetDigitalHysteresis(size_t channel, float level);
778
782 virtual void SetDigitalThreshold(size_t channel, float level);
783
785 // Frequency domain channel configuration
786
792 virtual void SetSpan(int64_t span);
793
797 virtual int64_t GetSpan();
798
805 virtual void SetCenterFrequency(size_t channel, int64_t freq);
806
812 virtual int64_t GetCenterFrequency(size_t channel);
813
817 virtual void SetResolutionBandwidth(int64_t rbw);
818
823
827 virtual bool HasFrequencyControls();
828
836 virtual bool HasResolutionBandwidth();
837
841 virtual bool HasTimebaseControls();
842
843 //TODO: window controls
844
846 // Configuration storage
847
848protected:
852 void DoSerializeConfiguration(YAML::Node& node, IDTable& table);
853
857 void DoLoadConfiguration(int version, const YAML::Node& node, IDTable& idmap);
858
862 void DoPreLoadConfiguration(int version, const YAML::Node& node, IDTable& idmap, ConfigWarningList& list);
863
865 // Sample format conversion
866public:
867 static void Convert8BitSamples(float* pout, const int8_t* pin, float gain, float offset, size_t count);
868 static void Convert8BitSamplesGeneric(float* pout, const int8_t* pin, float gain, float offset, size_t count);
869#ifdef __x86_64__
870 static void Convert8BitSamplesAVX2(float* pout, const int8_t* pin, float gain, float offset, size_t count);
871#endif
872
873 static void ConvertUnsigned8BitSamples(float* pout, const uint8_t* pin, float gain, float offset, size_t count);
874 static void ConvertUnsigned8BitSamplesGeneric(float* pout, const uint8_t* pin, float gain, float offset, size_t count);
875#ifdef __x86_64__
876 static void ConvertUnsigned8BitSamplesAVX2(float* pout, const uint8_t* pin, float gain, float offset, size_t count);
877#endif
878
879protected:
880
882 std::shared_ptr<QueueHandle> m_queue;
883
885 std::unique_ptr<vk::raii::CommandPool> m_pool;
886
888 std::unique_ptr<vk::raii::CommandBuffer> m_cmdBuf;
889
890 void InitVulkanQueue(const char* debugName);
891
892public:
894 // Waveform Access
895
896 bool HasPendingWaveforms();
898 size_t GetPendingWaveformCount();
899 virtual bool PopPendingWaveform();
900 virtual bool IsAppendingToWaveform();
901
902 double GetWaveformDownloadRate()
903 { return m_downloadClock.GetAverageHz(); }
904
905protected:
906 typedef std::map<StreamDescriptor, WaveformBase*> SequenceSet;
907 std::list<SequenceSet> m_pendingWaveforms;
908 std::mutex m_pendingWaveformsMutex;
909 std::recursive_mutex m_mutex;
910
911 HzClock m_downloadClock;
912
914 // Diagnostics Access
915protected:
916 std::deque<std::string> m_diagnosticLogMessages;
917 std::map<std::string, FilterParameter*> m_diagnosticValues;
918 // Pointers are expected to be to members of this class; not dynamically allocated
919
920 void AddDiagnosticLog(const std::string& message)
921 { m_diagnosticLogMessages.push_back(message); }
922
923public:
924 bool HasPendingDiagnosticLogMessages()
925 { return !m_diagnosticLogMessages.empty(); }
926
927 std::string PopPendingDiagnosticLogMessage()
928 {
929 std::string message = m_diagnosticLogMessages.front();
930 m_diagnosticLogMessages.pop_front();
931 return message;
932 }
933
934 std::map<std::string, FilterParameter*>& GetDiagnosticsValues()
935 {
936 // TODO: Should really be readonly, but need to mutate to add change listeners...
937 return m_diagnosticValues;
938 }
939
940protected:
941
942 //The trigger
943 Trigger* m_trigger;
944
945 //Pool for reusing memory allocations
946 WaveformPool m_analogWaveformPool;
947
948 WaveformPool m_digitalWaveformPool;
949
950 UniformAnalogWaveform* AllocateAnalogWaveform(const std::string& name)
951 {
952 auto p = m_analogWaveformPool.Get();
953 auto ret = dynamic_cast<UniformAnalogWaveform*>(p);
954 if(ret)
955 {
956 ret->Rename(name);
957 return ret;
958 }
959
960 //Delete garbage if somebody pushed the wrong type of waveform
961 if(p)
962 delete p;
963
964 //Pool was empty, allocate a new waveform
965 return new UniformAnalogWaveform(name);
966 }
967
968 SparseDigitalWaveform* AllocateDigitalWaveform(const std::string& name)
969 {
970 auto p = m_digitalWaveformPool.Get();
971 auto ret = dynamic_cast<SparseDigitalWaveform*>(p);
972 if(ret)
973 {
974 ret->Rename(name);
975 return ret;
976 }
977
978 //Delete garbage if somebody pushed the wrong type of waveform
979 if(p)
980 delete p;
981
982 //Pool was empty, allocate a new waveform
983 return new SparseDigitalWaveform(name);
984 }
985
986public:
987
994 { return m_analogWaveformPool.clear() || m_digitalWaveformPool.clear(); }
995
996 void AddWaveformToAnalogPool(WaveformBase* w)
997 { m_analogWaveformPool.Add(w); }
998
999 void AddWaveformToDigitalPool(WaveformBase* w)
1000 { m_digitalWaveformPool.Add(w); }
1001
1002public:
1003 typedef std::shared_ptr<Oscilloscope> (*CreateProcType)(SCPITransport*);
1004 static void DoAddDriverClass(const std::string& name, CreateProcType proc);
1005
1006 static void EnumDrivers(std::vector<std::string>& names);
1007 static std::shared_ptr<Oscilloscope> CreateOscilloscope(const std::string& driver, SCPITransport* transport);
1008
1009protected:
1010 //Class enumeration
1011 typedef std::map< std::string, CreateProcType > CreateMapType;
1012 static CreateMapType m_createprocs;
1013};
1014
1015//must be declared here after Oscilloscope is defined
1016inline Oscilloscope* OscilloscopeChannel::GetScope()
1017{ return dynamic_cast<Oscilloscope*>(m_instrument); }
1018
1019#ifndef STRINGIFY
1020#define STRINGIFY(T) #T
1021#endif
1022
1023#define OSCILLOSCOPE_INITPROC(T) \
1024 static std::shared_ptr<Oscilloscope> CreateInstance(SCPITransport* transport) \
1025 { return std::make_shared<T>(transport); } \
1026 virtual std::string GetDriverName() const override \
1027 { return GetDriverNameInternal(); }
1028
1029#define AddDriverClass(T) Oscilloscope::DoAddDriverClass(T::GetDriverNameInternal(), T::CreateInstance); SCPIInstrument::DoAddDriverClass(T::GetDriverNameInternal(), T::GetDriverSupportedModels)
1030
1031#endif
Declaration of SCPITransport.
Declaration of WaveformPool.
Definition AcceleratorBuffer.h:204
All warnings generated by a configuration we're in the process of loading.
Definition ConfigWarningList.h:90
Clock that measures rate at which it is called; windowed average.
Definition HzClock.h:52
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Definition IDTable.h:49
DownloadState
Enum values to be mapped to GetDownloadState() int result value for specific channel download states.
Definition InstrumentChannel.h:283
Instrument * m_instrument
The instrument we're part of (may be null in the case of filters etc)
Definition InstrumentChannel.h:313
An arbitrary lab instrument. Oscilloscope, LA, PSU, DMM, etc.
Definition Instrument.h:62
InstrumentChannel * GetChannelByHwName(const std::string &name)
Gets a channel given the hardware name.
Definition Instrument.cpp:86
InstrumentChannel * GetChannel(size_t i) const
Gets a given channel on the instrument.
Definition Instrument.h:170
A single channel on an oscilloscope.
Definition OscilloscopeChannel.h:49
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition Oscilloscope.h:51
virtual int64_t GetCenterFrequency(size_t channel)
Gets the center frequency for a frequency-domain channel.
Definition Oscilloscope.cpp:991
std::unique_ptr< vk::raii::CommandBuffer > m_cmdBuf
Vulkan command buffer for GPU waveform processing.
Definition Oscilloscope.h:888
virtual bool IsChannelEnabled(size_t i)=0
Checks if a channel is enabled in hardware.
virtual std::vector< uint64_t > GetSampleRatesInterleaved()=0
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
virtual bool IsInverted(size_t i)
Checks if hardware polarity inversion is enabled for a channel.
Definition Oscilloscope.cpp:908
virtual bool HasInputMux(size_t i)
Checks if a channel has an input multiplexer.
Definition Oscilloscope.cpp:827
void DoLoadConfiguration(int version, const YAML::Node &node, IDTable &idmap)
Load instrument and channel configuration from a save file.
Definition Oscilloscope.cpp:425
virtual float GetChannelOffset(size_t i, size_t stream)=0
Gets the offset, in volts, for a given channel.
virtual bool HasFrequencyControls()
Returns true if the instrument has at least one frequency-domain channel.
Definition Oscilloscope.cpp:1005
virtual void SetChannelAttenuation(size_t i, double atten)=0
Sets the probe attenuation used for an input channel.
virtual int64_t GetResolutionBandwidth()
Gets the resolution bandwidth for frequency-domain channels.
Definition Oscilloscope.cpp:1000
std::pair< OscilloscopeChannel *, OscilloscopeChannel * > InterleaveConflict
Get the set of conflicting channels.
Definition Oscilloscope.h:584
virtual void SetDigitalThreshold(size_t channel, float level)
Gets the threshold for a digital input.
Definition Oscilloscope.cpp:795
virtual bool IsHighRateOffsetCapable(size_t i)
Checks if the channel supports high rate offset changes, or if the GUI should rate-limit.
Definition Oscilloscope.cpp:1021
virtual unsigned int GetChannelBandwidthLimit(size_t i)=0
Gets the bandwidth limit for an input channel.
virtual bool IsSamplingModeAvailable(SamplingMode mode)
Returns true if the requested sampling mode is available with the current instrument configuration.
Definition Oscilloscope.cpp:699
virtual void SetDigitalHysteresis(size_t channel, float level)
Sets the hysteresis for a digital input.
Definition Oscilloscope.cpp:791
virtual bool IsADCModeConfigurable()
Returns true if the ADC is configurable, false if it can only run in one mode.
Definition Oscilloscope.cpp:877
bool FreeWaveformPools()
Free all waveforms in our pool to reclaim memory.
Definition Oscilloscope.h:993
virtual int64_t GetDeskewForChannel(size_t channel)
Gets the deskew setting for a channel.
Definition Oscilloscope.cpp:726
virtual bool PopPendingWaveform()
Pops the queue of pending waveforms and updates each channel with a new waveform.
Definition Oscilloscope.cpp:209
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved()=0
Get the legal memory depths for this scope in all-channels mode.
static void ConvertUnsigned8BitSamplesGeneric(float *pout, const uint8_t *pin, float gain, float offset, size_t count)
Generic backend for ConvertUnsigned8BitSamples()
Definition Oscilloscope.cpp:1223
virtual bool ShouldDegauss(size_t i)
Determines if a channel requires a degauss cycle (if supported)
Definition Oscilloscope.cpp:813
virtual uint64_t GetSampleDepth()=0
Gets the current sample depth of this scope.
virtual void SetADCMode(size_t channel, size_t mode)
Sets the ADC mode for a channel.
Definition Oscilloscope.cpp:894
virtual bool HasResolutionBandwidth()
Returns true if the instrument has a resolution bandwidth setting.
Definition Oscilloscope.cpp:1010
static void Convert8BitSamples(float *pout, const int8_t *pin, float gain, float offset, size_t count)
Converts 8-bit ADC samples to floating point.
Definition Oscilloscope.cpp:1032
virtual void SetDeskewForChannel(size_t channel, int64_t skew)
Sets the deskew setting for a channel.
Definition Oscilloscope.cpp:721
virtual bool IsDigitalThresholdConfigurable()
Checks if digital input threshold is configurable or fixed.
Definition Oscilloscope.cpp:776
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved()=0
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
virtual double GetChannelAttenuation(size_t i)=0
Gets the probe attenuation for an input channel.
virtual float GetChannelVoltageRange(size_t i, size_t stream)=0
Gets the range of the current channel configuration.
virtual size_t GetNumAverages(size_t i)
Returns the number of averages the channel is configured for.
Definition Oscilloscope.cpp:241
virtual bool CanEnableChannel(size_t i)
Determines if a channel can be enabled.
Definition Oscilloscope.cpp:144
int GetEnabledChannelCount()
Returns the number of enabled channels for this oscilloscope.
Definition Oscilloscope.cpp:149
virtual bool IsADCModePerChannel()
Returns true if the ADC is a per-channel setting, false if global for the entire instrument.
Definition Oscilloscope.cpp:871
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz)=0
Sets the bandwidth limit for an input channel.
virtual std::string IDPing()=0
Returns the instrument's identification string.
void ChannelsDownloadStatusUpdate(size_t ch, InstrumentChannel::DownloadState state, float progress)
Helper method called by drivers to set one channel's download status and update its download progress...
Definition Oscilloscope.cpp:938
virtual void StartSingleTrigger()=0
Arms the trigger for a single acquistion.
virtual void DisableChannel(size_t i)=0
Turn a channel off, given the index.
void DoPreLoadConfiguration(int version, const YAML::Node &node, IDTable &idmap, ConfigWarningList &list)
Validate instrument and channel configuration from a save file.
Definition Oscilloscope.cpp:634
virtual void Start()=0
Starts the instrument in continuous trigger mode.
virtual void SetSampleDepth(uint64_t depth)=0
Sets the sample depth of the scope.
virtual void SetSampleRate(uint64_t rate)=0
Sets the sample rate of the scope, in Hz.
void ChannelsDownloadFinished()
Helper method called by drivers when waveform download is finished to reset all channels to "no downl...
Definition Oscilloscope.cpp:948
virtual bool HasInterleavingControls()
Returns true if the scope has a user controllable interleaving feature, false if not.
Definition Oscilloscope.cpp:732
virtual bool PeekTriggerArmed()
Checks if the trigger is armed directly on the instrument, without altering internal state or touchin...
Definition Oscilloscope.cpp:970
virtual std::vector< AnalogBank > GetAnalogBanks()
Gets the analog banks for this instrument.
Definition Oscilloscope.cpp:850
virtual bool CanDegauss(size_t i)
Determines if a channel has a probe connected which supports the "degauss" feature.
Definition Oscilloscope.cpp:808
virtual void SetChannelOffset(size_t i, size_t stream, float offset)=0
Sets the offset for a given channel.
static void Convert8BitSamplesGeneric(float *pout, const int8_t *pin, float gain, float offset, size_t count)
Generic backend for Convert8BitSamples()
Definition Oscilloscope.cpp:1091
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range)=0
Sets the range of the current channel configuration.
virtual void SetSpan(int64_t span)
Sets the span for frequency-domain channels.
Definition Oscilloscope.cpp:978
virtual void SetInputMux(size_t i, size_t select)
Sets the input mux for a channel.
Definition Oscilloscope.cpp:843
virtual bool IsInterleaving()=0
Checks if the scope is currently combining channels.
virtual bool IsTriggerArmed()=0
Checks if the trigger is currently armed.
virtual bool CanAutoZero(size_t i)
Determines if a channel has a probe connected which supports the "auto zero" feature.
Definition Oscilloscope.cpp:799
virtual std::vector< std::string > GetInputMuxNames(size_t i)
Gets names for the input mux ports of a channel.
Definition Oscilloscope.cpp:837
void ClearPendingWaveforms()
Discard any pending waveforms that haven't yet been processed.
Definition Oscilloscope.cpp:194
virtual size_t GetInputMuxSetting(size_t i)
Gets the setting for a channel's input mux (if it has one)
Definition Oscilloscope.cpp:832
OscilloscopeChannel * GetOscilloscopeChannelByHwName(const std::string &name)
Gets a channel given the hardware name.
Definition Oscilloscope.h:123
virtual size_t GetADCMode(size_t channel)
Gets the ADC mode for a channel.
Definition Oscilloscope.cpp:889
virtual std::vector< std::string > GetADCModeNames(size_t channel)
Gets the names of the ADC modes for the bank a given channel is located in.
Definition Oscilloscope.cpp:882
void InitVulkanQueue(const char *debugName)
Initializes the Vulkan queue and command buffer.
Definition Oscilloscope.cpp:86
OscilloscopeChannel * GetOscilloscopeChannel(size_t i)
Gets a channel by index.
Definition Oscilloscope.h:75
void SetTrigger(Trigger *trigger)
Sets a new trigger on the instrument and pushes changes.
Definition Oscilloscope.h:455
virtual std::string GetProbeName(size_t i)
Returns the name of the probe connected to the scope, if possible.
Definition Oscilloscope.cpp:822
virtual void Invert(size_t i, bool invert)
Enables hardware polarity inversion for a channel, if supported.
Definition Oscilloscope.cpp:904
virtual std::vector< unsigned int > GetChannelBandwidthLimiters(size_t i)
Gets the set of available bandwidth limiters for an input channel.
Definition Oscilloscope.cpp:750
virtual bool CanInvert(size_t i)
Checks if a channel is capable of hardware polarity inversion.
Definition Oscilloscope.cpp:899
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type)=0
Sets the coupling used for an input channel.
virtual bool IsAppendingToWaveform()
Checks if we are appending to the existing waveform or creating a new one.
Definition Oscilloscope.cpp:228
bool WaitForTrigger(int timeout)
Block until a trigger happens or a timeout elapses.
Definition Oscilloscope.cpp:164
virtual void Stop()=0
Stops triggering.
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i)=0
Gets the coupling used for an input channel.
virtual float GetDigitalHysteresis(size_t channel)
Gets the hysteresis for a digital input.
Definition Oscilloscope.cpp:781
virtual std::vector< uint64_t > GetSampleDepthsInterleaved()=0
Get the legal memory depths for this scope in combined-channels mode.
virtual bool CanInterleave()
Returns true if we have no interleave conflicts, false if we have conflicts.
Definition Oscilloscope.cpp:737
virtual void SetResolutionBandwidth(int64_t rbw)
Gets the resolution bandwidth for frequency-domain channels.
Definition Oscilloscope.cpp:996
virtual void SetSamplingMode(SamplingMode mode)
Sets the current sampling mode of the instrument.
Definition Oscilloscope.cpp:709
virtual DigitalBank GetDigitalBank(size_t channel)
Gets the bank containing a given channel.
Definition Oscilloscope.cpp:766
std::unique_ptr< vk::raii::CommandPool > m_pool
Vulkan command pool for GPU waveform processing.
Definition Oscilloscope.h:885
Trigger * GetTrigger(bool sync=false)
Gets the current trigger.
Definition Oscilloscope.h:481
virtual bool SetInterleaving(bool combine)=0
Configures the scope to combine channels.
virtual void ForceTrigger()=0
Forces a single acquisition as soon as possible.
virtual SamplingMode GetSamplingMode()
Gets the current sampling mode of the instrument.
Definition Oscilloscope.cpp:704
virtual void PushTrigger()=0
Pushes changes made to m_trigger to the instrument.
virtual int64_t GetTriggerOffset()=0
Gets the trigger offset.
virtual void PullTrigger()=0
Updates m_trigger with any changes made from the instrument side.
void ChannelsDownloadStarted()
Helper method called by drivers to reset all channels to "waiting to download" state.
Definition Oscilloscope.cpp:913
virtual bool IsDigitalHysteresisConfigurable()
Checks if digital input hysteresis is configurable or fixed.
Definition Oscilloscope.cpp:771
std::shared_ptr< QueueHandle > m_queue
Vulkan queue for GPU waveform processing.
Definition Oscilloscope.h:882
virtual float GetDigitalThreshold(size_t channel)
Gets the threshold for a digital input.
Definition Oscilloscope.cpp:786
virtual int64_t GetSpan()
Gets the span for frequency-domain channels.
Definition Oscilloscope.cpp:982
virtual void AutoZero(size_t i)
Performs an "auto zero" cycle on the attached active probe, if supported by the hardware.
Definition Oscilloscope.cpp:804
virtual void EnableChannel(size_t i)=0
Turn a channel on, given the index.
virtual void SetUseExternalRefclk(bool external)
Configures the instrument's clock source.
Definition Oscilloscope.cpp:714
virtual void EnableTriggerOutput()
Enables the trigger output, configuring a shared auxiliary port for this purpose if needed.
Definition Oscilloscope.cpp:694
static void ConvertUnsigned8BitSamples(float *pout, const uint8_t *pin, float gain, float offset, size_t count)
Converts Unsigned 8-bit ADC samples to floating point.
Definition Oscilloscope.cpp:1164
TriggerMode
Definition Oscilloscope.h:398
@ TRIGGER_MODE_AUTO
Auto trigger - waiting for auto-trigger.
Definition Oscilloscope.h:412
@ TRIGGER_MODE_COUNT
Placeholder.
Definition Oscilloscope.h:415
@ TRIGGER_MODE_WAIT
WAIT - not yet fully armed.
Definition Oscilloscope.h:409
@ TRIGGER_MODE_TRIGGERED
Just got triggered, data is ready to read.
Definition Oscilloscope.h:406
@ TRIGGER_MODE_RUN
Active, waiting for a trigger event.
Definition Oscilloscope.h:400
@ TRIGGER_MODE_STOP
Triggered once, but not recently.
Definition Oscilloscope.h:403
virtual std::vector< DigitalBank > GetDigitalBanks()
Gets the digital channel banks for this instrument.
Definition Oscilloscope.cpp:760
virtual void SetCenterFrequency(size_t channel, int64_t freq)
Sets the center frequency for frequency-domain channels.
Definition Oscilloscope.cpp:987
virtual void SetNumAverages(size_t i, size_t navg)
Sets the number of hardware averages to use.
Definition Oscilloscope.cpp:246
virtual OscilloscopeChannel * GetExternalTrigger()=0
Returns the external trigger input channel, if we have one.
virtual bool HasTimebaseControls()
Returns true if the instrument has at least one time-domain channel.
Definition Oscilloscope.cpp:1016
virtual Oscilloscope::TriggerMode PollTrigger()=0
Checks the curent trigger status.
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i)=0
Gets the set of legal coupling values for an input channel.
virtual void Degauss(size_t i)
Performs an "degauss" cycle on the attached active probe, if supported by the hardware.
Definition Oscilloscope.cpp:818
virtual std::vector< std::string > GetTriggerTypes()
Gets a list of triggers this instrument supports.
Definition Oscilloscope.cpp:963
virtual AnalogBank GetAnalogBank(size_t channel)
Gets the bank containing a given channel.
Definition Oscilloscope.cpp:857
virtual void SetTriggerOffset(int64_t offset)=0
Sets the trigger offset.
void DoSerializeConfiguration(YAML::Node &node, IDTable &table)
Serializes this oscilloscope's configuration to a YAML node.
Definition Oscilloscope.cpp:255
virtual bool CanAverage(size_t i)
Determines if the channel supports hardware averaging.
Definition Oscilloscope.cpp:236
virtual uint64_t GetSampleRate()=0
Gets the current sampling rate (in Hz) of this scope.
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition SCPITransport.h:53
A waveform sampled at irregular intervals.
Definition Waveform.h:514
Abstract base class for oscilloscope / logic analyzer trigger inputs.
Definition Trigger.h:46
A waveform sampled at uniform intervals.
Definition Waveform.h:404
Base class for all Waveform specializations.
Definition Waveform.h:59
Thread safe memory pool for reusing Waveform objects.
Definition WaveformPool.h:47
bool clear()
Free all waveforms in the pool to reclaim memory.
Definition WaveformPool.h:118
WaveformBase * Get()
Attempts to get a waveform from the pool.
Definition WaveformPool.h:98
void Add(WaveformBase *w)
Adds a new waveform to the pool if there's sufficient free slots in the pool.
Definition WaveformPool.h:73