GNU Radio's M2K Package
mixed_signal_source_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2022 Analog Devices Inc..
4 *
5 * SPDX-License-Identifier: GPL-3.0-or-later
6 */
7
8#ifndef INCLUDED_M2K_MIXED_SIGNAL_SOURCE_IMPL_H
9#define INCLUDED_M2K_MIXED_SIGNAL_SOURCE_IMPL_H
10
12
13#include <libm2k/analog/m2kanalogin.hpp>
14#include <libm2k/digital/m2kdigital.hpp>
15#include <condition_variable>
16#include <thread>
17#include <vector>
18#include <ctype.h>
19#include <mutex>
20
21namespace gr {
22 namespace m2k {
23
25 {
26 public: // gr block api
27 mixed_signal_source_impl(libm2k::context::M2k *context, int buffer_size, double data_rate, int kb);
29
30 bool start() override;
31 bool stop() override;
32
33 int work(int noutput_items,
34 gr_vector_const_void_star &input_items,
35 gr_vector_void_star &output_items) override;
36
37 public: // mixed_signal_source api
38 void set_timeout_ms(unsigned int timeout) override;
39 void set_buffer_size(int buffer_size) override;
40 void set_data_rate(double rate) override;
41
42 private: // private methods
43 void restart();
44 void refill_buffer();
45
46 private:
47 libm2k::context::M2k *d_m2k_context;
48 libm2k::analog::M2kAnalogIn *d_analog_in;
49 libm2k::digital::M2kDigital *d_digital_in;
50
51 const short *d_analog_raw;
52 const unsigned short *d_digital_raw;
53
54 int d_timeout;
55 int d_buffer_size;
56 int d_items_in_buffer;
57 int d_current_index;
58 double d_data_rate;
59
60 int d_kernel_buffers;
61
62 pmt::pmt_t d_port_id;
63
64 std::mutex d_m2k_mutex;
65 std::condition_variable d_m2k_cond, d_m2k_cond2;
66 bool d_please_refill_buffer, d_thread_stopped;
67 std::thread d_refill_thd;
68
69 int d_current_captured_buffer;
70
71
72 };
73
74 } // namespace m2k
75} // namespace gr
76
77#endif /* INCLUDED_M2K_MIXED_SIGNAL_SOURCE_IMPL_H */
mixed_signal_source_impl(libm2k::context::M2k *context, int buffer_size, double data_rate, int kb)
void set_timeout_ms(unsigned int timeout) override
void set_data_rate(double rate) override
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
void set_buffer_size(int buffer_size) override
Definition mixed_signal_source.h:20
Definition adf4350_sink.h:15
Definition adf4350_sink.h:14