GNU Radio's LIMESDR Package
source_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2018 Lime Microsystems info@limemicro.com
4 *
5 * GNU Radio 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 * GNU Radio 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 GNU Radio; 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_SOURCE_IMPL_H
22#define INCLUDED_LIMESDR_SOURCE_IMPL_H
23
25#include <limesdr/source.h>
26
27
28static const pmt::pmt_t TIME_TAG = pmt::string_to_symbol("rx_time");
29
30namespace gr {
31namespace limesdr {
32class source_impl : public source {
33 private:
34 lms_stream_t streamId[2];
35
36 bool stream_analyzer = false;
37
38 int source_block = 1;
39
40 bool add_tag = false;
41 uint32_t pktLoss = 0;
42
43 struct constant_data {
44 std::string serial;
45 int device_number;
46 int channel_mode;
47 double samp_rate = 10e6;
48 uint32_t FIFO_size = 0;
49 } stored;
50
51 std::chrono::high_resolution_clock::time_point t1, t2;
52
53 void print_stream_stats(lms_stream_status_t status);
54
55 void add_time_tag(int channel, lms_stream_meta_t meta);
56
57 public:
58 source_impl(std::string serial, int channel_mode, const std::string& filename);
60
61 int general_work(int noutput_items,
62 gr_vector_int& ninput_items,
63 gr_vector_const_void_star& input_items,
64 gr_vector_void_star& output_items);
65
66 bool start(void);
67
68 bool stop(void);
69
70 inline gr::io_signature::sptr args_to_io_signature(int channel_mode);
71
72 void init_stream(int device_number, int channel);
73 void release_stream(int device_number, lms_stream_t *stream);
74
75 double set_center_freq(double freq, size_t chan = 0);
76
77 void set_antenna(int antenna, int channel = 0);
78
79 void set_nco(float nco_freq, int channel = 0);
80
81 double set_bandwidth(double analog_bandw, int channel = 0);
82
83 void set_digital_filter(double digital_bandw, int channel = 0);
84
85 unsigned set_gain(unsigned gain_dB, int channel = 0);
86
87 double set_sample_rate(double rate);
88
89 void set_oversampling(int oversample);
90
91 void set_buffer_size(uint32_t size);
92
93 void calibrate(double bandw, int channel = 0);
94
95 void set_tcxo_dac(uint16_t dacVal = 125);
96};
97} // namespace limesdr
98} // namespace gr
99
100#endif
Definition source_impl.h:32
void release_stream(int device_number, lms_stream_t *stream)
gr::io_signature::sptr args_to_io_signature(int channel_mode)
double set_sample_rate(double rate)
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
double set_center_freq(double freq, size_t chan=0)
source_impl(std::string serial, int channel_mode, const std::string &filename)
void set_nco(float nco_freq, int channel=0)
void set_digital_filter(double digital_bandw, int channel=0)
void set_antenna(int antenna, int channel=0)
double set_bandwidth(double analog_bandw, int channel=0)
void calibrate(double bandw, int channel=0)
void init_stream(int device_number, int channel)
void set_oversampling(int oversample)
void set_buffer_size(uint32_t size)
unsigned set_gain(unsigned gain_dB, int channel=0)
void set_tcxo_dac(uint16_t dacVal=125)
Definition source.h:29
Definition rfe.h:29
static const pmt::pmt_t TIME_TAG
Definition source_impl.h:28