1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* -*- c++ -*- */
/*
* Copyright 2014 Analog Devices Inc.
* Author: Paul Cercueil <paul.cercueil@analog.com>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef INCLUDED_IIO_DEVICE_SINK_IMPL_H
#define INCLUDED_IIO_DEVICE_SINK_IMPL_H
#include <gnuradio/iio/device_sink.h>
#include <iio.h>
#include <string>
#include <vector>
namespace gr {
namespace iio {
class device_sink_impl : public device_sink
{
private:
void channel_write(const iio_channel* chn, const void* src, size_t len);
std::vector<tag_t> d_tags;
protected:
iio_context* ctx;
iio_device *dev, *phy;
iio_buffer* buf;
std::vector<iio_channel*> channel_list;
unsigned int interpolation;
unsigned int buffer_size;
bool destroy_ctx;
pmt::pmt_t d_len_tag_key;
public:
device_sink_impl(iio_context* ctx,
bool destroy_ctx,
const std::string& device,
const std::vector<std::string>& channels,
const std::string& device_phy,
const iio_param_vec_t& params,
unsigned int buffer_size = DEFAULT_BUFFER_SIZE,
unsigned int interpolation = 0,
bool cyclic = false);
~device_sink_impl();
void set_params(const iio_param_vec_t& params);
void set_len_tag_key(const std::string& len_tag_key) override;
// Where all the action really happens
int work(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
};
} // namespace iio
} // namespace gr
#endif /* INCLUDED_IIO_DEVICE_SINK_IMPL_H */
|