GNU Radio's IIO Package
eightbit_sink_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 Analog Devices Inc.
4  * Author: Paul Cercueil <paul.cercueil@analog.com>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this software; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef INCLUDED_IIO_EIGHTBIT_SINK_IMPL_H
23 #define INCLUDED_IIO_EIGHTBIT_SINK_IMPL_H
24 
25 #include <string>
26 #include <vector>
27 
28 #include <iio.h>
29 #include <iio/eightbit_sink.h>
30 
31 namespace gr {
32  namespace iio {
33 
35  {
36  private:
37  void channel_write(const struct iio_channel *chn,
38  const void *src, size_t len);
39 
40  protected:
41  struct iio_context *ctx;
42  struct iio_device *dev, *phy;
43  struct iio_buffer *buf;
44  std::vector <struct iio_channel *> channel_list;
45  unsigned int buffer_size;
46  unsigned int interpolation;
48 
49  public:
50  eightbit_sink_impl(struct iio_context *ctx, bool destroy_ctx,
51  const std::string &device,
52  const std::vector<std::string> &channels,
53  const std::string &device_phy,
54  const std::vector<std::string> &params,
55  unsigned int buffer_size = DEFAULT_BUFFER_SIZE,
56  unsigned int interpolation = 0,
57  bool cyclic = false);
59 
60  void set_params(const std::vector<std::string> &params);
61 
62  // Where all the action really happens
63  int work(int noutput_items,
64  gr_vector_const_void_star &input_items,
65  gr_vector_void_star &output_items);
66 
67  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
68  };
69 
70  } // namespace iio
71 } // namespace gr
72 
73 #endif /* INCLUDED_IIO_EIGHTBIT_SINK_IMPL_H */
struct iio_device * phy
Definition: eightbit_sink_impl.h:42
struct iio_context * ctx
Definition: eightbit_sink_impl.h:41
unsigned int buffer_size
Definition: eightbit_sink_impl.h:45
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
#define DEFAULT_BUFFER_SIZE
Definition: device_sink.h:29
unsigned int interpolation
Definition: eightbit_sink_impl.h:46
bool destroy_ctx
Definition: eightbit_sink_impl.h:47
void set_params(const std::vector< std::string > &params)
eightbit_sink_impl(struct iio_context *ctx, bool destroy_ctx, const std::string &device, const std::vector< std::string > &channels, const std::string &device_phy, const std::vector< std::string > &params, unsigned int buffer_size=DEFAULT_BUFFER_SIZE, unsigned int interpolation=0, bool cyclic=false)
struct iio_device * dev
Definition: eightbit_sink_impl.h:42
<+description of block+>
Definition: eightbit_sink.h:43
Definition: attr_sink.h:29
struct iio_buffer * buf
Definition: eightbit_sink_impl.h:43
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: eightbit_sink_impl.h:34
std::vector< struct iio_channel * > channel_list
Definition: eightbit_sink_impl.h:44