GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* Copyright 2012 Free Software Foundation, Inc. 00003 * 00004 * This file is part of GNU Radio 00005 * 00006 * GNU Radio is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3, or (at your option) 00009 * any later version. 00010 * 00011 * GNU Radio is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with GNU Radio; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 00023 #ifndef INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H 00024 #define INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H 00025 00026 #include <digital_api.h> 00027 #include <gr_tagged_stream_block.h> 00028 00029 class digital_ofdm_carrier_allocator_cvc; 00030 typedef boost::shared_ptr<digital_ofdm_carrier_allocator_cvc> digital_ofdm_carrier_allocator_cvc_sptr; 00031 00032 /* 00033 * \param occupied_carriers A vector of vectors of indexes. Example: if 00034 * occupied_carriers = ((1, 2, 3), (1, 2, 4)), the first 00035 * three input symbols will be mapped to carriers 1, 2 00036 * and 3. After that, a new OFDM symbol is started. The next 00037 * three input symbols will be placed onto carriers 1, 2 00038 * and 4 of the second OFDM symbol. The allocation then 00039 * starts from the beginning. 00040 * Order matters! The first input symbol is always mapped 00041 * onto occupied_carriers[0][0]. 00042 * \param pilot_carriers The position of the pilot symbols. Same as occupied_carriers, 00043 * but the actual symbols are taken from pilot_symbols instead 00044 * of the input stream. 00045 * \param pilot_symbols The pilot symbols which are placed onto the pilot carriers. 00046 * pilot_symbols[0][0] is placed onto the first OFDM symbol, on 00047 * carrier index pilot_carriers[0][0] etc. 00048 * \param len_tag_key The key of the tag identifying the length of the input packet. 00049 */ 00050 DIGITAL_API digital_ofdm_carrier_allocator_cvc_sptr 00051 digital_make_ofdm_carrier_allocator_cvc ( 00052 int fft_len, 00053 const std::vector<std::vector<int> > &occupied_carriers, 00054 const std::vector<std::vector<int> > &pilot_carriers, 00055 const std::vector<std::vector<gr_complex> > &pilot_symbols, 00056 const std::string &len_tag_key = "packet_len"); 00057 00058 /*! 00059 * \brief Create frequency domain OFDM symbols from complex values, add pilots. 00060 * \ingroup ofdm_blk 00061 * 00062 * This block turns a stream of complex, scalar modulation symbols into vectors 00063 * which are the input for an IFFT in an OFDM transmitter. It also supports the 00064 * possibility of placing pilot symbols onto the carriers. 00065 * 00066 * The carriers can be allocated freely, if a carrier is not allocated, it is set 00067 * to zero. This allows doing OFDMA-style carrier allocations. 00068 * 00069 * Input: A tagged stream of complex scalars. The first item must have a tag 00070 * containing the number of complex symbols in this frame. 00071 * Output: A tagged stream of complex vectors of length fft_len. This can directly 00072 * be connected to an FFT block. Make sure to set this block to 'reverse' 00073 * for the IFFT and to deactivate FFT shifting. 00074 * 00075 * Carrier indexes are always such that index 0 is the DC carrier (note: you should 00076 * not allocate this carrier). The carriers below the DC carrier are either indexed 00077 * with negative numbers, or with indexes larger than fft_len/2. Index -1 and index 00078 * fft_len-1 both identify the carrier below the DC carrier. 00079 * 00080 */ 00081 class DIGITAL_API digital_ofdm_carrier_allocator_cvc : public gr_tagged_stream_block 00082 { 00083 private: 00084 friend DIGITAL_API digital_ofdm_carrier_allocator_cvc_sptr digital_make_ofdm_carrier_allocator_cvc (int fft_len, const std::vector<std::vector<int> > &occupied_carriers, const std::vector<std::vector<int> > &pilot_carriers, const std::vector<std::vector<gr_complex> > &pilot_symbols, const std::string &len_tag_key); 00085 00086 digital_ofdm_carrier_allocator_cvc(int fft_len, const std::vector<std::vector<int> > &occupied_carriers, const std::vector<std::vector<int> > &pilot_carriers, const std::vector<std::vector<gr_complex> > &pilot_symbols, const std::string &len_tag_key); 00087 00088 //! FFT length 00089 const int d_fft_len; 00090 //! Which carriers/symbols carry data 00091 std::vector<std::vector<int> > d_occupied_carriers; 00092 //! Which carriers/symbols carry pilots symbols 00093 std::vector<std::vector<int> > d_pilot_carriers; 00094 //! Value of said pilot symbols 00095 const std::vector<std::vector<gr_complex> > d_pilot_symbols; 00096 int d_symbols_per_set; 00097 00098 protected: 00099 int calculate_output_stream_length(const gr_vector_int &ninput_items); 00100 00101 public: 00102 ~digital_ofdm_carrier_allocator_cvc(); 00103 00104 std::string len_tag_key() { return d_length_tag_key_str; }; 00105 00106 const int fft_len() { return d_fft_len; }; 00107 std::vector<std::vector<int> > occupied_carriers() { return d_occupied_carriers; }; 00108 00109 int work (int noutput_items, 00110 gr_vector_int &ninput_items, 00111 gr_vector_const_void_star &input_items, 00112 gr_vector_void_star &output_items); 00113 }; 00114 00115 #endif /* INCLUDED_DIGITAL_OFDM_CARRIER_ALLOCATOR_CVC_H */ 00116