GNU Radio's LIMESDR Package
sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 Lime Microsystems <info@limemicro.com>
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_LIMESDR_SINK_H
22 #define INCLUDED_LIMESDR_SINK_H
23 
24 #include <gnuradio/sync_block.h>
25 #include <limesdr/api.h>
26 
27 namespace gr {
28 namespace limesdr {
29 class LIMESDR_API sink : virtual public gr::sync_block
30 {
31 public:
32  typedef boost::shared_ptr<sink> sptr;
33  /*!
34  * @brief Return a shared_ptr to a new instance of sink.
35  *
36  * To avoid accidental use of raw pointers, sink's
37  * constructor is private. limesdr::sink::make is the public
38  * interface for creating new instances.
39  *
40  * @param serial Device serial number. Cannot be left blank.
41  *
42  * @param channel_mode Channel and mode selection A(1), B(2), (A+B)MIMO(3).
43  *
44  * @param filename Path to file if file switch is turned on.
45  *
46  * @param length_tag_name Name of stream burst length tag
47  *
48  * @return a new limesdr sink block object
49  */
50  static sptr make(std::string serial,
51  int channel_mode,
52  const std::string& filename,
53  const std::string& length_tag_name);
54  /**
55  * Set center frequency
56  *
57  * @param freq Frequency to set in Hz
58  *
59  * @param chan Channel (not used)
60  *
61  * @return actual center frequency
62  */
63  virtual double set_center_freq(double freq, size_t chan = 0) = 0;
64 
65  /**
66  * Set which antenna is used
67  *
68  * @note setting antenna to BAND1 or BAND2 will enable PA path and because of that
69  * Lime boards will transmit CW signal, even when stream is stopped.
70  *
71  * @param antenna Antenna to set: None(0), BAND1(1), BAND(2), NONE(3), AUTO(255)
72  *
73  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
74  */
75  virtual void set_antenna(int antenna, int channel = 0) = 0;
76  /**
77  * Set NCO (numerically controlled oscillator).
78  * By selecting NCO frequency
79  * configure NCO. When NCO frequency is 0, NCO is off.
80  *
81  * @param nco_freq NCO frequency in Hz.
82  *
83  * @param channel Channel index.
84  */
85  virtual void set_nco(float nco_freq, int channel) = 0;
86  /**
87  * Set analog filters.
88  *
89  * @param analog_bandw Channel filter bandwidth in Hz.
90  *
91  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
92  *
93  * @return actual filter bandwidth in Hz
94  */
95  virtual double set_bandwidth(double analog_bandw, int channel = 0) = 0;
96  /**
97  * Set digital filters (GFIR).
98  *
99  * @param digital_bandw Channel filter bandwidth in Hz.
100  *
101  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
102  */
103  virtual void set_digital_filter(double digital_bandw, int channel) = 0;
104  /**
105  * Set the combined gain value in dB
106  *
107  * @note actual gain depends on LO frequency and analog LPF configuration and
108  * resulting output signal level may be different when those values are changed
109  *
110  * @param gain_dB Desired gain: [0,60]
111  *
112  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
113  *
114  * @return actual gain in dB
115  */
116  virtual unsigned set_gain(unsigned gain_dB, int channel = 0) = 0;
117  /**
118  * Set the same sample rate for both channels.
119  *
120  * @param rate Sample rate in S/s.
121  *
122  * @return actual sample rate in S/s
123  */
124  virtual double set_sample_rate(double rate) = 0;
125  /**
126  * Set oversampling for both channels.
127  *
128  * @param oversample Oversampling value (0 (default),1,2,4,8,16,32).
129  */
130  virtual void set_oversampling(int oversample) = 0;
131  /**
132  * Perform device calibration.
133  *
134  * @param bandw Set calibration bandwidth in Hz.
135  *
136  * @param channel Channel selection: A(LMS_CH_0),B(LMS_CH_1).
137  */
138  virtual void calibrate(double bandw, int channel = 0) = 0;
139  /**
140  * Set stream buffer size
141  *
142  * @param size FIFO buffer size in samples
143  */
144  virtual void set_buffer_size(uint32_t size) = 0;
145  /**
146  * Set TCXO DAC.
147  * @note Care must be taken as this parameter is returned to default value only after
148  * power off.
149  * @note LimeSDR-Mini default value is 180 range is [0,255]
150  * LimeSDR-USB default value is 125 range is [0,255]
151  * LimeSDR-PCIe default value is 134 range is [0,255]
152  * LimeNET-Micro default value is 30714 range is [0,65535]
153  *
154  * @param dacVal DAC value (0-65535)
155  */
156  virtual void set_tcxo_dac(uint16_t dacVal = 125) = 0;
157 };
158 } // namespace limesdr
159 } // namespace gr
160 
161 #endif
LIMESDR_API
#define LIMESDR_API
Definition: api.h:31
gr
Definition: sink.h:27
gr::limesdr::sink
Definition: sink.h:29
gr::limesdr::sink::sptr
boost::shared_ptr< sink > sptr
Definition: sink.h:32
api.h