ngscopeclient 0.1-dev+51fbda87c
AntikernelLabsOscilloscope.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
36#ifndef AntikernelLabsOscilloscope_h
37#define AntikernelLabsOscilloscope_h
38
45{
46public:
49
50 //not copyable or assignable
52 AntikernelLabsOscilloscope& operator=(const AntikernelLabsOscilloscope& rhs) =delete;
53
54public:
55 //Device information
56 virtual unsigned int GetInstrumentTypes() const override;
57 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
58
59 virtual void FlushConfigCache() override;
60
61 //Channel configuration
62 virtual bool IsChannelEnabled(size_t i) override;
63 virtual void EnableChannel(size_t i) override;
64 virtual void DisableChannel(size_t i) override;
65 virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override;
66 virtual std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) override;
67 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override;
68 virtual double GetChannelAttenuation(size_t i) override;
69 virtual void SetChannelAttenuation(size_t i, double atten) override;
70 virtual unsigned int GetChannelBandwidthLimit(size_t i) override;
71 virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override;
72 virtual float GetChannelVoltageRange(size_t i, size_t stream) override;
73 virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override;
74 virtual OscilloscopeChannel* GetExternalTrigger() override;
75 virtual float GetChannelOffset(size_t i, size_t stream) override;
76 virtual void SetChannelOffset(size_t i, size_t stream, float offset) override;
77
78 //Triggering
79 virtual Oscilloscope::TriggerMode PollTrigger() override;
80 virtual bool AcquireData() override;
81 virtual void Start() override;
82 virtual void StartSingleTrigger() override;
83 virtual void Stop() override;
84 virtual void ForceTrigger() override;
85 virtual bool IsTriggerArmed() override;
86 virtual void PushTrigger() override;
87 virtual void PullTrigger() override;
88
89 //Timebase
90 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() override;
91 virtual std::vector<uint64_t> GetSampleRatesInterleaved() override;
92 virtual std::set<InterleaveConflict> GetInterleaveConflicts() override;
93 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
94 virtual std::vector<uint64_t> GetSampleDepthsInterleaved() override;
95 virtual uint64_t GetSampleRate() override;
96 virtual uint64_t GetSampleDepth() override;
97 virtual void SetSampleDepth(uint64_t depth) override;
98 virtual void SetSampleRate(uint64_t rate) override;
99 virtual void SetTriggerOffset(int64_t offset) override;
100 virtual int64_t GetTriggerOffset() override;
101 virtual bool IsInterleaving() override;
102 virtual bool SetInterleaving(bool combine) override;
103
104protected:
105 SCPITransport* m_waveformTransport;
106
107 //OscilloscopeChannel* m_extTrigChannel;
108
109 //hardware analog channel count, independent of LA option etc
110 unsigned int m_analogChannelCount;
111
112 //config cache
113 std::map<size_t, float> m_channelOffsets;
114 std::map<size_t, float> m_channelVoltageRanges;
115 /*
116 std::map<int, bool> m_channelsEnabled;
117 bool m_triggerChannelValid;
118 size_t m_triggerChannel;
119 bool m_triggerLevelValid;
120 float m_triggerLevel;
121
122 bool m_triggerArmed;
123 bool m_triggerOneShot;
124 */
125
126public:
127 static std::string GetDriverNameInternal();
128 OSCILLOSCOPE_INITPROC(AntikernelLabsOscilloscope)
129};
130
131#endif
Driver for experimental scopes, probably not useful to most people.
Definition: AntikernelLabsOscilloscope.h:45
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: AntikernelLabsOscilloscope.cpp:149
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:256
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: AntikernelLabsOscilloscope.cpp:538
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: AntikernelLabsOscilloscope.cpp:378
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: AntikernelLabsOscilloscope.cpp:487
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:232
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: AntikernelLabsOscilloscope.cpp:544
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition: AntikernelLabsOscilloscope.cpp:570
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: AntikernelLabsOscilloscope.cpp:144
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: AntikernelLabsOscilloscope.cpp:168
static std::string GetDriverNameInternal()
Return the constant driver name "aklabs".
Definition: AntikernelLabsOscilloscope.cpp:139
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:273
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: AntikernelLabsOscilloscope.cpp:345
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: AntikernelLabsOscilloscope.cpp:549
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition: AntikernelLabsOscilloscope.cpp:496
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition: AntikernelLabsOscilloscope.cpp:523
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: AntikernelLabsOscilloscope.cpp:309
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: AntikernelLabsOscilloscope.cpp:481
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: AntikernelLabsOscilloscope.cpp:157
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: AntikernelLabsOscilloscope.cpp:514
virtual void Stop() override
Stops triggering.
Definition: AntikernelLabsOscilloscope.cpp:466
AntikernelLabsOscilloscope(SCPITransport *transport)
Initialize the driver.
Definition: AntikernelLabsOscilloscope.cpp:52
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: AntikernelLabsOscilloscope.cpp:559
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: AntikernelLabsOscilloscope.cpp:202
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: AntikernelLabsOscilloscope.cpp:338
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: AntikernelLabsOscilloscope.cpp:575
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:221
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: AntikernelLabsOscilloscope.cpp:440
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: AntikernelLabsOscilloscope.cpp:366
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: AntikernelLabsOscilloscope.cpp:595
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:249
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition: AntikernelLabsOscilloscope.cpp:565
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: AntikernelLabsOscilloscope.cpp:453
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: AntikernelLabsOscilloscope.cpp:278
virtual bool AcquireData() override
Pull data from the instrument.
Definition: AntikernelLabsOscilloscope.cpp:385
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:227
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: AntikernelLabsOscilloscope.cpp:214
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: AntikernelLabsOscilloscope.cpp:532
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: AntikernelLabsOscilloscope.cpp:554
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: AntikernelLabsOscilloscope.cpp:476
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: AntikernelLabsOscilloscope.cpp:208
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
TriggerMode
Definition: Oscilloscope.h:411
An SCPI-based oscilloscope.
Definition: SCPIOscilloscope.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47