diff options
Diffstat (limited to 'gr-digital/include')
-rw-r--r-- | gr-digital/include/CMakeLists.txt | 6 | ||||
-rw-r--r-- | gr-digital/include/Makefile.am | 6 | ||||
-rw-r--r-- | gr-digital/include/digital_clock_recovery_mm_cc.h | 9 | ||||
-rw-r--r-- | gr-digital/include/digital_ofdm_cyclic_prefixer.h | 59 | ||||
-rw-r--r-- | gr-digital/include/digital_ofdm_frame_acquisition.h | 116 | ||||
-rw-r--r-- | gr-digital/include/digital_ofdm_frame_sink.h | 127 | ||||
-rw-r--r-- | gr-digital/include/digital_ofdm_insert_preamble.h | 105 | ||||
-rw-r--r-- | gr-digital/include/digital_ofdm_mapper_bcv.h | 88 | ||||
-rw-r--r-- | gr-digital/include/digital_ofdm_sampler.h | 68 |
9 files changed, 581 insertions, 3 deletions
diff --git a/gr-digital/include/CMakeLists.txt b/gr-digital/include/CMakeLists.txt index f5d4d76b6..cf20bd1e7 100644 --- a/gr-digital/include/CMakeLists.txt +++ b/gr-digital/include/CMakeLists.txt @@ -37,6 +37,12 @@ install(FILES digital_kurtotic_equalizer_cc.h digital_metric_type.h digital_mpsk_receiver_cc.h + digital_ofdm_cyclic_prefixer.h + digital_ofdm_frame_acquisition.h + digital_ofdm_frame_sink.h + digital_ofdm_insert_preamble.h + digital_ofdm_mapper_bcv.h + digital_ofdm_sampler.h digital_gmskmod_bc.h digital_cpmmod_bc.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio diff --git a/gr-digital/include/Makefile.am b/gr-digital/include/Makefile.am index 346d036ce..8ce3a94e8 100644 --- a/gr-digital/include/Makefile.am +++ b/gr-digital/include/Makefile.am @@ -39,6 +39,12 @@ grinclude_HEADERS = \ digital_kurtotic_equalizer_cc.h \ digital_metric_type.h \ digital_mpsk_receiver_cc.h \ + digital_ofdm_cyclic_prefixer.h \ + digital_ofdm_frame_acquisition.h \ + digital_ofdm_frame_sink.h \ + digital_ofdm_insert_preamble.h \ + digital_ofdm_mapper_bcv.h \ + digital_ofdm_sampler.h \ digital_gmskmod_bc.h \ digital_cpmmod_bc.h diff --git a/gr-digital/include/digital_clock_recovery_mm_cc.h b/gr-digital/include/digital_clock_recovery_mm_cc.h index f8d973765..a2577d537 100644 --- a/gr-digital/include/digital_clock_recovery_mm_cc.h +++ b/gr-digital/include/digital_clock_recovery_mm_cc.h @@ -44,12 +44,15 @@ digital_make_clock_recovery_mm_cc (float omega, float gain_omega, * \ingroup sync_blk * \ingroup digital * - * This implements the Mueller and Müller (M&M) discrete-time error-tracking synchronizer. + * This implements the Mueller and Müller (M&M) discrete-time + * error-tracking synchronizer. + * * The complex version here is based on: * Modified Mueller and Muller clock recovery circuit * Based: - * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller and Muller - * algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033. + * G. R. Danesfahani, T.G. Jeans, "Optimisation of modified Mueller + * and Muller algorithm," Electronics Letters, Vol. 31, no. 13, 22 + * June 1995, pp. 1032 - 1033. */ class DIGITAL_API digital_clock_recovery_mm_cc : public gr_block { diff --git a/gr-digital/include/digital_ofdm_cyclic_prefixer.h b/gr-digital/include/digital_ofdm_cyclic_prefixer.h new file mode 100644 index 000000000..1b9682bb3 --- /dev/null +++ b/gr-digital/include/digital_ofdm_cyclic_prefixer.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004-2006,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H +#define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H + +#include <digital_api.h> +#include <gr_sync_interpolator.h> +#include <stdio.h> + +class digital_ofdm_cyclic_prefixer; +typedef boost::shared_ptr<digital_ofdm_cyclic_prefixer> digital_ofdm_cyclic_prefixer_sptr; + +DIGITAL_API digital_ofdm_cyclic_prefixer_sptr +digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); + + +/*! + * \brief adds a cyclic prefix vector to an input size long ofdm + * symbol(vector) and converts vector to a stream output_size long. + * \ingroup ofdm_blk + */ +class DIGITAL_API digital_ofdm_cyclic_prefixer : public gr_sync_interpolator +{ + friend DIGITAL_API digital_ofdm_cyclic_prefixer_sptr + digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); + + protected: + digital_ofdm_cyclic_prefixer (size_t input_size, size_t output_size); + + public: + int work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + private: + size_t d_input_size; + size_t d_output_size; +}; + +#endif /* INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H */ diff --git a/gr-digital/include/digital_ofdm_frame_acquisition.h b/gr-digital/include/digital_ofdm_frame_acquisition.h new file mode 100644 index 000000000..9c2f60233 --- /dev/null +++ b/gr-digital/include/digital_ofdm_frame_acquisition.h @@ -0,0 +1,116 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H +#define INCLUDED_DIGITAL_OFDM_FRAME_ACQUISITION_H + +#include <digital_api.h> +#include <gr_block.h> +#include <vector> + +class digital_ofdm_frame_acquisition; +typedef boost::shared_ptr<digital_ofdm_frame_acquisition> digital_ofdm_frame_acquisition_sptr; + +digital_ofdm_frame_acquisition_sptr +DIGITAL_API digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, + unsigned int cplen, + const std::vector<gr_complex> &known_symbol, + unsigned int max_fft_shift_len=10); + +/*! + * \brief take a vector of complex constellation points in from an FFT + * and performs a correlation and equalization. + * \ingroup demodulation_blk + * \ingroup ofdm_blk + * + * This block takes the output of an FFT of a received OFDM symbol and finds the + * start of a frame based on two known symbols. It also looks at the surrounding + * bins in the FFT output for the correlation in case there is a large frequency + * shift in the data. This block assumes that the fine frequency shift has already + * been corrected and that the samples fall in the middle of one FFT bin. + * + * It then uses one of those known + * symbols to estimate the channel response over all subcarriers and does a simple + * 1-tap equalization on all subcarriers. This corrects for the phase and amplitude + * distortion caused by the channel. + */ + +class DIGITAL_API digital_ofdm_frame_acquisition : public gr_block +{ + /*! + * \brief Build an OFDM correlator and equalizer. + * \param occupied_carriers The number of subcarriers with data in the received symbol + * \param fft_length The size of the FFT vector (occupied_carriers + unused carriers) + * \param cplen The length of the cycle prefix + * \param known_symbol A vector of complex numbers representing a known symbol at the + * start of a frame (usually a BPSK PN sequence) + * \param max_fft_shift_len Set's the maximum distance you can look between bins for correlation + */ + friend DIGITAL_API digital_ofdm_frame_acquisition_sptr + digital_make_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, + unsigned int cplen, + const std::vector<gr_complex> &known_symbol, + unsigned int max_fft_shift_len); + +protected: + digital_ofdm_frame_acquisition (unsigned int occupied_carriers, unsigned int fft_length, + unsigned int cplen, + const std::vector<gr_complex> &known_symbol, + unsigned int max_fft_shift_len); + + private: + unsigned char slicer(gr_complex x); + void correlate(const gr_complex *symbol, int zeros_on_left); + void calculate_equalizer(const gr_complex *symbol, int zeros_on_left); + gr_complex coarse_freq_comp(int freq_delta, int count); + + unsigned int d_occupied_carriers; // !< \brief number of subcarriers with data + unsigned int d_fft_length; // !< \brief length of FFT vector + unsigned int d_cplen; // !< \brief length of cyclic prefix in samples + unsigned int d_freq_shift_len; // !< \brief number of surrounding bins to look at for correlation + std::vector<gr_complex> d_known_symbol; // !< \brief known symbols at start of frame + std::vector<float> d_known_phase_diff; // !< \brief factor used in correlation from known symbol + std::vector<float> d_symbol_phase_diff; // !< \brief factor used in correlation from received symbol + std::vector<gr_complex> d_hestimate; // !< channel estimate + int d_coarse_freq; // !< \brief search distance in number of bins + unsigned int d_phase_count; // !< \brief accumulator for coarse freq correction + float d_snr_est; // !< an estimation of the signal to noise ratio + + gr_complex *d_phase_lut; // !< look-up table for coarse frequency compensation + + void forecast(int noutput_items, gr_vector_int &ninput_items_required); + + public: + /*! + * \brief Return an estimate of the SNR of the channel + */ + float snr() { return d_snr_est; } + + ~digital_ofdm_frame_acquisition(void); + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + + +#endif diff --git a/gr-digital/include/digital_ofdm_frame_sink.h b/gr-digital/include/digital_ofdm_frame_sink.h new file mode 100644 index 000000000..5785d4be7 --- /dev/null +++ b/gr-digital/include/digital_ofdm_frame_sink.h @@ -0,0 +1,127 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_OFDM_FRAME_SINK_H +#define INCLUDED_DIGITAL_OFDM_FRAME_SINK_H + +#include <digital_api.h> +#include <gr_sync_block.h> +#include <gr_msg_queue.h> + +class digital_ofdm_frame_sink; +typedef boost::shared_ptr<digital_ofdm_frame_sink> digital_ofdm_frame_sink_sptr; + +DIGITAL_API digital_ofdm_frame_sink_sptr +digital_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out, + gr_msg_queue_sptr target_queue, unsigned int occupied_tones, + float phase_gain=0.25, float freq_gain=0.25*0.25/4.0); + +/*! + * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs + * them into packets, and sends to to a message queue sink. + * \ingroup sink_blk + * \ingroup ofdm_blk + * + * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually, + * we want to be able to pass in a reference to an object to do the demapping and slicing + * for a given modulation type. + */ +class DIGITAL_API digital_ofdm_frame_sink : public gr_sync_block +{ + friend DIGITAL_API digital_ofdm_frame_sink_sptr + digital_make_ofdm_frame_sink (const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out, + gr_msg_queue_sptr target_queue, unsigned int occupied_tones, + float phase_gain, float freq_gain); + + private: + enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; + + static const int MAX_PKT_LEN = 4096; + static const int HEADERBYTELEN = 4; + + gr_msg_queue_sptr d_target_queue; // where to send the packet when received + state_t d_state; + unsigned int d_header; // header bits + int d_headerbytelen_cnt; // how many so far + + unsigned char *d_bytes_out; // hold the current bytes produced by the demapper + + unsigned int d_occupied_carriers; + unsigned int d_byte_offset; + unsigned int d_partial_byte; + + unsigned char d_packet[MAX_PKT_LEN]; // assembled payload + int d_packetlen; // length of packet + int d_packet_whitener_offset; // offset into whitener string to use + int d_packetlen_cnt; // how many so far + + gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out + + std::vector<gr_complex> d_sym_position; + std::vector<unsigned char> d_sym_value_out; + std::vector<gr_complex> d_dfe; + unsigned int d_nbits; + + unsigned char d_resid; + unsigned int d_nresid; + float d_phase; + float d_freq; + float d_phase_gain; + float d_freq_gain; + float d_eq_gain; + + std::vector<int> d_subcarrier_map; + + protected: + digital_ofdm_frame_sink(const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out, + gr_msg_queue_sptr target_queue, unsigned int occupied_tones, + float phase_gain, float freq_gain); + + void enter_search(); + void enter_have_sync(); + void enter_have_header(); + + bool header_ok() + { + // confirm that two copies of header info are identical + return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; + } + + unsigned char slicer(const gr_complex x); + unsigned int demapper(const gr_complex *in, + unsigned char *out); + + bool set_sym_value_out(const std::vector<gr_complex> &sym_position, + const std::vector<unsigned char> &sym_value_out); + + public: + ~digital_ofdm_frame_sink(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_GR_OFDM_FRAME_SINK_H */ diff --git a/gr-digital/include/digital_ofdm_insert_preamble.h b/gr-digital/include/digital_ofdm_insert_preamble.h new file mode 100644 index 000000000..6f9dae5d6 --- /dev/null +++ b/gr-digital/include/digital_ofdm_insert_preamble.h @@ -0,0 +1,105 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H +#define INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H + +#include <digital_api.h> +#include <gr_block.h> +#include <vector> + +class digital_ofdm_insert_preamble; +typedef boost::shared_ptr<digital_ofdm_insert_preamble> digital_ofdm_insert_preamble_sptr; + +DIGITAL_API digital_ofdm_insert_preamble_sptr +digital_make_ofdm_insert_preamble(int fft_length, + const std::vector<std::vector<gr_complex> > &preamble); + +/*! + * \brief insert "pre-modulated" preamble symbols before each payload. + * \ingroup sync_blk + * \ingroup ofdm_blk + * + * <pre> + * input 1: stream of vectors of gr_complex [fft_length] + * These are the modulated symbols of the payload. + * + * input 2: stream of char. The LSB indicates whether the corresponding + * symbol on input 1 is the first symbol of the payload or not. + * It's a 1 if the corresponding symbol is the first symbol, + * otherwise 0. + * + * N.B., this implies that there must be at least 1 symbol in the payload. + * + * + * output 1: stream of vectors of gr_complex [fft_length] + * These include the preamble symbols and the payload symbols. + * + * output 2: stream of char. The LSB indicates whether the corresponding + * symbol on input 1 is the first symbol of a packet (i.e., the + * first symbol of the preamble.) It's a 1 if the corresponding + * symbol is the first symbol, otherwise 0. + * </pre> + * + * \param fft_length length of each symbol in samples. + * \param preamble vector of symbols that represent the pre-modulated preamble. + */ + +class DIGITAL_API digital_ofdm_insert_preamble : public gr_block +{ + friend DIGITAL_API digital_ofdm_insert_preamble_sptr + digital_make_ofdm_insert_preamble(int fft_length, + const std::vector<std::vector<gr_complex> > &preamble); + +protected: + digital_ofdm_insert_preamble(int fft_length, + const std::vector<std::vector<gr_complex> > &preamble); + +private: + enum state_t { + ST_IDLE, + ST_PREAMBLE, + ST_FIRST_PAYLOAD, + ST_PAYLOAD + }; + + int d_fft_length; + const std::vector<std::vector<gr_complex> > d_preamble; + state_t d_state; + int d_nsymbols_output; + int d_pending_flag; + + void enter_idle(); + void enter_preamble(); + void enter_first_payload(); + void enter_payload(); + + +public: + ~digital_ofdm_insert_preamble(); + + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif /* INCLUDED_DIGITAL_OFDM_INSERT_PREAMBLE_H */ diff --git a/gr-digital/include/digital_ofdm_mapper_bcv.h b/gr-digital/include/digital_ofdm_mapper_bcv.h new file mode 100644 index 000000000..daed1eab2 --- /dev/null +++ b/gr-digital/include/digital_ofdm_mapper_bcv.h @@ -0,0 +1,88 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2007,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H +#define INCLUDED_DIGITAL_OFDM_MAPPER_BCV_H + +#include <digital_api.h> +#include <gr_sync_block.h> +#include <gr_message.h> +#include <gr_msg_queue.h> + +class digital_ofdm_mapper_bcv; +typedef boost::shared_ptr<digital_ofdm_mapper_bcv> digital_ofdm_mapper_bcv_sptr; + +DIGITAL_API digital_ofdm_mapper_bcv_sptr +digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, + unsigned occupied_carriers, unsigned int fft_length); + +/*! + * \brief take a stream of bytes in and map to a vector of complex + * constellation points suitable for IFFT input to be used in an ofdm + * modulator. Abstract class must be subclassed with specific mapping. + * \ingroup modulation_blk + * \ingroup ofdm_blk + */ + +class DIGITAL_API digital_ofdm_mapper_bcv : public gr_sync_block +{ + friend DIGITAL_API digital_ofdm_mapper_bcv_sptr + digital_make_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, + unsigned occupied_carriers, unsigned int fft_length); +protected: + digital_ofdm_mapper_bcv (const std::vector<gr_complex> &constellation, unsigned msgq_limit, + unsigned occupied_carriers, unsigned int fft_length); + + private: + std::vector<gr_complex> d_constellation; + gr_msg_queue_sptr d_msgq; + gr_message_sptr d_msg; + unsigned d_msg_offset; + bool d_eof; + + unsigned int d_occupied_carriers; + unsigned int d_fft_length; + unsigned int d_bit_offset; + int d_pending_flag; + + unsigned long d_nbits; + unsigned char d_msgbytes; + + unsigned char d_resid; + unsigned int d_nresid; + + std::vector<int> d_subcarrier_map; + + int randsym(); + + public: + ~digital_ofdm_mapper_bcv(void); + + gr_msg_queue_sptr msgq() const { return d_msgq; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +}; + +#endif diff --git a/gr-digital/include/digital_ofdm_sampler.h b/gr-digital/include/digital_ofdm_sampler.h new file mode 100644 index 000000000..9c54e4e77 --- /dev/null +++ b/gr-digital/include/digital_ofdm_sampler.h @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_OFDM_SAMPLER_H +#define INCLUDED_DIGITAL_OFDM_SAMPLER_H + +#include <digital_api.h> +#include <gr_sync_block.h> + +class digital_ofdm_sampler; +typedef boost::shared_ptr<digital_ofdm_sampler> digital_ofdm_sampler_sptr; + +DIGITAL_API digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length, + unsigned int symbol_length, + unsigned int timeout=1000); + +/*! + * \brief does the rest of the OFDM stuff + * \ingroup ofdm_blk + */ +class DIGITAL_API digital_ofdm_sampler : public gr_block +{ + friend DIGITAL_API digital_ofdm_sampler_sptr digital_make_ofdm_sampler (unsigned int fft_length, + unsigned int symbol_length, + unsigned int timeout); + + digital_ofdm_sampler (unsigned int fft_length, + unsigned int symbol_length, + unsigned int timeout); + + private: + enum state_t {STATE_NO_SIG, STATE_PREAMBLE, STATE_FRAME}; + + state_t d_state; + unsigned int d_timeout_max; + unsigned int d_timeout; + unsigned int d_fft_length; + unsigned int d_symbol_length; + + public: + void forecast (int noutput_items, gr_vector_int &ninput_items_required); + + int general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif |