diff options
author | Josh Blum <josh@joshknows.com> | 2010-02-17 16:23:12 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-02-17 16:23:12 -0800 |
commit | 4fb4572e1a16f54439f57655f90e0fc937c57c1e (patch) | |
tree | 5dc731d266c8f5f783c5b28996a1583dac18ab57 /host/test | |
parent | eb7e709b7aff162cc7c8f9b8004089846839ffbe (diff) | |
download | uhd-4fb4572e1a16f54439f57655f90e0fc937c57c1e.tar.gz uhd-4fb4572e1a16f54439f57655f90e0fc937c57c1e.tar.bz2 uhd-4fb4572e1a16f54439f57655f90e0fc937c57c1e.zip |
Worked out spi api for the dboard interface.
Created usrp2 spi transaction control on host and fw
Diffstat (limited to 'host/test')
-rw-r--r-- | host/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | host/test/device_test.cpp | 44 | ||||
-rw-r--r-- | host/test/usrp_dboard_test.cpp | 60 |
3 files changed, 0 insertions, 106 deletions
diff --git a/host/test/CMakeLists.txt b/host/test/CMakeLists.txt index 0dcd1e68e..234b6f92c 100644 --- a/host/test/CMakeLists.txt +++ b/host/test/CMakeLists.txt @@ -19,9 +19,7 @@ ADD_EXECUTABLE(main_test main_test.cpp addr_test.cpp - device_test.cpp gain_handler_test.cpp - usrp_dboard_test.cpp wax_test.cpp ) diff --git a/host/test/device_test.cpp b/host/test/device_test.cpp deleted file mode 100644 index 6373ff41b..000000000 --- a/host/test/device_test.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// 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 <boost/test/unit_test.hpp> -#include <uhd/device.hpp> - -using namespace uhd; - -BOOST_AUTO_TEST_CASE(test_device){ - device_addr_t device_addr; - device_addr["type"] = "test"; - device_addr["num_dboards"] = "2"; - device::sptr dev = device::make(device_addr); - - std::cout << "Access the device" << std::endl; - std::cout << wax::cast<std::string>((*dev)[DEVICE_PROP_NAME]) << std::endl; - - std::cout << "Access the mboard" << std::endl; - wax::obj mb0 = (*dev)[DEVICE_PROP_MBOARD]; - std::cout << wax::cast<std::string>(mb0[MBOARD_PROP_NAME]) << std::endl; - BOOST_CHECK_EQUAL( - 2, - wax::cast<prop_names_t>(mb0[MBOARD_PROP_RX_DBOARD_NAMES]).size() - ); - BOOST_CHECK_EQUAL( - 2, - wax::cast<prop_names_t>(mb0[MBOARD_PROP_TX_DBOARD_NAMES]).size() - ); - -} diff --git a/host/test/usrp_dboard_test.cpp b/host/test/usrp_dboard_test.cpp deleted file mode 100644 index f0ae7a53d..000000000 --- a/host/test/usrp_dboard_test.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// 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 <boost/test/unit_test.hpp> -#include <uhd/usrp/dboard/manager.hpp> - -using namespace uhd::usrp::dboard; - -/*********************************************************************** - * dummy interface for dboards - **********************************************************************/ -class dummy_interface : public interface{ -public: - dummy_interface(void){} - ~dummy_interface(void){} - void write_aux_dac(int, int){} - int read_aux_adc(int){return 0;} - void set_atr_reg(gpio_bank_t, uint16_t, uint16_t, uint16_t){} - void set_gpio_ddr(gpio_bank_t, uint16_t, uint16_t){} - void write_gpio(gpio_bank_t, uint16_t, uint16_t){} - uint16_t read_gpio(gpio_bank_t){return 0;} - void write_i2c (int, const std::string &){} - std::string read_i2c (int, size_t){return "";} - void write_spi (spi_dev_t, spi_push_t, const std::string &){} - std::string read_spi (spi_dev_t, spi_latch_t, size_t){return "";} - double get_rx_clock_rate(void){return 0.0;} - double get_tx_clock_rate(void){return 0.0;} -}; - -BOOST_AUTO_TEST_CASE(test_manager){ - std::cout << "Making a dummy usrp dboard interface..." << std::endl; - interface::sptr ifc0(new dummy_interface()); - - std::cout << "Making a usrp dboard manager..." << std::endl; - manager::sptr mgr0(new manager(ID_BASIC_RX, ID_BASIC_TX, ifc0)); - - std::cout << "Testing the dboard manager..." << std::endl; - BOOST_CHECK_EQUAL(size_t(3), mgr0->get_rx_subdev_names().size()); - BOOST_CHECK_EQUAL(size_t(1), mgr0->get_tx_subdev_names().size()); - - std::cout << "Testing access (will fail later when db code filled in)..." << std::endl; - BOOST_CHECK_THROW(mgr0->get_rx_subdev(""), std::invalid_argument); - BOOST_CHECK_THROW(mgr0->get_tx_subdev("x"), std::invalid_argument); - mgr0->get_rx_subdev("a")[0]; - mgr0->get_tx_subdev("")[0]; -} |