GNU Radio C++ API Reference  gcd20ee2
The Free & Open Software Radio Ecosystem
rfnoc_fft.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 Ettus Research, a National Instruments Brand.
4  * Copyright 2020 Free Software Foundation, Inc.
5  *
6  * SPDX-License-Identifier: GPL-3.0-or-later
7  */
8 
9 #ifndef INCLUDED_GR_UHD_RFNOC_FFT_H
10 #define INCLUDED_GR_UHD_RFNOC_FFT_H
11 
12 #include <gnuradio/uhd/api.h>
14 #include <vector>
15 
16 namespace gr {
17 namespace uhd {
18 
19 /*! RFNoC FFT Block
20  *
21  * \ingroup uhd_blk
22  */
23 class GR_UHD_API rfnoc_fft : virtual public rfnoc_block
24 {
25 public:
26  typedef std::shared_ptr<rfnoc_fft> sptr;
27 
28  enum class fft_shift { NORMAL, REVERSE, NATURAL, BIT_REVERSE };
29  enum class fft_direction { REVERSE, FORWARD };
30  enum class fft_magnitude { COMPLEX, MAGNITUDE, MAGNITUDE_SQUARED };
31 
32  /*!
33  * \param graph Reference to the rfnoc_graph object this block is attached to
34  * \param block_args Additional block arguments
35  * \param device_select Device Selection
36  * \param instance Instance Selection
37  */
38  static sptr make(rfnoc_graph::sptr graph,
39  const ::uhd::device_addr_t& block_args,
40  const int device_select,
41  const int instance);
42 
43  /*! Set the FFT direction
44  *
45  * \param direction FFT direction
46  */
47  virtual void set_direction(const fft_direction direction) = 0;
48 
49  /*! Set the FFT direction using a string
50  *
51  * \param direction The FFT direction to choose ["REVERSE", "FORWARD"];
52  */
53  virtual void set_direction(const std::string& direction) = 0;
54 
55  /*! Get the FFT direction
56  *
57  * \returns The current FFT direction as a string
58  */
59  virtual std::string get_direction_string() const = 0;
60 
61  /*! Get the FFT direction
62  *
63  * \returns FFT direction
64  */
65  virtual fft_direction get_direction() const = 0;
66 
67  /*! Set the format of the returned FFT output data
68  *
69  * \param magnitude Format of the returned FFT output data
70  */
71  virtual void set_magnitude(const fft_magnitude magnitude) = 0;
72 
73  /*! Set the magnitude using a string
74  *
75  * \param magnitude The magnitude to choose ["COMPLEX", "MAGNITUDE",
76  * "MAGNITUDE_SQUARED"]
77  */
78  virtual void set_magnitude(const std::string& magnitude) = 0;
79 
80  /*! Get the FFT magnitude
81  *
82  * \returns The current FFT magnitude as a string
83  */
84  virtual std::string get_magnitude_string() const = 0;
85 
86  /*! Get the format of the returned FFT output data
87  *
88  * \returns Format of the returned FFT output data
89  */
90  virtual fft_magnitude get_magnitude() const = 0;
91 
92  /*! Set the shift configuration of the output FFT data
93  *
94  * \param shift Configuration for shifting FFT output data
95  */
96  virtual void set_shift_config(const fft_shift shift) = 0;
97 
98  /*! Set the shift configuration of the output FFT data using a string
99  *
100  * \param shift The shift configuration to choose ["NORMAL", "REVERSE", "NATURAL",
101  * "BIT_REVERSE"]
102  */
103  virtual void set_shift_config(const std::string& shift) = 0;
104 
105  /*! Get the shift configuration of the output FFT data
106  *
107  * \returns The current shift configuration of the output FFT data as a string
108  */
109  virtual std::string get_shift_config_string() const = 0;
110 
111  /*! Get the shift configuration of the output FFT data
112  *
113  * \returns Shift configuration of the output FFT data
114  */
115  virtual fft_shift get_shift_config() const = 0;
116 
117  /*! Set the scaling factor for the FFT block
118  *
119  * \param factor Desired scaling factor
120  */
121  virtual void set_scaling_factor(const double factor) = 0;
122 
123  /*! Set the scaling schedule for the FFT block
124  *
125  * \param scaling Scaling schedule for the FFT block
126  */
127  virtual void set_scaling(const uint32_t scaling) = 0;
128 
129  /*! Get the scaling schedule for the FFT block
130  *
131  * \returns Scaling schedule for the FFT block
132  */
133  virtual uint32_t get_scaling() const = 0;
134 
135  /*! Set the length of the FFT
136  *
137  * \param length Desired FFT length
138  */
139  virtual void set_length(const uint32_t length) = 0;
140 
141  /*! Get the length of the FFT
142  *
143  * \returns Current FFT length
144  */
145  virtual uint32_t get_length() const = 0;
146 
147  /*! Set the bypass mode of the FFT
148  *
149  * \param bypass FFT bypass moe
150  */
151  virtual void set_bypass_mode(const bool bypass) = 0;
152 
153  /*! Get the bypass mode of the FFT
154  *
155  * \returns Current FFT bypass mode
156  */
157  virtual bool get_bypass_mode() const = 0;
158 
159  /*! Get the number of items per clock cycle (NIPC)
160  *
161  * \returns NIPC
162  */
163  virtual uint32_t get_nipc() const = 0;
164 
165  /*! Get the maximum supported length of the FFT
166  *
167  * \returns Maximum supported FFT length
168  */
169  virtual uint32_t get_max_length() const = 0;
170 
171  /*! Get the maximum supported cyclic prefix length
172  *
173  * \returns Maximum supported cyclic prefix length
174  */
175  virtual uint32_t get_max_cp_length() const = 0;
176 
177  /*! Get the maximum supported number of values that can be written to the
178  * cyclic prefix removal list
179  *
180  * \returns Maximum number of values for the cyclic prefix removal list
181  */
182  virtual uint32_t get_max_cp_removal_list_length() const = 0;
183 
184  /*! Get the maximum supported number of values that can be written to the
185  * cyclic prefix insertion list
186  *
187  * \returns Maximum number of values for the cyclic prefix insertion list
188  */
189  virtual uint32_t get_max_cp_insertion_list_length() const = 0;
190 
191  /*! Load values to the cyclic prefix insertion list.
192  *
193  * \param cp_lengths The cyclic prefix lengths to be written to the list
194  */
195  virtual void set_cp_insertion_list(const std::vector<uint32_t> cp_lengths) = 0;
196 
197  /*! Gets the values from the cyclic prefix insertion list.
198  *
199  * \returns The cyclic prefix insertion list
200  */
201  virtual std::vector<uint32_t> get_cp_insertion_list() const = 0;
202 
203  /*! Load values to the cyclic prefix removal list.
204  *
205  * \param cp_lengths The cyclic prefix lengths to be written to the list
206  */
207  virtual void set_cp_removal_list(const std::vector<uint32_t> cp_lengths) = 0;
208 
209  /*! Gets the values from the cyclic prefix removal list.
210  *
211  * \returns The cyclic prefix removal list
212  */
213  virtual std::vector<uint32_t> get_cp_removal_list() const = 0;
214 };
215 
216 } // namespace uhd
217 } // namespace gr
218 
219 #endif /* INCLUDED_GR_UHD_RFNOC_FFT_H */
Definition: rfnoc_block.h:29
std::shared_ptr< rfnoc_block > sptr
Definition: rfnoc_block.h:37
Definition: rfnoc_fft.h:24
virtual fft_shift get_shift_config() const =0
fft_magnitude
Definition: rfnoc_fft.h:30
virtual uint32_t get_nipc() const =0
virtual void set_cp_removal_list(const std::vector< uint32_t > cp_lengths)=0
virtual void set_cp_insertion_list(const std::vector< uint32_t > cp_lengths)=0
virtual uint32_t get_max_length() const =0
fft_shift
Definition: rfnoc_fft.h:28
virtual std::vector< uint32_t > get_cp_removal_list() const =0
virtual uint32_t get_max_cp_insertion_list_length() const =0
virtual void set_length(const uint32_t length)=0
virtual uint32_t get_length() const =0
virtual void set_direction(const std::string &direction)=0
virtual std::vector< uint32_t > get_cp_insertion_list() const =0
virtual void set_shift_config(const fft_shift shift)=0
virtual void set_shift_config(const std::string &shift)=0
virtual void set_bypass_mode(const bool bypass)=0
virtual std::string get_direction_string() const =0
virtual void set_scaling(const uint32_t scaling)=0
virtual void set_magnitude(const std::string &magnitude)=0
virtual uint32_t get_scaling() const =0
virtual std::string get_shift_config_string() const =0
virtual void set_scaling_factor(const double factor)=0
virtual uint32_t get_max_cp_removal_list_length() const =0
virtual void set_magnitude(const fft_magnitude magnitude)=0
fft_direction
Definition: rfnoc_fft.h:29
virtual bool get_bypass_mode() const =0
virtual uint32_t get_max_cp_length() const =0
virtual void set_direction(const fft_direction direction)=0
virtual std::string get_magnitude_string() const =0
virtual fft_direction get_direction() const =0
virtual fft_magnitude get_magnitude() const =0
std::shared_ptr< rfnoc_fft > sptr
Definition: rfnoc_fft.h:26
static sptr make(rfnoc_graph::sptr graph, const ::uhd::device_addr_t &block_args, const int device_select, const int instance)
std::shared_ptr< rfnoc_graph > sptr
Definition: rfnoc_graph.h:32
#define GR_UHD_API
Definition: gr-uhd/include/gnuradio/uhd/api.h:18
@ COMPLEX
Definition: qtgui_types.h:26
GNU Radio logging wrapper.
Definition: basic_block.h:29
PMT_API size_t length(const pmt_t &v)
Return the number of elements in v.