diff options
46 files changed, 962 insertions, 344 deletions
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4 index 80052bb50..e94747c1a 100644 --- a/config/grc_gr_uhd.m4 +++ b/config/grc_gr_uhd.m4 @@ -26,8 +26,8 @@ AC_DEFUN([GRC_GR_UHD],[ if test $passed = yes; then dnl Don't do gr-uhd if the 'uhd' package is not installed PKG_CHECK_MODULES( - [UHD], [uhd >= 1.0.0 uhd < 2.0.0], [], - [passed=no; AC_MSG_RESULT([gr-uhd requires libuhd 1.x.x])] + [UHD], [uhd >= 2.0.0 uhd < 3.0.0], [], + [passed=no; AC_MSG_RESULT([gr-uhd requires libuhd 2.x.x])] ) UHD_CPPFLAGS="${UHD_CPPFLAGS} -I\${abs_top_srcdir}/gr-uhd/lib" AC_SUBST(UHD_CPPFLAGS) diff --git a/config/grc_grc.m4 b/config/grc_grc.m4 index 16720b8fe..446bba3c5 100644 --- a/config/grc_grc.m4 +++ b/config/grc_grc.m4 @@ -20,7 +20,7 @@ dnl Boston, MA 02110-1301, USA. AC_DEFUN([GRC_GRC],[ GRC_ENABLE(grc) - GRC_CHECK_DEPENDENCY(grc, gr-wxgui) +dnl GRC_CHECK_DEPENDENCY(grc, gr-wxgui) AC_CHECK_PROG(XDG_UTILS, xdg-mime, true, false) AM_CONDITIONAL(XDG_UTILS, $XDG_UTILS) diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index bf97d6cdc..ebc7ad203 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2001,2002,2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -159,7 +159,9 @@ armv7_a_CODE = \ gr_fir_sysconfig_armv7_a.cc \ gr_cpu_armv7_a.cc \ gr_fir_fff_armv7_a.cc \ - dotprod_fff_armv7_a.c + dotprod_fff_armv7_a.c \ + gr_fir_ccf_armv7_a.cc \ + dotprod_ccf_armv7_a.c armv7_a_qa_CODE = \ qa_dotprod_armv7_a.cc @@ -312,6 +314,7 @@ noinst_HEADERS = \ assembly.h \ dotprod_fff_altivec.h \ dotprod_fff_armv7_a.h \ + dotprod_ccf_armv7_a.h \ gr_fir_scc_simd.h \ gr_fir_scc_x86.h \ gr_fir_fcc_simd.h \ @@ -322,6 +325,7 @@ noinst_HEADERS = \ gr_fir_ccc_x86.h \ gr_fir_fff_altivec.h \ gr_fir_fff_armv7_a.h \ + gr_fir_ccf_armv7_a.h \ gr_fir_fff_simd.h \ gr_fir_fff_x86.h \ gr_fir_fsf_simd.h \ diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c new file mode 100644 index 000000000..90bd2ee10 --- /dev/null +++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.c @@ -0,0 +1,90 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <dotprod_ccf_armv7_a.h> + +/*! + * \param x any value + * \param pow2 must be a power of 2 + * \returns \p x rounded down to a multiple of \p pow2. + */ +static inline size_t +gr_p2_round_down(size_t x, size_t pow2) +{ + return x & -pow2; +} + + +#if 0 + +void +dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) +{ + size_t i; + res[0] = 0; + res[1] = 0; + + for (i = 0; i < n; i++){ + res[0] += a[2*i] * b[i]; + res[1] += a[2*i+1] * b[i]; + } +} + +#else + +/* + * preconditions: + * + * n > 0 and a multiple of 4 + * a 4-byte aligned + * b 16-byte aligned + */ +void +dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n) +{ + + asm volatile( + "vmov.f32 q14, #0.0 \n\t" + "vmov.f32 q15, #0.0 \n\t" + "1: \n\t" + "subs %2, %2, #4 \n\t" + "vld2.f32 {q0-q1}, [%0]! \n\t" + "vld1.f32 {q2}, [%1]! \n\t" + "vmla.f32 q14, q0, q2 \n\t" + "vmla.f32 q15, q1, q2 \n\t" + "bgt 1b \n\t" + "vpadd.f32 d0, d28, d29 \n\t" + "vpadd.f32 d1, d30, d31 \n\t" + "vpadd.f32 d0, d0, d1 \n\t" + "vst1.f32 {d0}, [%3] \n\t" + + : "+&r"(a), "+&r"(b), "+&r"(n) + : "r"(res) + : "memory", "d0", "d1", "d2", "d3", "d4", "d5", + "d28", "d29", "d30", "d31" ); +} + + +#endif diff --git a/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h new file mode 100644 index 000000000..7ee728ac4 --- /dev/null +++ b/gnuradio-core/src/lib/filter/dotprod_ccf_armv7_a.h @@ -0,0 +1,47 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,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_DOTPROD_CCF_ARMV7_A_H +#define INCLUDED_DOTPROD_CCF_ARMV7_A_H + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * <pre> + * + * preconditions: + * + * n > 0 and a multiple of 4 + * a 4-byte aligned + * b 16-byte aligned + * + * </pre> + */ +void dotprod_ccf_armv7_a(const float *a, const float *b, float *res, size_t n); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_DOTPROD_CCF_ARMV7_A_H */ diff --git a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c index bd1b88e22..c3275c331 100644 --- a/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c +++ b/gnuradio-core/src/lib/filter/dotprod_fff_armv7_a.c @@ -77,7 +77,8 @@ dotprod_fff_armv7_a(const float *a, const float *b, size_t n) "vpadd.f32 d0, d16, d17 \n\t" "vadd.f32 %0, s0, s1 \n\t" : "=w"(s), "+r"(a), "+r"(b), "+r"(n) - :: "q0", "q1", "q2", "q3", "q8", "q9"); + :: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", + "d16", "d17", "d18", "d19"); return s; diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc new file mode 100644 index 000000000..ac42b57b7 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.cc @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gr_fir_ccf_armv7_a.h> +#include <stdlib.h> +#include <string.h> +#include <stdexcept> +#include <assert.h> +#include <gr_math.h> +#include <dotprod_ccf_armv7_a.h> + +#define FLOATS_PER_VEC 4 + +gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a() + : gr_fir_ccf_generic(), + d_naligned_taps(0), d_aligned_taps(0) +{ +} + +gr_fir_ccf_armv7_a::gr_fir_ccf_armv7_a (const std::vector<float> &new_taps) + : gr_fir_ccf_generic(new_taps), + d_naligned_taps(0), d_aligned_taps(0) +{ + set_taps(new_taps); +} + +gr_fir_ccf_armv7_a::~gr_fir_ccf_armv7_a() +{ + if (d_aligned_taps){ + free(d_aligned_taps); + d_aligned_taps = 0; + } +} + +void +gr_fir_ccf_armv7_a::set_taps(const std::vector<float> &inew_taps) +{ + gr_fir_ccf_generic::set_taps(inew_taps); // call superclass + d_naligned_taps = gr_p2_round_up(ntaps(), FLOATS_PER_VEC); + + if (d_aligned_taps){ + free(d_aligned_taps); + d_aligned_taps = 0; + } + void *p; + int r = posix_memalign(&p, sizeof(float), d_naligned_taps * sizeof(d_aligned_taps[0])); + if (r != 0){ + throw std::bad_alloc(); + } + d_aligned_taps = (float *) p; + memcpy(d_aligned_taps, &d_taps[0], ntaps() * sizeof(d_aligned_taps[0])); + for (size_t i = ntaps(); i < d_naligned_taps; i++) + d_aligned_taps[i] = 0.0; +} + + +gr_complex +gr_fir_ccf_armv7_a::filter (const gr_complex input[]) +{ + if (d_naligned_taps == 0) + return 0.0; + + gr_complex result; + float *presult = reinterpret_cast<float *>(&result); + const float *pinput = reinterpret_cast<const float *>(input); + + dotprod_ccf_armv7_a(pinput, d_aligned_taps, presult, d_naligned_taps); + return result; +} diff --git a/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h new file mode 100644 index 000000000..719ff4010 --- /dev/null +++ b/gnuradio-core/src/lib/filter/gr_fir_ccf_armv7_a.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,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_GR_FIR_CCF_ARMV7_A_H +#define INCLUDED_GR_FIR_CCF_ARMV7_A_H + +#include <gr_fir_ccf_generic.h> + +/*! + * \brief armv7_a using NEON coprocessor version of gr_fir_ccf + */ +class gr_fir_ccf_armv7_a : public gr_fir_ccf_generic +{ +protected: + + size_t d_naligned_taps; // number of taps (multiple of 4) + float *d_aligned_taps; // 16-byte aligned, and zero padded to multiple of 4 + +public: + gr_fir_ccf_armv7_a(); + gr_fir_ccf_armv7_a(const std::vector<float> &taps); + ~gr_fir_ccf_armv7_a(); + + virtual void set_taps (const std::vector<float> &taps); + virtual gr_complex filter (const gr_complex input[]); +}; + +#endif /* INCLUDED_GR_FIR_CCF_ARMV7_A*_H */ diff --git a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc index 34c7d4c01..71e622d37 100644 --- a/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc +++ b/gnuradio-core/src/lib/filter/gr_fir_sysconfig_armv7_a.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002,2008,2009 Free Software Foundation, Inc. + * Copyright 2002,2008,2009,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,6 +28,7 @@ #include <gr_fir_ccf.h> #include <gr_fir_ccf_generic.h> +#include <gr_fir_ccf_armv7_a.h> #include <gr_fir_fcc.h> #include <gr_fir_fcc_generic.h> #include <gr_fir_fff.h> @@ -51,13 +52,13 @@ using std::cerr; * ---------------------------------------------------------------- */ -#if 0 static gr_fir_ccf * -make_gr_fir_ccf_altivec(const std::vector<float> &taps) +make_gr_fir_ccf_armv7_a (const std::vector<float> &taps) { - return new gr_fir_ccf_altivec(taps); + return new gr_fir_ccf_armv7_a(taps); } +#if 0 static gr_fir_fcc * make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps) { @@ -107,15 +108,13 @@ gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector<float> &taps) { static bool first = true; -#if 0 - if (gr_cpu::has_altivec ()){ + if (gr_cpu::has_armv7_a ()){ if (first){ - cerr << ">>> gr_fir_ccf: using altivec\n"; + cerr << ">>> gr_fir_ccf: using armv7_a\n"; first = false; } - return make_gr_fir_ccf_altivec (taps); + return make_gr_fir_ccf_armv7_a (taps); } -#endif if (0 && first){ cerr << ">>> gr_fir_ccf: handing off to parent class\n"; @@ -245,15 +244,13 @@ gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *inf // invoke parent.. gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); -#if 0 // add our stuff... gr_fir_ccf_info t; - if (gr_cpu::has_altivec ()){ - t.name = "altivec"; - t.create = make_gr_fir_ccf_altivec; + if (gr_cpu::has_armv7_a ()){ + t.name = "armv7_a"; + t.create = make_gr_fir_ccf_armv7_a; (*info).push_back (t); } -#endif } void diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc b/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc index a93751b2f..938a522f4 100644 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc +++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2010 Free Software Foundation, Inc. + * Copyright 2006,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -42,6 +42,8 @@ gr_goertzel_fc::gr_goertzel_fc(int rate, int len, float freq) d_goertzel(rate, len, freq) { d_len = len; + d_rate = rate; + d_freq = freq; } int gr_goertzel_fc::work(int noutput_items, @@ -58,3 +60,17 @@ int gr_goertzel_fc::work(int noutput_items, return noutput_items; } + +void +gr_goertzel_fc::set_freq(float freq) +{ + d_freq = freq; + d_goertzel.gri_setparms(d_rate, d_len, d_freq); +} + +void +gr_goertzel_fc::set_rate(int rate) +{ + d_rate = rate; + d_goertzel.gri_setparms(d_rate, d_len, d_freq); +} diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h index 9518c5c92..c60b63d88 100644 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.h +++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -44,11 +44,16 @@ private: gr_goertzel_fc(int rate, int len, float freq); gri_goertzel d_goertzel; int d_len; + float d_freq; + int d_rate; public: int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); + + void set_freq (float freq); + void set_rate (int rate); }; #endif /* INCLUDED_GR_GOERTZEL_FC_H */ diff --git a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i b/gnuradio-core/src/lib/filter/gr_goertzel_fc.i index 4cbc1dece..775c78cc8 100644 --- a/gnuradio-core/src/lib/filter/gr_goertzel_fc.i +++ b/gnuradio-core/src/lib/filter/gr_goertzel_fc.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,4 +28,8 @@ class gr_goertzel_fc : public gr_sync_decimator { private: gr_goertzel_fc(); + +public: + void set_freq (float freq); + void set_rate (int rate); }; diff --git a/gnuradio-core/src/lib/filter/gri_goertzel.cc b/gnuradio-core/src/lib/filter/gri_goertzel.cc index f0314e400..85e66c069 100644 --- a/gnuradio-core/src/lib/filter/gri_goertzel.cc +++ b/gnuradio-core/src/lib/filter/gri_goertzel.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,15 +26,21 @@ gri_goertzel::gri_goertzel(int rate, int len, float freq) { + gri_setparms(rate, len, freq); +} + +void +gri_goertzel::gri_setparms(int rate, int len, float freq) +{ d_d1 = 0.0; d_d2 = 0.0; float w = 2.0*M_PI*freq/rate; d_wr = 2.0*std::cos(w); d_wi = std::sin(w); - d_len = len; d_processed = 0; + } gr_complex gri_goertzel::batch(float *in) diff --git a/gnuradio-core/src/lib/filter/gri_goertzel.h b/gnuradio-core/src/lib/filter/gri_goertzel.h index 86d3d34d3..e062f000e 100644 --- a/gnuradio-core/src/lib/filter/gri_goertzel.h +++ b/gnuradio-core/src/lib/filter/gri_goertzel.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -34,6 +34,7 @@ class gri_goertzel public: gri_goertzel() {} gri_goertzel(int rate, int len, float freq); + void gri_setparms(int rate, int len, float freq); // Process a input array gr_complex batch(float *in); diff --git a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc index d52ca78b9..35ef5527e 100644 --- a/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc +++ b/gnuradio-core/src/lib/runtime/qa_set_msg_handler.cc @@ -74,8 +74,8 @@ void qa_set_msg_handler::t0() // core. send(src, mp(mp("example-msg"), mp(0))); - // Surrender our CPU for a bit - boost::this_thread::yield(); + // Give the messages a chance to be processed + boost::this_thread::sleep(boost::posix_time::milliseconds(100)); tb->stop(); tb->wait(); diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py index 5902fa855..9f413f2a8 100755 --- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py +++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Copyright 2010 Free Software Foundation, Inc. +Copyright 2010-2011 Free Software Foundation, Inc. This file is part of GNU Radio @@ -27,16 +27,12 @@ MAIN_TMPL = """\ <import>from gnuradio import uhd</import> <make>uhd.multi_usrp_$(sourk)( device_addr=\$dev_addr, - io_type=uhd.io_type_t.\$type.type, + io_type=uhd.io_type.\$type.type, num_channels=\$nchan, ) \#if \$sync() -_clk_cfg = uhd.clock_config_t() -_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA -_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA -_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS -self.\$(id).set_clock_config(_clk_cfg, uhd.ALL_MBOARDS); -self.\$(id).set_time_unknown_pps(uhd.time_spec_t()) +self.\$(id).set_clock_config(uhd.clock_config.external(), uhd.ALL_MBOARDS); +self.\$(id).setime_unknown_pps(uhd.time_spec()) \#end if #for $m in range($max_mboards) \#if \$num_mboards() > $m and \$sd_spec$(m)() @@ -201,8 +197,8 @@ If the requested rate is not possible, the UHD block will print an error at runt Center frequency: The center frequency is the overall frequency of the RF chain. \\ For greater control of how the UHD tunes elements in the RF chain, \\ -pass a tune_request_t object rather than a simple target frequency. -Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off) +pass a tune_request object rather than a simple target frequency. +Tuning with an LO offset example: uhd.tune_request(freq, lo_off) Antenna: For subdevices with only one antenna, this may be left blank. \\ diff --git a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py index 66728fe28..4de21c989 100755 --- a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py +++ b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Copyright 2010 Free Software Foundation, Inc. +Copyright 2010-2011 Free Software Foundation, Inc. This file is part of GNU Radio @@ -27,15 +27,11 @@ MAIN_TMPL = """\ <import>from gnuradio import uhd</import> <make>uhd.single_usrp_$(sourk)( device_addr=\$dev_addr, - io_type=uhd.io_type_t.\$type.type, + io_type=uhd.io_type.\$type.type, num_channels=\$nchan, ) \#if \$ref_clk() -_clk_cfg = uhd.clock_config_t() -_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA -_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA -_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS -self.\$(id).set_clock_config(_clk_cfg); +self.\$(id).set_clock_config(uhd.clock_config.external()); \#end if \#if \$sd_spec() self.\$(id).set_subdev_spec(\$sd_spec) @@ -180,8 +176,8 @@ If the requested rate is not possible, the UHD block will print an error at runt Center frequency: The center frequency is the overall frequency of the RF chain. \\ For greater control of how the UHD tunes elements in the RF chain, \\ -pass a tune_request_t object rather than a simple target frequency. -Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off) +pass a tune_request object rather than a simple target frequency. +Tuning with an LO offset example: uhd.tune_request(freq, lo_off) Antenna: For subdevices with only one antenna, this may be left blank. \\ diff --git a/gr-uhd/lib/Makefile.am b/gr-uhd/lib/Makefile.am index 1bcfbbbdc..7ddb45cb3 100644 --- a/gr-uhd/lib/Makefile.am +++ b/gr-uhd/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -41,6 +41,7 @@ libgnuradio_uhd_la_LIBADD = \ libgnuradio_uhd_la_LDFLAGS = $(LTVERSIONFLAGS) grinclude_HEADERS = \ + gr_uhd_api.h \ uhd_multi_usrp_source.h \ uhd_multi_usrp_sink.h \ uhd_single_usrp_source.h \ diff --git a/gr-uhd/lib/gr_uhd_api.h b/gr-uhd/lib/gr_uhd_api.h new file mode 100644 index 000000000..a9b99fd87 --- /dev/null +++ b/gr-uhd/lib/gr_uhd_api.h @@ -0,0 +1,33 @@ +/* + * Copyright 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_GR_UHD_API_H +#define INCLUDED_GR_UHD_API_H + +#include <uhd/config.hpp> + +#ifdef gnuradio_uhd_EXPORTS +# define GR_UHD_API UHD_EXPORT +#else +# define GR_UHD_API UHD_EXPORT +#endif + +#endif /* INCLUDED_GR_UHD_API_H */ diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc index ee16e2928..32039e44a 100644 --- a/gr-uhd/lib/uhd_multi_usrp_sink.cc +++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -37,7 +37,7 @@ uhd_multi_usrp_sink::uhd_multi_usrp_sink(gr_io_signature_sptr sig) class uhd_multi_usrp_sink_impl : public uhd_multi_usrp_sink{ public: uhd_multi_usrp_sink_impl( - const std::string &device_addr, + const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, size_t num_channels ): @@ -56,6 +56,7 @@ public: void set_samp_rate(double rate){ _dev->set_tx_rate(rate); + _sample_rate = this->get_samp_rate(); } double get_samp_rate(void){ @@ -72,11 +73,11 @@ public: return _dev->get_tx_freq_range(chan); } - void set_gain(float gain, size_t chan){ + void set_gain(double gain, size_t chan){ return _dev->set_tx_gain(gain, chan); } - float get_gain(size_t chan){ + double get_gain(size_t chan){ return _dev->get_tx_gain(chan); } @@ -128,28 +129,31 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items ){ - uhd::tx_metadata_t metadata; - metadata.start_of_burst = true; + //send a mid-burst packet with time spec + _metadata.start_of_burst = false; + _metadata.end_of_burst = false; + _metadata.has_time_spec = true; - return _dev->get_device()->send( - input_items, noutput_items, metadata, + size_t num_sent = _dev->get_device()->send( + input_items, noutput_items, _metadata, _type, uhd::device::SEND_MODE_FULL_BUFF, 1.0 ); + + //increment the timespec by the number of samples sent + _metadata.time_spec += uhd::time_spec_t(0, num_sent, _sample_rate); + return num_sent; } //Send an empty start-of-burst packet to begin streaming. - //Set at a time in the near future so data will be sync'd. + //Set at a time in the near future to avoid late packets. bool start(void){ - uhd::tx_metadata_t metadata; - metadata.start_of_burst = true; - metadata.has_time_spec = true; - //TODO: Time in the near future, must be less than source time in future - //because ethernet pause frames with throttle stream commands. - //It will be fixed with the invention of host-based flow control. - metadata.time_spec = get_time_now() + uhd::time_spec_t(0.05); + _metadata.start_of_burst = true; + _metadata.end_of_burst = false; + _metadata.has_time_spec = true; + _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01); _dev->get_device()->send( - gr_vector_const_void_star(_nchan), 0, metadata, + gr_vector_const_void_star(_nchan), 0, _metadata, _type, uhd::device::SEND_MODE_ONE_PACKET, 1.0 ); return true; @@ -158,11 +162,12 @@ public: //Send an empty end-of-burst packet to end streaming. //Ending the burst avoids an underflow error on stop. bool stop(void){ - uhd::tx_metadata_t metadata; - metadata.end_of_burst = true; + _metadata.start_of_burst = false; + _metadata.end_of_burst = true; + _metadata.has_time_spec = false; _dev->get_device()->send( - gr_vector_const_void_star(_nchan), 0, metadata, + gr_vector_const_void_star(_nchan), 0, _metadata, _type, uhd::device::SEND_MODE_ONE_PACKET, 1.0 ); return true; @@ -172,14 +177,16 @@ protected: uhd::usrp::multi_usrp::sptr _dev; const uhd::io_type_t _type; size_t _nchan; + uhd::tx_metadata_t _metadata; + double _sample_rate; }; /*********************************************************************** * Make UHD Multi USRP Sink **********************************************************************/ boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels ){ return boost::shared_ptr<uhd_multi_usrp_sink>( diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h index 370e59d0e..4866f2cbb 100644 --- a/gr-uhd/lib/uhd_multi_usrp_sink.h +++ b/gr-uhd/lib/uhd_multi_usrp_sink.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,18 +22,19 @@ #ifndef INCLUDED_UHD_MULTI_USRP_SINK_H #define INCLUDED_UHD_MULTI_USRP_SINK_H +#include <gr_uhd_api.h> #include <gr_sync_block.h> #include <uhd/usrp/multi_usrp.hpp> class uhd_multi_usrp_sink; -boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, +GR_UHD_API boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink( + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels ); -class uhd_multi_usrp_sink : public gr_sync_block{ +class GR_UHD_API uhd_multi_usrp_sink : public gr_sync_block{ public: /*! @@ -96,14 +97,14 @@ public: * \param gain the gain in dB * \param chan the channel index 0 to N-1 */ - virtual void set_gain(float gain, size_t chan) = 0; + virtual void set_gain(double gain, size_t chan) = 0; /*! * Get the actual dboard gain setting. * \param chan the channel index 0 to N-1 * \return the actual gain in dB */ - virtual float get_gain(size_t chan) = 0; + virtual double get_gain(size_t chan) = 0; /*! * Get the settable gain range. diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc index 029a763e3..181cf1eb4 100644 --- a/gr-uhd/lib/uhd_multi_usrp_source.cc +++ b/gr-uhd/lib/uhd_multi_usrp_source.cc @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -39,7 +39,7 @@ uhd_multi_usrp_source::uhd_multi_usrp_source(gr_io_signature_sptr sig) class uhd_multi_usrp_source_impl : public uhd_multi_usrp_source{ public: uhd_multi_usrp_source_impl( - const std::string &device_addr, + const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, size_t num_channels ): @@ -73,11 +73,11 @@ public: return _dev->get_rx_freq_range(chan); } - void set_gain(float gain, size_t chan){ + void set_gain(double gain, size_t chan){ return _dev->set_rx_gain(gain, chan); } - float get_gain(size_t chan){ + double get_gain(size_t chan){ return _dev->get_rx_gain(chan); } @@ -177,8 +177,8 @@ private: * Make UHD Multi USRP Source **********************************************************************/ boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels ){ return boost::shared_ptr<uhd_multi_usrp_source>( diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h index b3cbdae1f..9cbec52aa 100644 --- a/gr-uhd/lib/uhd_multi_usrp_source.h +++ b/gr-uhd/lib/uhd_multi_usrp_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,18 +22,19 @@ #ifndef INCLUDED_UHD_MULTI_USRP_SOURCE_H #define INCLUDED_UHD_MULTI_USRP_SOURCE_H +#include <gr_uhd_api.h> #include <gr_sync_block.h> #include <uhd/usrp/multi_usrp.hpp> class uhd_multi_usrp_source; -boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, +GR_UHD_API boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source( + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels ); -class uhd_multi_usrp_source : public gr_sync_block{ +class GR_UHD_API uhd_multi_usrp_source : public gr_sync_block{ public: /*! @@ -96,14 +97,14 @@ public: * \param gain the gain in dB * \param chan the channel index 0 to N-1 */ - virtual void set_gain(float gain, size_t chan) = 0; + virtual void set_gain(double gain, size_t chan) = 0; /*! * Get the actual dboard gain setting. * \param chan the channel index 0 to N-1 * \return the actual gain in dB */ - virtual float get_gain(size_t chan) = 0; + virtual double get_gain(size_t chan) = 0; /*! * Get the settable gain range. diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc index 622f506b5..d9aaac893 100644 --- a/gr-uhd/lib/uhd_single_usrp_sink.cc +++ b/gr-uhd/lib/uhd_single_usrp_sink.cc @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -37,7 +37,7 @@ uhd_single_usrp_sink::uhd_single_usrp_sink(gr_io_signature_sptr sig) class uhd_single_usrp_sink_impl : public uhd_single_usrp_sink{ public: uhd_single_usrp_sink_impl( - const std::string &device_addr, + const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, size_t num_channels ): @@ -72,11 +72,11 @@ public: return _dev->get_tx_freq_range(chan); } - void set_gain(float gain, size_t chan){ + void set_gain(double gain, size_t chan){ return _dev->set_tx_gain(gain, chan); } - float get_gain(size_t chan){ + double get_gain(size_t chan){ return _dev->get_tx_gain(chan); } @@ -128,8 +128,7 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items ){ - uhd::tx_metadata_t metadata; - metadata.start_of_burst = true; + uhd::tx_metadata_t metadata; //send a mid-burst packet return _dev->get_device()->send( input_items, noutput_items, metadata, @@ -173,8 +172,8 @@ protected: * Make UHD Single USRP Sink **********************************************************************/ boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels ){ return boost::shared_ptr<uhd_single_usrp_sink>( diff --git a/gr-uhd/lib/uhd_single_usrp_sink.h b/gr-uhd/lib/uhd_single_usrp_sink.h index a4c4e6452..4929d0f13 100644 --- a/gr-uhd/lib/uhd_single_usrp_sink.h +++ b/gr-uhd/lib/uhd_single_usrp_sink.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,18 +22,19 @@ #ifndef INCLUDED_UHD_SINGLE_USRP_SINK_H #define INCLUDED_UHD_SINGLE_USRP_SINK_H +#include <gr_uhd_api.h> #include <gr_sync_block.h> #include <uhd/usrp/single_usrp.hpp> class uhd_single_usrp_sink; -boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, +GR_UHD_API boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink( + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels = 1 ); -class uhd_single_usrp_sink : public gr_sync_block{ +class GR_UHD_API uhd_single_usrp_sink : public gr_sync_block{ public: /*! @@ -95,14 +96,14 @@ public: * \param gain the gain in dB * \param chan the channel index 0 to N-1 */ - virtual void set_gain(float gain, size_t chan = 0) = 0; + virtual void set_gain(double gain, size_t chan = 0) = 0; /*! * Get the actual dboard gain setting. * \param chan the channel index 0 to N-1 * \return the actual gain in dB */ - virtual float get_gain(size_t chan = 0) = 0; + virtual double get_gain(size_t chan = 0) = 0; /*! * Get the settable gain range. diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc index 45f852a3e..5a26d44b1 100644 --- a/gr-uhd/lib/uhd_single_usrp_source.cc +++ b/gr-uhd/lib/uhd_single_usrp_source.cc @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -39,7 +39,7 @@ uhd_single_usrp_source::uhd_single_usrp_source(gr_io_signature_sptr sig) class uhd_single_usrp_source_impl : public uhd_single_usrp_source{ public: uhd_single_usrp_source_impl( - const std::string &device_addr, + const uhd::device_addr_t &device_addr, const uhd::io_type_t &io_type, size_t num_channels ): @@ -49,7 +49,6 @@ public: _type(io_type) { _dev = uhd::usrp::single_usrp::make(device_addr); - d_tag_srcid = pmt::mp("uhd_single_usrp_source"); } void set_subdev_spec(const std::string &spec){ @@ -74,11 +73,11 @@ public: return _dev->get_rx_freq_range(chan); } - void set_gain(float gain, size_t chan){ + void set_gain(double gain, size_t chan){ return _dev->set_rx_gain(gain, chan); } - float get_gain(size_t chan){ + double get_gain(size_t chan){ return _dev->get_rx_gain(chan); } @@ -125,7 +124,7 @@ public: /*********************************************************************** * Work **********************************************************************/ - int work( + virtual int work( int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items @@ -139,16 +138,7 @@ public: switch(metadata.error_code){ case uhd::rx_metadata_t::ERROR_CODE_NONE: - if(metadata.has_time_spec) { - d_tstamp_pair = pmt::mp(pmt::mp(metadata.time_spec.get_full_secs()), - pmt::mp(metadata.time_spec.get_frac_secs())); - add_item_tag(0, nitems_written(0), - //gr_tags::key_time, - pmt::pmt_string_to_symbol("time"), - d_tstamp_pair, - d_tag_srcid); - } - return num_samps; + return num_samps; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: //ignore overflows and try work again @@ -172,9 +162,68 @@ public: return true; } -private: +protected: uhd::usrp::single_usrp::sptr _dev; const uhd::io_type_t _type; +}; + +/*********************************************************************** + * UHD Single USRP Source Impl with Tags + **********************************************************************/ +class uhd_single_usrp_source_impl_with_tags : public uhd_single_usrp_source_impl{ +public: + uhd_single_usrp_source_impl_with_tags( + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, + size_t num_channels + ): + uhd_single_usrp_source_impl(device_addr, io_type, num_channels) + { + d_tag_srcid = pmt::mp("uhd_single_usrp_source"); + } + + int work( + int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items + ){ + uhd::rx_metadata_t metadata; //not passed out of this block + + size_t num_samps = _dev->get_device()->recv( + output_items, noutput_items, metadata, + _type, uhd::device::RECV_MODE_FULL_BUFF + ); + + switch(metadata.error_code){ + case uhd::rx_metadata_t::ERROR_CODE_NONE: + //FIXME in RECV_MODE_FULL_BUFF we are probably get remainders, + //there is no guarantee of has_time_spec, its random + if(metadata.has_time_spec) { + d_tstamp_pair = pmt::mp(pmt::mp(metadata.time_spec.get_full_secs()), + pmt::mp(metadata.time_spec.get_frac_secs())); + add_item_tag(0, nitems_written(0), + //gr_tags::key_time, + pmt::pmt_string_to_symbol("time"), + d_tstamp_pair, + d_tag_srcid); + } + return num_samps; + + case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: + //ignore overflows and try work again + return work(noutput_items, input_items, output_items); + + default: + std::cout << boost::format( + "UHD source block got error code 0x%x" + ) % metadata.error_code << std::endl; + return num_samps; + } + } + +private: + size_t d_num_packet_samps; + pmt::pmt_t d_tstamp_pair; pmt::pmt_t d_tag_srcid; }; @@ -182,11 +231,18 @@ private: /*********************************************************************** * Make UHD Single USRP Source **********************************************************************/ +#include <gr_prefs.h> boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels ){ + //use the tags constructor if tags is set to on + bool tags_enabled = (gr_prefs().get_string("gr-uhd", "tags", "off") == "on"); + if (tags_enabled) return boost::shared_ptr<uhd_single_usrp_source>( + new uhd_single_usrp_source_impl_with_tags(device_addr, io_type, num_channels) + ); + return boost::shared_ptr<uhd_single_usrp_source>( new uhd_single_usrp_source_impl(device_addr, io_type, num_channels) ); diff --git a/gr-uhd/lib/uhd_single_usrp_source.h b/gr-uhd/lib/uhd_single_usrp_source.h index 2a011b2b3..262f6696c 100644 --- a/gr-uhd/lib/uhd_single_usrp_source.h +++ b/gr-uhd/lib/uhd_single_usrp_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,18 +22,19 @@ #ifndef INCLUDED_UHD_SINGLE_USRP_SOURCE_H #define INCLUDED_UHD_SINGLE_USRP_SOURCE_H +#include <gr_uhd_api.h> #include <gr_sync_block.h> #include <uhd/usrp/single_usrp.hpp> class uhd_single_usrp_source; -boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source( - const std::string &device_addr, - const uhd::io_type_t::tid_t &io_type, +GR_UHD_API boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source( + const uhd::device_addr_t &device_addr, + const uhd::io_type_t &io_type, size_t num_channels = 1 ); -class uhd_single_usrp_source : public gr_sync_block{ +class GR_UHD_API uhd_single_usrp_source : public gr_sync_block{ public: /*! @@ -95,14 +96,14 @@ public: * \param gain the gain in dB * \param chan the channel index 0 to N-1 */ - virtual void set_gain(float gain, size_t chan = 0) = 0; + virtual void set_gain(double gain, size_t chan = 0) = 0; /*! * Get the actual dboard gain setting. * \param chan the channel index 0 to N-1 * \return the actual gain in dB */ - virtual float get_gain(size_t chan = 0) = 0; + virtual double get_gain(size_t chan = 0) = 0; /*! * Get the settable gain range. @@ -168,10 +169,6 @@ public: * \return the single usrp device object */ virtual uhd::usrp::single_usrp::sptr get_device(void) = 0; - - protected: - size_t d_num_packet_samps; - pmt::pmt_t d_tstamp_pair; }; #endif /* INCLUDED_UHD_SINGLE_USRP_SOURCE_H */ diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py index 0fdacb796..1a9f8358d 100644 --- a/gr-uhd/swig/__init__.py +++ b/gr-uhd/swig/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,17 @@ # The presence of this file turns this directory into a Python package ######################################################################## +# Create aliases for uhd swig attributes to avoid the "_t" +# Install the __str__ and __repr__ handlers if applicable +######################################################################## +import uhd_swig +for attr in dir(uhd_swig): + myobj = getattr(uhd_swig, attr) + if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip() + if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip() + if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj) + +######################################################################## # Add SWIG generated code to this namespace ######################################################################## from uhd_swig import * @@ -29,6 +40,8 @@ from uhd_swig import * ######################################################################## # Add other content from pure-Python modules here ######################################################################## +class freq_range_t(meta_range_t): pass #a typedef for the user +class gain_range_t(meta_range_t): pass #a typedef for the user class tune_request_t(tune_request_t, float): """ @@ -38,3 +51,36 @@ class tune_request_t(tune_request_t, float): """ def __new__(self, *args): return float.__new__(self) def __float__(self): return self.target_freq + +class device_addr_t(device_addr_t, str): + """ + Make the python tune request object inherit from string + so that it can be passed in GRC as a string parameter. + The type checking in GRC will accept the device address. + Define the set/get item special methods for dict access. + """ + def __new__(self, *args): return str.__new__(self) + def __getitem__(self, key): return self.get(key) + def __setitem__(self, key, val): self.set(key, val) + +######################################################################## +# Cast constructor args (FIXME swig handle overloads?) +######################################################################## +for attr in ( + 'single_usrp_source', 'single_usrp_sink', + 'multi_usrp_source', 'multi_usrp_sink' +): + def constructor_factory(old_constructor): + def constructor_interceptor(*args, **kwargs): + args = list(args) + kwargs = dict(kwargs) + for index, key, cast in ( + (0, 'device_addr', device_addr), + (1, 'io_type', io_type), + ): + if len(args) > index: args[index] = cast(args[index]) + if kwargs.has_key(key): kwargs[key] = cast(kwargs[key]) + return old_constructor(*args, **kwargs) + return constructor_interceptor + import uhd_swig + globals()[attr] = constructor_factory(getattr(uhd_swig, attr)) diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 76f44a491..3c317beb4 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2010-2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -24,6 +24,8 @@ // header files if UHD was not installed. #ifdef GR_HAVE_UHD +#define GR_UHD_API + //////////////////////////////////////////////////////////////////////// // Language independent exception handler //////////////////////////////////////////////////////////////////////// @@ -47,10 +49,6 @@ //////////////////////////////////////////////////////////////////////// %include "gnuradio.i" -namespace std { - %template(StringVector) vector<string>; -} - //////////////////////////////////////////////////////////////////////// // block headers //////////////////////////////////////////////////////////////////////// @@ -64,25 +62,36 @@ namespace std { //////////////////////////////////////////////////////////////////////// // used types //////////////////////////////////////////////////////////////////////// +%template(string_vector_t) std::vector<std::string>; + %include <uhd/config.hpp> + %include <uhd/utils/pimpl.hpp> + +%include <uhd/types/dict.hpp> +%template(string_string_dict_t) uhd::dict<std::string, std::string>; //define after dict + +%include <uhd/types/device_addr.hpp> + +%include <uhd/types/io_type.hpp> + +%template(range_vector_t) std::vector<uhd::range_t>; //define before range %include <uhd/types/ranges.hpp> + %include <uhd/types/tune_request.hpp> + %include <uhd/types/tune_result.hpp> + %include <uhd/types/io_type.hpp> + %include <uhd/types/time_spec.hpp> -%include <uhd/types/clock_config.hpp> -//Re-create range typedefs here with %template as they are not imported. -//Replicate all the levels of templated inheritance so swig understands. +%include <uhd/types/clock_config.hpp> -%template(float_range_t) uhd::range_t<float>; -%template(_float_range_vector_t) std::vector<uhd::range_t<float> >; -%template(gain_range_t) uhd::meta_range_t<float>; +%include <uhd/types/metadata.hpp> -%template(double_range_t) uhd::range_t<double>; -%template(_double_range_vector_t) std::vector<uhd::range_t<double> >; -%template(freq_range_t) uhd::meta_range_t<double>; +%include <uhd/device.hpp> +%template(device_addr_vector_t) std::vector<uhd::device_addr_t>; //////////////////////////////////////////////////////////////////////// // block magic diff --git a/gr-utils/src/python/gr_plot_const.py b/gr-utils/src/python/gr_plot_const.py index ec2272c74..5dd08c9a0 100755 --- a/gr-utils/src/python/gr_plot_const.py +++ b/gr-utils/src/python/gr_plot_const.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2008 Free Software Foundation, Inc. +# Copyright 2007,2008,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -80,15 +80,15 @@ class draw_constellation: def get_data(self): self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data)) - iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) - #print "Read in %d items" % len(iq) - if(len(iq) == 0): + try: + iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + except MemoryError: print "End of File" else: - self.reals = [r.real for r in iq] - self.imags = [i.imag for i in iq] + self.reals = scipy.array([r.real for r in iq]) + self.imags = scipy.array([i.imag for i in iq]) - self.time = [i*(1/self.sample_rate) for i in range(len(self.reals))] + self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) def make_plots(self): # if specified on the command-line, set file pointer @@ -117,9 +117,9 @@ class draw_constellation: self.plot_const += self.sp_const.plot([self.reals[self.indx],], [self.imags[self.indx],], 'mo', ms=12) # Adjust axis - self.sp_iq.axis([min(self.time), max(self.time), - 1.5*min([min(self.reals), min(self.imags)]), - 1.5*max([max(self.reals), max(self.imags)])]) + self.sp_iq.axis([self.time.min(), self.time.max(), + 1.5*min([self.reals.min(), self.imags.min()]), + 1.5*max([self.reals.max(), self.imags.max()])]) self.sp_const.axis([-2, 2, -2, 2]) draw() @@ -127,9 +127,9 @@ class draw_constellation: def update_plots(self): self.plot_iq[0].set_data([self.time, self.reals]) self.plot_iq[1].set_data([self.time, self.imags]) - self.sp_iq.axis([min(self.time), max(self.time), - 1.5*min([min(self.reals), min(self.imags)]), - 1.5*max([max(self.reals), max(self.imags)])]) + self.sp_iq.axis([self.time.min(), self.time.max(), + 1.5*min([self.reals.min(), self.imags.min()]), + 1.5*max([self.reals.max(), self.imags.max()])]) self.plot_const[0].set_data([self.reals, self.imags]) self.sp_const.axis([-2, 2, -2, 2]) @@ -138,7 +138,7 @@ class draw_constellation: def zoom(self, event): newxlim = scipy.array(self.sp_iq.get_xlim()) curxlim = scipy.array(self.xlim) - if(newxlim.all() != curxlim.all()): + if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]): self.xlim = newxlim r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] i = self.imags[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] diff --git a/gr-utils/src/python/gr_plot_fft.py b/gr-utils/src/python/gr_plot_fft.py index a9c1417f9..ba3901e03 100755 --- a/gr-utils/src/python/gr_plot_fft.py +++ b/gr-utils/src/python/gr_plot_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2008 Free Software Foundation, Inc. +# Copyright 2007,2008,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -81,15 +81,16 @@ class gr_plot_fft: def get_data(self): self.position = self.hfile.tell()/self.sizeof_data self.text_file_pos.set_text("File Position: %d" % (self.position)) - self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) - #print "Read in %d items" % len(self.iq) - if(len(self.iq) == 0): + try: + self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + except MemoryError: print "End of File" else: self.iq_fft = self.dofft(self.iq) tstep = 1.0 / self.sample_rate - self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))] + #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))]) + self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))]) self.freq = self.calc_freq(self.time, self.sample_rate) @@ -102,9 +103,9 @@ class gr_plot_fft: def calc_freq(self, time, sample_rate): N = len(time) - Fs = 1.0 / (max(time) - min(time)) + Fs = 1.0 / (time.max() - time.min()) Fn = 0.5 * sample_rate - freq = [-Fn + i*Fs for i in xrange(N)] + freq = scipy.array([-Fn + i*Fs for i in xrange(N)]) return freq def make_plots(self): @@ -139,14 +140,14 @@ class gr_plot_fft: imags = self.iq.imag self.plot_iq[0].set_data([self.time, reals]) self.plot_iq[1].set_data([self.time, imags]) - self.sp_iq.set_xlim(min(self.time), max(self.time)) - self.sp_iq.set_ylim([1.5*min([min(reals), min(imags)]), - 1.5*max([max(reals), max(imags)])]) + self.sp_iq.set_xlim(self.time.min(), self.time.max()) + self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), + 1.5*max([reals.max(), imags.max()])]) def draw_fft(self): self.plot_fft[0].set_data([self.freq, self.iq_fft]) - self.sp_fft.set_xlim(min(self.freq), max(self.freq)) - self.sp_fft.set_ylim([min(self.iq_fft)-10, max(self.iq_fft)+10]) + self.sp_fft.set_xlim(self.freq.min(), self.freq.max()) + self.sp_fft.set_ylim([self.iq_fft.min()-10, self.iq_fft.max()+10]) def update_plots(self): self.draw_time() @@ -158,10 +159,12 @@ class gr_plot_fft: def zoom(self, event): newxlim = scipy.array(self.sp_iq.get_xlim()) curxlim = scipy.array(self.xlim) - if(newxlim.all() != curxlim.all()): + if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]): self.xlim = newxlim - xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position)))) - xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq)) + #xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position)))) + #xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq)) + xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0])))) + xmax = min(int(ceil(self.sample_rate*(self.xlim[1]))), len(self.iq)) iq = self.iq[xmin : xmax] time = self.time[xmin : xmax] @@ -170,8 +173,8 @@ class gr_plot_fft: freq = self.calc_freq(time, self.sample_rate) self.plot_fft[0].set_data(freq, iq_fft) - self.sp_fft.axis([min(freq), max(freq), - min(iq_fft)-10, max(iq_fft)+10]) + self.sp_fft.axis([freq.min(), freq.max(), + iq_fft.min()-10, iq_fft.max()+10]) draw() diff --git a/gr-utils/src/python/gr_plot_iq.py b/gr-utils/src/python/gr_plot_iq.py index 371ce3b79..316e60a75 100755 --- a/gr-utils/src/python/gr_plot_iq.py +++ b/gr-utils/src/python/gr_plot_iq.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2008 Free Software Foundation, Inc. +# Copyright 2007,2008,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -78,14 +78,14 @@ class draw_iq: def get_data(self): self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data)) - self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) - #print "Read in %d items" % len(self.iq) - if(len(self.iq) == 0): + try: + self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + except MemoryError: print "End of File" else: - self.reals = [r.real for r in self.iq] - self.imags = [i.imag for i in self.iq] - self.time = [i*(1/self.sample_rate) for i in range(len(self.reals))] + self.reals = scipy.array([r.real for r in self.iq]) + self.imags = scipy.array([i.imag for i in self.iq]) + self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) def make_plots(self): # if specified on the command-line, set file pointer @@ -99,16 +99,17 @@ class draw_iq: self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") self.plot_iq = plot(self.time, self.reals, 'bo-', self.time, self.imags, 'ro-') - self.sp_iq.set_ylim([1.5*min([min(self.reals), min(self.imags)]), - 1.5*max([max(self.reals), max(self.imags)])]) - + self.sp_iq.set_ylim([1.5*min([self.reals.min(), self.imags.min()]), + 1.5*max([self.reals.max(), self.imags.max()])]) + self.sp_iq.set_xlim(self.time.min(), self.time.max()) draw() def update_plots(self): self.plot_iq[0].set_data([self.time, self.reals]) self.plot_iq[1].set_data([self.time, self.imags]) - self.sp_iq.set_ylim([1.5*min([min(self.reals), min(self.imags)]), - 1.5*max([max(self.reals), max(self.imags)])]) + self.sp_iq.set_ylim([1.5*min([self.reals.min(), self.imags.min()]), + 1.5*max([self.reals.max(), self.imags.max()])]) + self.sp_iq.set_xlim(self.time.min(), self.time.max()) draw() def click(self, event): diff --git a/gr-utils/src/python/gr_plot_psd.py b/gr-utils/src/python/gr_plot_psd.py index e3ecabd6a..3f90a7104 100755 --- a/gr-utils/src/python/gr_plot_psd.py +++ b/gr-utils/src/python/gr_plot_psd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2008,2010 Free Software Foundation, Inc. +# Copyright 2007,2008,2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -61,8 +61,10 @@ class gr_plot_psd: rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), weight="heavy", size=self.text_size) - self.text_file_pos = figtext(0.10, 0.92, "File Position: ", weight="heavy", size=self.text_size) + self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), + weight="heavy", size=self.text_size) + self.text_file_pos = figtext(0.10, 0.92, "File Position: ", + weight="heavy", size=self.text_size) self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length), weight="heavy", size=self.text_size) self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate), @@ -77,7 +79,7 @@ class gr_plot_psd: self.button_right = Button(self.button_right_axes, ">") self.button_right_callback = self.button_right.on_clicked(self.button_right_click) - self.xlim = self.sp_iq.get_xlim() + self.xlim = scipy.array(self.sp_iq.get_xlim()) self.manager = get_current_fig_manager() connect('draw_event', self.zoom) @@ -93,10 +95,11 @@ class gr_plot_psd: print "End of File" else: tstep = 1.0 / self.sample_rate - self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))]) + #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))]) + self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))]) self.iq_psd, self.freq = self.dopsd(self.iq) - + def dopsd(self, iq): ''' Need to do this here and plot later so we can do the fftshift ''' overlap = self.psdfftsize/4 @@ -131,10 +134,10 @@ class gr_plot_psd: self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags - self.draw_time() # draw the plot + self.draw_time(self.time, self.iq) # draw the plot self.plot_psd = self.sp_psd.plot([], 'b') # make plot for PSD - self.draw_psd() # draw the plot + self.draw_psd(self.freq, self.iq_psd) # draw the plot if self.dospec: @@ -144,58 +147,59 @@ class gr_plot_psd: self.sp_spec.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") self.sp_spec.set_ylabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") - self.draw_spec() + self.draw_spec(self.time, self.iq) draw() - def draw_time(self): - reals = self.iq.real - imags = self.iq.imag - self.plot_iq[0].set_data([self.time, reals]) - self.plot_iq[1].set_data([self.time, imags]) - self.sp_iq.set_xlim(self.time.min(), self.time.max()) + def draw_time(self, t, iq): + reals = iq.real + imags = iq.imag + self.plot_iq[0].set_data([t, reals]) + self.plot_iq[1].set_data([t, imags]) + self.sp_iq.set_xlim(t.min(), t.max()) self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), 1.5*max([reals.max(), imags.max()])]) - def draw_psd(self): - self.plot_psd[0].set_data([self.freq, self.iq_psd]) - self.sp_psd.set_ylim([self.iq_psd.min()-10, self.iq_psd.max()+10]) - self.sp_psd.set_xlim([self.freq.min(), self.freq.max()]) + def draw_psd(self, f, p): + self.plot_psd[0].set_data([f, p]) + self.sp_psd.set_ylim([p.min()-10, p.max()+10]) + self.sp_psd.set_xlim([f.min(), f.max()]) - def draw_spec(self): + def draw_spec(self, t, s): overlap = self.specfftsize/4 winfunc = scipy.blackman self.sp_spec.clear() - self.sp_spec.specgram(self.iq, self.specfftsize, self.sample_rate, + self.sp_spec.specgram(s, self.specfftsize, self.sample_rate, window = lambda d: d*winfunc(self.specfftsize), - noverlap = overlap, xextent=[self.time.min(), self.time.max()]) + noverlap = overlap, xextent=[t.min(), t.max()]) def update_plots(self): - self.draw_time() - self.draw_psd() + self.draw_time(self.time, self.iq) + self.draw_psd(self.freq, self.iq_psd) if self.dospec: - self.draw_spec() + self.draw_spec(self.time, self.iq) - self.xlim = self.sp_iq.get_xlim() # so zoom doesn't get called + self.xlim = scipy.array(self.sp_iq.get_xlim()) # so zoom doesn't get called + draw() def zoom(self, event): newxlim = scipy.array(self.sp_iq.get_xlim()) curxlim = scipy.array(self.xlim) - if(newxlim.all() != curxlim.all()): - self.xlim = newxlim - xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position)))) - xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq)) + if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]): + #xmin = max(0, int(ceil(self.sample_rate*(newxlim[0] - self.position)))) + #xmax = min(int(ceil(self.sample_rate*(newxlim[1] - self.position))), len(self.iq)) + xmin = max(0, int(ceil(self.sample_rate*(newxlim[0])))) + xmax = min(int(ceil(self.sample_rate*(newxlim[1]))), len(self.iq)) iq = scipy.array(self.iq[xmin : xmax]) time = scipy.array(self.time[xmin : xmax]) iq_psd, freq = self.dopsd(iq) - self.plot_psd[0].set_data(freq, iq_psd) - self.sp_psd.axis([freq.min(), freq.max(), - iq_psd.min()-10, iq_psd.max()+10]) + self.draw_psd(freq, iq_psd) + self.xlim = scipy.array(self.sp_iq.get_xlim()) draw() diff --git a/gr-utils/src/python/plot_data.py b/gr-utils/src/python/plot_data.py index 08cdd6030..15012e589 100644 --- a/gr-utils/src/python/plot_data.py +++ b/gr-utils/src/python/plot_data.py @@ -1,5 +1,5 @@ # -# Copyright 2007,2008 Free Software Foundation, Inc. +# Copyright 2007,2008,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -81,13 +81,13 @@ class plot_data: def get_data(self, hfile): self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data)) - f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length) - #print "Read in %d items" % len(self.f) - if(len(f) == 0): + try: + f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length) + except MemoryError: print "End of File" else: - self.f = f - self.time = [i*(1/self.sample_rate) for i in range(len(self.f))] + self.f = scipy.array(f) + self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.f))]) def make_plots(self): self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6]) @@ -107,8 +107,8 @@ class plot_data: # Subplot for real and imaginary parts of signal self.plot_f += plot(self.time, self.f, 'o-') - maxval = max(maxval, max(self.f)) - minval = min(minval, min(self.f)) + maxval = max(maxval, self.f.max()) + minval = min(minval, self.f.min()) self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) @@ -122,8 +122,8 @@ class plot_data: for hf,p in zip(self.hfile,self.plot_f): self.get_data(hf) p.set_data([self.time, self.f]) - maxval = max(maxval, max(self.f)) - minval = min(minval, min(self.f)) + maxval = max(maxval, self.f.max()) + minval = min(minval, self.f.min()) self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) diff --git a/grc/blocks/gr_goertzel_fc.xml b/grc/blocks/gr_goertzel_fc.xml index 2105445d1..f27d9582e 100644 --- a/grc/blocks/gr_goertzel_fc.xml +++ b/grc/blocks/gr_goertzel_fc.xml @@ -9,6 +9,8 @@ <key>gr_goertzel_fc</key> <import>from gnuradio import gr</import> <make>gr.goertzel_fc($rate, $len, $freq)</make> + <callback>set_freq($freq)</callback> + <callback>set_rate($rate)</callback> <param> <name>Rate</name> <key>rate</key> diff --git a/volk/Makefile.am b/volk/Makefile.am index 271d495cd..03c5aac35 100644 --- a/volk/Makefile.am +++ b/volk/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2008 Free Software Foundation, Inc. +# Copyright 2004,2008,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # diff --git a/volk/Makefile.common b/volk/Makefile.common index 083f6f710..daa8d78b6 100644 --- a/volk/Makefile.common +++ b/volk/Makefile.common @@ -1,6 +1,6 @@ # -*- Makefile -*- # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,6 +20,33 @@ # Boston, MA 02110-1301, USA. # +if MD_CPU_generic + platform_CODE = \ + $(top_srcdir)/lib/volk_cpu_generic.c +endif + +if MD_CPU_x86 +if MD_SUBCPU_x86_64 + platform_CODE = \ + $(top_srcdir)/lib/volk_cpu_x86.c \ + $(top_srcdir)/lib/cpuid_x86_64.S +endif +endif + +if MD_CPU_x86 +if !MD_SUBCPU_x86_64 + platform_CODE = \ + $(top_srcdir)/lib/volk_cpu_x86.c \ + $(top_srcdir)/lib/cpuid_x86.S +endif +endif + +if MD_CPU_powerpc + platform_CODE = \ + $(top_srcdir)/lib/volk_cpu_powerpc.c +endif + + ourincludedir = $(includedir)/volk # swig includes @@ -44,3 +71,4 @@ STD_DEFINES_AND_INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/lib $(GNURADIO # not. We define it now in configure.ac using AM_PATH_PROG, but now # here have to add a -f to be like GNU make. RM=$(RM_PROG) -f + diff --git a/volk/configure.ac b/volk/configure.ac index 5a1eac3f2..ebbebb7d2 100644 --- a/volk/configure.ac +++ b/volk/configure.ac @@ -1,5 +1,5 @@ dnl -dnl Copyright 2010 Free Software Foundation, Inc. +dnl Copyright 2010,2011 Free Software Foundation, Inc. dnl dnl This program is free software: you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -63,13 +63,6 @@ dnl AX_BOOST_WSERIALIZATION AC_CONFIG_HEADERS([volk_config.h]) LV_SET_SIMD_FLAGS -# FIXME: Not very extensible to supporting more processors easily -AM_CONDITIONAL([MYCPU_X86], [test "$MD_CPU" = "x86"]) -AM_CONDITIONAL([MYSUBCPU_X86], [test "$MD_SUBCPU" = "x86"]) -AM_CONDITIONAL([MYSUBCPU_X86_64], [test "$MD_SUBCPU" = "x86_64"]) -AM_CONDITIONAL([MYSUBCPU_POWERPC], [test "$MD_SUBCPU" = "powerpc"]) -AM_CONDITIONAL([MYSUBCPU_GENERIC], [test "$MD_SUBCPU" != "powerpc" && test "$MD_SUBCPU" != "x86" && test "$MD_SUBCPU" != "x86_64"]) - AC_CONFIG_FILES([\ Makefile \ config/Makefile \ diff --git a/volk/include/volk/Makefile.am b/volk/include/volk/Makefile.am index 43c8ae9df..83f386c6c 100644 --- a/volk/include/volk/Makefile.am +++ b/volk/include/volk/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -130,33 +130,11 @@ volkinclude_HEADERS = \ volk_8i_s32f_convert_32f_u.h VOLK_MKTABLES_SOURCES = \ + $(platform_CODE) \ $(top_srcdir)/lib/volk_rank_archs.c \ $(top_srcdir)/lib/volk_mktables.c -# FIXME: Not very extensible to supporting more processors easily -if MYSUBCPU_X86_64 - VOLK_MKTABLES_SOURCES += \ - $(top_srcdir)/lib/volk_cpu_x86.c \ - $(top_srcdir)/lib/cpuid_x86_64.S -endif - -if MYSUBCPU_X86 - VOLK_MKTABLES_SOURCES += \ - $(top_srcdir)/lib/volk_cpu_x86.c \ - $(top_srcdir)/lib/cpuid_x86.S -endif - -if MYSUBCPU_POWERPC - VOLK_MKTABLES_SOURCES += \ - $(top_srcdir)/lib/volk_cpu_powerpc.c -endif - -if MYSUBCPU_GENERIC - VOLK_MKTABLES_SOURCES += \ - $(top_srcdir)/lib/volk_cpu_generic.c -endif - volk_mktables$(EXEEXT): $(VOLK_MKTABLES_SOURCES) $(CC) -o $@ $^ $(AM_CPPFLAGS) -I$(top_builddir)/include diff --git a/volk/include/volk/make_cpuid_generic_c.py b/volk/include/volk/make_cpuid_generic_c.py index 3ba225fca..c682d4138 100644 --- a/volk/include/volk/make_cpuid_generic_c.py +++ b/volk/include/volk/make_cpuid_generic_c.py @@ -1,11 +1,33 @@ +#!/usr/bin/env python +# +# Copyright 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. +# + from xml.dom import minidom def make_cpuid_generic_c(dom) : tempstring = ""; tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n"; tempstring = tempstring + "#include <volk/volk_cpu.h>\n" - tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n" - tempstring = tempstring + "\n\n" + tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n" + tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n" for domarch in dom: if str(domarch.attributes["type"].value) == "all": diff --git a/volk/include/volk/make_cpuid_h.py b/volk/include/volk/make_cpuid_h.py index 823e3b2c0..cd3da2455 100644 --- a/volk/include/volk/make_cpuid_h.py +++ b/volk/include/volk/make_cpuid_h.py @@ -1,3 +1,25 @@ +#!/usr/bin/env python +# +# Copyright 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. +# + from xml.dom import minidom from emit_omnilog import * @@ -13,7 +35,8 @@ def make_cpuid_h(dom) : for domarch in dom: arch = str(domarch.attributes["name"].value); tempstring = tempstring + " int (*has_" + arch + ") ();\n"; - tempstring = tempstring + "}volk_cpu;\n\n"; + tempstring = tempstring + "};\n\n"; + tempstring = tempstring + "extern struct VOLK_CPU volk_cpu;\n\n"; tempstring = tempstring + "void volk_cpu_init ();\n" tempstring = tempstring + "unsigned int volk_get_lvarch ();\n" diff --git a/volk/include/volk/make_cpuid_powerpc_c.py b/volk/include/volk/make_cpuid_powerpc_c.py index 443a58488..0b0ea84e7 100644 --- a/volk/include/volk/make_cpuid_powerpc_c.py +++ b/volk/include/volk/make_cpuid_powerpc_c.py @@ -1,11 +1,33 @@ +#!/usr/bin/env python +# +# Copyright 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. +# + from xml.dom import minidom def make_cpuid_powerpc_c(dom) : tempstring = ""; tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n"; tempstring = tempstring + "#include <volk/volk_cpu.h>\n" - tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n" - tempstring = tempstring + "\n\n" + tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n" + tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n" #just assume it has them for powerpc for domarch in dom: diff --git a/volk/include/volk/make_cpuid_x86_c.py b/volk/include/volk/make_cpuid_x86_c.py index 8ebe243e5..48a406fa4 100644 --- a/volk/include/volk/make_cpuid_x86_c.py +++ b/volk/include/volk/make_cpuid_x86_c.py @@ -1,11 +1,34 @@ +#!/usr/bin/env python +# +# Copyright 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. +# + from xml.dom import minidom def make_cpuid_x86_c(dom) : tempstring = ""; tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n"; tempstring = tempstring + "#include <volk/volk_cpu.h>\n" - tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n" - tempstring = tempstring + "\n\n" + tempstring = tempstring + "#include <volk/volk_config_fixed.h>\n\n" + tempstring = tempstring + "struct VOLK_CPU volk_cpu;\n\n" + tempstring = tempstring + "extern void cpuid_x86 (unsigned int op, unsigned int result[4]);\n\n" tempstring = tempstring + "static inline unsigned int cpuid_eax(unsigned int op) {\n"; tempstring = tempstring + " unsigned int regs[4];\n" diff --git a/volk/include/volk/make_proccpu_sim.py b/volk/include/volk/make_proccpu_sim.py index c75a4d5fb..029dacfcc 100644 --- a/volk/include/volk/make_proccpu_sim.py +++ b/volk/include/volk/make_proccpu_sim.py @@ -1,3 +1,25 @@ +#!/usr/bin/env python +# +# Copyright 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. +# + from xml.dom import minidom def make_proccpu_sim(dom) : diff --git a/volk/lib/Makefile.am b/volk/lib/Makefile.am index f609f5bf9..63df85244 100644 --- a/volk/lib/Makefile.am +++ b/volk/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -63,76 +63,17 @@ EXTRA_DIST = \ # The main library # ---------------------------------------------------------------- -universal_runtime_CODE = \ - volk_runtime.c \ - volk_init.c \ +libvolk_runtime_la_SOURCES = \ + $(platform_CODE) \ + volk_runtime.c \ + volk_init.c \ volk_rank_archs.c -universal_CODE = \ +libvolk_la_SOURCES = \ + $(platform_CODE) \ volk.c \ volk_environment_init.c -generic_CODE = \ - volk_cpu_generic.c - -x86_CODE = \ - volk_cpu_x86.c - -x86_SUBCODE = \ - cpuid_x86.S - -x86_64_SUBCODE = \ - cpuid_x86_64.S - -powerpc_CODE = \ - volk_cpu_powerpc.c - - -if MD_CPU_generic -libvolk_la_SOURCES = \ - $(generic_CODE) \ - $(universal_CODE) -libvolk_runtime_la_SOURCES = \ - $(generic_CODE) \ - $(universal_runtime_CODE) - -endif - -if MD_CPU_x86 -if MD_SUBCPU_x86_64 -libvolk_la_SOURCES = \ - $(x86_CODE) \ - $(x86_64_SUBCODE) \ - $(universal_CODE) - -libvolk_runtime_la_SOURCES = \ - $(x86_CODE) \ - $(x86_64_SUBCODE) \ - $(universal_runtime_CODE) -else -libvolk_la_SOURCES = \ - $(x86_CODE) \ - $(x86_SUBCODE) \ - $(universal_CODE) - -libvolk_runtime_la_SOURCES = \ - $(x86_CODE) \ - $(x86_SUBCODE) \ - $(universal_runtime_CODE) -endif -endif - - -if MD_CPU_powerpc -libvolk_la_SOURCES = \ - $(powerpc_CODE) \ - $(universal_CODE) - -libvolk_runtime_la_SOURCES = \ - $(powerpc_CODE) \ - $(universal_runtime_CODE) -endif - volk_orc_LDFLAGS = \ $(ORC_LDFLAGS) \ -lorc-0.4 @@ -182,11 +123,16 @@ noinst_PROGRAMS = \ testqa_SOURCES = testqa.cc qa_utils.cc testqa_CPPFLAGS = -DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN testqa_LDFLAGS = -lboost_unit_test_framework +if LV_HAVE_ORC testqa_LDADD = \ libvolk.la \ libvolk_runtime.la \ ../orc/libvolk_orc.la - +else +testqa_LDADD = \ + libvolk.la \ + libvolk_runtime.la +endif distclean-local: rm -f volk.c diff --git a/volk/lib/testqa.cc b/volk/lib/testqa.cc new file mode 100644 index 000000000..1ee264fb4 --- /dev/null +++ b/volk/lib/testqa.cc @@ -0,0 +1,101 @@ +#include "qa_utils.h" +#include "../include/volk/volk.h" +#include "../include/volk/volk_registry.h" +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(volk_test_all) { + //in order... +// VOLK_RUN_TESTS(volk_16i_x5_add_quad_16i_x4_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16i_branch_4_state_8_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16ic_deinterleave_16i_x2_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16ic_s32f_deinterleave_32f_x2_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_deinterleave_real_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_s32f_deinterleave_real_32f_a16, 1e-5, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_deinterleave_real_8i_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16ic_deinterleave_16i_x2_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16ic_s32f_deinterleave_32f_x2_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_deinterleave_real_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_s32f_deinterleave_real_32f_a16, 1e-5, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_deinterleave_real_8i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_magnitude_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16ic_s32f_magnitude_32f_a16, 1e-5, 2046, 10000); + VOLK_RUN_TESTS(volk_16i_s32f_convert_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16i_s32f_convert_32f_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16i_convert_8i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16i_convert_8i_u, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16i_max_star_16i_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16i_max_star_horizontal_16i_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16i_permute_and_scalar_add_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_16i_x4_quad_max_star_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_16u_byteswap_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32f_accumulator_s32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_add_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_32f_multiply_32fc_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_32f_power_32fc_a16, 1e-4, 2046, 1000); +// VOLK_RUN_TESTS(volk_32f_calc_spectral_noise_floor_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_s32f_atan2_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_x2_conjugate_dot_prod_32fc_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32fc_deinterleave_32f_x2_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32fc_deinterleave_64f_x2_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_deinterleave_real_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_deinterleave_real_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_deinterleave_real_64f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_x2_dot_prod_32fc_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32fc_index_max_16u_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_s32f_magnitude_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_magnitude_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_x2_multiply_32fc_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_convert_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_convert_16i_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_convert_32i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_convert_32i_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_convert_64f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_convert_64f_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_convert_8i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_convert_8i_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_s32f_x2_power_spectral_density_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32fc_s32f_power_spectrum_32f_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32fc_x2_square_dist_32f_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32fc_x2_s32f_square_dist_scalar_mult_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_divide_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_dot_prod_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_dot_prod_32f_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_32f_fm_detect_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_index_max_16u_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_s32f_interleave_16ic_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_interleave_32fc_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_max_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_min_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_multiply_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_normalize_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_power_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_sqrt_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_s32f_stddev_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_stddev_and_mean_32f_x2_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x2_subtract_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32f_x3_sum_of_poly_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32i_x2_and_32i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32i_s32f_convert_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32i_s32f_convert_32f_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32i_x2_or_32i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_32u_byteswap_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_32u_popcnt_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_64f_convert_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_64f_convert_32f_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_64f_x2_max_64f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_64f_x2_min_64f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_64u_byteswap_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_64u_popcnt_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_8ic_deinterleave_16i_x2_a16, 1e-4, 2046, 10000); +// VOLK_RUN_TESTS(volk_8ic_s32f_deinterleave_32f_x2_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8ic_deinterleave_real_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8ic_s32f_deinterleave_real_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8ic_deinterleave_real_8i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8ic_x2_multiply_conjugate_16ic_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8ic_x2_s32f_multiply_conjugate_32fc_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8i_convert_16i_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8i_convert_16i_u, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8i_s32f_convert_32f_a16, 1e-4, 2046, 10000); + VOLK_RUN_TESTS(volk_8i_s32f_convert_32f_u, 1e-4, 2046, 10000); + +} |