30#ifndef RSRTB2kOscilloscope_h
31#define RSRTB2kOscilloscope_h
48#define MAX_DIGITAL_POD 2
52#define c_digiChannelsPerBus 8
67 std::string converse(
const char*
fmt, ...);
68 void sendOnly(
const char*
fmt, ...);
69 bool sendWithAck(
const char*
fmt, ...);
71 void protocolError(
bool flush,
const char*
fmt,
va_list ap);
72 void protocolError(
const char*
fmt, ...);
73 void protocolErrorWithFlush(
const char*
fmt, ...);
76 void IdentifyHardware();
78 virtual void AddAnalogChannels();
79 void AddDigitalChannels();
80 void AddExternalTriggerChannel();
81 void AddLineTriggerChannel();
106 virtual void SetChannelCoupling(
size_t i, OscilloscopeChannel::CouplingType type)
override;
127 virtual void Start()
override;
129 virtual void Stop()
override;
140 virtual std::set<InterleaveConflict> GetInterleaveConflicts()
override;
214 unsigned int progressChannel;
217 std::string PullTriggerSourceNumber(
bool noDigital);
234 void PushFloat(
const std::string& path,
float f);
244 void PrepareAcquisition();
245 void SetupForAcquisition();
247 std::string GetDigitalChannelBankName(
size_t channel);
248 std::string GetChannelName(
size_t channel);
253 std::vector<WaveformBase*> ProcessAnalogWaveform(
254 const std::vector<uint8_t>&
data,
265 unsigned int m_analogChannelCount;
266 unsigned int m_digitalChannelCount;
267 unsigned int m_analogAndDigitalChannelCount;
268 size_t m_digitalChannelBase;
273 bool m_hasFunctionGen;
274 bool m_hasI2cTrigger;
275 bool m_hasSpiTrigger;
276 bool m_hasUartTrigger;
277 bool m_hasCanTrigger;
278 bool m_hasLinTrigger;
281 unsigned int m_maxBandwidth;
283 bool m_triggerForced;
286 std::map<size_t, float> m_channelVoltageRanges;
287 std::map<size_t, float> m_channelOffsets;
288 std::map<std::string, float> m_channelDigitalHysteresis;
289 std::map<std::string, float> m_channelDigitalThresholds;
290 std::map<int, bool> m_channelsEnabled;
291 bool m_sampleRateValid;
293 bool m_memoryDepthValid;
295 bool m_memoryDepthAuto;
296 bool m_triggerOffsetValid;
302 std::map<size_t, bool> m_awgEnabled;
303 std::map<size_t, float> m_awgDutyCycle;
304 std::map<size_t, float> m_awgRange;
305 std::map<size_t, float> m_awgOffset;
306 std::map<size_t, float> m_awgFrequency;
307 std::map<size_t, float> m_awgRiseTime;
308 std::map<size_t, float> m_awgFallTime;
309 std::map<size_t, FunctionGenerator::WaveShape> m_awgShape;
310 std::map<size_t, FunctionGenerator::OutputImpedance> m_awgImpedance;
313 bool m_highDefinition;
319 std::vector<OscilloscopeChannel*> m_digitalChannels;
322 static std::string GetDriverNameInternal();
Definition AcceleratorBuffer.h:204
Simple edge trigger.
Definition EdgeTrigger.h:44
A single channel of a function generator.
Definition FunctionGeneratorChannel.h:45
WaveShape
Predefined waveform shapes.
Definition FunctionGenerator.h:55
OutputImpedance
Nominal output impedance for a function generator channel.
Definition FunctionGenerator.h:259
trigger uses the waveform of the power supply's alternating line voltage
Definition LineTrigger.h:44
A single channel on an oscilloscope.
Definition OscilloscopeChannel.h:49
TriggerMode
Definition Oscilloscope.h:398
Definition RSRTB2kOscilloscope.h:57
virtual float GetFunctionChannelDutyCycle(int chan) override
Gets the duty cycle for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3228
void PullWidthTrigger()
Reads settings for an edge trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1575
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition RSRTB2kOscilloscope.cpp:630
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition RSRTB2kOscilloscope.cpp:610
virtual OutputImpedance GetFunctionChannelOutputImpedance(int chan) override
Gets the currently selected output impedance for a function generator output (if supported)
Definition RSRTB2kOscilloscope.cpp:3479
virtual void SetFunctionChannelOutputImpedance(int chan, OutputImpedance z) override
Sets the currently selected output impedance for a function generator output (if supported)
Definition RSRTB2kOscilloscope.cpp:3497
virtual bool AcquireData() override
Pull data from the instrument.
Definition RSRTB2kOscilloscope.cpp:2277
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition RSRTB2kOscilloscope.cpp:509
virtual float GetDigitalHysteresis(size_t channel) override
Gets the hysteresis for a digital input.
Definition RSRTB2kOscilloscope.cpp:3085
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition RSRTB2kOscilloscope.cpp:1342
void PullTimeoutTrigger()
Reads settings for a timeout trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1813
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1420
void GetTriggerCoupling(Trigger *trig, std::string reply)
Processes the coupling for an edge or edge-derived trigger.
Definition RSRTB2kOscilloscope.cpp:1106
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition RSRTB2kOscilloscope.cpp:975
virtual float GetDigitalThreshold(size_t channel) override
Gets the threshold for a digital input.
Definition RSRTB2kOscilloscope.cpp:3116
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition RSRTB2kOscilloscope.cpp:722
virtual WaveShape GetFunctionChannelShape(int chan) override
Gets the waveform shape for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3351
void PushWidthTrigger(RSRTB2kWidthTrigger *trig)
Pushes settings for a pulse width trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1630
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition RSRTB2kOscilloscope.cpp:2850
void PushVideoTrigger(RSRTB2kVideoTrigger *trig)
Pushes settings for a video trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1949
static void Convert8BitSamples(float *pout, const uint8_t *pin, float gain, float offset, size_t count)
Converts 8-bit ADC samples to floating point.
Definition RSRTB2kOscilloscope.cpp:2099
virtual float GetFunctionChannelAmplitude(int chan) override
Gets the amplitude for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3259
virtual bool IsDigitalThresholdConfigurable() override
Checks if digital input threshold is configurable or fixed.
Definition RSRTB2kOscilloscope.cpp:3079
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition RSRTB2kOscilloscope.cpp:2937
virtual bool GetFunctionChannelActive(int chan) override
Returns true if the function generator channel's output is enabled.
Definition RSRTB2kOscilloscope.cpp:3200
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition RSRTB2kOscilloscope.cpp:437
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition RSRTB2kOscilloscope.cpp:307
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition RSRTB2kOscilloscope.cpp:1156
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition RSRTB2kOscilloscope.cpp:958
virtual void SetFunctionChannelActive(int chan, bool on) override
Turns a function generator channel on or off.
Definition RSRTB2kOscilloscope.cpp:3219
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition RSRTB2kOscilloscope.cpp:701
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition RSRTB2kOscilloscope.cpp:2582
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition RSRTB2kOscilloscope.cpp:2966
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition RSRTB2kOscilloscope.cpp:929
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition RSRTB2kOscilloscope.cpp:1129
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition RSRTB2kOscilloscope.cpp:561
virtual bool IsInverted(size_t i) override
Checks if hardware polarity inversion is enabled for a channel.
Definition RSRTB2kOscilloscope.cpp:747
virtual void Stop() override
Stops triggering.
Definition RSRTB2kOscilloscope.cpp:2593
virtual void SetChannelDisplayName(size_t i, std::string name) override
Sets the hardware display name for a channel. This is an arbitrary user-selected string.
Definition RSRTB2kOscilloscope.cpp:759
virtual void SetFunctionChannelOffset(int chan, float offset) override
Sets the DC offset for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3312
virtual void SetDigitalThreshold(size_t channel, float level) override
Gets the threshold for a digital input.
Definition RSRTB2kOscilloscope.cpp:3162
void PullVideoTrigger()
Reads settings for a video trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1881
virtual void SetFunctionChannelFallTime(int, float) override
Sets the fall time for a function generator output (if supported)
Definition RSRTB2kOscilloscope.cpp:3554
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition RSRTB2kOscilloscope.cpp:678
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition RSRTB2kOscilloscope.cpp:2884
virtual void SetFunctionChannelRiseTime(int, float) override
Sets the rise time for a function generator output (if supported)
Definition RSRTB2kOscilloscope.cpp:3539
virtual void SetDigitalHysteresis(size_t channel, float level) override
Sets the hysteresis for a digital input.
Definition RSRTB2kOscilloscope.cpp:3143
virtual bool CanEnableChannel(size_t i) override
Determines if a channel can be enabled.
Definition RSRTB2kOscilloscope.cpp:554
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition RSRTB2kOscilloscope.cpp:422
void GetTriggerSlope(Trigger *trig, std::string reply)
Processes the slope for an edge or edge-derived trigger.
Definition RSRTB2kOscilloscope.cpp:1061
virtual float GetFunctionChannelRiseTime(int) override
Gets the rise time for a function generator output (if supported)
Definition RSRTB2kOscilloscope.cpp:3518
void ForceHDMode(bool mode)
Forces 16-bit transfer mode on/off when for HD models.
Definition RSRTB2kOscilloscope.cpp:2040
virtual float GetFunctionChannelOffset(int chan) override
Gets the DC offset for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3291
virtual std::vector< unsigned int > GetChannelBandwidthLimiters(size_t i) override
Gets the set of available bandwidth limiters for an input channel.
Definition RSRTB2kOscilloscope.cpp:690
virtual bool CanInvert(size_t i) override
Checks if a channel is capable of hardware polarity inversion.
Definition RSRTB2kOscilloscope.cpp:731
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition RSRTB2kOscilloscope.cpp:2626
static void Convert16BitSamplesGeneric(float *pout, const uint16_t *pin, float gain, float offset, size_t count)
Converts raw ADC samples to floating point.
Definition RSRTB2kOscilloscope.cpp:2089
virtual std::vector< DigitalBank > GetDigitalBanks() override
Gets the digital channel banks for this instrument.
Definition RSRTB2kOscilloscope.cpp:3033
virtual void Invert(size_t i, bool invert) override
Enables hardware polarity inversion for a channel, if supported.
Definition RSRTB2kOscilloscope.cpp:738
virtual void EnableTriggerOutput() override
Enables the trigger output, configuring a shared auxiliary port for this purpose if needed.
Definition RSRTB2kOscilloscope.cpp:2609
void BulkCheckChannelEnableState()
Optimized function for checking channel enable status en masse with less round trips to the scope.
Definition RSRTB2kOscilloscope.cpp:1202
void PushTimeoutTrigger(RSRTB2kTimeoutTrigger *trig)
Pushes settings for a timeout trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1852
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition RSRTB2kOscilloscope.cpp:600
virtual void SetFunctionChannelShape(int chan, WaveShape shape) override
Sets the waveform shape for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3403
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition RSRTB2kOscilloscope.cpp:2709
void PushRiseTimeTrigger(RSRTB2kRiseTimeTrigger *trig)
Pushes settings for a slew rate trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1778
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition RSRTB2kOscilloscope.cpp:1135
virtual void SetFunctionChannelDutyCycle(int chan, float duty) override
Sets the duty cycle for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3250
virtual void SetFunctionChannelAmplitude(int chan, float amplitude) override
Sets the amplitude for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3282
virtual std::string GetChannelDisplayName(size_t i) override
Gets the hardware display name for a channel. This is an arbitrary user-selected string.
Definition RSRTB2kOscilloscope.cpp:804
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition RSRTB2kOscilloscope.cpp:2947
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition RSRTB2kOscilloscope.cpp:2619
Trigger::Condition GetCondition(std::string reply)
Parses a trigger condition.
Definition RSRTB2kOscilloscope.cpp:1247
void GetTriggerHysteresis(Trigger *trig, std::string reply)
Processes the channel hystersis for an trigger.
Definition RSRTB2kOscilloscope.cpp:1023
virtual bool IsDigitalHysteresisConfigurable() override
Checks if digital input hysteresis is configurable or fixed.
Definition RSRTB2kOscilloscope.cpp:3074
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition RSRTB2kOscilloscope.cpp:2868
void PullTriggerSource(Trigger *trig, std::string triggerModeName, bool isUart)
Reads the source of a trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1379
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition RSRTB2kOscilloscope.cpp:2716
virtual bool HasFunctionRiseFallTimeControls(int chan) override
Determines if the function generator allows control over rise/fall times.
Definition RSRTB2kOscilloscope.cpp:3512
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition RSRTB2kOscilloscope.cpp:450
void PushEdgeTrigger(EdgeTrigger *trig, const std::string &trigType)
Pushes settings for an edge trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1520
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition RSRTB2kOscilloscope.cpp:2913
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition RSRTB2kOscilloscope.cpp:2825
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition RSRTB2kOscilloscope.cpp:2571
static void Convert16BitSamples(float *pout, const uint16_t *pin, float gain, float offset, size_t count)
Converts 16-bit ADC samples to floating point.
Definition RSRTB2kOscilloscope.cpp:2049
virtual std::vector< std::string > GetTriggerTypes() override
Gets a list of triggers this instrument supports.
Definition RSRTB2kOscilloscope.cpp:1328
virtual void SetFunctionChannelFrequency(int chan, float hz) override
Sets the frequency for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3342
void PushRuntTrigger(RSRTB2kRuntTrigger *trig)
Pushes settings for a runt trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:1703
void PullLineTrigger()
Reads settings for a line trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:2003
void PushCondition(const std::string &path, Trigger::Condition cond)
Pushes settings for a trigger condition under a .Condition field.
Definition RSRTB2kOscilloscope.cpp:1269
virtual float GetFunctionChannelFrequency(int chan) override
Gets the frequency for a function generator output.
Definition RSRTB2kOscilloscope.cpp:3321
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition RSRTB2kOscilloscope.cpp:1004
void PullEdgeTrigger()
Reads settings for an edge trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1480
virtual float GetFunctionChannelFallTime(int chan) override
Gets the fall time for a function generator output (if supported)
Definition RSRTB2kOscilloscope.cpp:3548
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition RSRTB2kOscilloscope.cpp:654
void PullRuntTrigger()
Reads settings for a runt-pulse trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1667
void PushLineTrigger(LineTrigger *trig)
Pushes settings for a line trigger to the instrument.
Definition RSRTB2kOscilloscope.cpp:2029
virtual DigitalBank GetDigitalBank(size_t channel) override
Gets the bank containing a given channel.
Definition RSRTB2kOscilloscope.cpp:3054
static void Convert8BitSamplesGeneric(float *pout, const uint8_t *pin, float gain, float offset, size_t count)
Generic backend for Convert8BitSamples()
Definition RSRTB2kOscilloscope.cpp:2142
virtual std::vector< WaveShape > GetAvailableWaveformShapes(int chan) override
Query the set of available pre-defined waveforms for this generator.
Definition RSRTB2kOscilloscope.cpp:3178
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition RSRTB2kOscilloscope.cpp:428
void PullRiseTimeTrigger()
Reads settings for a rise time trigger from the instrument.
Definition RSRTB2kOscilloscope.cpp:1733
Slew rate trigger - trigger when an edge rate meets the specified conditions.
Definition RSRTB2kRiseTimeTrigger.h:44
Runt trigger - trigger when a pulse of a given width crosses one threshold but not the second.
Definition RSRTB2kRuntTrigger.h:44
Trigger when a signal stops toggling for some amount of time.
Definition RSRTB2kTimeoutTrigger.h:44
Video or TV trigger is used to analyze analog baseband video signals.
Definition RSRTB2kVideoTrigger.h:44
Trigger on a pulse meeting certain width criteria.
Definition RSRTB2kWidthTrigger.h:42
An SCPI-based function generator.
Definition SCPIFunctionGenerator.h:38
An SCPI-based oscilloscope.
Definition SCPIOscilloscope.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition SCPITransport.h:53
Abstract base class for oscilloscope / logic analyzer trigger inputs.
Definition Trigger.h:46
Condition
Conditions for triggers that perform logical comparisons of values.
Definition Trigger.h:85
Definition RSRTB2kOscilloscope.h:212