diff options
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/usrp_e/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e/codec_impl.cpp | 96 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e/dboard_impl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e/mboard_impl.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e/usrp_e_impl.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp_e/usrp_e_impl.hpp | 8 |
6 files changed, 122 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp_e/CMakeLists.txt b/host/lib/usrp/usrp_e/CMakeLists.txt index 1d64d29d2..f0c125f26 100644 --- a/host/lib/usrp/usrp_e/CMakeLists.txt +++ b/host/lib/usrp/usrp_e/CMakeLists.txt @@ -32,6 +32,7 @@ IF(HAVE_LINUX_USRP_E_H) ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/clock_ctrl.hpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/codec_ctrl.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/codec_ctrl.hpp + ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/codec_impl.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/dboard_impl.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/dboard_iface.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e/dsp_impl.cpp diff --git a/host/lib/usrp/usrp_e/codec_impl.cpp b/host/lib/usrp/usrp_e/codec_impl.cpp new file mode 100644 index 000000000..51f7b02b8 --- /dev/null +++ b/host/lib/usrp/usrp_e/codec_impl.cpp @@ -0,0 +1,96 @@ +// +// Copyright 2010 Ettus Research LLC +// +// This program 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 of the License, or +// (at your option) any later version. +// +// This program 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, see <http://www.gnu.org/licenses/>. +// + +#include "usrp_e_impl.hpp" +#include <uhd/usrp/codec_props.hpp> +#include <boost/bind.hpp> + +using namespace uhd; +using namespace uhd::usrp; + +/*********************************************************************** + * Helper Methods + **********************************************************************/ +void usrp_e_impl::codec_init(void){ + //make proxies + _rx_codec_proxy = wax_obj_proxy::make( + boost::bind(&usrp_e_impl::rx_codec_get, this, _1, _2), + boost::bind(&usrp_e_impl::rx_codec_set, this, _1, _2) + ); + _tx_codec_proxy = wax_obj_proxy::make( + boost::bind(&usrp_e_impl::tx_codec_get, this, _1, _2), + boost::bind(&usrp_e_impl::tx_codec_set, this, _1, _2) + ); +} + +/*********************************************************************** + * RX Codec Properties + **********************************************************************/ +void usrp_e_impl::rx_codec_get(const wax::obj &key_, wax::obj &val){ + wax::obj key; std::string name; + boost::tie(key, name) = extract_named_prop(key_); + + //handle the get request conditioned on the key + switch(key.as<codec_prop_t>()){ + case CODEC_PROP_NAME: + val = std::string("usrp-e adc - ad9522"); + return; + + case CODEC_PROP_OTHERS: + val = prop_names_t(); + return; + + case CODEC_PROP_GAIN_NAMES: + val = prop_names_t(); //no gain elements to be controlled + return; + + default: UHD_THROW_PROP_GET_ERROR(); + } +} + +void usrp_e_impl::rx_codec_set(const wax::obj &, const wax::obj &){ + UHD_THROW_PROP_SET_ERROR(); +} + +/*********************************************************************** + * TX Codec Properties + **********************************************************************/ +void usrp_e_impl::tx_codec_get(const wax::obj &key_, wax::obj &val){ + wax::obj key; std::string name; + boost::tie(key, name) = extract_named_prop(key_); + + //handle the get request conditioned on the key + switch(key.as<codec_prop_t>()){ + case CODEC_PROP_NAME: + val = std::string("usrp-e dac - ad9522"); + return; + + case CODEC_PROP_OTHERS: + val = prop_names_t(); + return; + + case CODEC_PROP_GAIN_NAMES: + val = prop_names_t(); //no gain elements to be controlled + return; + + default: UHD_THROW_PROP_GET_ERROR(); + } +} + +void usrp_e_impl::tx_codec_set(const wax::obj &, const wax::obj &){ + UHD_THROW_PROP_SET_ERROR(); +} diff --git a/host/lib/usrp/usrp_e/dboard_impl.cpp b/host/lib/usrp/usrp_e/dboard_impl.cpp index 809b6f06b..8aaf16c51 100644 --- a/host/lib/usrp/usrp_e/dboard_impl.cpp +++ b/host/lib/usrp/usrp_e/dboard_impl.cpp @@ -81,6 +81,10 @@ void usrp_e_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){ val = _dboard_iface; return; + case DBOARD_PROP_CODEC: + val = _rx_codec_proxy->get_link(); + return; + default: UHD_THROW_PROP_GET_ERROR(); } } @@ -128,6 +132,10 @@ void usrp_e_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){ val = _dboard_iface; return; + case DBOARD_PROP_CODEC: + val = _tx_codec_proxy->get_link(); + return; + default: UHD_THROW_PROP_GET_ERROR(); } } diff --git a/host/lib/usrp/usrp_e/mboard_impl.cpp b/host/lib/usrp/usrp_e/mboard_impl.cpp index 4914bd3b7..88e16a6f5 100644 --- a/host/lib/usrp/usrp_e/mboard_impl.cpp +++ b/host/lib/usrp/usrp_e/mboard_impl.cpp @@ -22,6 +22,7 @@ #include <uhd/utils/assert.hpp> #include <uhd/usrp/mboard_props.hpp> #include <boost/bind.hpp> +#include <iostream> using namespace uhd; using namespace uhd::usrp; @@ -40,10 +41,6 @@ void usrp_e_impl::mboard_init(void){ _clock_config.pps_source = clock_config_t::PPS_SMA; //TODO poke the clock config regs - - //set default subdev specs - this->mboard_set(MBOARD_PROP_RX_SUBDEV_SPEC, subdev_spec_t()); - this->mboard_set(MBOARD_PROP_TX_SUBDEV_SPEC, subdev_spec_t()); } /*********************************************************************** diff --git a/host/lib/usrp/usrp_e/usrp_e_impl.cpp b/host/lib/usrp/usrp_e/usrp_e_impl.cpp index 76c77af15..0566cfd59 100644 --- a/host/lib/usrp/usrp_e/usrp_e_impl.cpp +++ b/host/lib/usrp/usrp_e/usrp_e_impl.cpp @@ -17,6 +17,7 @@ #include "usrp_e_impl.hpp" #include <uhd/usrp/device_props.hpp> +#include <uhd/usrp/mboard_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/utils/static.hpp> #include <boost/format.hpp> @@ -93,8 +94,15 @@ usrp_e_impl::usrp_e_impl(const std::string &node){ rx_ddc_init(); tx_duc_init(); + //init the codec properties + codec_init(); + //init the io send/recv io_init(); + + //set default subdev specs + this->mboard_set(MBOARD_PROP_RX_SUBDEV_SPEC, subdev_spec_t()); + this->mboard_set(MBOARD_PROP_TX_SUBDEV_SPEC, subdev_spec_t()); } usrp_e_impl::~usrp_e_impl(void){ diff --git a/host/lib/usrp/usrp_e/usrp_e_impl.hpp b/host/lib/usrp/usrp_e/usrp_e_impl.hpp index e3249e9de..2457e27cc 100644 --- a/host/lib/usrp/usrp_e/usrp_e_impl.hpp +++ b/host/lib/usrp/usrp_e/usrp_e_impl.hpp @@ -152,6 +152,14 @@ private: void tx_duc_set(const wax::obj &, const wax::obj &); double _duc_freq; size_t _duc_interp; wax_obj_proxy::sptr _tx_duc_proxy; + + //codec functions and settings + void codec_init(void); + void rx_codec_get(const wax::obj &, wax::obj &); + void rx_codec_set(const wax::obj &, const wax::obj &); + void tx_codec_get(const wax::obj &, wax::obj &); + void tx_codec_set(const wax::obj &, const wax::obj &); + wax_obj_proxy::sptr _rx_codec_proxy, _tx_codec_proxy; }; #endif /* INCLUDED_USRP_E_IMPL_HPP */ |