diff options
Diffstat (limited to 'gr-blocks/include')
-rw-r--r-- | gr-blocks/include/blocks/CMakeLists.txt | 6 | ||||
-rw-r--r-- | gr-blocks/include/blocks/delay.h | 57 | ||||
-rw-r--r-- | gr-blocks/include/blocks/log2_const.h | 53 | ||||
-rw-r--r-- | gr-blocks/include/blocks/packed_to_unpacked_XX.h.t | 73 | ||||
-rw-r--r-- | gr-blocks/include/blocks/rms_cf.h | 54 | ||||
-rw-r--r-- | gr-blocks/include/blocks/rms_ff.h | 53 | ||||
-rw-r--r-- | gr-blocks/include/blocks/unpacked_to_packed_XX.h.t | 72 |
7 files changed, 368 insertions, 0 deletions
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt index 37790b7cf..a6608696a 100644 --- a/gr-blocks/include/blocks/CMakeLists.txt +++ b/gr-blocks/include/blocks/CMakeLists.txt @@ -78,6 +78,8 @@ expand_h(not_XX bb ss ii) expand_h(or_XX bb ss ii) expand_h(sub_XX ss ii ff cc) expand_h(xor_XX bb ss ii) +expand_h(packed_to_unpacked_XX bb ss ii) +expand_h(unpacked_to_packed_XX bb ss ii) add_custom_target(blocks_generated_includes DEPENDS ${generated_includes} @@ -90,6 +92,7 @@ install(FILES ${generated_includes} api.h count_bits.h + log2_const.h add_ff.h char_to_float.h char_to_short.h @@ -102,6 +105,7 @@ install(FILES complex_to_arg.h conjugate_cc.h deinterleave.h + delay.h file_source.h file_meta_sink.h file_meta_source.h @@ -123,6 +127,8 @@ install(FILES nlog10_ff.h patterned_interleaver.h repeat.h + rms_cf.h + rms_ff.h short_to_char.h short_to_float.h stream_mux.h diff --git a/gr-blocks/include/blocks/delay.h b/gr-blocks/include/blocks/delay.h new file mode 100644 index 000000000..2a59fa0fc --- /dev/null +++ b/gr-blocks/include/blocks/delay.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2012-2013 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_BLOCKS_DELAY_H +#define INCLUDED_BLOCKS_DELAY_H + +#include <blocks/api.h> +#include <gr_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief delay the input by a certain number of samples + * \ingroup misc_blk + */ + class BLOCKS_API delay : virtual public gr_block + { + public: + // gr::blocks::delay::sptr + typedef boost::shared_ptr<delay> sptr; + + /*! + * \brief Make a delay block. + * \param itemsize size of the data items. + * \param delay number of samples to delay stream. + */ + static sptr make(size_t itemsize, int delay); + + virtual int dly() const = 0; + virtual void set_dly(int d) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_DELAY_H */ + diff --git a/gr-blocks/include/blocks/log2_const.h b/gr-blocks/include/blocks/log2_const.h new file mode 100644 index 000000000..67d63810f --- /dev/null +++ b/gr-blocks/include/blocks/log2_const.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + + +/* + * a bit of template hackery... + */ +#ifndef INCLUDED_BLOCKS_LOG2_CONST_H +#define INCLUDED_BLOCKS_LOG2_CONST_H + +#include <blocks/api.h> +#include <assert.h> + +namespace gr { + namespace blocks { + + template<unsigned int k> static inline int log2_const() { assert(0); return 0; } + + template<> inline int log2_const<1>() { return 0; } + template<> inline int log2_const<2>() { return 1; } + template<> inline int log2_const<4>() { return 2; } + template<> inline int log2_const<8>() { return 3; } + template<> inline int log2_const<16>() { return 4; } + template<> inline int log2_const<32>() { return 5; } + template<> inline int log2_const<64>() { return 6; } + template<> inline int log2_const<128>() { return 7; } + template<> inline int log2_const<256>() { return 8; } + template<> inline int log2_const<512>() { return 9; } + template<> inline int log2_const<1024>(){ return 10; } + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_LOG2_CONST_H */ diff --git a/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t b/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t new file mode 100644 index 000000000..9ab8b8bdf --- /dev/null +++ b/gr-blocks/include/blocks/packed_to_unpacked_XX.h.t @@ -0,0 +1,73 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <blocks/api.h> +#include <gr_block.h> +#include <gr_endianness.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts. + * \ingroup converter_blk + * + * input: stream of @I_TYPE@; output: stream of @O_TYPE@ + * + * This is the inverse of gr::blocks::unpacked_to_packed_XX. + * + * The bits in the bytes or shorts input stream are grouped into + * chunks of \p bits_per_chunk bits and each resulting chunk is + * written right- justified to the output stream of bytes or + * shorts. All b or 16 bits of the each input bytes or short are + * processed. The right thing is done if bits_per_chunk is not a + * power of two. + * + * The combination of gr_packed_to_unpacked_XX_ followed by + * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the + * general case of mapping from a stream of bytes or shorts into + * arbitrary float or complex symbols. + * + * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, + * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, + * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. + * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. + */ + class BLOCKS_API @NAME@ : virtual public gr_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(unsigned int bits_per_chunk, + gr_endianness_t endianness); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-blocks/include/blocks/rms_cf.h b/gr-blocks/include/blocks/rms_cf.h new file mode 100644 index 000000000..e73be6923 --- /dev/null +++ b/gr-blocks/include/blocks/rms_cf.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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_BLOCKS_RMS_CF_H +#define INCLUDED_BLOCKS_RMS_CF_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief RMS average power + * \ingroup math_blk + */ + class BLOCKS_API rms_cf : virtual public gr_sync_block + { + public: + // gr::blocks::rms_cf::sptr + typedef boost::shared_ptr<rms_cf> sptr; + + /*! + * \brief Make an RMS calc. block. + * \param alpha gain for running average filter. + */ + static sptr make(double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_RMS_CF_H */ diff --git a/gr-blocks/include/blocks/rms_ff.h b/gr-blocks/include/blocks/rms_ff.h new file mode 100644 index 000000000..19fb0016d --- /dev/null +++ b/gr-blocks/include/blocks/rms_ff.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2013 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_BLOCKS_RMS_FF_H +#define INCLUDED_BLOCKS_RMS_FF_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief RMS average power + * \ingroup math_blk + */ + class BLOCKS_API rms_ff : virtual public gr_sync_block + { + public: + // gr::blocks::rms_ff::sptr + typedef boost::shared_ptr<rms_ff> sptr; + + /*! + * \brief Make an RMS calc. block. + * \param alpha gain for running average filter. + */ + static sptr make(double alpha = 0.0001); + + virtual void set_alpha(double alpha) = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_RMS_FF_H */ diff --git a/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t b/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t new file mode 100644 index 000000000..749f0e00f --- /dev/null +++ b/gr-blocks/include/blocks/unpacked_to_packed_XX.h.t @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2013 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <blocks/api.h> +#include <gr_block.h> +#include <gr_endianness.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Convert a stream of unpacked bytes or shorts into a stream of packed bytes or shorts. + * \ingroup converter_blk + * + * input: stream of @I_TYPE@; output: stream of @O_TYPE@ + * + * This is the inverse of gr::blocks::packed_to_unpacked_XX. + * + * The low \p bits_per_chunk bits are extracted from each input + * byte or short. These bits are then packed densely into the + * output bytes or shorts, such that all 8 or 16 bits of the + * output bytes or shorts are filled with valid input bits. The + * right thing is done if bits_per_chunk is not a power of two. + * + * The combination of gr_packed_to_unpacked_XX followed by + * gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the + * general case of mapping from a stream of bytes or shorts into + * arbitrary float or complex symbols. + * + * \sa gr::blocks::packed_to_unpacked_bb, gr::blocks::unpacked_to_packed_bb, + * \sa gr::blocks::packed_to_unpacked_ss, gr::blocks::unpacked_to_packed_ss, + * \sa gr::blocks::chunks_to_symbols_bf, gr::blocks::chunks_to_symbols_bc. + * \sa gr::blocks::chunks_to_symbols_sf, gr::blocks::chunks_to_symbols_sc. + */ + class BLOCKS_API @NAME@ : virtual public gr_block + { + public: + // gr::blocks::@NAME@::sptr + typedef boost::shared_ptr<@NAME@> sptr; + + static sptr make(unsigned int bits_per_chunk, + gr_endianness_t endianness); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ |