From 0d0d03d08d13037da2f2f1c85e546addff32aa69 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 15 Mar 2011 18:21:59 -0700 Subject: uhd: replace file_string() with string() for deprecation reasons Patch from moritz.fischer@student.kit.edu [1] http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/deprecated.html [2] http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/index.htm Boost 1.36 appears to have string(), so this should be safe to use. --- host/lib/usrp/usrp_e100/usrp_e100_impl.cpp | 2 +- host/lib/utils/images.cpp | 4 ++-- host/lib/utils/load_modules.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp index 40ea56466..f430090f0 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp @@ -53,7 +53,7 @@ static device_addrs_t usrp_e100_find(const device_addr_t &hint){ if (fs::exists(hint["node"])){ device_addr_t new_addr; new_addr["type"] = "usrp-e"; - new_addr["node"] = fs::system_complete(fs::path(hint["node"])).file_string(); + new_addr["node"] = fs::system_complete(fs::path(hint["node"])).string(); try{ usrp_e100_iface::sptr iface = usrp_e100_iface::make(new_addr["node"]); new_addr["name"] = iface->mb_eeprom["name"]; diff --git a/host/lib/utils/images.cpp b/host/lib/utils/images.cpp index 395e542c1..24a599322 100644 --- a/host/lib/utils/images.cpp +++ b/host/lib/utils/images.cpp @@ -30,11 +30,11 @@ std::vector get_image_paths(void); //defined in paths.cpp **********************************************************************/ std::string uhd::find_image_path(const std::string &image_name){ if (fs::exists(image_name)){ - return fs::system_complete(image_name).file_string(); + return fs::system_complete(image_name).string(); } BOOST_FOREACH(const fs::path &path, get_image_paths()){ fs::path image_path = path / image_name; - if (fs::exists(image_path)) return image_path.file_string(); + if (fs::exists(image_path)) return image_path.string(); } throw std::runtime_error("Could not find path for image: " + image_name); } diff --git a/host/lib/utils/load_modules.cpp b/host/lib/utils/load_modules.cpp index fa9b22438..33152855a 100644 --- a/host/lib/utils/load_modules.cpp +++ b/host/lib/utils/load_modules.cpp @@ -72,7 +72,7 @@ static void load_module(const std::string &file_name){ */ static void load_module_path(const fs::path &path){ if (not fs::exists(path)){ - //std::cerr << boost::format("Module path \"%s\" not found.") % path.file_string() << std::endl; + //std::cerr << boost::format("Module path \"%s\" not found.") % path.string() << std::endl; return; } @@ -90,7 +90,7 @@ static void load_module_path(const fs::path &path){ //its not a directory, try to load it try{ - load_module(path.file_string()); + load_module(path.string()); } catch(const std::exception &err){ std::cerr << boost::format("Error: %s") % err.what() << std::endl; -- cgit v1.2.3 From 9d752805de2020b6a8705c4abfce536620dcb760 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 16 Mar 2011 10:31:52 -0700 Subject: USB zero copy impl: proper cleanup for canceled transfers -- wait for cancel before freeing --- host/lib/transport/libusb1_zero_copy.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 87adece45..b425843fa 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -105,6 +105,12 @@ static void libusb_async_cb(libusb_transfer *lut){ (*static_cast *>(lut->user_data))(); } +//! callback to free transfer upon cancellation +static void cancel_transfer_cb(libusb_transfer *lut) { + if(lut->status == LIBUSB_TRANSFER_CANCELLED) libusb_free_transfer(lut); + else std::cout << "cancel_transfer unexpected status " << lut->status << std::endl; +} + /*********************************************************************** * USB zero_copy device class **********************************************************************/ @@ -190,16 +196,18 @@ public: } ~libusb_zero_copy_impl(void){ - //shutdown the threads - _threads_running = false; - _thread_group.interrupt_all(); - _thread_group.join_all(); - //cancel and free all transfers BOOST_FOREACH(libusb_transfer *lut, _all_luts){ + lut->callback = &cancel_transfer_cb; libusb_cancel_transfer(lut); - libusb_free_transfer(lut); + while(lut->status != LIBUSB_TRANSFER_CANCELLED && lut->status != LIBUSB_TRANSFER_COMPLETED) { + boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + } } + //shutdown the threads + _threads_running = false; + _thread_group.interrupt_all(); + _thread_group.join_all(); } managed_recv_buffer::sptr get_recv_buff(double timeout){ -- cgit v1.2.3 From 71e82fb3cd960153603b48d50eae077ff0fb8ace Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 16 Mar 2011 10:34:22 -0700 Subject: E100: fix test clock output enable --- host/lib/usrp/usrp_e100/clock_ctrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp index e29fe18ce..d18ccdcb9 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp @@ -302,7 +302,7 @@ public: _ad9522_regs.out4_cmos_configuration = (enb)? ad9522_regs_t::OUT4_CMOS_CONFIGURATION_A_ON : ad9522_regs_t::OUT4_CMOS_CONFIGURATION_OFF; - this->send_reg(0x0F0); + this->send_reg(0x0F4); this->latch_regs(); } -- cgit v1.2.3 From 843886694f847bb4ddfb838ca6e43094b51edec0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 5 Mar 2011 17:19:29 +0000 Subject: usrp-e100: disabling VCO cal check, its not right, and the warning alarms people --- host/lib/usrp/usrp_e100/clock_ctrl.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp index aba630d88..ef6179119 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp @@ -425,6 +425,8 @@ private: this->send_reg(0x18); this->latch_regs(); //wait for calibration done: + boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + /* this routine seems to not work, just sleep and return... static const boost::uint8_t addr = 0x01F; for (size_t ms10 = 0; ms10 < 100; ms10++){ boost::uint32_t reg = _iface->read_spi( @@ -436,6 +438,7 @@ private: boost::this_thread::sleep(boost::posix_time::milliseconds(10)); } std::cerr << "USRP-E100 clock control: VCO calibration timeout" << std::endl; + */ } void send_all_regs(void){ -- cgit v1.2.3 From fb65f85e0f915b8587f218bde433210cc574b21f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 17 Mar 2011 17:41:12 -0700 Subject: uhd: whoops, spi convenience functions have 32 bit data --- host/include/uhd/types/serial.hpp | 4 ++-- host/lib/types/serial.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index 5c6de162b..ef6125933 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -151,7 +151,7 @@ namespace uhd{ virtual boost::uint32_t read_spi( int which_slave, const spi_config_t &config, - boost::uint16_t data, + boost::uint32_t data, size_t num_bits ); @@ -165,7 +165,7 @@ namespace uhd{ virtual void write_spi( int which_slave, const spi_config_t &config, - boost::uint16_t data, + boost::uint32_t data, size_t num_bits ); }; diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index aa1133e72..9e9d32954 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -58,7 +58,7 @@ byte_vector_t i2c_iface::read_eeprom( boost::uint32_t spi_iface::read_spi( int which_slave, const spi_config_t &config, - boost::uint16_t data, + boost::uint32_t data, size_t num_bits ){ return transact_spi( @@ -69,7 +69,7 @@ boost::uint32_t spi_iface::read_spi( void spi_iface::write_spi( int which_slave, const spi_config_t &config, - boost::uint16_t data, + boost::uint32_t data, size_t num_bits ){ transact_spi( -- cgit v1.2.3 From 7a949ffd2be87c0bbf5f733e71dbe81d565f0444 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 6 Mar 2011 12:35:42 +0000 Subject: usrp-e100: reinstate the VCO calibration timeout message --- host/lib/usrp/usrp_e100/clock_ctrl.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp index ef6179119..aba630d88 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp @@ -425,8 +425,6 @@ private: this->send_reg(0x18); this->latch_regs(); //wait for calibration done: - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); - /* this routine seems to not work, just sleep and return... static const boost::uint8_t addr = 0x01F; for (size_t ms10 = 0; ms10 < 100; ms10++){ boost::uint32_t reg = _iface->read_spi( @@ -438,7 +436,6 @@ private: boost::this_thread::sleep(boost::posix_time::milliseconds(10)); } std::cerr << "USRP-E100 clock control: VCO calibration timeout" << std::endl; - */ } void send_all_regs(void){ -- cgit v1.2.3 From fb2059949e0ad898e745aafbe958dfb2f326b077 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 21 Mar 2011 10:34:16 -0700 Subject: usb: fix callback cast in libusb zero copy under msvc --- host/lib/transport/libusb1_zero_copy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 697944089..9f38ce97b 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -199,7 +199,7 @@ public: ~libusb_zero_copy_impl(void){ //cancel and free all transfers BOOST_FOREACH(libusb_transfer *lut, _all_luts){ - lut->callback = &cancel_transfer_cb; + lut->callback = libusb_transfer_cb_fn(&cancel_transfer_cb); libusb_cancel_transfer(lut); while(lut->status != LIBUSB_TRANSFER_CANCELLED && lut->status != LIBUSB_TRANSFER_COMPLETED) { boost::this_thread::sleep(boost::posix_time::milliseconds(10)); -- cgit v1.2.3 From 3938de0cfedb4c4ca8b5fdb1ed7137ee32208648 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 21 Mar 2011 11:52:38 -0700 Subject: usrp2: use the discovered mtu to clip the user specified mtu --- host/lib/usrp/usrp2/usrp2_impl.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index 96552929a..f42be321b 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -241,14 +241,17 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ mtu.send_mtu = std::min(mtu.send_mtu, mtu_i.send_mtu); } - std::cout << "mtu recv bytes " << mtu.recv_mtu << std::endl; - std::cout << "mtu send bytes " << mtu.send_mtu << std::endl; - - //use the discovered mtu if not specified by the user - if (not device_addr.has_key("recv_frame_size")) - device_addr["recv_frame_size"] = boost::lexical_cast(mtu.recv_mtu); - if (not device_addr.has_key("send_frame_size")) - device_addr["send_frame_size"] = boost::lexical_cast(mtu.send_mtu); + //use the discovered mtu or clip the users requested mtu + mtu.recv_mtu = std::min(size_t(device_addr.cast("recv_frame_size", 9000)), mtu.recv_mtu); + mtu.send_mtu = std::min(size_t(device_addr.cast("send_frame_size", 9000)), mtu.send_mtu); + + device_addr["recv_frame_size"] = boost::lexical_cast(mtu.recv_mtu); + device_addr["send_frame_size"] = boost::lexical_cast(mtu.send_mtu); + + std::cout << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu << std::endl; + std::cout << boost::format("Current send frame size: %d bytes") % mtu.send_mtu << std::endl; + + device_args = separate_device_addr(device_addr); //update args for new frame sizes //setup rx otw type _rx_otw_type.width = 16; -- cgit v1.2.3 From a963caab9b6500ecef015fa5c514f2a7ae23046f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 21 Mar 2011 16:40:21 -0700 Subject: uhd: setup cpack components for component based installers --- host/CMakeLists.txt | 2 ++ host/Modules/UHDPackage.cmake | 37 ++++++++++++++++++++++++++++++- host/docs/CMakeLists.txt | 6 ++--- host/examples/CMakeLists.txt | 4 ++-- host/include/uhd/CMakeLists.txt | 1 + host/include/uhd/transport/CMakeLists.txt | 1 + host/include/uhd/types/CMakeLists.txt | 1 + host/include/uhd/usrp/CMakeLists.txt | 3 ++- host/include/uhd/utils/CMakeLists.txt | 1 + host/lib/CMakeLists.txt | 1 + host/tests/CMakeLists.txt | 6 +---- host/utils/CMakeLists.txt | 5 +++-- 12 files changed, 54 insertions(+), 14 deletions(-) (limited to 'host/lib') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index bbcf34373..590f1b138 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -156,6 +156,7 @@ CONFIGURE_FILE( INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/uhd.pc DESTINATION ${LIBRARY_DIR}/pkgconfig + COMPONENT libraries ) ######################################################################## @@ -166,6 +167,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS DESTINATION ${PKG_DOC_DIR} + COMPONENT libraries ) ######################################################################## diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 2a11d407b..ed705148a 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -19,7 +19,7 @@ INCLUDE(UHDVersion) #sets version information ######################################################################## -# Setup CPack +# Setup CPack General ######################################################################## SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver") SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC") @@ -29,6 +29,35 @@ SET(CPACK_PACKAGE_VERSION_MINOR ${UHD_VERSION_MINOR}) SET(CPACK_PACKAGE_VERSION_PATCH ${UHD_VERSION_PATCH}) SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README) SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) + +######################################################################## +# Setup CPack Components +######################################################################## +SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +SET(CPACK_COMPONENT_HEADERS_GROUP "Development") +SET(CPACK_COMPONENT_UTILITIES_GROUP "Runtime") +SET(CPACK_COMPONENT_EXAMPLES_GROUP "Runtime") +SET(CPACK_COMPONENT_TESTS_GROUP "Runtime") +SET(CPACK_COMPONENT_MANUAL_GROUP "Documentation") +SET(CPACK_COMPONENT_DOXYGEN_GROUP "Documentation") + +SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") +SET(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "Utilities") +SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples") +SET(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Unit Tests") +SET(CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Manual") +SET(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME "Doxygen") + +SET(CPACK_COMPONENT_UTILITIES_DEPENDS libraries) +SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries) +SET(CPACK_COMPONENT_TESTS_DEPENDS libraries) + +SET(CPACK_COMPONENTS_ALL libraries headers utilities examples tests manual doxygen) + +######################################################################## +# Setup CPack Debian +######################################################################## SET(BOOST_MIN_VERSION 1.36) #used in setup for boost STRING(REPLACE "," ", " CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-date-time-dev (>= ${BOOST_MIN_VERSION})," @@ -40,5 +69,11 @@ STRING(REPLACE "," ", " CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-thread-dev (>= ${BOOST_MIN_VERSION})" ) SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") + +######################################################################## +# Setup CPack RPM +######################################################################## SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${BOOST_MIN_VERSION}") + +######################################################################## INCLUDE(CPack) #include after setting vars diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt index c04262b63..1a2738647 100644 --- a/host/docs/CMakeLists.txt +++ b/host/docs/CMakeLists.txt @@ -64,14 +64,14 @@ IF(ENABLE_MANUAL) #make the manual target depend on the html file LIST(APPEND manual_html_files ${htmlfile}) - INSTALL(FILES ${htmlfile} DESTINATION ${PKG_DOC_DIR}/manual/html) + INSTALL(FILES ${htmlfile} DESTINATION ${PKG_DOC_DIR}/manual/html COMPONENT manual) ENDFOREACH(rstfile ${manual_sources}) #make the html manual a build-time dependency ADD_CUSTOM_TARGET(manual_html ALL DEPENDS ${manual_html_files}) ENDIF(ENABLE_MANUAL) -INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst) +INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst COMPONENT manual) ######################################################################## # Setup Doxygen @@ -99,5 +99,5 @@ IF(ENABLE_DOXYGEN) #make the doxygen generation a built-time dependency ADD_CUSTOM_TARGET(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN}) - INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR}) + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR} COMPONENT doxygen) ENDIF(ENABLE_DOXYGEN) diff --git a/host/examples/CMakeLists.txt b/host/examples/CMakeLists.txt index 44ed55380..1bb037d16 100644 --- a/host/examples/CMakeLists.txt +++ b/host/examples/CMakeLists.txt @@ -37,7 +37,7 @@ FOREACH(example_source ${example_sources}) GET_FILENAME_COMPONENT(example_name ${example_source} NAME_WE) ADD_EXECUTABLE(${example_name} ${example_source}) TARGET_LINK_LIBRARIES(${example_name} uhd) - INSTALL(TARGETS ${example_name} RUNTIME DESTINATION ${PKG_DATA_DIR}/examples) + INSTALL(TARGETS ${example_name} RUNTIME DESTINATION ${PKG_DATA_DIR}/examples COMPONENT examples) ENDFOREACH(example_source) ######################################################################## @@ -49,5 +49,5 @@ IF(CURSES_FOUND) INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR}) ADD_EXECUTABLE(rx_ascii_art_dft rx_ascii_art_dft.cpp) TARGET_LINK_LIBRARIES(rx_ascii_art_dft uhd ${CURSES_LIBRARIES}) - INSTALL(TARGETS rx_ascii_art_dft RUNTIME DESTINATION ${PKG_DATA_DIR}/examples) + INSTALL(TARGETS rx_ascii_art_dft RUNTIME DESTINATION ${PKG_DATA_DIR}/examples COMPONENT examples) ENDIF(CURSES_FOUND) diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt index db755511e..74dc4a7d6 100644 --- a/host/include/uhd/CMakeLists.txt +++ b/host/include/uhd/CMakeLists.txt @@ -29,4 +29,5 @@ INSTALL(FILES version.hpp wax.hpp DESTINATION ${INCLUDE_DIR}/uhd + COMPONENT headers ) diff --git a/host/include/uhd/transport/CMakeLists.txt b/host/include/uhd/transport/CMakeLists.txt index 14ca82226..bf7497ee7 100644 --- a/host/include/uhd/transport/CMakeLists.txt +++ b/host/include/uhd/transport/CMakeLists.txt @@ -29,4 +29,5 @@ INSTALL(FILES vrt_if_packet.hpp zero_copy.hpp DESTINATION ${INCLUDE_DIR}/uhd/transport + COMPONENT headers ) diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt index c856e5568..0971ca472 100644 --- a/host/include/uhd/types/CMakeLists.txt +++ b/host/include/uhd/types/CMakeLists.txt @@ -34,4 +34,5 @@ INSTALL(FILES tune_request.hpp tune_result.hpp DESTINATION ${INCLUDE_DIR}/uhd/types + COMPONENT headers ) diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index 59a1302af..e441433fd 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 @@ -46,4 +46,5 @@ INSTALL(FILES mboard_iface.hpp DESTINATION ${INCLUDE_DIR}/uhd/usrp + COMPONENT headers ) diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index 70f724c2d..71808ac98 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -31,4 +31,5 @@ INSTALL(FILES thread_priority.hpp warning.hpp DESTINATION ${INCLUDE_DIR}/uhd/utils + COMPONENT headers ) diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index dbfa234b6..a30b380c4 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -121,4 +121,5 @@ INSTALL(TARGETS uhd LIBRARY DESTINATION ${LIBRARY_DIR} # .so file ARCHIVE DESTINATION ${LIBRARY_DIR} # .lib file RUNTIME DESTINATION ${LIBRARY_DIR} # .dll file + COMPONENT libraries ) diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt index 79b20cd47..821b2eb9e 100644 --- a/host/tests/CMakeLists.txt +++ b/host/tests/CMakeLists.txt @@ -44,7 +44,7 @@ FOREACH(test_source ${test_sources}) ADD_EXECUTABLE(${test_name} ${test_source}) TARGET_LINK_LIBRARIES(${test_name} uhd) ADD_TEST(${test_name} ${test_name}) - INSTALL(TARGETS ${test_name} RUNTIME DESTINATION ${PKG_DATA_DIR}/tests) + INSTALL(TARGETS ${test_name} RUNTIME DESTINATION ${PKG_DATA_DIR}/tests COMPONENT tests) ENDFOREACH(test_source) ######################################################################## @@ -52,7 +52,3 @@ ENDFOREACH(test_source) ######################################################################## ADD_LIBRARY(module_test MODULE module_test.cpp) TARGET_LINK_LIBRARIES(module_test uhd) - -INSTALL(TARGETS - RUNTIME DESTINATION ${PKG_DATA_DIR}/tests -) diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index 53527c03d..3c18324a5 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -28,7 +28,7 @@ FOREACH(util_source ${util_runtime_sources}) GET_FILENAME_COMPONENT(util_name ${util_source} NAME_WE) ADD_EXECUTABLE(${util_name} ${util_source}) TARGET_LINK_LIBRARIES(${util_name} uhd) - INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${RUNTIME_DIR}) + INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT utilities) ENDFOREACH(util_source) ######################################################################## @@ -50,7 +50,7 @@ FOREACH(util_source ${util_share_sources}) GET_FILENAME_COMPONENT(util_name ${util_source} NAME_WE) ADD_EXECUTABLE(${util_name} ${util_source}) TARGET_LINK_LIBRARIES(${util_name} uhd) - INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${PKG_DATA_DIR}/utils) + INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${PKG_DATA_DIR}/utils COMPONENT utilities) ENDFOREACH(util_source) IF(ENABLE_USRP2) @@ -60,5 +60,6 @@ IF(ENABLE_USRP2) usrp2_card_burner_gui.py usrp_n2xx_net_burner.py DESTINATION ${PKG_DATA_DIR}/utils + COMPONENT utilities ) ENDIF(ENABLE_USRP2) -- cgit v1.2.3 From 6fc9a384a7d9aef9457e7f7015431880f6bf91d8 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 11 Mar 2011 17:02:11 +0000 Subject: usrp-e100: added module compat num check, made fpga compat constant more obvious --- host/lib/usrp/usrp_e100/usrp_e100_iface.cpp | 11 ++++++++++- host/lib/usrp/usrp_e100/usrp_e100_impl.cpp | 8 ++++---- host/lib/usrp/usrp_e100/usrp_e100_impl.hpp | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp b/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp index ec0baf490..55446da63 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_iface.cpp @@ -22,7 +22,7 @@ #include //open, close #include //ioctl structures and constants #include -#include //mutex +#include #include #include #include @@ -109,6 +109,15 @@ public: throw uhd::io_error("Failed to open " + node); } + //check the module compatibility number + int module_compat_num = ::ioctl(_node_fd, USRP_E_GET_COMPAT_NUMBER, NULL); + if (module_compat_num != USRP_E_COMPAT_NUMBER){ + throw uhd::runtime_error(str(boost::format( + "Expected module compatibility number 0x%x, but got 0x%x:\n" + "The module build is not compatible with the host code build." + ) % USRP_E_COMPAT_NUMBER % module_compat_num)); + } + mb_eeprom = mboard_eeprom_t(get_i2c_dev_iface(), mboard_eeprom_t::MAP_E100); } diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp index a120c3303..a8fbe5d69 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp @@ -120,10 +120,10 @@ static device::sptr usrp_e100_make(const device_addr_t &device_addr){ try{std::ifstream(hash_file_path) >> loaded_hash;}catch(...){} //if not loaded: load the fpga image and write the hash-file - if (fpga_compat_num != USRP_E_COMPAT_NUM or loaded_hash != fpga_hash){ + if (fpga_compat_num != USRP_E_FPGA_COMPAT_NUM or loaded_hash != fpga_hash){ iface.reset(); usrp_e100_load_fpga(usrp_e100_fpga_image); - sleep(1); ///\todo do this better one day. + sleep(1); ///\todo do this better one day. std::cout << boost::format("re-Opening USRP-E on %s") % node << std::endl; iface = usrp_e100_iface::make(node); try{std::ofstream(hash_file_path) << fpga_hash;}catch(...){} @@ -131,11 +131,11 @@ static device::sptr usrp_e100_make(const device_addr_t &device_addr){ //check that the compatibility is correct fpga_compat_num = iface->peek16(UE_REG_MISC_COMPAT); - if (fpga_compat_num != USRP_E_COMPAT_NUM){ + if (fpga_compat_num != USRP_E_FPGA_COMPAT_NUM){ throw uhd::runtime_error(str(boost::format( "Expected fpga compatibility number 0x%x, but got 0x%x:\n" "The fpga build is not compatible with the host code build." - ) % USRP_E_COMPAT_NUM % fpga_compat_num)); + ) % USRP_E_FPGA_COMPAT_NUM % fpga_compat_num)); } return device::sptr(new usrp_e100_impl(iface)); diff --git a/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp index 897616320..98117cf26 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_impl.hpp @@ -30,7 +30,7 @@ #ifndef INCLUDED_USRP_E100_IMPL_HPP #define INCLUDED_USRP_E100_IMPL_HPP -static const boost::uint16_t USRP_E_COMPAT_NUM = 0x03; +static const boost::uint16_t USRP_E_FPGA_COMPAT_NUM = 0x03; //! load an fpga image from a bin file into the usrp-e fpga extern void usrp_e100_load_fpga(const std::string &bin_file); -- cgit v1.2.3 From 95b966a599c0030921dc6b530ca8c94633d905f6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 23 Mar 2011 18:48:30 -0700 Subject: uhd: update copyright headers with automated script --- host/Modules/UHDComponent.cmake | 2 +- host/Modules/UHDPackage.cmake | 2 +- host/Modules/UHDPython.cmake | 2 +- host/include/uhd/types/serial.hpp | 2 +- host/include/uhd/types/time_spec.hpp | 2 +- host/include/uhd/usrp/gps_ctrl.hpp | 2 +- host/include/uhd/usrp/tune_helper.hpp | 2 +- host/lib/device.cpp | 2 +- host/lib/ic_reg_maps/common.py | 2 +- host/lib/ic_reg_maps/gen_ad9522_regs.py | 2 +- host/lib/transport/if_addrs.cpp | 2 +- host/lib/usrp/CMakeLists.txt | 2 +- host/lib/usrp/dboard_base.cpp | 2 +- host/lib/usrp/dsp_utils.cpp | 2 +- host/lib/usrp/gps_ctrl.cpp | 2 +- host/lib/usrp/tune_helper.cpp | 2 +- host/lib/usrp/usrp1/clock_ctrl.hpp | 2 +- host/lib/usrp/usrp1/usrp1_ctrl.cpp | 2 +- host/lib/usrp/usrp1/usrp1_ctrl.hpp | 2 +- host/lib/usrp/usrp1/usrp1_iface.cpp | 2 +- host/lib/usrp/usrp1/usrp1_iface.hpp | 2 +- host/lib/usrp/usrp2/CMakeLists.txt | 2 +- host/lib/usrp/usrp2/clock_ctrl.cpp | 2 +- host/lib/usrp/usrp2/usrp2_iface.hpp | 2 +- host/lib/usrp/usrp_e100/clock_ctrl.hpp | 2 +- host/lib/usrp/usrp_e100/usrp_e100_iface.hpp | 2 +- host/lib/utils/images.cpp | 2 +- host/tests/addr_test.cpp | 2 +- host/tests/byteswap_test.cpp | 2 +- host/tests/dict_test.cpp | 2 +- host/tests/module_test.cpp | 2 +- host/tests/subdev_spec_test.cpp | 2 +- host/tests/time_spec_test.cpp | 2 +- host/tests/tune_helper_test.cpp | 2 +- host/tests/vrt_test.cpp | 2 +- host/tests/warning_test.cpp | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) (limited to 'host/lib') diff --git a/host/Modules/UHDComponent.cmake b/host/Modules/UHDComponent.cmake index 4ea55bbb9..52b7450d5 100644 --- a/host/Modules/UHDComponent.cmake +++ b/host/Modules/UHDComponent.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 03483e042..8ca8995cd 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/Modules/UHDPython.cmake b/host/Modules/UHDPython.cmake index 345e0187d..90a778609 100644 --- a/host/Modules/UHDPython.cmake +++ b/host/Modules/UHDPython.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index ef6125933..8281fd3ec 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/include/uhd/types/time_spec.hpp b/host/include/uhd/types/time_spec.hpp index 2046fbd3f..02de20ea1 100644 --- a/host/include/uhd/types/time_spec.hpp +++ b/host/include/uhd/types/time_spec.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/include/uhd/usrp/gps_ctrl.hpp b/host/include/uhd/usrp/gps_ctrl.hpp index 74f984ee0..21d400b3b 100644 --- a/host/include/uhd/usrp/gps_ctrl.hpp +++ b/host/include/uhd/usrp/gps_ctrl.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/include/uhd/usrp/tune_helper.hpp b/host/include/uhd/usrp/tune_helper.hpp index e97ab0298..0d468a4e2 100644 --- a/host/include/uhd/usrp/tune_helper.hpp +++ b/host/include/uhd/usrp/tune_helper.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/device.cpp b/host/lib/device.cpp index 0002bee6e..1b3daa103 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/ic_reg_maps/common.py b/host/lib/ic_reg_maps/common.py index a509936b4..24f5bf8be 100644 --- a/host/lib/ic_reg_maps/common.py +++ b/host/lib/ic_reg_maps/common.py @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/lib/ic_reg_maps/gen_ad9522_regs.py b/host/lib/ic_reg_maps/gen_ad9522_regs.py index 86605c34a..1512da811 100755 --- a/host/lib/ic_reg_maps/gen_ad9522_regs.py +++ b/host/lib/ic_reg_maps/gen_ad9522_regs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/lib/transport/if_addrs.cpp b/host/lib/transport/if_addrs.cpp index b7c8ad844..83a1ee56f 100644 --- a/host/lib/transport/if_addrs.cpp +++ b/host/lib/transport/if_addrs.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index 59dabbd58..018beb417 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/lib/usrp/dboard_base.cpp b/host/lib/usrp/dboard_base.cpp index 999dd9ffc..e14c9d144 100644 --- a/host/lib/usrp/dboard_base.cpp +++ b/host/lib/usrp/dboard_base.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/dsp_utils.cpp b/host/lib/usrp/dsp_utils.cpp index a3a557060..2686e895b 100644 --- a/host/lib/usrp/dsp_utils.cpp +++ b/host/lib/usrp/dsp_utils.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index e0ab6de90..ff8e9cee6 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp index ced80c187..9637301ad 100644 --- a/host/lib/usrp/tune_helper.cpp +++ b/host/lib/usrp/tune_helper.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp1/clock_ctrl.hpp b/host/lib/usrp/usrp1/clock_ctrl.hpp index 645472f02..339d547e6 100644 --- a/host/lib/usrp/usrp1/clock_ctrl.hpp +++ b/host/lib/usrp/usrp1/clock_ctrl.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.cpp b/host/lib/usrp/usrp1/usrp1_ctrl.cpp index 3fa6cb8b7..22e9fd1ce 100644 --- a/host/lib/usrp/usrp1/usrp1_ctrl.cpp +++ b/host/lib/usrp/usrp1/usrp1_ctrl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.hpp b/host/lib/usrp/usrp1/usrp1_ctrl.hpp index ee68f8401..970ca2951 100644 --- a/host/lib/usrp/usrp1/usrp1_ctrl.hpp +++ b/host/lib/usrp/usrp1/usrp1_ctrl.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 0c37610ce..ea7c1cea5 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp index fdb7464ce..2ebcdbacc 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.hpp +++ b/host/lib/usrp/usrp1/usrp1_iface.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp2/CMakeLists.txt b/host/lib/usrp/usrp2/CMakeLists.txt index e8811a8fb..49be9ac7d 100644 --- a/host/lib/usrp/usrp2/CMakeLists.txt +++ b/host/lib/usrp/usrp2/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2010 Ettus Research LLC +# Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp index abda53bf2..7572ed6b1 100644 --- a/host/lib/usrp/usrp2/clock_ctrl.cpp +++ b/host/lib/usrp/usrp2/clock_ctrl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index df53ec66a..08f3955f1 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.hpp b/host/lib/usrp/usrp_e100/clock_ctrl.hpp index 1f9960ce4..623fbc73b 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.hpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/usrp/usrp_e100/usrp_e100_iface.hpp b/host/lib/usrp/usrp_e100/usrp_e100_iface.hpp index cb0ca2dd4..d9fe96db7 100644 --- a/host/lib/usrp/usrp_e100/usrp_e100_iface.hpp +++ b/host/lib/usrp/usrp_e100/usrp_e100_iface.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/lib/utils/images.cpp b/host/lib/utils/images.cpp index 2b6c02772..a124cc208 100644 --- a/host/lib/utils/images.cpp +++ b/host/lib/utils/images.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/addr_test.cpp b/host/tests/addr_test.cpp index d4b45aa1a..01a7ab607 100644 --- a/host/tests/addr_test.cpp +++ b/host/tests/addr_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/byteswap_test.cpp b/host/tests/byteswap_test.cpp index 3d50c9bfa..7d94bbfba 100644 --- a/host/tests/byteswap_test.cpp +++ b/host/tests/byteswap_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/dict_test.cpp b/host/tests/dict_test.cpp index 0501a7878..7b388d090 100644 --- a/host/tests/dict_test.cpp +++ b/host/tests/dict_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/module_test.cpp b/host/tests/module_test.cpp index 47a0e1af9..af2f749a7 100644 --- a/host/tests/module_test.cpp +++ b/host/tests/module_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/subdev_spec_test.cpp b/host/tests/subdev_spec_test.cpp index 8817d5eee..aa0b9a119 100644 --- a/host/tests/subdev_spec_test.cpp +++ b/host/tests/subdev_spec_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/time_spec_test.cpp b/host/tests/time_spec_test.cpp index 070392f93..e57bbced1 100644 --- a/host/tests/time_spec_test.cpp +++ b/host/tests/time_spec_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/tune_helper_test.cpp b/host/tests/tune_helper_test.cpp index aabaaaf6e..51d216825 100644 --- a/host/tests/tune_helper_test.cpp +++ b/host/tests/tune_helper_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/vrt_test.cpp b/host/tests/vrt_test.cpp index 9e131a10b..066f1493b 100644 --- a/host/tests/vrt_test.cpp +++ b/host/tests/vrt_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 diff --git a/host/tests/warning_test.cpp b/host/tests/warning_test.cpp index db19955de..3394f84d4 100644 --- a/host/tests/warning_test.cpp +++ b/host/tests/warning_test.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 -- cgit v1.2.3 From d078d4f5d17088b9f366c62f5b3eca7b167e665c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 27 Mar 2011 05:03:39 -0700 Subject: uhd: work on versioning technique for the releases --- host/Modules/UHDVersion.cmake | 25 +++++++++++++++++-------- host/lib/CMakeLists.txt | 3 ++- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'host/lib') diff --git a/host/Modules/UHDVersion.cmake b/host/Modules/UHDVersion.cmake index 9b20bb98a..440ce6698 100644 --- a/host/Modules/UHDVersion.cmake +++ b/host/Modules/UHDVersion.cmake @@ -17,19 +17,28 @@ ######################################################################## INCLUDE(UHDPython) #requires python for parsing +FIND_PACKAGE(Git QUIET) ######################################################################## # Setup Version Numbers +# - increment major on api compatibility changes +# - increment minor on feature-level changes +# - increment patch on for bug fixes and docs ######################################################################## -SET(UHD_VERSION_MAJOR 003) #API compatibility number -SET(UHD_VERSION_MINOR 0) #Timestamp of git commit -SET(UHD_VERSION_PATCH 0) #Short hash of git commit +SET(UHD_VERSION_MAJOR 003) +SET(UHD_VERSION_MINOR 000) +SET(UHD_VERSION_PATCH 000) ######################################################################## -# Find GIT to get repo information +# Version information discovery through git log ######################################################################## -FIND_PACKAGE(Git QUIET) -IF(GIT_FOUND) +IF(UHD_PACKAGE_MODE STREQUAL AUTO) + SET(UHD_VERSION_DISCOVERY FALSE) +ELSE() + SET(UHD_VERSION_DISCOVERY GIT_FOUND) +ENDIF() + +IF(UHD_VERSION_DISCOVERY) #grab the git log entry for the current head EXECUTE_PROCESS( @@ -50,7 +59,7 @@ IF(GIT_FOUND) COMMAND ${PYTHON_EXECUTABLE} -c "import time; print time.strftime('%Y%m%d%H%M%S', time.gmtime(${_git_timestamp}))" OUTPUT_VARIABLE _git_date OUTPUT_STRIP_TRAILING_WHITESPACE ) - SET(UHD_VERSION_MINOR ${_git_date}) + #SET(UHD_VERSION_MINOR ${_git_date}) #grab the git ref id for the current head EXECUTE_PROCESS( @@ -59,7 +68,7 @@ IF(GIT_FOUND) OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE ) SET(UHD_VERSION_PATCH ${_git_rev}) -ENDIF(GIT_FOUND) +ENDIF(UHD_VERSION_DISCOVERY) ######################################################################## SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}") diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index a30b380c4..cb75979e8 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -112,7 +112,8 @@ LIBUHD_APPEND_SOURCES( ADD_LIBRARY(uhd SHARED ${libuhd_sources}) TARGET_LINK_LIBRARIES(uhd ${Boost_LIBRARIES} ${libuhd_libs}) SET_TARGET_PROPERTIES(uhd PROPERTIES DEFINE_SYMBOL "UHD_DLL_EXPORTS") -SET_TARGET_PROPERTIES(uhd PROPERTIES SOVERSION ${UHD_VERSION_MAJOR}) +SET_TARGET_PROPERTIES(uhd PROPERTIES SOVERSION "${UHD_VERSION_MAJOR}") +SET_TARGET_PROPERTIES(uhd PROPERTIES VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}") IF(DEFINED LIBUHD_OUTPUT_NAME) SET_TARGET_PROPERTIES(uhd PROPERTIES OUTPUT_NAME ${LIBUHD_OUTPUT_NAME}) ENDIF(DEFINED LIBUHD_OUTPUT_NAME) -- cgit v1.2.3 From 69d19fedd3fd7945a21daac0ae14c06fee78ee91 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Mar 2011 13:44:36 -0700 Subject: uhd: various packing fixes (lib suffix, and library components) 1) setup lib suffix for fedora 64 2) specify component for all library target types (should fix missing library files problem) --- host/Modules/UHDPackage.cmake | 5 +++++ host/lib/CMakeLists.txt | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'host/lib') diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 65637ab16..e7aa386f6 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -48,6 +48,11 @@ IF(UHD_RELEASE_MODE) SET(CPACK_GENERATOR RPM) ENDIF() + #when the library suffix should be 64 (applies to redhat linux family) + IF(EXISTS "/etc/redhat-release" AND _machine MATCHES "64$") + SET(LIB_SUFFIX 64) + ENDIF() + #set a more sensible package name for this system SET(CPACK_PACKAGE_FILE_NAME "UHD-${UHD_VERSION}-${_os_name}-${_os_version}-${_machine}") diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index cb75979e8..d095255ea 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -113,14 +113,13 @@ ADD_LIBRARY(uhd SHARED ${libuhd_sources}) TARGET_LINK_LIBRARIES(uhd ${Boost_LIBRARIES} ${libuhd_libs}) SET_TARGET_PROPERTIES(uhd PROPERTIES DEFINE_SYMBOL "UHD_DLL_EXPORTS") SET_TARGET_PROPERTIES(uhd PROPERTIES SOVERSION "${UHD_VERSION_MAJOR}") -SET_TARGET_PROPERTIES(uhd PROPERTIES VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}") +SET_TARGET_PROPERTIES(uhd PROPERTIES VERSION "${UHD_VERSION}") IF(DEFINED LIBUHD_OUTPUT_NAME) SET_TARGET_PROPERTIES(uhd PROPERTIES OUTPUT_NAME ${LIBUHD_OUTPUT_NAME}) ENDIF(DEFINED LIBUHD_OUTPUT_NAME) INSTALL(TARGETS uhd - LIBRARY DESTINATION ${LIBRARY_DIR} # .so file - ARCHIVE DESTINATION ${LIBRARY_DIR} # .lib file - RUNTIME DESTINATION ${LIBRARY_DIR} # .dll file - COMPONENT libraries + LIBRARY DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .so file + ARCHIVE DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .lib file + RUNTIME DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .dll file ) -- cgit v1.2.3 From 1ff8aaeaab91919e0c67c85ba6bb74fba96eefe8 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Mar 2011 21:17:09 -0700 Subject: uhd: revert VERSION setting for libuhd, macosx does not like patch level --- host/lib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index d095255ea..54f4893e3 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -113,7 +113,7 @@ ADD_LIBRARY(uhd SHARED ${libuhd_sources}) TARGET_LINK_LIBRARIES(uhd ${Boost_LIBRARIES} ${libuhd_libs}) SET_TARGET_PROPERTIES(uhd PROPERTIES DEFINE_SYMBOL "UHD_DLL_EXPORTS") SET_TARGET_PROPERTIES(uhd PROPERTIES SOVERSION "${UHD_VERSION_MAJOR}") -SET_TARGET_PROPERTIES(uhd PROPERTIES VERSION "${UHD_VERSION}") +SET_TARGET_PROPERTIES(uhd PROPERTIES VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}") IF(DEFINED LIBUHD_OUTPUT_NAME) SET_TARGET_PROPERTIES(uhd PROPERTIES OUTPUT_NAME ${LIBUHD_OUTPUT_NAME}) ENDIF(DEFINED LIBUHD_OUTPUT_NAME) -- cgit v1.2.3 From 2d1bd00bf04274358aed15b5652e67187424a424 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Mar 2011 23:41:01 -0700 Subject: usb: changes to allow for static linking of libusb on windows --- host/lib/transport/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'host/lib') diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index a5bf9c5f1..656ca9987 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -31,6 +31,10 @@ IF(ENABLE_USB) MESSAGE(STATUS "USB support enabled via libusb.") INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR}) LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES}) + IF(WIN32) + #needed when statically linking libusb + LIBUHD_APPEND_LIBS(Setupapi.lib) + ENDIF(WIN32) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_control.cpp ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp -- cgit v1.2.3 From a2a78451d196a7f52a3e2a3bda94f52d127313d0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 29 Mar 2011 11:38:38 -0700 Subject: usrp-e100: set the ticks-per-second every time we change clock rate --- host/lib/usrp/usrp_e100/clock_ctrl.cpp | 1 + host/lib/usrp/usrp_e100/mboard_impl.cpp | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp index aba630d88..b0bf20b67 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp @@ -287,6 +287,7 @@ public: if (_out_rate == rate) return; if (rate == 61.44e6) set_clock_settings_with_external_vcxo(rate); else set_clock_settings_with_internal_vco(rate); + _iface->poke32(UE_REG_TIME64_TPS, boost::uint32_t(get_fpga_clock_rate())); } double get_fpga_clock_rate(void){ diff --git a/host/lib/usrp/usrp_e100/mboard_impl.cpp b/host/lib/usrp/usrp_e100/mboard_impl.cpp index cec4fd0ad..29e3c5da2 100644 --- a/host/lib/usrp/usrp_e100/mboard_impl.cpp +++ b/host/lib/usrp/usrp_e100/mboard_impl.cpp @@ -36,11 +36,6 @@ void usrp_e100_impl::mboard_init(void){ boost::bind(&usrp_e100_impl::mboard_set, this, _1, _2) ); - //set the ticks per seconds into the vita time control - _iface->poke32(UE_REG_TIME64_TPS, - boost::uint32_t(_clock_ctrl->get_fpga_clock_rate()) - ); - //init the clock config _clock_config = clock_config_t::internal(); update_clock_config(); -- cgit v1.2.3 From 32357927bdc52b0cc7cd7b6d18457932aaa79682 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 29 Mar 2011 13:42:40 -0700 Subject: uhd: remove build information in the version string (just major.minor.patch) Add the build info as an additional string to the get_version function(). --- host/CMakeLists.txt | 2 +- host/Modules/UHDVersion.cmake | 14 ++++++++------ host/lib/constants.hpp.in | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'host/lib') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index db100129f..244793b9e 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -211,5 +211,5 @@ ADD_SUBDIRECTORY(usrp_e_utils) # Print Summary ######################################################################## UHD_PRINT_COMPONENT_SUMMARY() -MESSAGE(STATUS "Building version: ${CPACK_PACKAGE_VERSION}") +MESSAGE(STATUS "Building version: ${CPACK_PACKAGE_VERSION}-${UHD_BUILD_INFO}") MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") diff --git a/host/Modules/UHDVersion.cmake b/host/Modules/UHDVersion.cmake index dbc39b5a9..78bf7f690 100644 --- a/host/Modules/UHDVersion.cmake +++ b/host/Modules/UHDVersion.cmake @@ -33,12 +33,14 @@ SET(UHD_VERSION_PATCH 000) # Version information discovery through git log ######################################################################## IF(UHD_RELEASE_MODE) - SET(UHD_VERSION_DISCOVERY FALSE) + SET(UHD_BUILD_INFO_DISCOVERY FALSE) + SET(UHD_BUILD_INFO "release") ELSE() - SET(UHD_VERSION_DISCOVERY GIT_FOUND) + SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND) + SET(UHD_BUILD_INFO "unknown") ENDIF() -IF(UHD_VERSION_DISCOVERY) +IF(UHD_BUILD_INFO_DISCOVERY) #grab the git log entry for the current head EXECUTE_PROCESS( @@ -59,7 +61,6 @@ IF(UHD_VERSION_DISCOVERY) COMMAND ${PYTHON_EXECUTABLE} -c "import time; print time.strftime('%Y%m%d%H%M%S', time.gmtime(${_git_timestamp}))" OUTPUT_VARIABLE _git_date OUTPUT_STRIP_TRAILING_WHITESPACE ) - #SET(UHD_VERSION_MINOR ${_git_date}) #grab the git ref id for the current head EXECUTE_PROCESS( @@ -67,8 +68,9 @@ IF(UHD_VERSION_DISCOVERY) COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE ) - SET(UHD_VERSION_PATCH ${_git_rev}) -ENDIF(UHD_VERSION_DISCOVERY) + + SET(UHD_BUILD_INFO ${_git_rev}) +ENDIF(UHD_BUILD_INFO_DISCOVERY) ######################################################################## SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}") diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in index 4aedb6d4a..d62dda1cb 100644 --- a/host/lib/constants.hpp.in +++ b/host/lib/constants.hpp.in @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 @@ -19,7 +19,7 @@ #define INCLUDED_LIBUHD_CONSTANTS_HPP //these should be pre-processor macros to avoid static initialization issues -#define UHD_VERSION_STRING "@CPACK_PACKAGE_VERSION@" +#define UHD_VERSION_STRING "@UHD_VERSION@-@UHD_BUILD_INFO@" #define LOCAL_PKG_DATA_DIR "@LOCAL_PKG_DATA_DIR@" #define INSTALLER_PKG_DATA_DIR "@INSTALLER_PKG_DATA_DIR@" -- cgit v1.2.3 From 48f6e1f8aae24ee4ff3b15232cfc335b0210ed11 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 29 Mar 2011 17:27:17 -0700 Subject: usrp1: ignore claimed interfaces, avoids the problem of discovery when one device is claimed --- host/lib/usrp/usrp1/usrp1_impl.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 7005c59f2..a99777775 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -86,7 +86,11 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) } //std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; - usrp_ctrl::make(usb_control::make(handle))->usrp_load_firmware(usrp1_fw_image); + usb_control::sptr control; + try{control = usb_control::make(handle);} + catch(const uhd::exception &){continue;} //ignore claimed + + usrp_ctrl::make(control)->usrp_load_firmware(usrp1_fw_image); } //get descriptors again with serial number, but using the initialized VID/PID now since we have firmware @@ -94,7 +98,11 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) pid = USRP1_PRODUCT_ID; BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { - usrp1_iface::sptr iface = usrp1_iface::make(usrp_ctrl::make(usb_control::make(handle))); + usb_control::sptr control; + try{control = usb_control::make(handle);} + catch(const uhd::exception &){continue;} //ignore claimed + + usrp1_iface::sptr iface = usrp1_iface::make(usrp_ctrl::make(control)); device_addr_t new_addr; new_addr["type"] = "usrp1"; new_addr["name"] = iface->mb_eeprom["name"]; -- cgit v1.2.3 From 1d29ee1086620b7dc51dcdbcaaef2690d2e95dc6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 30 Mar 2011 16:48:09 -0700 Subject: usrp1: switch usrp1 iface to use spi read (transact never worked) It detects the number of header bytes by searching for non-zero bytes. --- host/lib/usrp/usrp1/usrp1_iface.cpp | 46 +++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index ea7c1cea5..8f10df751 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -175,24 +175,31 @@ public: UHD_ASSERT_THROW((num_bits <= 32) && !(num_bits % 8)); size_t num_bytes = num_bits / 8; - // Byteswap on num_bytes - unsigned char buff[4] = { 0 }; - for (size_t i = 1; i <= num_bytes; i++) - buff[num_bytes - i] = (bits >> ((i - 1) * 8)) & 0xff; - if (readback) { - boost::uint8_t w_len_h = which_slave & 0xff; - boost::uint8_t w_len_l = num_bytes & 0xff; - - int ret = _ctrl_transport->usrp_control_read( - VRQ_SPI_TRANSACT, - (buff[0] << 8) | (buff[1] << 0), - (buff[2] << 8) | (buff[3] << 0), - buff, - (w_len_h << 8) | (w_len_l << 0)); - - if (ret < 0) throw uhd::io_error("USRP1: failed SPI readback transaction"); - + unsigned char buff[4] = { + (bits >> 0) & 0xff, (bits >> 8) & 0xff, + (bits >> 16) & 0xff, (bits >> 24) & 0xff + }; + //conditions where there are two header bytes + if (num_bytes >= 3 and buff[num_bytes-1] != 0 and buff[num_bytes-2] != 0 and buff[num_bytes-3] == 0){ + if (int(num_bytes-2) != _ctrl_transport->usrp_control_read( + VRQ_SPI_READ, (buff[num_bytes-1] << 8) | (buff[num_bytes-2] << 0), + (which_slave << 8) | SPI_FMT_MSB | SPI_FMT_HDR_2, + buff, num_bytes-2 + )) throw uhd::io_error("USRP1: failed SPI readback transaction"); + } + + //conditions where there is one header byte + else if (num_bytes >= 2 and buff[num_bytes-1] != 0 and buff[num_bytes-2] == 0){ + if (int(num_bytes-1) != _ctrl_transport->usrp_control_read( + VRQ_SPI_READ, buff[num_bytes-1], + (which_slave << 8) | SPI_FMT_MSB | SPI_FMT_HDR_1, + buff, num_bytes-1 + )) throw uhd::io_error("USRP1: failed SPI readback transaction"); + } + else{ + throw uhd::io_error("USRP1: invalid input data for SPI readback"); + } boost::uint32_t val = (((boost::uint32_t)buff[0]) << 0) | (((boost::uint32_t)buff[1]) << 8) | (((boost::uint32_t)buff[2]) << 16) | @@ -200,6 +207,11 @@ public: return val; } else { + // Byteswap on num_bytes + unsigned char buff[4] = { 0 }; + for (size_t i = 1; i <= num_bytes; i++) + buff[num_bytes - i] = (bits >> ((i - 1) * 8)) & 0xff; + boost::uint8_t w_index_h = which_slave & 0xff; boost::uint8_t w_index_l = (SPI_FMT_MSB | SPI_FMT_HDR_0) & 0xff; -- cgit v1.2.3 From 6f70d17b206226823dc6108410d0608373300f58 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 30 Mar 2011 16:51:01 -0700 Subject: usrp1: fixed codec ctrl aux adc read (didnt start conversions) + cleaned-up logic --- host/lib/usrp/usrp1/codec_ctrl.cpp | 73 +++++++++++++++----------------------- 1 file changed, 29 insertions(+), 44 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index 1b4411002..9df29da0e 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -71,7 +71,6 @@ private: usrp1_clock_ctrl::sptr _clock_ctrl; int _spi_slave; ad9862_regs_t _ad9862_regs; - aux_adc_t _last_aux_adc_a, _last_aux_adc_b; void send_reg(boost::uint8_t addr); void recv_reg(boost::uint8_t addr); @@ -134,6 +133,10 @@ usrp1_codec_ctrl_impl::usrp1_codec_ctrl_impl(usrp1_iface::sptr iface, this->send_reg(addr); } + //always start conversions for aux ADC + _ad9862_regs.start_a = 1; + _ad9862_regs.start_b = 1; + //aux adc clock _ad9862_regs.clk_4 = ad9862_regs_t::CLK_4_1_4; this->send_reg(34); @@ -206,55 +209,37 @@ static double aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low) return double(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff; } -double usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) -{ - //check to see if the switch needs to be set - bool write_switch = false; - switch(which) { - +double usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which){ + switch(which){ case AUX_ADC_A1: + _ad9862_regs.select_a = ad9862_regs_t::SELECT_A_AUX_ADC1; + this->send_reg(34); //start conversion and select mux + this->recv_reg(28); //read the value (2 bytes, 2 reads) + this->recv_reg(29); + return aux_adc_to_volts(_ad9862_regs.aux_adc_a1_9_2, _ad9862_regs.aux_adc_a1_1_0); + case AUX_ADC_A2: - if (which != _last_aux_adc_a) { - _ad9862_regs.select_a = (which == AUX_ADC_A1)? - ad9862_regs_t::SELECT_A_AUX_ADC1: ad9862_regs_t::SELECT_A_AUX_ADC2; - _last_aux_adc_a = which; - write_switch = true; - } - break; + _ad9862_regs.select_a = ad9862_regs_t::SELECT_A_AUX_ADC2; + this->send_reg(34); //start conversion and select mux + this->recv_reg(26); //read the value (2 bytes, 2 reads) + this->recv_reg(27); + return aux_adc_to_volts(_ad9862_regs.aux_adc_a2_9_2, _ad9862_regs.aux_adc_a2_1_0); case AUX_ADC_B1: - case AUX_ADC_B2: - if (which != _last_aux_adc_b) { - _ad9862_regs.select_b = (which == AUX_ADC_B1)? - ad9862_regs_t::SELECT_B_AUX_ADC1: ad9862_regs_t::SELECT_B_AUX_ADC2; - _last_aux_adc_b = which; - write_switch = true; - } - break; + _ad9862_regs.select_b = ad9862_regs_t::SELECT_B_AUX_ADC1; + this->send_reg(34); //start conversion and select mux + this->recv_reg(32); //read the value (2 bytes, 2 reads) + this->recv_reg(33); + return aux_adc_to_volts(_ad9862_regs.aux_adc_b1_9_2, _ad9862_regs.aux_adc_b1_1_0); + case AUX_ADC_B2: + _ad9862_regs.select_b = ad9862_regs_t::SELECT_B_AUX_ADC2; + this->send_reg(34); //start conversion and select mux + this->recv_reg(30); //read the value (2 bytes, 2 reads) + this->recv_reg(31); + return aux_adc_to_volts(_ad9862_regs.aux_adc_b2_9_2, _ad9862_regs.aux_adc_b2_1_0); } - - //write the switch if it changed - if(write_switch) this->send_reg(34); - - //map aux adcs to register values to read - static const uhd::dict aux_dac_to_addr = boost::assign::map_list_of - (AUX_ADC_A2, 26) (AUX_ADC_A1, 28) - (AUX_ADC_B2, 30) (AUX_ADC_B1, 32) - ; - - //read the value - this->recv_reg(aux_dac_to_addr[which]+0); - this->recv_reg(aux_dac_to_addr[which]+1); - - //return the value scaled to volts - switch(which) { - case AUX_ADC_A1: return aux_adc_to_volts(_ad9862_regs.aux_adc_a1_9_2, _ad9862_regs.aux_adc_a1_1_0); - case AUX_ADC_A2: return aux_adc_to_volts(_ad9862_regs.aux_adc_a2_9_2, _ad9862_regs.aux_adc_a2_1_0); - case AUX_ADC_B1: return aux_adc_to_volts(_ad9862_regs.aux_adc_b1_9_2, _ad9862_regs.aux_adc_b1_1_0); - case AUX_ADC_B2: return aux_adc_to_volts(_ad9862_regs.aux_adc_b2_9_2, _ad9862_regs.aux_adc_b2_1_0); - } - UHD_ASSERT_THROW(false); + UHD_THROW_INVALID_CODE_PATH(); } /*********************************************************************** -- cgit v1.2.3 From f64dad9d95550aaf8ed56ab4f107b2e7632921eb Mon Sep 17 00:00:00 2001 From: Jason Abele Date: Thu, 31 Mar 2011 12:36:42 -0700 Subject: Correct RFX400 div2 logic, makes RFX400 TX work --- host/lib/usrp/dboard/db_rfx.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 4d8222a52..725b5cc03 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -294,6 +294,9 @@ double rfx_xcvr::set_lo_freq( target_freq = _freq_range.clip(target_freq); if (_div2[unit]) target_freq *= 2; + //rfx400 rx is a special case with div2 in mixer, so adf4360 must output fundamental + bool is_rx_rfx400 = ((get_rx_id() == 0x0024) && unit != dboard_iface::UNIT_TX); + //map prescalers to the register enums static const uhd::dict prescaler_to_enum = map_list_of (8, adf4360_regs_t::PRESCALER_VALUE_8_9) @@ -341,8 +344,8 @@ double rfx_xcvr::set_lo_freq( } done_loop: if (rfx_debug) std::cerr << boost::format( - "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d" - ) % R % BS % P % B % A << std::endl; + "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d, DIV2=%d" + ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) << std::endl; //load the register values adf4360_regs_t regs; @@ -361,7 +364,7 @@ double rfx_xcvr::set_lo_freq( regs.a_counter = A; regs.b_counter = B; regs.cp_gain_1 = adf4360_regs_t::CP_GAIN_1_SET1; - regs.divide_by_2_output = (_div2[unit] && (get_rx_id() != 0x0024)) ? // Special case RFX400 RX Mixer divides by two + regs.divide_by_2_output = (_div2[unit] && (!is_rx_rfx400)) ? // Special case RFX400 RX Mixer divides by two adf4360_regs_t::DIVIDE_BY_2_OUTPUT_DIV2 : adf4360_regs_t::DIVIDE_BY_2_OUTPUT_FUND ; regs.divide_by_2_prescaler = adf4360_regs_t::DIVIDE_BY_2_PRESCALER_FUND; -- cgit v1.2.3 From 1c5076ea68345e74de35cad43e4a4b4adf68fa15 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 31 Mar 2011 15:00:56 -0700 Subject: uhd: implemented boost barriers on all code that creates threads The barrier ensures that the thread must spawn before the caller exits. Some of the code already used a mutex to accomplish this, however cygwin chokes when a mutex is locked twice by the same thread. Mutex implementations were replaced with the barrier implementation. Also the barrier implementation is far cleaner. --- host/lib/transport/libusb1_zero_copy.cpp | 8 ++++++-- host/lib/usrp/usrp1/soft_time_ctrl.cpp | 14 ++++++++------ host/lib/usrp/usrp2/io_impl.cpp | 25 ++++++++++++------------- host/lib/usrp/usrp_e100/io_impl.cpp | 16 +++++++++++----- 4 files changed, 37 insertions(+), 26 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 9f38ce97b..fe6936c7e 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -191,9 +192,11 @@ public: //spawn the event handler threads size_t concurrency = hints.cast("concurrency_hint", 1); + boost::barrier spawn_barrier(concurrency+1); for (size_t i = 0; i < concurrency; i++) _thread_group.create_thread( - boost::bind(&libusb_zero_copy_impl::run_event_loop, this) + boost::bind(&libusb_zero_copy_impl::run_event_loop, this, boost::ref(spawn_barrier)) ); + spawn_barrier.wait(); } ~libusb_zero_copy_impl(void){ @@ -263,7 +266,8 @@ private: boost::thread_group _thread_group; bool _threads_running; - void run_event_loop(void){ + void run_event_loop(boost::barrier &spawn_barrier){ + spawn_barrier.wait(); set_thread_priority_safe(); libusb_context *context = libusb::session::get_global_session()->get_context(); _threads_running = true; diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp index e1b671811..1bab34e7b 100644 --- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp +++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -43,10 +44,11 @@ public: _stream_on_off(stream_on_off) { //synchronously spawn a new thread - _update_mutex.lock(); //lock mutex before spawned - _thread_group.create_thread(boost::bind(&soft_time_ctrl_impl::recv_cmd_dispatcher, this)); - _update_mutex.lock(); //lock blocks until spawned - _update_mutex.unlock(); //unlock mutex before done + boost::barrier spawn_barrier(2); + _thread_group.create_thread(boost::bind( + &soft_time_ctrl_impl::recv_cmd_dispatcher, this, boost::ref(spawn_barrier)) + ); + spawn_barrier.wait(); //initialize the time to something this->set_time(time_spec_t(0.0)); @@ -175,8 +177,8 @@ public: _stream_mode = cmd.stream_mode; } - void recv_cmd_dispatcher(void){ - _update_mutex.unlock(); + void recv_cmd_dispatcher(boost::barrier &spawn_barrier){ + spawn_barrier.wait(); try{ boost::any cmd; while (true){ diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 340e9d155..07cbd2432 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -25,7 +25,8 @@ #include #include #include -#include +#include +#include #include using namespace uhd; @@ -209,11 +210,10 @@ struct usrp2_impl::io_impl{ vrt_packet_handler::send_state packet_handler_send_state; //methods and variables for the pirate crew - void recv_pirate_loop(usrp2_mboard_impl::sptr, zero_copy_if::sptr, size_t); + void recv_pirate_loop(boost::barrier &, usrp2_mboard_impl::sptr, zero_copy_if::sptr, size_t); boost::thread_group recv_pirate_crew; bool recv_pirate_crew_raiding; bounded_buffer async_msg_fifo; - boost::mutex spawn_mutex; }; /*********************************************************************** @@ -223,13 +223,15 @@ struct usrp2_impl::io_impl{ * - put async message packets into queue **********************************************************************/ void usrp2_impl::io_impl::recv_pirate_loop( - usrp2_mboard_impl::sptr mboard, zero_copy_if::sptr err_xport, size_t index + boost::barrier &spawn_barrier, + usrp2_mboard_impl::sptr mboard, + zero_copy_if::sptr err_xport, + size_t index ){ + spawn_barrier.wait(); set_thread_priority_safe(); recv_pirate_crew_raiding = true; - spawn_mutex.unlock(); - //store a reference to the flow control monitor (offset by max dsps) flow_control_monitor &fc_mon = *(this->fc_mons[index*usrp2_mboard_impl::MAX_NUM_DSPS]); @@ -286,19 +288,16 @@ void usrp2_impl::io_init(void){ _io_impl = UHD_PIMPL_MAKE(io_impl, (dsp_xports)); //create a new pirate thread for each zc if (yarr!!) + boost::barrier spawn_barrier(_mboards.size()+1); for (size_t i = 0; i < _mboards.size(); i++){ - //lock the unlocked mutex (non-blocking) - _io_impl->spawn_mutex.lock(); //spawn a new pirate to plunder the recv booty _io_impl->recv_pirate_crew.create_thread(boost::bind( &usrp2_impl::io_impl::recv_pirate_loop, - _io_impl.get(), _mboards.at(i), err_xports.at(i), i + _io_impl.get(), boost::ref(spawn_barrier), + _mboards.at(i), err_xports.at(i), i )); - //block here until the spawned thread unlocks - _io_impl->spawn_mutex.lock(); - //exit loop iteration in an unlocked condition - _io_impl->spawn_mutex.unlock(); } + spawn_barrier.wait(); //update mapping here since it didnt b4 when io init not called first update_xport_channel_mapping(); diff --git a/host/lib/usrp/usrp_e100/io_impl.cpp b/host/lib/usrp/usrp_e100/io_impl.cpp index fc6aaeaee..cbab5a761 100644 --- a/host/lib/usrp/usrp_e100/io_impl.cpp +++ b/host/lib/usrp/usrp_e100/io_impl.cpp @@ -23,7 +23,8 @@ #include "../../transport/vrt_packet_handler.hpp" #include #include -#include +#include +#include #include using namespace uhd; @@ -93,7 +94,7 @@ struct usrp_e100_impl::io_impl{ bool continuous_streaming; //a pirate's life is the life for me! - void recv_pirate_loop(usrp_e100_clock_ctrl::sptr); + void recv_pirate_loop(boost::barrier &, usrp_e100_clock_ctrl::sptr); bounded_buffer recv_pirate_booty; bounded_buffer async_msg_fifo; boost::thread_group recv_pirate_crew; @@ -105,8 +106,10 @@ struct usrp_e100_impl::io_impl{ * - while raiding, loot for recv buffers * - put booty into the alignment buffer **********************************************************************/ -void usrp_e100_impl::io_impl::recv_pirate_loop(usrp_e100_clock_ctrl::sptr clock_ctrl) -{ +void usrp_e100_impl::io_impl::recv_pirate_loop( + boost::barrier &spawn_barrier, usrp_e100_clock_ctrl::sptr clock_ctrl +){ + spawn_barrier.wait(); set_thread_priority_safe(); recv_pirate_crew_raiding = true; @@ -201,9 +204,12 @@ void usrp_e100_impl::io_init(void){ _iface->poke32(UE_REG_CTRL_TX_POLICY, UE_FLAG_CTRL_TX_POLICY_NEXT_PACKET); //spawn a pirate, yarrr! + boost::barrier spawn_barrier(2); _io_impl->recv_pirate_crew.create_thread(boost::bind( - &usrp_e100_impl::io_impl::recv_pirate_loop, _io_impl.get(), _clock_ctrl + &usrp_e100_impl::io_impl::recv_pirate_loop, _io_impl.get(), + boost::ref(spawn_barrier), _clock_ctrl )); + spawn_barrier.wait(); } void usrp_e100_impl::issue_stream_cmd(const stream_cmd_t &stream_cmd){ -- cgit v1.2.3 From 1721352e905e10dbff48d44b66b1684020a103d7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 1 Apr 2011 10:27:54 -0700 Subject: uhd: install dlls into runtime path, updated docs --- host/docs/build.rst | 4 +--- host/docs/index.rst | 4 +--- host/lib/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'host/lib') diff --git a/host/docs/build.rst b/host/docs/build.rst index b81e25de1..c645817ab 100644 --- a/host/docs/build.rst +++ b/host/docs/build.rst @@ -197,9 +197,7 @@ Open the Visual Studio Command Prompt Shorcut: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Setup the PATH environment variable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* Add the boost library path to %PATH% (usually c:\\program files\\boost\\\\lib) -* Add the uhd library path to %PATH% (usually c:\\program files\\uhd\\lib) -* Add the libusb library to %PATH% (if using usb support) +* Add the uhd bin path to %PATH% (usually c:\\program files\\uhd\\bin) **Note:** The interface for editing environment variable paths in Windows is very poor. diff --git a/host/docs/index.rst b/host/docs/index.rst index 734300164..467d5f385 100644 --- a/host/docs/index.rst +++ b/host/docs/index.rst @@ -4,9 +4,7 @@ UHD - Universal Hardware Driver The UHD is the universal hardware driver for Ettus Research products. The goal of the UHD is to provide a host driver and api for current and future Ettus Research products. -Users will be able to use the UHD driver standalone/without gnuradio. -Also, a dual license option will be available for those who build against the UHD -but cannot release their software products under the GPL. +Users will be able to use the UHD driver standalone or with 3rd party applications. ------------------------------------------------------------------------ Contents diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 54f4893e3..f8886566a 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -121,5 +121,5 @@ ENDIF(DEFINED LIBUHD_OUTPUT_NAME) INSTALL(TARGETS uhd LIBRARY DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .so file ARCHIVE DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .lib file - RUNTIME DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .dll file + RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT libraries # .dll file ) -- cgit v1.2.3 From 81e891f3f38259e7450b454933c979f2d8c93d65 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 1 Apr 2011 12:06:08 -0700 Subject: uhd: setup INSTALLER_PKG_DATA_DIR for windows systems --- host/lib/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index f8886566a..e65a2d2ba 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -79,7 +79,7 @@ INCLUDE_SUBDIRECTORY(usrp) INCLUDE_SUBDIRECTORY(utils) ######################################################################## -# Append to the list of sources for lib uhd +# Setup compiled-in constants for data directories ######################################################################## FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} LOCAL_PKG_DATA_DIR) STRING(REPLACE "\\" "\\\\" LOCAL_PKG_DATA_DIR ${LOCAL_PKG_DATA_DIR}) @@ -88,9 +88,12 @@ MESSAGE(STATUS "Local package data directory: ${LOCAL_PKG_DATA_DIR}") IF(UNIX) #on unix systems, installers will use this directory for the package data FILE(TO_NATIVE_PATH /usr/${PKG_DATA_DIR} INSTALLER_PKG_DATA_DIR) - STRING(REPLACE "\\" "\\\\" INSTALLER_PKG_DATA_DIR ${INSTALLER_PKG_DATA_DIR}) - MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}") -ENDIF(UNIX) +ELSE() + #for the NSIS installer, this will be the default path for package data + FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX} ${UHD_VERSION}/${PKG_DATA_DIR}" INSTALLER_PKG_DATA_DIR) +ENDIF() +STRING(REPLACE "\\" "\\\\" INSTALLER_PKG_DATA_DIR ${INSTALLER_PKG_DATA_DIR}) +MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}") CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/constants.hpp.in @@ -98,6 +101,9 @@ CONFIGURE_FILE( @ONLY) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +######################################################################## +# Append to the list of sources for lib uhd +######################################################################## LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_BINARY_DIR}/constants.hpp ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp -- cgit v1.2.3 From 83c608e17de45fd5372f05b54f343c721e25ad82 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 1 Apr 2011 15:54:51 -0700 Subject: uhd: define LINUX in build system to simplify some checks --- host/Modules/UHDPackage.cmake | 4 ++++ host/lib/usrp/usrp_e100/CMakeLists.txt | 6 +----- host/usrp_e_utils/CMakeLists.txt | 6 +----- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'host/lib') diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 7fee51741..7ac677d28 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -29,6 +29,10 @@ IF(UNIX AND EXISTS "/etc/redhat-release") SET(REDHAT TRUE) ENDIF() +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + SET(LINUX TRUE) +ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + ######################################################################## # Setup package file name ######################################################################## diff --git a/host/lib/usrp/usrp_e100/CMakeLists.txt b/host/lib/usrp/usrp_e100/CMakeLists.txt index acbac177e..d0e20a3d8 100644 --- a/host/lib/usrp/usrp_e100/CMakeLists.txt +++ b/host/lib/usrp/usrp_e100/CMakeLists.txt @@ -22,11 +22,7 @@ ######################################################################## # Conditionally configure the USRP-E100 support ######################################################################## -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - SET(LINUX_TARGET TRUE) -ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - -LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 OFF "ENABLE_LIBUHD;LINUX_TARGET" OFF) +LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 OFF "ENABLE_LIBUHD;LINUX" OFF) IF(ENABLE_USRP_E100) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/host/usrp_e_utils/CMakeLists.txt b/host/usrp_e_utils/CMakeLists.txt index f3537e542..e7d6ae4b8 100644 --- a/host/usrp_e_utils/CMakeLists.txt +++ b/host/usrp_e_utils/CMakeLists.txt @@ -18,11 +18,7 @@ ######################################################################## # USRP embedded utilities that get installed into the share path ######################################################################## -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - SET(LINUX_TARGET TRUE) -ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - -LIBUHD_REGISTER_COMPONENT("USRP-E Utils" ENABLE_USRP_E_UTILS OFF "LINUX_TARGET" OFF) +LIBUHD_REGISTER_COMPONENT("USRP-E Utils" ENABLE_USRP_E_UTILS OFF "LINUX" OFF) IF(ENABLE_USRP_E_UTILS) ENABLE_LANGUAGE(C) -- cgit v1.2.3 From 7cd216e967161a0d3a4d7b9bc03583d270ce4de3 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 4 Apr 2011 13:10:06 -0700 Subject: uhd: specify msvc for implementations known only to work on msvc --- host/CMakeLists.txt | 9 +++++++-- host/Modules/UHDPackage.cmake | 12 ++++++------ host/include/uhd/config.hpp | 2 +- host/include/uhd/utils/byteswap.ipp | 6 +++--- host/lib/transport/CMakeLists.txt | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) (limited to 'host/lib') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 3808481bf..7df04995c 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -80,16 +80,21 @@ ENDIF(CMAKE_COMPILER_IS_GNUCXX) IF(MSVC) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/msvc) - ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp - ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max ADD_DEFINITIONS( #stop all kinds of compatibility warnings -D_SCL_SECURE_NO_WARNINGS + -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE ) ENDIF(MSVC) +IF(WIN32) + ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp + ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max +ENDIF(WIN32) + ######################################################################## # Setup Boost ######################################################################## diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 7ac677d28..4986e314c 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -21,18 +21,18 @@ INCLUDE(UHDVersion) #sets version information ######################################################################## # Setup additional defines for OS types ######################################################################## -IF(UNIX AND EXISTS "/etc/debian_version") +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + SET(LINUX TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/debian_version") SET(DEBIAN TRUE) ENDIF() -IF(UNIX AND EXISTS "/etc/redhat-release") +IF(LINUX AND EXISTS "/etc/redhat-release") SET(REDHAT TRUE) ENDIF() -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - SET(LINUX TRUE) -ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - ######################################################################## # Setup package file name ######################################################################## diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index fdb168950..6fd2932cf 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.hpp @@ -49,7 +49,7 @@ typedef ptrdiff_t ssize_t; #endif //BOOST_MSVC //define cross platform attribute macros -#if defined(BOOST_HAS_DECLSPEC) +#if defined(BOOST_MSVC) #define UHD_EXPORT __declspec(dllexport) #define UHD_IMPORT __declspec(dllimport) #define UHD_INLINE __forceinline diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp index a070a7cf5..c090dee55 100644 --- a/host/include/uhd/utils/byteswap.ipp +++ b/host/include/uhd/utils/byteswap.ipp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 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 @@ -21,8 +21,8 @@ /*********************************************************************** * Platform-specific implementation details for byteswap below: **********************************************************************/ -#if defined(UHD_PLATFORM_WIN32) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx - #include +#if defined(BOOST_MSVC) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx + #include UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){ return _byteswap_ushort(x); diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index 656ca9987..a7179d561 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -31,10 +31,10 @@ IF(ENABLE_USB) MESSAGE(STATUS "USB support enabled via libusb.") INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR}) LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES}) - IF(WIN32) + IF(MSVC) #needed when statically linking libusb LIBUHD_APPEND_LIBS(Setupapi.lib) - ENDIF(WIN32) + ENDIF(MSVC) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_control.cpp ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp -- cgit v1.2.3 From 1ba366a94ef70980fb5db5dd0142c3d3596ef9aa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 4 Apr 2011 16:09:02 -0700 Subject: usb: newer libusb1 does not need to link with setupapi.lib --- host/lib/transport/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index a7179d561..a5bf9c5f1 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -31,10 +31,6 @@ IF(ENABLE_USB) MESSAGE(STATUS "USB support enabled via libusb.") INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR}) LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES}) - IF(MSVC) - #needed when statically linking libusb - LIBUHD_APPEND_LIBS(Setupapi.lib) - ENDIF(MSVC) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_control.cpp ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp -- cgit v1.2.3 From dcd555636c282ac0454b463c91d360ce062e316d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 4 Apr 2011 16:22:38 -0700 Subject: uhd: set CPACK_PACKAGE_INSTALL_DIRECTORY on NSIS so we dont get an inconsistent version suffix --- host/Modules/UHDPackage.cmake | 4 ++++ host/lib/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 4986e314c..bf31df3b3 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -69,6 +69,10 @@ IF(UHD_RELEASE_MODE) ENDIF(LSB_RELEASE_EXECUTABLE) + IF(${CPACK_GENERATOR} STREQUAL NSIS) + SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") + ENDIF() + ENDIF(UHD_RELEASE_MODE) ######################################################################## diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index e65a2d2ba..8ca7c7dca 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -90,7 +90,7 @@ IF(UNIX) FILE(TO_NATIVE_PATH /usr/${PKG_DATA_DIR} INSTALLER_PKG_DATA_DIR) ELSE() #for the NSIS installer, this will be the default path for package data - FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX} ${UHD_VERSION}/${PKG_DATA_DIR}" INSTALLER_PKG_DATA_DIR) + FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}" INSTALLER_PKG_DATA_DIR) ENDIF() STRING(REPLACE "\\" "\\\\" INSTALLER_PKG_DATA_DIR ${INSTALLER_PKG_DATA_DIR}) MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}") -- cgit v1.2.3 From 6a2fbe07e7674794a883a7062ce2225781cf5193 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 4 Apr 2011 16:51:17 -0700 Subject: uhd: a few minor changes to get uhd building under mingw or cygwin --- host/lib/CMakeLists.txt | 8 ++++++++ host/tests/CMakeLists.txt | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 8ca7c7dca..268f05df6 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -68,6 +68,14 @@ MACRO(INCLUDE_SUBDIRECTORY subdir) LIST(REMOVE_AT _cmake_binary_dirs 0) ENDMACRO(INCLUDE_SUBDIRECTORY) +######################################################################## +# Cygwin special +######################################################################## +IF(CYGWIN) + ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this + LIBUHD_APPEND_LIBS(ws2_32) +ENDIF(CYGWIN) + ######################################################################## # Include subdirectories (different than add) ######################################################################## diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt index 821b2eb9e..f08fe669b 100644 --- a/host/tests/CMakeLists.txt +++ b/host/tests/CMakeLists.txt @@ -50,5 +50,7 @@ ENDFOREACH(test_source) ######################################################################## # demo of a loadable module ######################################################################## -ADD_LIBRARY(module_test MODULE module_test.cpp) -TARGET_LINK_LIBRARIES(module_test uhd) +IF(MSVC OR APPLE OR LINUX) + ADD_LIBRARY(module_test MODULE module_test.cpp) + TARGET_LINK_LIBRARIES(module_test uhd) +ENDIF() -- cgit v1.2.3 From dbfbc497a8e0a144e0db2b8daa0f4baba5284775 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 5 Apr 2011 16:32:48 -0700 Subject: uhd: tweaks for cygwin/mingw, always link winsock2, findusb1, __USE_W32_SOCKETS --- host/CMakeLists.txt | 4 ++++ host/Modules/FindUSB1.cmake | 6 +++--- host/lib/CMakeLists.txt | 8 -------- host/lib/transport/CMakeLists.txt | 4 ++++ 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'host/lib') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 7df04995c..552fe492c 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -90,6 +90,10 @@ IF(MSVC) ) ENDIF(MSVC) +IF(CYGWIN) + ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this +ENDIF(CYGWIN) + IF(WIN32) ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max diff --git a/host/Modules/FindUSB1.cmake b/host/Modules/FindUSB1.cmake index ebcac99eb..efb2e288b 100644 --- a/host/Modules/FindUSB1.cmake +++ b/host/Modules/FindUSB1.cmake @@ -17,12 +17,12 @@ if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) set(LIBUSB_FOUND TRUE) else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) - IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_LIBUSB libusb-1.0) - ENDIF(NOT WIN32) + IF(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUSB libusb-1.0) + ENDIF(PKG_CONFIG_FOUND) FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 268f05df6..8ca7c7dca 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -68,14 +68,6 @@ MACRO(INCLUDE_SUBDIRECTORY subdir) LIST(REMOVE_AT _cmake_binary_dirs 0) ENDMACRO(INCLUDE_SUBDIRECTORY) -######################################################################## -# Cygwin special -######################################################################## -IF(CYGWIN) - ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this - LIBUHD_APPEND_LIBS(ws2_32) -ENDIF(CYGWIN) - ######################################################################## # Include subdirectories (different than add) ######################################################################## diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index a5bf9c5f1..30f8db48a 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -79,6 +79,10 @@ SET_SOURCE_FILES_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}" ) +IF(WIN32 AND UNIX) #MinGW/Cygwin needs winsock2 + LIBUHD_APPEND_LIBS(ws2_32) +ENDIF() + ######################################################################## # Append to the list of sources for lib uhd ######################################################################## -- cgit v1.2.3 From d07870f698e314a516939ca91de3d7307c9bade7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 5 Apr 2011 20:37:29 -0700 Subject: usb: mark libusb callbacks with LIBUSB_CALL to ensure correct calling convention --- host/lib/transport/libusb1_zero_copy.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index fe6936c7e..e42cab1d1 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -34,13 +34,23 @@ using namespace uhd::transport; static const size_t DEFAULT_NUM_XFERS = 16; //num xfers static const size_t DEFAULT_XFER_SIZE = 32*512; //bytes +//! Define LIBUSB_CALL when its missing (non-windows) +#ifndef LIBUSB_CALL + #define LIBUSB_CALL +#endif /*LIBUSB_CALL*/ + +/*! + * All libusb callback functions should be marked with the LIBUSB_CALL macro + * to ensure that they are compiled with the same calling convention as libusb. + */ + //! helper function: handles all async callbacks -static void libusb_async_cb(libusb_transfer *lut){ +static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){ (*static_cast *>(lut->user_data))(); } //! callback to free transfer upon cancellation -static void cancel_transfer_cb(libusb_transfer *lut){ +static void LIBUSB_CALL cancel_transfer_cb(libusb_transfer *lut){ if (lut->status == LIBUSB_TRANSFER_CANCELLED) libusb_free_transfer(lut); else std::cout << "libusb cancel_transfer unexpected status " << lut->status << std::endl; } -- cgit v1.2.3 From 74fc8946688d53ccd5d067d3f86e26b990af1bd4 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 6 Apr 2011 09:55:54 -0700 Subject: uhd: always link winsock2 on windows, disable pthread SCHED_RR for cygwin --- host/lib/transport/CMakeLists.txt | 4 +++- host/lib/utils/CMakeLists.txt | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index 30f8db48a..90360977a 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -79,7 +79,9 @@ SET_SOURCE_FILES_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}" ) -IF(WIN32 AND UNIX) #MinGW/Cygwin needs winsock2 +#On windows, the boost asio implementation uses the winsock2 library. +#Note: we exclude the .lib extension for cygwin and mingw platforms. +IF(WIN32) LIBUHD_APPEND_LIBS(ws2_32) ENDIF() diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index c0d99b37e..26c02b5b4 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -36,6 +36,11 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_PTHREAD_SETSCHEDPARAM ) +IF(CYGWIN) + #SCHED_RR non-operational on cygwin + SET(HAVE_PTHREAD_SETSCHEDPARAM False) +ENDIF(CYGWIN) + CHECK_CXX_SOURCE_COMPILES(" #include int main(){ -- cgit v1.2.3 From ee705a42fb41bf92529a02c3087167e71d5e2630 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 7 Apr 2011 15:46:31 -0500 Subject: usrp-e100: reset dboard clocks on rate change, and dont cache in dboard iface --- host/lib/usrp/usrp_e100/clock_ctrl.cpp | 16 +++++++++++++++- host/lib/usrp/usrp_e100/clock_ctrl.hpp | 12 ++++++++++++ host/lib/usrp/usrp_e100/dboard_iface.cpp | 8 +++++--- 3 files changed, 32 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp index b0bf20b67..1ac2b804c 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp @@ -287,6 +287,9 @@ public: if (_out_rate == rate) return; if (rate == 61.44e6) set_clock_settings_with_external_vcxo(rate); else set_clock_settings_with_internal_vco(rate); + //clock rate changed! update dboard clocks and FPGA ticks per second + set_rx_dboard_clock_rate(rate); + set_tx_dboard_clock_rate(rate); _iface->poke32(UE_REG_TIME64_TPS, boost::uint32_t(get_fpga_clock_rate())); } @@ -328,6 +331,7 @@ public: void set_rx_dboard_clock_rate(double rate){ assert_has(get_rx_dboard_clock_rates(), rate, "rx dboard clock rate"); + _rx_clock_rate = rate; size_t divider = size_t(this->_chan_rate/rate); //set the divider registers set_clock_divider(divider, @@ -340,6 +344,10 @@ public: this->latch_regs(); } + double get_rx_clock_rate(void){ + return _rx_clock_rate; + } + /*********************************************************************** * TX Dboard Clock Control (output 6, divider 2) **********************************************************************/ @@ -358,6 +366,7 @@ public: void set_tx_dboard_clock_rate(double rate){ assert_has(get_tx_dboard_clock_rates(), rate, "tx dboard clock rate"); + _tx_clock_rate = rate; size_t divider = size_t(this->_chan_rate/rate); //set the divider registers set_clock_divider(divider, @@ -369,7 +378,11 @@ public: this->send_reg(0x197); this->latch_regs(); } - + + double get_tx_clock_rate(void){ + return _tx_clock_rate; + } + /*********************************************************************** * Clock reference control **********************************************************************/ @@ -401,6 +414,7 @@ private: ad9522_regs_t _ad9522_regs; double _out_rate; //rate at the fpga and codec double _chan_rate; //rate before final dividers + double _rx_clock_rate, _tx_clock_rate; void latch_regs(void){ _ad9522_regs.io_update = 1; diff --git a/host/lib/usrp/usrp_e100/clock_ctrl.hpp b/host/lib/usrp/usrp_e100/clock_ctrl.hpp index 623fbc73b..507f914f3 100644 --- a/host/lib/usrp/usrp_e100/clock_ctrl.hpp +++ b/host/lib/usrp/usrp_e100/clock_ctrl.hpp @@ -78,6 +78,18 @@ public: */ virtual void set_tx_dboard_clock_rate(double rate) = 0; + /*! + * Get the current rx dboard clock rate. + * \return the clock rate in Hz + */ + virtual double get_rx_clock_rate(void) = 0; + + /*! + * Get the current tx dboard clock rate. + * \return the clock rate in Hz + */ + virtual double get_tx_clock_rate(void) = 0; + /*! * Enable/disable the rx dboard clock. * \param enb true to enable diff --git a/host/lib/usrp/usrp_e100/dboard_iface.cpp b/host/lib/usrp/usrp_e100/dboard_iface.cpp index 4ee354486..61b5a1c92 100644 --- a/host/lib/usrp/usrp_e100/dboard_iface.cpp +++ b/host/lib/usrp/usrp_e100/dboard_iface.cpp @@ -97,7 +97,6 @@ private: usrp_e100_iface::sptr _iface; usrp_e100_clock_ctrl::sptr _clock; usrp_e100_codec_ctrl::sptr _codec; - uhd::dict _clock_rates; }; /*********************************************************************** @@ -115,7 +114,6 @@ dboard_iface::sptr make_usrp_e100_dboard_iface( * Clock Rates **********************************************************************/ void usrp_e100_dboard_iface::set_clock_rate(unit_t unit, double rate){ - _clock_rates[unit] = rate; switch(unit){ case UNIT_RX: return _clock->set_rx_dboard_clock_rate(rate); case UNIT_TX: return _clock->set_tx_dboard_clock_rate(rate); @@ -131,7 +129,11 @@ std::vector usrp_e100_dboard_iface::get_clock_rates(unit_t unit){ } double usrp_e100_dboard_iface::get_clock_rate(unit_t unit){ - return _clock_rates[unit]; + switch(unit){ + case UNIT_RX: return _clock->get_rx_clock_rate(); + case UNIT_TX: return _clock->get_tx_clock_rate(); + } + UHD_THROW_INVALID_CODE_PATH(); } void usrp_e100_dboard_iface::set_clock_enabled(unit_t unit, bool enb){ -- cgit v1.2.3 From 2f102fbff2b7245d3d038e7dfffaa2de856b61aa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 8 Apr 2011 16:59:29 -0500 Subject: usrp2: support fw protos with older compats for various parts i2c, spi, and uart are long time no changing registers changed recently (think re-map) also, perform the fpga compat check in the make now we can find devices with out of date images --- host/lib/usrp/usrp2/mboard_impl.cpp | 10 ++++++++ host/lib/usrp/usrp2/usrp2_iface.cpp | 48 +++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 20 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 40fc5098b..7a6c596bc 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -66,6 +66,16 @@ usrp2_mboard_impl::usrp2_mboard_impl( device_addr["addr"], BOOST_STRINGIZE(USRP2_UDP_CTRL_PORT) ))) { + + //check the fpga compatibility number + const boost::uint32_t fpga_compat_num = _iface->peek32(_iface->regs.compat_num_rb); + if (fpga_compat_num != USRP2_FPGA_COMPAT_NUM){ + throw uhd::runtime_error(str(boost::format( + "Expected fpga compatibility number %d, but got %d:\n" + "The fpga build is not compatible with the host code build." + ) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num)); + } + //construct transports for dsp and async errors std::cout << "Making transport for DSP0..." << std::endl; device.dsp_xports.push_back(udp_zero_copy::make( diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index e3827233b..227233917 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -34,6 +34,13 @@ using namespace uhd::transport; static const double CTRL_RECV_TIMEOUT = 1.0; +static const boost::uint32_t MIN_PROTO_COMPAT_SPI = 7; +static const boost::uint32_t MIN_PROTO_COMPAT_I2C = 7; +// The register compat number must reflect the protocol compatibility +// and the compatibility of the register mapping (more likely to change). +static const boost::uint32_t MIN_PROTO_COMPAT_REG = USRP2_FW_COMPAT_NUM; +static const boost::uint32_t MIN_PROTO_COMPAT_UART = 7; + class usrp2_iface_impl : public usrp2_iface{ public: /*********************************************************************** @@ -59,15 +66,6 @@ public: regs = usrp2_get_regs(false); break; } - - //check the fpga compatibility number - const boost::uint32_t fpga_compat_num = this->peek32(this->regs.compat_num_rb); - if (fpga_compat_num != USRP2_FPGA_COMPAT_NUM){ - throw uhd::runtime_error(str(boost::format( - "Expected fpga compatibility number %d, but got %d:\n" - "The fpga build is not compatible with the host code build." - ) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num)); - } } /*********************************************************************** @@ -115,7 +113,7 @@ public: out_data.data.spi_args.data = htonl(data); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_SPI); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_OMG_TRANSACTED_SPI_DUDE); return ntohl(in_data.data.spi_args.data); @@ -138,7 +136,7 @@ public: std::copy(buf.begin(), buf.end(), out_data.data.i2c_args.data); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_I2C); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_COOL_IM_DONE_I2C_WRITE_DUDE); } @@ -153,7 +151,7 @@ public: UHD_ASSERT_THROW(num_bytes <= sizeof(out_data.data.i2c_args.data)); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_I2C); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_HERES_THE_I2C_DATA_DUDE); UHD_ASSERT_THROW(in_data.data.i2c_args.addr = num_bytes); @@ -186,7 +184,7 @@ public: std::copy(item.begin(), item.end(), out_data.data.uart_args.data); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_UART); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_MAN_I_TOTALLY_WROTE_THAT_UART_DUDE); } } @@ -205,7 +203,7 @@ public: //UHD_ASSERT_THROW(num_bytes <= sizeof(out_data.data.uart_args.data)); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_UART); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_I_HELLA_READ_THAT_UART_DUDE); readlen = in_data.data.uart_args.bytes; @@ -226,9 +224,18 @@ public: /*********************************************************************** * Send/Recv over control **********************************************************************/ - usrp2_ctrl_data_t ctrl_send_and_recv(const usrp2_ctrl_data_t &out_data){ + usrp2_ctrl_data_t ctrl_send_and_recv( + const usrp2_ctrl_data_t &out_data, + boost::uint32_t lo = USRP2_FW_COMPAT_NUM, + boost::uint32_t hi = USRP2_FW_COMPAT_NUM + ){ boost::mutex::scoped_lock lock(_ctrl_mutex); + std::string range = (lo == hi)? + str(boost::format("%d") % hi) : + str(boost::format("[%d to %d]") % lo % hi) + ; + //fill in the seq number and send usrp2_ctrl_data_t out_copy = out_data; out_copy.proto_ver = htonl(USRP2_FW_COMPAT_NUM); @@ -240,11 +247,12 @@ public: const usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast(usrp2_ctrl_data_in_mem); while(true){ size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem), CTRL_RECV_TIMEOUT); - if(len >= sizeof(boost::uint32_t) and ntohl(ctrl_data_in->proto_ver) != USRP2_FW_COMPAT_NUM){ + boost::uint32_t compat = ntohl(ctrl_data_in->proto_ver); + if(len >= sizeof(boost::uint32_t) and hi >= compat and lo <= compat){ throw uhd::runtime_error(str(boost::format( - "Expected protocol compatibility number %d, but got %d:\n" + "Expected protocol compatibility number %s, but got %d:\n" "The firmware build is not compatible with the host code build." - ) % int(USRP2_FW_COMPAT_NUM) % ntohl(ctrl_data_in->proto_ver))); + ) % range % compat)); } if (len >= sizeof(usrp2_ctrl_data_t) and ntohl(ctrl_data_in->seq) == _ctrl_seq_num){ return *ctrl_data_in; @@ -297,7 +305,7 @@ private: out_data.data.poke_args.num_bytes = sizeof(T); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_REG); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_OMG_POKED_REGISTER_SO_BAD_DUDE); } @@ -309,7 +317,7 @@ private: out_data.data.poke_args.num_bytes = sizeof(T); //send and recv - usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); + usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data, MIN_PROTO_COMPAT_REG); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_WOAH_I_DEFINITELY_PEEKED_IT_DUDE); return T(ntohl(in_data.data.poke_args.data)); } -- cgit v1.2.3 From e9ca5336eaa84832ccda9dec81022f7fbba48c45 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 9 Apr 2011 18:30:16 -0500 Subject: uhd: attempt to cleanup language in thread prio warning --- host/lib/utils/thread_priority.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'host/lib') diff --git a/host/lib/utils/thread_priority.cpp b/host/lib/utils/thread_priority.cpp index bd34055e8..a63bdf5ce 100644 --- a/host/lib/utils/thread_priority.cpp +++ b/host/lib/utils/thread_priority.cpp @@ -27,18 +27,17 @@ bool uhd::set_thread_priority_safe(float priority, bool realtime){ return true; }catch(const std::exception &e){ uhd::warning::post(str(boost::format( + "Unable to set the thread priority. Performance may be negatively affected.\n" + "Please see the general application notes in the manual for instructions.\n" "%s\n" - "Failed to set thread priority %d (%s):\n" - "Performance may be negatively affected.\n" - "See the general application notes.\n" - ) % e.what() % priority % (realtime?"realtime":""))); + ) % e.what())); return false; } } static void check_priority_range(float priority){ if (priority > +1.0 or priority < -1.0) - throw std::range_error("priority out of range [-1.0, +1.0]"); + throw uhd::value_error("priority out of range [-1.0, +1.0]"); } /*********************************************************************** -- cgit v1.2.3 From f9e1f06e81109573d2e600a18c288aafd1438f64 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 13 Apr 2011 10:04:42 -0700 Subject: usrp2: add check for holler protocol, we can support backwards --- host/lib/usrp/usrp2/usrp2_iface.cpp | 2 +- host/lib/usrp/usrp2/usrp2_impl.cpp | 42 ++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 15 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 227233917..6e1d69044 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -248,7 +248,7 @@ public: while(true){ size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem), CTRL_RECV_TIMEOUT); boost::uint32_t compat = ntohl(ctrl_data_in->proto_ver); - if(len >= sizeof(boost::uint32_t) and hi >= compat and lo <= compat){ + if(len >= sizeof(boost::uint32_t) and (hi < compat or lo > compat)){ throw uhd::runtime_error(str(boost::format( "Expected protocol compatibility number %s, but got %d:\n" "The firmware build is not compatible with the host code build." diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index f42be321b..cb92b1921 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -171,6 +171,15 @@ static mtu_result_t determine_mtu(const std::string &addr){ usrp2_ctrl_data_t *ctrl_data = reinterpret_cast(buffer); static const double echo_timeout = 0.020; //20 ms + //test holler - check if its supported in this fw version + ctrl_data->id = htonl(USRP2_CTRL_ID_HOLLER_AT_ME_BRO); + ctrl_data->proto_ver = htonl(USRP2_FW_COMPAT_NUM); + ctrl_data->data.echo_args.len = htonl(sizeof(usrp2_ctrl_data_t)); + udp_sock->send(boost::asio::buffer(buffer, sizeof(usrp2_ctrl_data_t))); + udp_sock->recv(boost::asio::buffer(buffer), echo_timeout); + if (ntohl(ctrl_data->id) != USRP2_CTRL_ID_HOLLER_BACK_DUDE) + throw uhd::not_implemented_error("holler protocol not implemented"); + size_t min_recv_mtu = sizeof(usrp2_ctrl_data_t), max_recv_mtu = sizeof(buffer); size_t min_send_mtu = sizeof(usrp2_ctrl_data_t), max_send_mtu = sizeof(buffer); @@ -233,23 +242,28 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){ device_addrs_t device_args = separate_device_addr(device_addr); - //calculate the minimum send and recv mtu of all devices - mtu_result_t mtu = determine_mtu(device_args[0]["addr"]); - for (size_t i = 1; i < device_args.size(); i++){ - mtu_result_t mtu_i = determine_mtu(device_args[i]["addr"]); - mtu.recv_mtu = std::min(mtu.recv_mtu, mtu_i.recv_mtu); - mtu.send_mtu = std::min(mtu.send_mtu, mtu_i.send_mtu); - } + try{ + //calculate the minimum send and recv mtu of all devices + mtu_result_t mtu = determine_mtu(device_args[0]["addr"]); + for (size_t i = 1; i < device_args.size(); i++){ + mtu_result_t mtu_i = determine_mtu(device_args[i]["addr"]); + mtu.recv_mtu = std::min(mtu.recv_mtu, mtu_i.recv_mtu); + mtu.send_mtu = std::min(mtu.send_mtu, mtu_i.send_mtu); + } - //use the discovered mtu or clip the users requested mtu - mtu.recv_mtu = std::min(size_t(device_addr.cast("recv_frame_size", 9000)), mtu.recv_mtu); - mtu.send_mtu = std::min(size_t(device_addr.cast("send_frame_size", 9000)), mtu.send_mtu); + //use the discovered mtu or clip the users requested mtu + mtu.recv_mtu = std::min(size_t(device_addr.cast("recv_frame_size", 9000)), mtu.recv_mtu); + mtu.send_mtu = std::min(size_t(device_addr.cast("send_frame_size", 9000)), mtu.send_mtu); - device_addr["recv_frame_size"] = boost::lexical_cast(mtu.recv_mtu); - device_addr["send_frame_size"] = boost::lexical_cast(mtu.send_mtu); + device_addr["recv_frame_size"] = boost::lexical_cast(mtu.recv_mtu); + device_addr["send_frame_size"] = boost::lexical_cast(mtu.send_mtu); - std::cout << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu << std::endl; - std::cout << boost::format("Current send frame size: %d bytes") % mtu.send_mtu << std::endl; + std::cout << boost::format("Current recv frame size: %d bytes") % mtu.recv_mtu << std::endl; + std::cout << boost::format("Current send frame size: %d bytes") % mtu.send_mtu << std::endl; + } + catch(const uhd::not_implemented_error &){ + //just ignore this error, makes older fw work... + } device_args = separate_device_addr(device_addr); //update args for new frame sizes -- cgit v1.2.3 From 668402f27e34422a9afdc4d12f0f5575228f815b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 13 Apr 2011 10:59:18 -0700 Subject: usrp2: use the firmware's discovered compat number --- host/lib/usrp/usrp2/usrp2_iface.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 6e1d69044..6b3409ecc 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -46,9 +46,20 @@ public: /*********************************************************************** * Structors **********************************************************************/ - usrp2_iface_impl(udp_simple::sptr ctrl_transport){ - _ctrl_transport = ctrl_transport; - _ctrl_seq_num = 0; + usrp2_iface_impl(udp_simple::sptr ctrl_transport): + _ctrl_transport(ctrl_transport), + _ctrl_seq_num(0), + _protocol_compat(0) //initialized below... + { + //Obtain the firmware's compat number. + //Save the response compat number for communication. + //TODO can choose to reject certain older compat numbers + usrp2_ctrl_data_t ctrl_data; + ctrl_data.id = htonl(USRP2_CTRL_ID_WAZZUP_BRO); + ctrl_data = ctrl_send_and_recv(ctrl_data, 0, ~0); + if (ntohl(ctrl_data.id) != USRP2_CTRL_ID_WAZZUP_DUDE) + throw uhd::runtime_error("firmware not responding"); + _protocol_compat = ntohl(ctrl_data.proto_ver); mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_N100); switch(this->get_rev()){ @@ -238,7 +249,7 @@ public: //fill in the seq number and send usrp2_ctrl_data_t out_copy = out_data; - out_copy.proto_ver = htonl(USRP2_FW_COMPAT_NUM); + out_copy.proto_ver = htonl(_protocol_compat); out_copy.seq = htonl(++_ctrl_seq_num); _ctrl_transport->send(boost::asio::buffer(&out_copy, sizeof(usrp2_ctrl_data_t))); @@ -292,6 +303,7 @@ private: //used in send/recv boost::mutex _ctrl_mutex; boost::uint32_t _ctrl_seq_num; + boost::uint32_t _protocol_compat; /*********************************************************************** * Private Templated Peek and Poke -- cgit v1.2.3 From 291a46b86e8e639b711a609134ace667235eeb91 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 14 Apr 2011 09:34:37 -0700 Subject: uhd: specify the UHD_PKG_DATA_PATH once (since images shipped w/ drivers) --- host/lib/CMakeLists.txt | 16 +++------------- host/lib/constants.hpp.in | 3 +-- host/lib/utils/paths.cpp | 8 ++------ 3 files changed, 6 insertions(+), 21 deletions(-) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 8ca7c7dca..618e33608 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -81,19 +81,9 @@ INCLUDE_SUBDIRECTORY(utils) ######################################################################## # Setup compiled-in constants for data directories ######################################################################## -FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} LOCAL_PKG_DATA_DIR) -STRING(REPLACE "\\" "\\\\" LOCAL_PKG_DATA_DIR ${LOCAL_PKG_DATA_DIR}) -MESSAGE(STATUS "Local package data directory: ${LOCAL_PKG_DATA_DIR}") - -IF(UNIX) - #on unix systems, installers will use this directory for the package data - FILE(TO_NATIVE_PATH /usr/${PKG_DATA_DIR} INSTALLER_PKG_DATA_DIR) -ELSE() - #for the NSIS installer, this will be the default path for package data - FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}" INSTALLER_PKG_DATA_DIR) -ENDIF() -STRING(REPLACE "\\" "\\\\" INSTALLER_PKG_DATA_DIR ${INSTALLER_PKG_DATA_DIR}) -MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}") +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} UHD_PKG_DATA_PATH) +STRING(REPLACE "\\" "\\\\" UHD_PKG_DATA_PATH ${UHD_PKG_DATA_PATH}) +MESSAGE(STATUS "Full package data directory: ${UHD_PKG_DATA_PATH}") CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/constants.hpp.in diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in index d62dda1cb..2e0495b12 100644 --- a/host/lib/constants.hpp.in +++ b/host/lib/constants.hpp.in @@ -20,7 +20,6 @@ //these should be pre-processor macros to avoid static initialization issues #define UHD_VERSION_STRING "@UHD_VERSION@-@UHD_BUILD_INFO@" -#define LOCAL_PKG_DATA_DIR "@LOCAL_PKG_DATA_DIR@" -#define INSTALLER_PKG_DATA_DIR "@INSTALLER_PKG_DATA_DIR@" +#define UHD_PKG_DATA_PATH "@UHD_PKG_DATA_PATH@" #endif /* INCLUDED_LIBUHD_CONSTANTS_HPP */ diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 329695873..0ddc80d6e 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -76,16 +76,12 @@ static std::vector get_env_paths(const std::string &var_name){ **********************************************************************/ std::vector get_image_paths(void){ std::vector paths = get_env_paths("UHD_IMAGE_PATH"); - paths.push_back(fs::path(LOCAL_PKG_DATA_DIR) / "images"); - if (not std::string(INSTALLER_PKG_DATA_DIR).empty()) - paths.push_back(fs::path(INSTALLER_PKG_DATA_DIR) / "images"); + paths.push_back(fs::path(UHD_PKG_DATA_PATH) / "images"); return paths; } std::vector get_module_paths(void){ std::vector paths = get_env_paths("UHD_MODULE_PATH"); - paths.push_back(fs::path(LOCAL_PKG_DATA_DIR) / "modules"); - if (not std::string(INSTALLER_PKG_DATA_DIR).empty()) - paths.push_back(fs::path(INSTALLER_PKG_DATA_DIR) / "modules"); + paths.push_back(fs::path(UHD_PKG_DATA_PATH) / "modules"); return paths; } -- cgit v1.2.3 From 98a05d85cd6537dee9bf2f48d0e068d322363fc4 Mon Sep 17 00:00:00 2001 From: Jason Abele Date: Wed, 13 Apr 2011 19:03:18 -0700 Subject: Updated documentation and improved XCVR RSSI calculation Documented dboard sensors Documented DBSRX2 Added description of direct conversion vs low IF for each dboard Added E1xx docs for adding refclock and pps connectors XCVR rssi calculation was in unscaled dB units Used chart in datasheet (pg 16) to rescale to dBm --- host/docs/dboards.rst | 119 ++++++++++++++++++++++++++++------- host/docs/usrp_e1xx.rst | 38 +++++++++++ host/lib/usrp/dboard/db_xcvr2450.cpp | 13 +++- 3 files changed, 144 insertions(+), 26 deletions(-) (limited to 'host/lib') diff --git a/host/docs/dboards.rst b/host/docs/dboards.rst index 419456df2..373189441 100644 --- a/host/docs/dboards.rst +++ b/host/docs/dboards.rst @@ -27,12 +27,14 @@ Though the magic of aliasing, you can down-convert signals greater than the Nyquist rate of the ADC. BasicRX Bandwidth (Hz): - For Real-Mode (A or B subdevice): 250M - For Complex (AB or BA subdevice): 500M + +* For Real-Mode (A or B subdevice): 250M +* For Complex (AB or BA subdevice): 500M LFRX Bandwidth (Hz): - For Real-Mode (A or B subdevice): 33M - For Complex (AB or BA subdevice): 66M + +* For Real-Mode (A or B subdevice): 33M +* For Complex (AB or BA subdevice): 66M ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Basic TX and and LFTX @@ -49,31 +51,67 @@ Though the magic of aliasing, you can up-convert signals greater than the Nyquist rate of the DAC. BasicTX Bandwidth (Hz): 250M - For Real-Mode (A or B subdevice): 250M - For Complex (AB or BA subdevice): 500M + +* For Real-Mode (A or B subdevice): 250M +* For Complex (AB or BA subdevice): 500M LFTX Bandwidth (Hz): 33M - For Real-Mode (A or B subdevice): 33M - For Complex (AB or BA subdevice): 66M + +* For Real-Mode (A or B subdevice): 33M +* For Complex (AB or BA subdevice): 66M ^^^^^^^^^^^^^^^^^^^^^^^^^^^ DBSRX ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The DBSRX board has 1 quadrature subdevice. +The DBSRX board has 1 quadrature subdevice. +It defaults to direct conversion, but can use a low IF through lo_offset in uhd::tune_request_t Receive Antennas: **J3** The board has no user selectable antenna setting -Receive Gains: - **GC1**, Range: 0-56dB - **GC2**, Range: 0-24dB +Receive Gains: + +* **GC1**, Range: 0-56dB +* **GC2**, Range: 0-24dB Bandwidth (Hz): 8M-66M +Sensors: + +* **lo_locked**: boolean for LO lock state + +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +DBSRX2 +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The DBSRX2 board has 1 quadrature subdevice. +It defaults to direct conversion, but can use a low IF through lo_offset in uhd::tune_request_t + +Receive Antennas: **J3** + +The board has no user selectable antenna setting + +Receive Gains: + +* **GC1**, Range: 0-73dB +* **BBG**, Range: 0-15dB + +Bandwidth (Hz): 8M-80M + +Sensors: + +* **lo_locked**: boolean for LO lock state + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ RFX Series ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The RFX Series boards have 2 quadrature subdevices, one transmit, one receive. +Transmit defaults to low IF and Receive defaults to direct conversion. +The IF can be adjusted through lo_offset in uhd::tune_request_t + +The RFX Series boards have independent receive and transmit LO's and synthesizers +allowing full-duplex operation on different transmit and receive frequencies. + Transmit Antennas: **TX/RX** Receive Antennas: **TX/RX** or **RX2** @@ -85,12 +123,21 @@ the receive antenna will always be set to RX2, regardless of the settings. Receive Gains: **PGA0**, Range: 0-70dB (except RFX400 range is 0-45dB) Bandwidths (Hz): - * **RX**: 40M - * **TX**: 40M + +* **RX**: 40M +* **TX**: 40M + +Sensors: + +* **lo_locked**: boolean for LO lock state ^^^^^^^^^^^^^^^^^^^^^^^^^^^ XCVR 2450 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The XCVR2450 has 2 quadrature subdevices, one transmit, one receive. +Transmit and Receive default to direct conversion but +can be used in low IF mode through lo_offset in uhd::tune_request_t + The XCVR2450 has a non-contiguous tuning range consisting of a high band (4.9-6.0GHz) and a low band (2.4-2.5GHz). @@ -106,20 +153,35 @@ The XCVR2450 does not support full-duplex mode, attempting to operate in full-duplex will result in transmit-only operation. Transmit Gains: - * **VGA**, Range: 0-30dB - * **BB**, Range: 0-5dB + +* **VGA**, Range: 0-30dB +* **BB**, Range: 0-5dB Receive Gains: - * **LNA**, Range: 0-30.5dB - * **VGA**, Range: 0-62dB + +* **LNA**, Range: 0-30.5dB +* **VGA**, Range: 0-62dB Bandwidths (Hz): - * **RX**: 15M, 19M, 28M, 36M; (each +-0, 5, or 10%) - * **TX**: 24M, 36M, 48M + +* **RX**: 15M, 19M, 28M, 36M; (each +-0, 5, or 10%) +* **TX**: 24M, 36M, 48M + +Sensors: + +* **lo_locked**: boolean for LO lock state +* **rssi**: float for rssi in dBm ^^^^^^^^^^^^^^^^^^^^^^^^^^^ WBX Series ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The WBX Series boards have 2 quadrature subdevices, one transmit, one receive. +Transmit and Receive default to direct conversion but +can be used in low IF mode through lo_offset in uhd::tune_request_t + +The WBX Series boards have independent receive and transmit LO's and synthesizers +allowing full-duplex operation on different transmit and receive frequencies. + Transmit Antennas: **TX/RX** Receive Antennas: **TX/RX** or **RX2** @@ -133,17 +195,26 @@ Transmit Gains: **PGA0**, Range: 0-25dB Receive Gains: **PGA0**, Range: 0-31.5dB Bandwidths (Hz): - * **RX**: 40M - * **TX**: 40M + +* **RX**: 40M +* **TX**: 40M + +Sensors: + +* **lo_locked**: boolean for LO lock state ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TVRX ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The TVRX board has 1 real-mode subdevice. +It is operated at a low IF. + Receive Antennas: RX Receive Gains: - * **RF**, Range: -13.3-50.3dB (frequency-dependent) - * **IF**, Range: -1.5-32.5dB + +* **RF**, Range: -13.3-50.3dB (frequency-dependent) +* **IF**, Range: -1.5-32.5dB Bandwidth: 6MHz diff --git a/host/docs/usrp_e1xx.rst b/host/docs/usrp_e1xx.rst index fb5848bad..2818a0a65 100644 --- a/host/docs/usrp_e1xx.rst +++ b/host/docs/usrp_e1xx.rst @@ -63,3 +63,41 @@ Run the following commands to restore the clock generator to a usable state: cd /share/uhd/usrp_e_utilities ./usrp-e-utility --fpga=../images/usrp_e100_pt_fpga.bin --reclk + + +------------------------------------------------------------------------ +Clock Synchronization +------------------------------------------------------------------------ + + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Ref Clock - 10MHz +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The E1xx has a 10MHz TCXO which can be used to discipline the flexible clocking by +selecting REF_INT for the clock_config_t. + +Alternately, an external 10MHz reference clock can be supplied by soldering a connector. + +* Connector J10 (REF_IN) needs MCX connector WM5541-ND or similar +* Square wave will offer the best phase noise performance, but sinusoid is acceptable +* Power level: 0 to 15dBm +* Select REF_SMA in clock_config_t + + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +PPS - Pulse Per Second +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +An exteral PPS signal for timestamp synchronization can be supplied by soldering a connector. + +* Connector J13 (PPS) needs MCX connector WM5541-ND or similar +* Requires a square wave signal +* Amplitude: 3.3 to 5Vpp + +Test the PPS input with the following app: + +* are device address arguments (optional if only one USRP is on your machine) + +:: + + cd /share/uhd/examples + ./test_pps_input --args= diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index 9d25b30a5..70b0bbabd 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -152,12 +152,21 @@ private: * \return the rssi in dB */ double get_rssi(void){ + //*FIXME* RSSI depends on LNA Gain Setting (datasheet pg 16 top middle chart) + double max_power; + switch(_max2829_regs.rx_lna_gain){ + case 0: + case 1: max_power = 0; break; + case 2: max_power = -15; break; + case 3: max_power = -30.5; break; + } + //constants for the rssi calculation static const double min_v = 0.5, max_v = 2.5; static const double rssi_dyn_range = 60; //calculate the rssi from the voltage double voltage = this->get_iface()->read_aux_adc(dboard_iface::UNIT_RX, dboard_iface::AUX_ADC_B); - return rssi_dyn_range*(voltage - min_v)/(max_v - min_v); + return max_power - rssi_dyn_range*(voltage - min_v)/(max_v - min_v); } }; @@ -621,7 +630,7 @@ void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){ if (key.name == "lo_locked") val = sensor_value_t("LO", this->get_locked(), "locked", "unlocked"); else if (key.name == "rssi") - val = sensor_value_t("RSSI", this->get_rssi(), "dB"); + val = sensor_value_t("RSSI", this->get_rssi(), "dBm"); else UHD_THROW_INVALID_CODE_PATH(); return; -- cgit v1.2.3 From 1304340f269b6474a49970ee302e08ca9ed8d0ed Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 18 Apr 2011 10:58:50 -0700 Subject: rfx: changes to pick from the dboard clock rates and use R=1 --- host/lib/usrp/dboard/db_rfx.cpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 725b5cc03..f938c749a 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -312,7 +312,8 @@ double rfx_xcvr::set_lo_freq( (8, adf4360_regs_t::BAND_SELECT_CLOCK_DIV_8) ; - double actual_freq=0, ref_freq = this->get_iface()->get_clock_rate(unit); + std::vector clock_rates = this->get_iface()->get_clock_rates(unit); + double actual_freq = 0, ref_freq = 0; int R=0, BS=0, P=0, B=0, A=0; /* @@ -325,27 +326,31 @@ double rfx_xcvr::set_lo_freq( * fvco = [P*B + A] * fref/R * fvco*R/fref = P*B + A = N */ - for(R = 2; R <= 32; R+=2){ - BOOST_FOREACH(BS, bandsel_to_enum.keys()){ - if (ref_freq/R/BS > 1e6) continue; //constraint on band select clock - BOOST_FOREACH(P, prescaler_to_enum.keys()){ - //calculate B and A from N - double N = target_freq*R/ref_freq; - B = int(std::floor(N/P)); - A = boost::math::iround(N - P*B); - if (B < A or B > 8191 or B < 3 or A > 31) continue; //constraints on A, B - //calculate the actual frequency - actual_freq = double(P*B + A)*ref_freq/R; - if (actual_freq/P > 300e6) continue; //constraint on prescaler output - //constraints met: exit loop - goto done_loop; + for(R = 1; R <= 32; R+=((R==1)?1:2)){ + BOOST_FOREACH(ref_freq, uhd::reversed(uhd::sorted(clock_rates))){ + BOOST_FOREACH(BS, bandsel_to_enum.keys()){ + if (ref_freq/R/BS > 1e6) continue; //constraint on band select clock + BOOST_FOREACH(P, prescaler_to_enum.keys()){ + //calculate B and A from N + double N = target_freq*R/ref_freq; + B = int(std::floor(N/P)); + A = boost::math::iround(N - P*B); + if (B < A or B > 8191 or B < 3 or A > 31) continue; //constraints on A, B + //calculate the actual frequency + actual_freq = double(P*B + A)*ref_freq/R; + if (actual_freq/P > 300e6) continue; //constraint on prescaler output + //constraints met: exit loop + goto done_loop; + } } } } done_loop: if (rfx_debug) std::cerr << boost::format( - "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d, DIV2=%d" - ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) << std::endl; + "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d, DIV2=%d, ref=%fMHz" + ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) % (ref_freq/1e6) << std::endl; + + this->get_iface()->set_clock_rate(unit, ref_freq); //load the register values adf4360_regs_t regs; -- cgit v1.2.3 From a28099fe4abe10b11c9234d67b243adbd20ce1a1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 19 Apr 2011 09:36:53 -0700 Subject: usrp2: improve the compatibility error messages --- host/lib/usrp/usrp2/mboard_impl.cpp | 6 ++++-- host/lib/usrp/usrp2/usrp2_iface.cpp | 9 +++------ 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 7a6c596bc..29e0535f8 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -71,8 +71,10 @@ usrp2_mboard_impl::usrp2_mboard_impl( const boost::uint32_t fpga_compat_num = _iface->peek32(_iface->regs.compat_num_rb); if (fpga_compat_num != USRP2_FPGA_COMPAT_NUM){ throw uhd::runtime_error(str(boost::format( - "Expected fpga compatibility number %d, but got %d:\n" - "The fpga build is not compatible with the host code build." + "\nPlease update the firmware and FPGA images for your device.\n" + "See the application notes for USRP2/N-Series for instructions.\n" + "Expected FPGA compatibility number %d, but got %d:\n" + "The FPGA build is not compatible with the host code build." ) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num)); } diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 6b3409ecc..d88d31765 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -242,11 +242,6 @@ public: ){ boost::mutex::scoped_lock lock(_ctrl_mutex); - std::string range = (lo == hi)? - str(boost::format("%d") % hi) : - str(boost::format("[%d to %d]") % lo % hi) - ; - //fill in the seq number and send usrp2_ctrl_data_t out_copy = out_data; out_copy.proto_ver = htonl(_protocol_compat); @@ -261,9 +256,11 @@ public: boost::uint32_t compat = ntohl(ctrl_data_in->proto_ver); if(len >= sizeof(boost::uint32_t) and (hi < compat or lo > compat)){ throw uhd::runtime_error(str(boost::format( + "\nPlease update the firmware and FPGA images for your device.\n" + "See the application notes for USRP2/N-Series for instructions.\n" "Expected protocol compatibility number %s, but got %d:\n" "The firmware build is not compatible with the host code build." - ) % range % compat)); + ) % ((lo == hi)? (boost::format("%d") % hi) : (boost::format("[%d to %d]") % lo % hi)) % compat)); } if (len >= sizeof(usrp2_ctrl_data_t) and ntohl(ctrl_data_in->seq) == _ctrl_seq_num){ return *ctrl_data_in; -- cgit v1.2.3 From 06e10b5f469b8b06af33a8a95a6302a1e365b396 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 18 Apr 2011 17:17:32 -0700 Subject: uhd: use UHD_PKG_DATA_PATH environment variable to override the one in constants The installer sets UHD_PKG_DATA_PATH, we can can handle transplanted builds. --- host/Modules/UHDPackage.cmake | 10 ++++++++++ host/lib/utils/paths.cpp | 27 +++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'host/lib') diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake index 1988c7f11..416d89998 100644 --- a/host/Modules/UHDPackage.cmake +++ b/host/Modules/UHDPackage.cmake @@ -144,5 +144,15 @@ SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, libusb1") ######################################################################## SET(CPACK_NSIS_MODIFY_PATH ON) +SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"") + +SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " + WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" \\\"$INSTDIR\\\\share\\\\uhd\\\" +") + +SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " + DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" +") + ######################################################################## INCLUDE(CPack) #include after setting vars diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 0ddc80d6e..a0e4da547 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -18,14 +18,13 @@ #include "constants.hpp" #include #include -#include #include #include #include +#include #include #include -namespace po = boost::program_options; namespace fs = boost::filesystem; /*********************************************************************** @@ -44,22 +43,14 @@ namespace fs = boost::filesystem; /*********************************************************************** * Get a list of paths for an environment variable **********************************************************************/ -static std::string name_mapper(const std::string &key, const std::string &var_name){ - return (var_name == key)? var_name : ""; +static std::string get_env_var(const std::string &var_name, const std::string &def_val = ""){ + const char *var_value_ptr = std::getenv(var_name.c_str()); + return (var_value_ptr == NULL)? def_val : var_value_ptr; } static std::vector get_env_paths(const std::string &var_name){ - //register the options - std::string var_value; - po::options_description desc; - desc.add_options() - (var_name.c_str(), po::value(&var_value)->default_value("")) - ; - //parse environment variables - po::variables_map vm; - po::store(po::parse_environment(desc, boost::bind(&name_mapper, var_name, _1)), vm); - po::notify(vm); + std::string var_value = get_env_var(var_name); //convert to filesystem path, filter blank paths std::vector paths; @@ -74,14 +65,18 @@ static std::vector get_env_paths(const std::string &var_name){ /*********************************************************************** * Get a list of special purpose paths **********************************************************************/ +static fs::path get_uhd_pkg_data_path(void){ + return fs::path(get_env_var("UHD_PKG_DATA_PATH", UHD_PKG_DATA_PATH)); +} + std::vector get_image_paths(void){ std::vector paths = get_env_paths("UHD_IMAGE_PATH"); - paths.push_back(fs::path(UHD_PKG_DATA_PATH) / "images"); + paths.push_back(get_uhd_pkg_data_path() / "images"); return paths; } std::vector get_module_paths(void){ std::vector paths = get_env_paths("UHD_MODULE_PATH"); - paths.push_back(fs::path(UHD_PKG_DATA_PATH) / "modules"); + paths.push_back(get_uhd_pkg_data_path() / "modules"); return paths; } -- cgit v1.2.3 From 00bc8d50d5a2528704441ef5532fea13106a8d30 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 19 Apr 2011 16:58:12 -0700 Subject: uhd: removed constants.hpp.in, replaced w/ per source compile defines --- host/lib/CMakeLists.txt | 17 ++++++----------- host/lib/constants.hpp.in | 25 ------------------------- host/lib/utils/CMakeLists.txt | 13 +++++++++++++ host/lib/utils/paths.cpp | 1 - host/lib/version.cpp | 8 +------- 5 files changed, 20 insertions(+), 44 deletions(-) delete mode 100644 host/lib/constants.hpp.in (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 618e33608..fca4730d8 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -79,23 +79,18 @@ INCLUDE_SUBDIRECTORY(usrp) INCLUDE_SUBDIRECTORY(utils) ######################################################################## -# Setup compiled-in constants for data directories +# Setup UHD_VERSION_STRING for version.cpp ######################################################################## -FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} UHD_PKG_DATA_PATH) -STRING(REPLACE "\\" "\\\\" UHD_PKG_DATA_PATH ${UHD_PKG_DATA_PATH}) -MESSAGE(STATUS "Full package data directory: ${UHD_PKG_DATA_PATH}") - -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/constants.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/constants.hpp -@ONLY) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp + PROPERTIES COMPILE_DEFINITIONS + "UHD_VERSION_STRING=\"${UHD_VERSION}-${UHD_BUILD_INFO}\"" +) ######################################################################## # Append to the list of sources for lib uhd ######################################################################## LIBUHD_APPEND_SOURCES( - ${CMAKE_CURRENT_BINARY_DIR}/constants.hpp ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/exception.cpp ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in deleted file mode 100644 index 2e0495b12..000000000 --- a/host/lib/constants.hpp.in +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright 2010-2011 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 . -// - -#ifndef INCLUDED_LIBUHD_CONSTANTS_HPP -#define INCLUDED_LIBUHD_CONSTANTS_HPP - -//these should be pre-processor macros to avoid static initialization issues -#define UHD_VERSION_STRING "@UHD_VERSION@-@UHD_BUILD_INFO@" -#define UHD_PKG_DATA_PATH "@UHD_PKG_DATA_PATH@" - -#endif /* INCLUDED_LIBUHD_CONSTANTS_HPP */ diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index 26c02b5b4..1314f7475 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -111,6 +111,19 @@ SET_SOURCE_FILES_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "${LOAD_MODULES_DEFS}" ) +######################################################################## +# Define UHD_PKG_DATA_PATH for paths.cpp +######################################################################## +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} UHD_PKG_DATA_PATH) +STRING(REPLACE "\\" "\\\\" UHD_PKG_DATA_PATH ${UHD_PKG_DATA_PATH}) +MESSAGE(STATUS "Full package data directory: ${UHD_PKG_DATA_PATH}") + +SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp + PROPERTIES COMPILE_DEFINITIONS + "UHD_PKG_DATA_PATH=\"${UHD_PKG_DATA_PATH}\"" +) + ######################################################################## # Append sources ######################################################################## diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index a0e4da547..a3dd377e5 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . // -#include "constants.hpp" #include #include #include diff --git a/host/lib/version.cpp b/host/lib/version.cpp index 93fdecb1a..d75cc8fda 100644 --- a/host/lib/version.cpp +++ b/host/lib/version.cpp @@ -15,13 +15,7 @@ // along with this program. If not, see . // -#include "constants.hpp" #include - -std::string uhd::get_version_string(void){ - return UHD_VERSION_STRING; -} - #include #include #include @@ -31,7 +25,7 @@ UHD_STATIC_BLOCK(print_system_info){ << BOOST_PLATFORM << "; " << BOOST_COMPILER << "; " << "Boost_" << BOOST_VERSION << "; " - << "UHD_" << uhd::get_version_string() + << "UHD_" << UHD_VERSION_STRING << std::endl << std::endl ; } -- cgit v1.2.3