aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/Dexter.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-10-26 18:04:55 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-10-26 18:04:55 +0200
commitd2c8a1f40be73417964523e5a942d7d4c558e967 (patch)
treeab9335c6951e78b3bd953e4dd4edac4ade7b5ee9 /src/output/Dexter.h
parent8ce3fce9ed2fa7d2a0eb2d9e0c2a0fecdc0c2844 (diff)
downloaddabmod-d2c8a1f40be73417964523e5a942d7d4c558e967.tar.gz
dabmod-d2c8a1f40be73417964523e5a942d7d4c558e967.tar.bz2
dabmod-d2c8a1f40be73417964523e5a942d7d4c558e967.zip
Add dexter underflow thread, still problematic
Diffstat (limited to 'src/output/Dexter.h')
-rw-r--r--src/output/Dexter.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/output/Dexter.h b/src/output/Dexter.h
index 3e9c34f..a3c827b 100644
--- a/src/output/Dexter.h
+++ b/src/output/Dexter.h
@@ -40,6 +40,8 @@ DESCRIPTION:
#include <string>
#include <memory>
#include <ctime>
+#include <mutex>
+#include <thread>
#include "output/SDR.h"
#include "ModPlugin.h"
@@ -54,20 +56,20 @@ class Dexter : public Output::SDRDevice
Dexter(SDRDeviceConfig& config);
Dexter(const Dexter& other) = delete;
Dexter& operator=(const Dexter& other) = delete;
- ~Dexter();
+ virtual ~Dexter();
virtual void tune(double lo_offset, double frequency) override;
virtual double get_tx_freq(void) const override;
virtual void set_txgain(double txgain) override;
- virtual double get_txgain(void) const override;
+ virtual double get_txgain() const override;
virtual void set_bandwidth(double bandwidth) override;
- virtual double get_bandwidth(void) const override;
+ virtual double get_bandwidth() const override;
virtual void transmit_frame(const struct FrameData& frame) override;
- virtual RunStatistics get_run_statistics(void) const override;
- virtual double get_real_secs(void) const override;
+ virtual RunStatistics get_run_statistics() const override;
+ virtual double get_real_secs() const override;
virtual void set_rxgain(double rxgain) override;
- virtual double get_rxgain(void) const override;
+ virtual double get_rxgain() const override;
virtual size_t receive_frame(
complexf *buf,
size_t num_samples,
@@ -75,10 +77,10 @@ class Dexter : public Output::SDRDevice
double timeout_secs) override;
// Return true if GPS and reference clock inputs are ok
- virtual bool is_clk_source_ok(void) const override;
- virtual const char* device_name(void) const override;
+ virtual bool is_clk_source_ok() const override;
+ virtual const char* device_name() const override;
- virtual double get_temperature(void) const override;
+ virtual double get_temperature() const override;
private:
SDRDeviceConfig& m_conf;
@@ -90,10 +92,19 @@ class Dexter : public Output::SDRDevice
struct iio_channel* m_tx_channel = nullptr;
struct iio_buffer *m_buffer = nullptr;
+ /* Underflows are counted in a separate thread */
+ std::atomic<bool> m_running = ATOMIC_VAR_INIT(false);
+ std::thread m_underflow_read_thread;
+ void underflow_read_process();
+ mutable std::mutex m_underflows_mutex;
size_t underflows = 0;
+
+ size_t prev_underflows = 0;
size_t num_late = 0;
size_t num_frames_modulated = 0;
+ size_t num_buffers_pushed = 0;
+
uint64_t m_utc_seconds_at_startup;
uint64_t m_clock_count_at_startup = 0;
uint64_t m_clock_count_frame = 0;