GNU Radio's M2K Package
digital_in_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_DIGITAL_IN_SOURCE_IMPL_H
9#define INCLUDED_M2K_DIGITAL_IN_SOURCE_IMPL_H
10
12#include <libm2k/digital/m2kdigital.hpp>
13#include <mutex>
14#include <thread>
15#include <condition_variable>
16
17namespace gr {
18 namespace m2k {
19
21 {
22 private:
23 libm2k::digital::M2kDigital *d_digital;
24 const std::string d_uri;
25 int d_channel;
26
27 unsigned int d_timeout;
28 bool d_deinit;
29
30 unsigned int d_buffer_size;
31 unsigned int d_sample_index;
32 unsigned long d_items_in_buffer;
33 const unsigned short *d_raw_samples;
34 double d_data_rate;
35
36 pmt::pmt_t d_port_id;
37
38 std::mutex d_mutex;
39 std::condition_variable d_cond_wait;
40 std::thread d_refill_thread;
41 volatile bool d_empty_buffer{}, d_thread_stopped{};
42
43 public:
44 digital_in_source_impl(libm2k::context::M2k *context,
45 int buffer_size,
46 const int channel,
47 double sampling_frequency,
48 int kernel_buffers,
49 bool streaming,
50 bool deinit,
51 double data_rate);
52
54
56
57 int work(int noutput_items,
58 gr_vector_const_void_star &input_items,
59 gr_vector_void_star &output_items);
60
61 bool start() override;
62 bool stop() override;
63
64 void set_params(double sampling_frequency, bool streaming) override;
65
66 void set_data_rate(double data) override;
67
68 void set_timeout_ms(unsigned int timeout) override;
69
70 void set_buffer_size(int buffer_size);
71 };
72
73 } // namespace m2k
74} // namespace gr
75
76#endif /* INCLUDED_M2K_DIGITAL_IN_SOURCE_IMPL_H */
void set_params(double sampling_frequency, bool streaming) override
void set_buffer_size(int buffer_size)
void set_data_rate(double data) override
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
void set_timeout_ms(unsigned int timeout) override
digital_in_source_impl(libm2k::context::M2k *context, int buffer_size, const int channel, double sampling_frequency, int kernel_buffers, bool streaming, bool deinit, double data_rate)
Source for ADALM2000 with buffered output channels.
Definition digital_in_source.h:25
Definition adf4350_sink.h:15
Definition adf4350_sink.h:14