From 4f41891176b8be25a2b6efe2cb888802347112cc Mon Sep 17 00:00:00 2001 From: jcorgan Date: Tue, 19 May 2009 03:10:32 +0000 Subject: [PATCH] Updates to C++ and Python APIs: * C++: Adds usrp2::MC_* constants for config_mimo() call in libusrp2 * Python: Adds usrp2.config_mimo(), and usrp2.MC_* constants * Python: Adds usrp2.sync_every_pps() git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11050 221aa14e-8319-0410-a670-987f0aec2ac5 --- gr-usrp2/src/usrp2.i | 3 ++ gr-usrp2/src/usrp2_base.cc | 12 +++++++ gr-usrp2/src/usrp2_base.h | 12 ++++++- usrp2/host/include/usrp2/Makefile.am | 1 + usrp2/host/include/usrp2/mimo_config.h | 50 ++++++++++++++++++++++++++ usrp2/host/include/usrp2/usrp2.h | 4 +-- 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 usrp2/host/include/usrp2/mimo_config.h diff --git a/gr-usrp2/src/usrp2.i b/gr-usrp2/src/usrp2.i index 3d6da060..31974028 100644 --- a/gr-usrp2/src/usrp2.i +++ b/gr-usrp2/src/usrp2.i @@ -31,6 +31,7 @@ %} %include +%include %template(uint32_t_vector) std::vector; @@ -48,7 +49,9 @@ public: std::string interface_name() const; %rename(_real_fpga_master_clock_freq) fpga_master_clock_freq; bool fpga_master_clock_freq(long *freq); + bool config_mimo(int flags); bool sync_to_pps(); + bool sync_every_pps(bool enable); std::vector peek32(uint32_t addr, uint32_t words); bool poke32(uint32_t addr, const std::vector &data); }; diff --git a/gr-usrp2/src/usrp2_base.cc b/gr-usrp2/src/usrp2_base.cc index 34492dc4..bb995972 100644 --- a/gr-usrp2/src/usrp2_base.cc +++ b/gr-usrp2/src/usrp2_base.cc @@ -67,12 +67,24 @@ usrp2_base::fpga_master_clock_freq(long *freq) const return d_u2->fpga_master_clock_freq(freq); } +bool +usrp2_base::config_mimo(int flags) +{ + return d_u2->config_mimo(flags); +} + bool usrp2_base::sync_to_pps() { return d_u2->sync_to_pps(); } +bool +usrp2_base::sync_every_pps(bool enable) +{ + return d_u2->sync_every_pps(enable); +} + std::vector usrp2_base::peek32(uint32_t addr, uint32_t words) { diff --git a/gr-usrp2/src/usrp2_base.h b/gr-usrp2/src/usrp2_base.h index bfd1dce0..67a62ba1 100644 --- a/gr-usrp2/src/usrp2_base.h +++ b/gr-usrp2/src/usrp2_base.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -63,11 +63,21 @@ public: */ bool fpga_master_clock_freq(long *freq) const; + /*! + * \brief MIMO configuration + */ + bool config_mimo(int flags); + /*! * \brief Set master time to 0 at next PPS rising edge */ bool sync_to_pps(); + /*! + * Reset master time to 0 at every PPS edge + */ + bool sync_every_pps(bool enable); + /*! * \brief Read memory from Wishbone bus as words */ diff --git a/usrp2/host/include/usrp2/Makefile.am b/usrp2/host/include/usrp2/Makefile.am index 4c6dac89..08fdcde3 100644 --- a/usrp2/host/include/usrp2/Makefile.am +++ b/usrp2/host/include/usrp2/Makefile.am @@ -26,6 +26,7 @@ usrp2include_HEADERS = \ copy_handler.h \ data_handler.h \ metadata.h \ + mimo_config.h \ rx_nop_handler.h \ rx_sample_handler.h \ strtod_si.h \ diff --git a/usrp2/host/include/usrp2/mimo_config.h b/usrp2/host/include/usrp2/mimo_config.h new file mode 100644 index 00000000..a1e038f7 --- /dev/null +++ b/usrp2/host/include/usrp2/mimo_config.h @@ -0,0 +1,50 @@ +/* -*- c -*- */ +/* + * Copyright 2008,2009 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_USRP2_MIMO_CONFIG_H +#define INCLUDED_USRP2_MIMO_CONFIG_H + +// FIXME: This duplicates the firmware usrp2_mimo_config.h file + +namespace usrp2 { + + static const int _MC_WE_LOCK = 0x0001; + static const int _MC_MIMO_CLK_INPUT = 0x0002; // else SMA input + + /* + * Derived masks (use these): + * + * We get our input from 1 of three places: + * Our free running oscilator, our SMA connector, or from the MIMO connector + */ + static const int MC_WE_DONT_LOCK = 0x0000; + static const int MC_WE_LOCK_TO_SMA = (_MC_WE_LOCK | 0); + static const int MC_WE_LOCK_TO_MIMO = (_MC_WE_LOCK | _MC_MIMO_CLK_INPUT); + + /* + * Independent of the source of the clock, we may or may not drive our + * clock onto the mimo connector. Note that there are dedicated clock + * signals in each direction, so disaster doesn't occurs if we're + * unnecessarily providing clock. + */ + static const int MC_PROVIDE_CLK_TO_MIMO = 0x0004; +} + +#endif /* INCLUDED_USRP2_MIMO_CONFIG_H */ diff --git a/usrp2/host/include/usrp2/usrp2.h b/usrp2/host/include/usrp2/usrp2.h index f4086440..1c99a54c 100644 --- a/usrp2/host/include/usrp2/usrp2.h +++ b/usrp2/host/include/usrp2/usrp2.h @@ -25,7 +25,7 @@ #include #include #include - +#include /* * N.B., The interfaces described here are still in flux. @@ -67,7 +67,7 @@ namespace usrp2 { // FIXME: get from firmware include static const int GPIO_TX_BANK = 0; static const int GPIO_RX_BANK = 1; - + class usrp2 : boost::noncopyable { public: -- 2.30.2