diff options
author | Tom Rondeau <tom@trondeau.com> | 2013-11-23 20:37:42 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2013-11-23 20:37:42 -0500 |
commit | c0b65c08d179e1b4622db8bdd55420e560f181a6 (patch) | |
tree | be779ab38fa8b545965dc7db9af72bcae8b724ff /gr-blocks | |
parent | 7c37898c35858d0aec5b345313de1cd89f107f99 (diff) | |
parent | 86a0c3c25f4ccbe6c07294221fec20f4682401de (diff) |
Merge branch 'maint'
Diffstat (limited to 'gr-blocks')
19 files changed, 161 insertions, 60 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/add_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_XX.h.t index 08e9646af..74c38889c 100644 --- a/gr-blocks/include/gnuradio/blocks/add_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_XX.h.t @@ -32,11 +32,16 @@ namespace gr { namespace blocks { /*! - * \brief output = sum (input_0, input_1, ...) + * \brief output = sum(input[0], input[1], ..., input[M-1]) * \ingroup math_operators_blk * - * \details - * Add across all input streams. + * \details + * Add samples across all input streams. For all \f$n\f$ samples + * on all \f$M\f$ input streams \f$x_m\f$: + * + * \f[ + * y[n] = \sum_{m=0}^{M-1} x_m[n] + * \f] */ class BLOCKS_API @NAME@ : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t index ea6c35695..d1ce94717 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_const_vXX.h.t @@ -32,7 +32,7 @@ namespace gr { namespace blocks { /*! - * \brief output = input + constant vector + * \brief output[m] = input[m] + constant vector for all M streams. * \ingroup math_operators_blk */ class BLOCKS_API @NAME@ : virtual public sync_block diff --git a/gr-blocks/include/gnuradio/blocks/and_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_XX.h.t index 820daefdb..8dc48fc04 100644 --- a/gr-blocks/include/gnuradio/blocks/and_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/and_XX.h.t @@ -32,10 +32,11 @@ namespace gr { namespace blocks { /*! - * \brief output = input_0 & input_1 & , ... & input_N) + * \brief output = input[0] & input[1] & ... & input[M-1] * \ingroup boolean_operators_blk * - * bitwise boolean and across all input streams. + * \details + * bitwise boolean AND across all input streams. */ class BLOCKS_API @NAME@ : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t index a4c83a4ea..62bfca204 100644 --- a/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/and_const_XX.h.t @@ -32,10 +32,11 @@ namespace gr { namespace blocks { /*! - * \brief output_N = input_N & value + * \brief output[m] = input[m] & value for all M streams. * \ingroup boolean_operators_blk * - * bitwise boolean and of const to the data stream. + * \details + * Bitwise boolean AND of constant \p k with the data stream. */ class BLOCKS_API @NAME@ : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t b/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t index 71468726e..ca0243b6d 100644 --- a/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/argmax_XX.h.t @@ -40,11 +40,13 @@ namespace gr { * \details * Data is passed in as a vector of length \p vlen from multiple * input sources. It will look through these streams of \p vlen - * data items and output two streams. - * Stream 0 will contain the index value in the vector where - * the maximum value occurred. - * Stream 1 will contain the number of the input stream that - * held the maximum value. + * data items and output two streams: + * + * \li Stream 0 will contain the index value in the vector where + * the maximum value occurred. + * + * \li Stream 1 will contain the number of the input stream that + * held the maximum value. */ class BLOCKS_API @NAME@ : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/char_to_float.h b/gr-blocks/include/gnuradio/blocks/char_to_float.h index b06abc900..be7adf46a 100644 --- a/gr-blocks/include/gnuradio/blocks/char_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/char_to_float.h @@ -30,8 +30,14 @@ namespace gr { namespace blocks { /*! - * \brief Convert stream of chars to a stream of float + * \brief Convert stream of chars to a stream of float. * \ingroup type_converters_blk + * + * \details + * Converts \p vlen length vectors of input char samples to floats + * and applies a scaling factor of \p scale: + * + * \li output[0][m:m+vlen] = static_cast<float>(input[0][m:m+vlen]) / scale */ class BLOCKS_API char_to_float : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/char_to_short.h b/gr-blocks/include/gnuradio/blocks/char_to_short.h index dcc93b5c5..05880e073 100644 --- a/gr-blocks/include/gnuradio/blocks/char_to_short.h +++ b/gr-blocks/include/gnuradio/blocks/char_to_short.h @@ -32,6 +32,11 @@ namespace gr { /*! * \brief Convert stream of chars to a stream of short * \ingroup type_converters_blk + * + * \details + * Converts \p vlen length vectors of input char samples to shorts: + * + * \li output[0][m:m+vlen] = static_cast<short>(input[0][m:m+vlen]) */ class BLOCKS_API char_to_short : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_arg.h b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h index 3ef79de00..2ea14aba6 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_arg.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_arg.h @@ -30,7 +30,7 @@ namespace gr { namespace blocks { /*! - * \brief complex in, arg out (float) + * \brief complex in, arg (arctan) out (float) * \ingroup type_converters_blk */ class BLOCKS_API complex_to_arg : virtual public sync_block diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_float.h b/gr-blocks/include/gnuradio/blocks/complex_to_float.h index c7b4a4880..40fcb729b 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_float.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_float.h @@ -30,8 +30,14 @@ namespace gr { namespace blocks { /*! - * \brief convert a stream of gr_complex to 1 or 2 streams of float + * \brief Convert a stream of gr_complex to 1 or 2 streams of float. * \ingroup type_converters_blk + * + * \details + * If a single output stream is attached, this will output the + * real part of the input complex samples. If a second output + * stream is connected, output[0] is the real part and output[1] + * is the imaginary part. */ class BLOCKS_API complex_to_float : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_imag.h b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h index c4014131b..1311fa4dc 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_imag.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_imag.h @@ -30,7 +30,7 @@ namespace gr { namespace blocks { /*! - * \brief complex in, imag out (float) + * \brief Produces the imaginary part (as a float0 of a complex stream. * \ingroup type_converters_blk */ class BLOCKS_API complex_to_imag : virtual public sync_block diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h index 788bdd91f..69b88e5f5 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h @@ -30,8 +30,17 @@ namespace gr { namespace blocks { /*! - * \brief Convert stream of complex to a stream of interleaved shorts + * \brief Convert stream of complex to a stream of interleaved shorts. * \ingroup type_converters_blk + * + * \details + * The output stream contains shorts with twice as many output + * items as input items. For every complex input item, we produce + * two output shorts that contain the real part and imaginary part + * converted to shorts: + * + * \li output[0][n] = static_cast<short>(input[0][m].real()); + * \li output[0][n+1] = static_cast<short>(input[0][m].imag()); */ class BLOCKS_API complex_to_interleaved_short : virtual public sync_interpolator { diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_mag.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h index 9089b7ce6..d6023a768 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_mag.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag.h @@ -32,6 +32,19 @@ namespace gr { /*! * \brief complex in, magnitude out (float) * \ingroup type_converters_blk + * + * \details + * Calculates the magnitude of the complex samples: + * + * \li output[0][m] = |input[0][m]| + * + * Or: + * \li output[0][m] = sqrt(Re{input[0][m]}^2 + Im{input[0][m]}^2) + * + * The input stream can be a vector of length \p vlen, and for + * each vector, each item is converted using the above + * function. So above, m is from 0 to noutput_items*vlen for each + * call to work. */ class BLOCKS_API complex_to_mag : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h index 6e4e31b4c..2165a5c52 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_mag_squared.h @@ -32,6 +32,19 @@ namespace gr { /*! * \brief complex in, magnitude squared out (float) * \ingroup type_converters_blk + * + * \details + * Calculates the magnitude squared of the complex samples: + * + * \li output[0][m] = |input[0][m]|^2 + * + * Or: + * \li output[0][m] = Re{input[0][m]}^2 + Im{input[0][m]}^2 + * + * The input stream can be a vector of length \p vlen, and for + * each vector, each item is converted using the above + * function. So above, m is from 0 to noutput_items*vlen for each + * call to work. */ class BLOCKS_API complex_to_mag_squared : virtual public sync_block { diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_real.h b/gr-blocks/include/gnuradio/blocks/complex_to_real.h index 9e4697081..2b8bcbe2a 100644 --- a/gr-blocks/include/gnuradio/blocks/complex_to_real.h +++ b/gr-blocks/include/gnuradio/blocks/complex_to_real.h @@ -30,7 +30,7 @@ namespace gr { namespace blocks { /*! - * \brief complex in, real out (float) + * \brief Produces the real part (as a float0 of a complex stream. * \ingroup type_converters_blk */ class BLOCKS_API complex_to_real : virtual public sync_block diff --git a/gr-blocks/include/gnuradio/blocks/control_loop.h b/gr-blocks/include/gnuradio/blocks/control_loop.h index d53c81cba..f956c8828 100644 --- a/gr-blocks/include/gnuradio/blocks/control_loop.h +++ b/gr-blocks/include/gnuradio/blocks/control_loop.h @@ -28,6 +28,36 @@ namespace gr { namespace blocks { + /*! + * \brief A second-order control loop implementation class. + * + * \details + * This class implements a second order control loop and is + * inteded to act as a parent class to blocks which need a control + * loop (e.g., gr::digital::costas_loop_cc, + * gr::analog::pll_refout_cc, etc.). It takes in a loop bandwidth + * as well as a max and min frequency and provides the functions + * that control the update of the loop. + * + * The loop works of alpha and beta gains. These gains are + * calculated using the input loop bandwidth and a pre-set damping + * factor. The damping factor can be changed using the + * #set_damping_factor after the block is + * constructed. The alpha and beta values can be set using their + * respective #set_alpha or #set_beta functions if very precise + * control over these is required. + * + * The class tracks both phase and frequency of a signal based on + * an error signal. The error calculation is unique for each + * algorithm and is calculated externally and passed to the + * advance_loop function, which uses this to update its phase and + * frequency estimates. + * + * This class also provides the functions #phase_wrap and + * #frequency_limit to easily keep the phase and frequency + * estimates within our set bounds (phase_wrap keeps it within + * +/-2pi). + */ class BLOCKS_API control_loop { protected: @@ -41,12 +71,13 @@ namespace gr { control_loop(float loop_bw, float max_freq, float min_freq); virtual ~control_loop(); - /*! \brief update the system gains from the loop bandwidth and damping factor + /*! \brief Update the system gains from the loop bandwidth and damping factor. * - * This function updates the system gains based on the loop - * bandwidth and damping factor of the system. These two - * factors can be set separately through their own set - * functions. + * \details + * This function updates the system gains based on the loop + * bandwidth and damping factor of the system. These two + * factors can be set separately through their own set + * functions. */ void update_gains(); @@ -55,8 +86,9 @@ namespace gr { */ void advance_loop(float error); - /*! \brief Keep the phase between -2pi and 2pi + /*! \brief Keep the phase between -2pi and 2pi. * + * \details * This function keeps the phase between -2pi and 2pi. If the * phase is greater than 2pi by d, it wraps around to be -2pi+d; * similarly if it is less than -2pi by d, it wraps around to @@ -69,8 +101,9 @@ namespace gr { */ void phase_wrap(); - /*! \brief Keep the frequency between d_min_freq and d_max_freq + /*! \brief Keep the frequency between d_min_freq and d_max_freq. * + * \details * This function keeps the frequency between d_min_freq and * d_max_freq. If the frequency is greater than d_max_freq, it * is set to d_max_freq. If the frequency is less than @@ -88,8 +121,9 @@ namespace gr { *******************************************************************/ /*! - * \brief Set the loop bandwidth + * \brief Set the loop bandwidth. * + * \details * Set the loop filter's bandwidth to \p bw. This should be * between 2*pi/200 and 2*pi/100 (in rads/samp). It must also be * a positive number. @@ -102,8 +136,9 @@ namespace gr { virtual void set_loop_bandwidth(float bw); /*! - * \brief Set the loop damping factor + * \brief Set the loop damping factor. * + * \details * Set the loop filter's damping factor to \p df. The damping * factor should be sqrt(2)/2.0 for critically damped systems. * Set it to anything else only if you know what you are @@ -117,22 +152,23 @@ namespace gr { void set_damping_factor(float df); /*! - * \brief Set the loop gain alpha + * \brief Set the loop gain alpha. * - * Set's the loop filter's alpha gain parameter. + * \details + * Sets the loop filter's alpha gain parameter. * * This value should really only be set by adjusting the loop * bandwidth and damping factor. * * \param alpha (float) new alpha gain - * */ void set_alpha(float alpha); /*! - * \brief Set the loop gain beta + * \brief Set the loop gain beta. * - * Set's the loop filter's beta gain parameter. + * \details + * Sets the loop filter's beta gain parameter. * * This value should really only be set by adjusting the loop * bandwidth and damping factor. @@ -144,7 +180,8 @@ namespace gr { /*! * \brief Set the control loop's frequency. * - * Set's the control loop's frequency. While this is normally + * \details + * Sets the control loop's frequency. While this is normally * updated by the inner loop of the algorithm, it could be * useful to manually initialize, set, or reset this under * certain circumstances. @@ -156,7 +193,8 @@ namespace gr { /*! * \brief Set the control loop's phase. * - * Set's the control loop's phase. While this is normally + * \details + * Sets the control loop's phase. While this is normally * updated by the inner loop of the algorithm, it could be * useful to manually initialize, set, or reset this under * certain circumstances. @@ -168,6 +206,7 @@ namespace gr { /*! * \brief Set the control loop's maximum frequency. * + * \details * Set the maximum frequency the control loop can track. * * \param freq (float) new max frequency @@ -177,6 +216,7 @@ namespace gr { /*! * \brief Set the control loop's minimum frequency. * + * \details * Set the minimum frequency the control loop can track. * * \param freq (float) new min frequency @@ -188,32 +228,32 @@ namespace gr { *******************************************************************/ /*! - * \brief Returns the loop bandwidth + * \brief Returns the loop bandwidth. */ float get_loop_bandwidth() const; /*! - * \brief Returns the loop damping factor + * \brief Returns the loop damping factor. */ float get_damping_factor() const; /*! - * \brief Returns the loop gain alpha + * \brief Returns the loop gain alpha. */ float get_alpha() const; /*! - * \brief Returns the loop gain beta + * \brief Returns the loop gain beta. */ float get_beta() const; /*! - * \brief Get the control loop's frequency estimate + * \brief Get the control loop's frequency estimate. */ float get_frequency() const; /*! - * \brief Get the control loop's phase estimate + * \brief Get the control loop's phase estimate. */ float get_phase() const; diff --git a/gr-blocks/include/gnuradio/blocks/divide_XX.h.t b/gr-blocks/include/gnuradio/blocks/divide_XX.h.t index 25e7941f7..aa918faca 100644 --- a/gr-blocks/include/gnuradio/blocks/divide_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/divide_XX.h.t @@ -32,7 +32,7 @@ namespace gr { namespace blocks { /*! - * \brief output = input_0 / input_1 / input_x ...) + * \brief output = input[0] / input[1] / ... / input[M-1] * \ingroup math_operators_blk * * \details diff --git a/gr-blocks/include/gnuradio/blocks/file_meta_sink.h b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h index 55b8b9801..0d68132f0 100644 --- a/gr-blocks/include/gnuradio/blocks/file_meta_sink.h +++ b/gr-blocks/include/gnuradio/blocks/file_meta_sink.h @@ -53,13 +53,13 @@ namespace gr { * type of data and properties of the data in the next segment of * samples. The information includes: * - * rx_rate (double): sample rate of data. - * rx_time (uint64_t, double): time stamp of first sample in segment. - * size (uint32_t): item size in bytes. - * type (gr_file_types as int32_t): data type. - * cplx (bool): Is data complex? - * strt (uint64_t): Starting byte of data in this segment. - * bytes (uint64_t): Size in bytes of data in this segment. + * \li rx_rate (double): sample rate of data. + * \li rx_time (uint64_t, double): time stamp of first sample in segment. + * \li size (uint32_t): item size in bytes. + * \li type (::gr_file_types as int32_t): data type. + * \li cplx (bool): Is data complex? + * \li strt (uint64_t): Starting byte of data in this segment. + * \li bytes (uint64_t): Size in bytes of data in this segment. * * Tags can be sent to the file to update the information, which * will create a new header. Headers are found by searching from diff --git a/gr-blocks/include/gnuradio/blocks/file_meta_source.h b/gr-blocks/include/gnuradio/blocks/file_meta_source.h index 6c631f47e..57bac1eca 100644 --- a/gr-blocks/include/gnuradio/blocks/file_meta_source.h +++ b/gr-blocks/include/gnuradio/blocks/file_meta_source.h @@ -37,13 +37,13 @@ namespace gr { * \details * The information in the metadata headers includes: * - * rx_rate (double): sample rate of data. - * rx_time (uint64_t, double): time stamp of first sample in segment. - * size (uint32_t): item size in bytes. - * type (gr_file_types as int32_t): data type. - * cplx (bool): Is data complex? - * strt (uint64_t): Starting byte of data in this segment. - * bytes (uint64_t): Size in bytes of data in this segment. + * \li rx_rate (double): sample rate of data. + * \li rx_time (uint64_t, double): time stamp of first sample in segment. + * \li size (uint32_t): item size in bytes. + * \li type (::gr_file_types as int32_t): data type. + * \li cplx (bool): Is data complex? + * \li strt (uint64_t): Starting byte of data in this segment. + * \li bytes (uint64_t): Size in bytes of data in this segment. * * Any item inside of the extra header dictionary is ready out and * made into a stream tag. diff --git a/gr-blocks/lib/char_to_short_impl.cc b/gr-blocks/lib/char_to_short_impl.cc index 065fb58bb..fa8d55fbd 100644 --- a/gr-blocks/lib/char_to_short_impl.cc +++ b/gr-blocks/lib/char_to_short_impl.cc @@ -38,8 +38,8 @@ namespace gr { char_to_short_impl::char_to_short_impl(size_t vlen) : sync_block("char_to_short", - io_signature::make (1, -1, sizeof(char)*vlen), - io_signature::make (1, 1, sizeof(short)*vlen)), + io_signature::make(1, 1, sizeof(char)*vlen), + io_signature::make(1, 1, sizeof(short)*vlen)), d_vlen(vlen) { const int alignment_multiple = @@ -52,8 +52,8 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const int8_t *in = (const int8_t *) input_items[0]; - int16_t *out = (int16_t *) output_items[0]; + const int8_t *in = (const int8_t *)input_items[0]; + int16_t *out = (int16_t *)output_items[0]; volk_8i_convert_16i(out, in, d_vlen*noutput_items); |