ngscopeclient 0.1-dev+51fbda87c
UHDBridgeSDR.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 UHDBridgeSDR_h
38#define UHDBridgeSDR_h
39
40#include "RemoteBridgeOscilloscope.h"
41
48 : public virtual RemoteBridgeOscilloscope
49 , public virtual SCPISDR
50{
51public:
52 UHDBridgeSDR(SCPITransport* transport);
53 virtual ~UHDBridgeSDR();
54
55 //not copyable or assignable
56 UHDBridgeSDR(const UHDBridgeSDR& rhs) =delete;
57 UHDBridgeSDR& operator=(const UHDBridgeSDR& rhs) =delete;
58
59public:
60
61 //Device information
62 virtual unsigned int GetInstrumentTypes() const override;
63 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
64
65 virtual void FlushConfigCache() override;
66
67 //Channel configuration
68 virtual bool IsChannelEnabled(size_t i) override;
69 virtual void EnableChannel(size_t i) override;
70 virtual void DisableChannel(size_t i) override;
71 virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override;
72 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override;
73 virtual std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) override;
74 virtual double GetChannelAttenuation(size_t i) override;
75 virtual void SetChannelAttenuation(size_t i, double atten) override;
76 virtual unsigned int GetChannelBandwidthLimit(size_t i) override;
77 virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override;
78 virtual float GetChannelVoltageRange(size_t i, size_t stream) override;
79 virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override;
80 virtual float GetChannelOffset(size_t i, size_t stream) override;
81 virtual void SetChannelOffset(size_t i, size_t stream, float offset) override;
82
83 //Baseband timebase
84 virtual uint64_t GetSampleRate() override;
85 virtual void SetSampleRate(uint64_t rate) override;
86 virtual void SetTriggerOffset(int64_t offset) override;
87 virtual int64_t GetTriggerOffset() override;
88 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() override;
89 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
90 virtual bool CanInterleave() override;
91
92 //LO configuration
93 virtual void SetSpan(int64_t span) override;
94 virtual int64_t GetSpan() override;
95 virtual void SetCenterFrequency(size_t channel, int64_t freq) override;
96 virtual int64_t GetCenterFrequency(size_t channel) override;
97
98 //Instrument settings
99 virtual bool HasTimebaseControls() override;
100 virtual bool HasFrequencyControls() override;
101 virtual bool HasResolutionBandwidth() override;
102
103 //Triggering
104 virtual Oscilloscope::TriggerMode PollTrigger() override;
105 virtual bool AcquireData() override;
106 virtual OscilloscopeChannel* GetExternalTrigger() override;
107
109 // Logic analyzer configuration
110
111protected:
112 void IdentifyHardware();
113
114 std::string GetChannelColor(size_t i);
115
117 int64_t m_span;
118
121
122public:
123
124 static std::string GetDriverNameInternal();
125 SDR_INITPROC(UHDBridgeSDR)
126};
127
128#endif
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
Generic representation of an optical (UV-VIS-IR) spectrometer.
Definition: SCPISDR.h:43
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
UHDBridgeSDR - driver for talking to the scopehal-uhd-bridge daemon (uhdbridge)
Definition: UHDBridgeSDR.h:50
virtual void SetCenterFrequency(size_t channel, int64_t freq) override
Sets the center frequency for frequency-domain channels.
Definition: UHDBridgeSDR.cpp:274
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: UHDBridgeSDR.cpp:185
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: UHDBridgeSDR.cpp:200
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: UHDBridgeSDR.cpp:175
virtual bool AcquireData() override
Pull data from the instrument.
Definition: UHDBridgeSDR.cpp:362
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: UHDBridgeSDR.cpp:290
int64_t m_span
Frequency span of the acquisition, in Hz.
Definition: UHDBridgeSDR.h:117
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: UHDBridgeSDR.cpp:141
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: UHDBridgeSDR.cpp:316
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: UHDBridgeSDR.cpp:235
virtual bool CanInterleave() override
Returns true if we have no interleave conflicts, false if we have conflicts.
Definition: UHDBridgeSDR.cpp:258
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: UHDBridgeSDR.cpp:355
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: UHDBridgeSDR.cpp:190
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: UHDBridgeSDR.cpp:340
void IdentifyHardware()
Query the hardware to determine capabilities of the instrument.
Definition: UHDBridgeSDR.cpp:128
virtual bool HasFrequencyControls() override
Returns true if the instrument has at least one frequency-domain channel.
Definition: UHDBridgeSDR.cpp:159
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: UHDBridgeSDR.cpp:195
int64_t m_centerFreq
Center frequency for the downconverter, in Hz.
Definition: UHDBridgeSDR.h:120
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: UHDBridgeSDR.cpp:180
UHDBridgeSDR(SCPITransport *transport)
Constructs a new driver object.
Definition: UHDBridgeSDR.cpp:57
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: UHDBridgeSDR.cpp:210
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: UHDBridgeSDR.cpp:248
virtual bool HasResolutionBandwidth() override
Returns true if the instrument has a resolution bandwidth setting.
Definition: UHDBridgeSDR.cpp:253
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: UHDBridgeSDR.cpp:205
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: UHDBridgeSDR.cpp:350
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: UHDBridgeSDR.cpp:146
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: UHDBridgeSDR.cpp:225
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: UHDBridgeSDR.cpp:242
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: UHDBridgeSDR.cpp:345
virtual bool HasTimebaseControls() override
Returns true if the instrument has at least one time-domain channel.
Definition: UHDBridgeSDR.cpp:154
std::string GetChannelColor(size_t i)
Color the channels arbitrarily (yellow-cyan-magenta-green)
Definition: UHDBridgeSDR.cpp:106
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: UHDBridgeSDR.cpp:285
virtual int64_t GetCenterFrequency(size_t channel) override
Gets the center frequency for a frequency-domain channel.
Definition: UHDBridgeSDR.cpp:280
virtual void SetSpan(int64_t span) override
Sets the span for frequency-domain channels.
Definition: UHDBridgeSDR.cpp:263
static std::string GetDriverNameInternal()
Return the constant driver name string "uhdbridge".
Definition: UHDBridgeSDR.cpp:165
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: UHDBridgeSDR.cpp:170
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: UHDBridgeSDR.cpp:230
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: UHDBridgeSDR.cpp:215
virtual int64_t GetSpan() override
Gets the span for frequency-domain channels.
Definition: UHDBridgeSDR.cpp:269
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: UHDBridgeSDR.cpp:220