ngscopeclient 0.1-dev+51fbda87c
RohdeSchwarzOscilloscope.h
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
30#ifndef RohdeSchwarzOscilloscope_h
31#define RohdeSchwarzOscilloscope_h
32
33class EdgeTrigger;
34
36{
37public:
40
41 //not copyable or assignable
43 RohdeSchwarzOscilloscope& operator=(const RohdeSchwarzOscilloscope& rhs) =delete;
44
45public:
46 //Device information
47 virtual unsigned int GetInstrumentTypes() const override;
48 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
49
50 virtual void FlushConfigCache() override;
51
52 //Channel configuration
53 virtual bool IsChannelEnabled(size_t i) override;
54 virtual void EnableChannel(size_t i) override;
55 virtual void DisableChannel(size_t i) override;
56 virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override;
57 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override;
58 virtual std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) override;
59 virtual double GetChannelAttenuation(size_t i) override;
60 virtual void SetChannelAttenuation(size_t i, double atten) override;
61 virtual unsigned int GetChannelBandwidthLimit(size_t i) override;
62 virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override;
63 virtual float GetChannelVoltageRange(size_t i, size_t stream) override;
64 virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override;
65 virtual OscilloscopeChannel* GetExternalTrigger() override;
66 virtual float GetChannelOffset(size_t i, size_t stream) override;
67 virtual void SetChannelOffset(size_t i, size_t stream, float offset) override;
68
69 //Triggering
70 virtual Oscilloscope::TriggerMode PollTrigger() override;
71 virtual bool AcquireData() override;
72 virtual void Start() override;
73 virtual void StartSingleTrigger() override;
74 virtual void Stop() override;
75 virtual void ForceTrigger() override;
76 virtual bool IsTriggerArmed() override;
77 virtual void PushTrigger() override;
78 virtual void PullTrigger() override;
79
80 //Timebase
81 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() override;
82 virtual std::vector<uint64_t> GetSampleRatesInterleaved() override;
83 virtual std::set<InterleaveConflict> GetInterleaveConflicts() override;
84 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
85 virtual std::vector<uint64_t> GetSampleDepthsInterleaved() override;
86 virtual uint64_t GetSampleRate() override;
87 virtual uint64_t GetSampleDepth() override;
88 virtual void SetSampleDepth(uint64_t depth) override;
89 virtual void SetSampleRate(uint64_t rate) override;
90 virtual void SetTriggerOffset(int64_t offset) override;
91 virtual int64_t GetTriggerOffset() override;
92 virtual bool IsInterleaving() override;
93 virtual bool SetInterleaving(bool combine) override;
94
95protected:
96 OscilloscopeChannel* m_extTrigChannel;
97
98 enum Series
99 {
100 SERIES_RTE,
101 SERIES_RTM,
102 SERIES_UNKNOWN
103 } m_series;
104
105 //hardware analog channel count, independent of LA option etc
106 unsigned int m_analogChannelCount;
107
108 //config cache
109 std::map<size_t, float> m_channelOffsets;
110 std::map<size_t, float> m_channelVoltageRanges;
111 std::map<int, bool> m_channelsEnabled;
112 std::map<size_t, OscilloscopeChannel::CouplingType> m_channelCouplings;
113 std::map<size_t, double> m_channelAttenuations;
114
115 bool m_triggerArmed;
116 bool m_triggerOneShot;
117
118 void PullEdgeTrigger();
119 void PushEdgeTrigger(EdgeTrigger* trig);
120 void PushFloat(std::string path, float f);
121
122public:
123 static std::string GetDriverNameInternal();
124 OSCILLOSCOPE_INITPROC(RohdeSchwarzOscilloscope)
125};
126
127#endif
Simple edge trigger.
Definition: EdgeTrigger.h:44
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
TriggerMode
Definition: Oscilloscope.h:411
Definition: RohdeSchwarzOscilloscope.h:36
void PushEdgeTrigger(EdgeTrigger *trig)
Pushes settings for an edge trigger to the instrument.
Definition: RohdeSchwarzOscilloscope.cpp:837
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:392
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:378
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: RohdeSchwarzOscilloscope.cpp:215
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:367
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: RohdeSchwarzOscilloscope.cpp:651
virtual void Stop() override
Stops triggering.
Definition: RohdeSchwarzOscilloscope.cpp:633
virtual bool AcquireData() override
Pull data from the instrument.
Definition: RohdeSchwarzOscilloscope.cpp:507
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: RohdeSchwarzOscilloscope.cpp:414
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: RohdeSchwarzOscilloscope.cpp:489
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: RohdeSchwarzOscilloscope.cpp:646
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: RohdeSchwarzOscilloscope.cpp:708
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: RohdeSchwarzOscilloscope.cpp:447
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: RohdeSchwarzOscilloscope.cpp:739
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:337
void PullEdgeTrigger()
Reads settings for an edge trigger from the instrument.
Definition: RohdeSchwarzOscilloscope.cpp:760
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition: RohdeSchwarzOscilloscope.cpp:660
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: RohdeSchwarzOscilloscope.cpp:718
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: RohdeSchwarzOscilloscope.cpp:824
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: RohdeSchwarzOscilloscope.cpp:220
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: RohdeSchwarzOscilloscope.cpp:454
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: RohdeSchwarzOscilloscope.cpp:242
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition: RohdeSchwarzOscilloscope.cpp:729
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:409
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:301
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: RohdeSchwarzOscilloscope.cpp:641
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: RohdeSchwarzOscilloscope.cpp:282
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: RohdeSchwarzOscilloscope.cpp:702
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: RohdeSchwarzOscilloscope.cpp:228
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: RohdeSchwarzOscilloscope.cpp:291
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: RohdeSchwarzOscilloscope.cpp:617
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: RohdeSchwarzOscilloscope.cpp:273
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: RohdeSchwarzOscilloscope.cpp:476
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: RohdeSchwarzOscilloscope.cpp:713
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition: RohdeSchwarzOscilloscope.cpp:687
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition: RohdeSchwarzOscilloscope.cpp:734
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: RohdeSchwarzOscilloscope.cpp:696
void PushFloat(std::string path, float f)
Sends float, assumes transport is already mutexed.
Definition: RohdeSchwarzOscilloscope.cpp:873
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: RohdeSchwarzOscilloscope.cpp:723
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: RohdeSchwarzOscilloscope.cpp:625
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: RohdeSchwarzOscilloscope.cpp:678
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: RohdeSchwarzOscilloscope.cpp:434
An SCPI-based oscilloscope.
Definition: SCPIOscilloscope.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47