GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2007,2012 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 #ifndef INCLUDED_GR_GLFSR_SOURCE_F_H 00024 #define INCLUDED_GR_GLFSR_SOURCE_F_H 00025 00026 #include <digital_api.h> 00027 #include <gr_sync_block.h> 00028 00029 class gri_glfsr; 00030 00031 class digital_glfsr_source_f; 00032 typedef boost::shared_ptr<digital_glfsr_source_f> digital_glfsr_source_f_sptr; 00033 00034 DIGITAL_API digital_glfsr_source_f_sptr 00035 digital_make_glfsr_source_f(int degree, bool repeat=true, 00036 int mask=0, int seed=1); 00037 00038 /*! 00039 * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0. 00040 * \ingroup waveform_generators_blk 00041 */ 00042 class DIGITAL_API digital_glfsr_source_f : public gr_sync_block 00043 { 00044 private: 00045 friend DIGITAL_API digital_glfsr_source_f_sptr 00046 digital_make_glfsr_source_f(int degree, bool repeat, 00047 int mask, int seed); 00048 00049 gri_glfsr *d_glfsr; 00050 00051 bool d_repeat; 00052 unsigned int d_index; 00053 unsigned int d_length; 00054 00055 /*! 00056 * Build a Galois LFSR pseudo-random source generating block. 00057 * 00058 * \param degree Degree of shift register must be in [1, 32]. If mask 00059 * is 0, the degree determines a default mask (see 00060 * digital_impl_glfsr.cc for the mapping). 00061 * \param repeat Set to repeat sequence. 00062 * \param mask Allows a user-defined bit mask for indexes of the shift 00063 * register to feed back. 00064 * \param seed Initial setting for values in shift register. 00065 */ 00066 digital_glfsr_source_f(int degree, bool repeat, 00067 int mask, int seed); 00068 00069 public: 00070 00071 ~digital_glfsr_source_f(); 00072 00073 int work(int noutput_items, 00074 gr_vector_const_void_star &input_items, 00075 gr_vector_void_star &output_items); 00076 00077 unsigned int period() const { return d_length; } 00078 int mask() const; 00079 }; 00080 00081 #endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */