ngscopeclient 0.1-dev+51fbda87c
AntikernelLogicAnalyzer.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 AntikernelLogicAnalyzer_h
38#define AntikernelLogicAnalyzer_h
39
46 : public virtual Oscilloscope
47 , public SCPIInstrument
48{
49public:
52
53 //not copyable or assignable
55 AntikernelLogicAnalyzer& operator=(const AntikernelLogicAnalyzer& rhs) =delete;
56
57 virtual std::string IDPing() override;
58
59 virtual std::string GetTransportConnectionString() override;
60 virtual std::string GetTransportName() override;
61
62 virtual std::string GetName() const override;
63 virtual std::string GetVendor() const override;
64 virtual std::string GetSerial() const override;
65 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const 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 std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) override;
73 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) 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 OscilloscopeChannel* GetExternalTrigger() override;
81 virtual float GetChannelOffset(size_t i, size_t stream) override;
82 virtual void SetChannelOffset(size_t i, size_t stream, float offset) override;
83
84 //Triggering
85 virtual Oscilloscope::TriggerMode PollTrigger() override;
86 virtual bool AcquireData() override;
87 virtual void Start() override;
88 virtual void StartSingleTrigger() override;
89 virtual void Stop() override;
90 virtual void ForceTrigger() override;
91
92 virtual bool IsTriggerArmed() override;
93 virtual void PushTrigger() override;
94 virtual void PullTrigger() override;
95
96 //Timebase
97 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() override;
98 virtual std::vector<uint64_t> GetSampleRatesInterleaved() override;
99 virtual std::set<InterleaveConflict> GetInterleaveConflicts() override;
100 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
101 virtual std::vector<uint64_t> GetSampleDepthsInterleaved() override;
102 virtual uint64_t GetSampleRate() override;
103 virtual uint64_t GetSampleDepth() override;
104 virtual void SetSampleDepth(uint64_t depth) override;
105 virtual void SetSampleRate(uint64_t rate) override;
106 virtual void SetTriggerOffset(int64_t offset) override;
107 virtual int64_t GetTriggerOffset() override;
108 virtual bool IsInterleaving() override;
109 virtual bool SetInterleaving(bool combine) override;
110
111 virtual unsigned int GetInstrumentTypes() const override;
112
113protected:
114 void LoadChannels();
115
116 void SendCommand(uint8_t opcode);
117 void SendCommand(uint8_t opcode, uint8_t chan);
118 void SendCommand(uint8_t opcode, uint8_t chan, uint8_t arg);
119 uint8_t Read1ByteReply();
120
121 void ArmTrigger();
122
123 bool m_triggerArmed;
124 bool m_triggerOneShot;
125
126 std::vector<size_t> m_lowIndexes;
127 std::vector<size_t> m_highIndexes;
128
129 uint32_t m_samplePeriod;
130 uint32_t m_memoryDepth;
131 uint32_t m_memoryWidth;
132 uint32_t m_maxWidth;
133
134public:
135 static std::string GetDriverNameInternal();
136 OSCILLOSCOPE_INITPROC(AntikernelLogicAnalyzer);
137};
138
139#endif
140
Driver for Antikernel Labs FPGA logic analyzer core (WIP)
Definition: AntikernelLogicAnalyzer.h:48
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: AntikernelLogicAnalyzer.cpp:154
virtual std::string IDPing() override
Returns the instrument's identification string.
Definition: AntikernelLogicAnalyzer.cpp:107
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:509
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition: AntikernelLogicAnalyzer.cpp:556
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: AntikernelLogicAnalyzer.cpp:600
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: AntikernelLogicAnalyzer.cpp:445
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: AntikernelLogicAnalyzer.cpp:439
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: AntikernelLogicAnalyzer.cpp:477
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:504
AntikernelLogicAnalyzer(SCPITransport *transport)
Connects to a UART and reads the stuff off it.
Definition: AntikernelLogicAnalyzer.cpp:72
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: AntikernelLogicAnalyzer.cpp:590
virtual std::string GetTransportConnectionString() override
Gets the connection string for our transport.
Definition: AntikernelLogicAnalyzer.cpp:120
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: AntikernelLogicAnalyzer.cpp:646
virtual bool AcquireData() override
Pull data from the instrument.
Definition: AntikernelLogicAnalyzer.cpp:299
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: AntikernelLogicAnalyzer.cpp:472
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: AntikernelLogicAnalyzer.cpp:524
virtual void Stop() override
Stops triggering.
Definition: AntikernelLogicAnalyzer.cpp:451
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:494
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: AntikernelLogicAnalyzer.cpp:278
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: AntikernelLogicAnalyzer.cpp:549
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: AntikernelLogicAnalyzer.cpp:570
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition: AntikernelLogicAnalyzer.cpp:577
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: AntikernelLogicAnalyzer.cpp:595
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:519
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: AntikernelLogicAnalyzer.cpp:159
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: AntikernelLogicAnalyzer.cpp:539
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: AntikernelLogicAnalyzer.cpp:626
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: AntikernelLogicAnalyzer.cpp:584
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: AntikernelLogicAnalyzer.cpp:534
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: AntikernelLogicAnalyzer.cpp:459
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: AntikernelLogicAnalyzer.cpp:610
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition: AntikernelLogicAnalyzer.cpp:616
virtual std::string GetTransportName() override
Gets the name of our transport.
Definition: AntikernelLogicAnalyzer.cpp:115
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:487
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: AntikernelLogicAnalyzer.cpp:544
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: AntikernelLogicAnalyzer.cpp:464
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: AntikernelLogicAnalyzer.cpp:482
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition: AntikernelLogicAnalyzer.cpp:621
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: AntikernelLogicAnalyzer.cpp:605
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:514
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: AntikernelLogicAnalyzer.cpp:529
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: AntikernelLogicAnalyzer.cpp:499
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition: Oscilloscope.h:50
TriggerMode
Definition: Oscilloscope.h:411
An SCPI-based oscilloscope.
Definition: SCPIInstrument.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47