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