summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/CMakeLists.txt37
-rw-r--r--host/config/Component.cmake86
-rw-r--r--host/docs/CMakeLists.txt16
-rw-r--r--host/docs/build.rst2
-rw-r--r--host/lib/CMakeLists.txt70
-rw-r--r--host/lib/ic_reg_maps/CMakeLists.txt64
-rw-r--r--host/lib/transport/CMakeLists.txt55
-rw-r--r--host/lib/usrp/CMakeLists.txt39
-rw-r--r--host/lib/usrp/dboard/CMakeLists.txt20
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp2
-rw-r--r--host/lib/usrp/dsp_utils.cpp13
-rw-r--r--host/lib/usrp/tune_helper.cpp7
-rw-r--r--host/lib/usrp/usrp1/CMakeLists.txt43
-rw-r--r--host/lib/usrp/usrp1/dsp_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/CMakeLists.txt42
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp23
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.hpp9
-rw-r--r--host/lib/usrp/usrp2/dsp_impl.cpp19
-rw-r--r--host/lib/usrp/usrp_e100/CMakeLists.txt42
-rw-r--r--host/lib/utils/CMakeLists.txt20
-rw-r--r--host/test/tune_helper_test.cpp2
21 files changed, 385 insertions, 228 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 75331ddfc..efc439af0 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -22,6 +22,7 @@ ENABLE_TESTING()
########################################################################
# Config Files (include order is important)
########################################################################
+INCLUDE(${CMAKE_SOURCE_DIR}/config/Component.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/config/Python.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/config/Version.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/config/CPack.cmake)
@@ -34,7 +35,6 @@ SET(LIBRARY_DIR lib${LIB_SUFFIX})
SET(INCLUDE_DIR include)
SET(PKG_DATA_DIR share/uhd)
SET(PKG_DOC_DIR share/doc/uhd)
-MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
########################################################################
# Local Include Dir
@@ -134,11 +134,38 @@ INSTALL(FILES
)
########################################################################
+# Register top level components
+########################################################################
+SET(ENABLE_LIBUHD ON) #always enabled
+LIBUHD_REGISTER_COMPONENT("Examples" ENABLE_EXAMPLES ON "ENABLE_LIBUHD" OFF)
+LIBUHD_REGISTER_COMPONENT("Utils" ENABLE_UTILS ON "ENABLE_LIBUHD" OFF)
+LIBUHD_REGISTER_COMPONENT("Tests" ENABLE_TESTS ON "ENABLE_LIBUHD" OFF)
+
+########################################################################
# Add the subdirectories
########################################################################
ADD_SUBDIRECTORY(docs)
-ADD_SUBDIRECTORY(examples)
+
+IF(ENABLE_EXAMPLES)
+ ADD_SUBDIRECTORY(examples)
+ENDIF(ENABLE_EXAMPLES)
+
ADD_SUBDIRECTORY(include)
-ADD_SUBDIRECTORY(lib)
-ADD_SUBDIRECTORY(test)
-ADD_SUBDIRECTORY(utils)
+
+IF(ENABLE_LIBUHD)
+ ADD_SUBDIRECTORY(lib)
+ENDIF(ENABLE_LIBUHD)
+
+IF(ENABLE_TESTS)
+ ADD_SUBDIRECTORY(test)
+ENDIF(ENABLE_TESTS)
+
+IF(ENABLE_UTILS)
+ ADD_SUBDIRECTORY(utils)
+ENDIF(ENABLE_UTILS)
+
+########################################################################
+# Print Summary
+########################################################################
+UHD_PRINT_COMPONENT_SUMMARY()
+MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
diff --git a/host/config/Component.cmake b/host/config/Component.cmake
new file mode 100644
index 000000000..0263b071f
--- /dev/null
+++ b/host/config/Component.cmake
@@ -0,0 +1,86 @@
+#
+# Copyright 2010 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE)
+SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Register a component into the system
+# - name the component string name
+# - var the global enable variable
+# - enb the default enable setting
+# - deps a list of dependencies
+# - dis the default disable setting
+########################################################################
+FUNCTION(LIBUHD_REGISTER_COMPONENT name var enb deps dis)
+ INCLUDE(CMakeDependentOption)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Configuring ${name} support...")
+ IF(DEFINED ${var})
+ MESSAGE(STATUS "${name} support configured ${var}=${${var}}")
+ ELSE(DEFINED ${var}) #not defined: automatic enabling of component
+ MESSAGE(STATUS "${name} support configured automatically")
+ ENDIF(DEFINED ${var})
+
+ #setup the dependent option for this component
+ CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis})
+
+ #remove previous occurrence of component in either list
+ IF(DEFINED _uhd_enabled_components)
+ LIST(REMOVE_ITEM _uhd_enabled_components ${name})
+ ENDIF(DEFINED _uhd_enabled_components)
+ IF(DEFINED _uhd_disabled_components)
+ LIST(REMOVE_ITEM _uhd_disabled_components ${name})
+ ENDIF(DEFINED _uhd_disabled_components)
+
+ #append the component into one of the lists
+ IF(${var})
+ MESSAGE(STATUS " Enabling ${name} support.")
+ LIST(APPEND _uhd_enabled_components ${name})
+ ELSE(${var})
+ MESSAGE(STATUS " Disabling ${name} support.")
+ LIST(APPEND _uhd_disabled_components ${name})
+ ENDIF(${var})
+
+ #make components lists into global variables
+ SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE)
+ SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE)
+ENDFUNCTION(LIBUHD_REGISTER_COMPONENT)
+
+########################################################################
+# Print the registered component summary
+########################################################################
+FUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# LibUHD enabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_uhd_enabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# LibUHD disabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_uhd_disabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt
index 296ce9922..d6a7801bf 100644
--- a/host/docs/CMakeLists.txt
+++ b/host/docs/CMakeLists.txt
@@ -41,10 +41,16 @@ FIND_PROGRAM(RST2HTML rst2html)
IF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
MESSAGE(STATUS "Checking for rst2html (docutils) - not found")
MESSAGE(STATUS " Disabled generation of HTML manual.")
+ SET(HAVE_RST2HTML FALSE)
ELSE(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
MESSAGE(STATUS "Checking for rst2html (docutils) - found")
MESSAGE(STATUS " Enabled generation of HTML manual.")
+ SET(HAVE_RST2HTML TRUE)
+ENDIF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
+
+LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "HAVE_RST2HTML" OFF)
+IF(ENABLE_MANUAL)
#setup rst2html options
SET(stylesheet ${CMAKE_CURRENT_SOURCE_DIR}/style.css)
SET(rst2html_options
@@ -73,7 +79,7 @@ ELSE(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
#make the html manual a build-time dependency
ADD_CUSTOM_TARGET(manual_html ALL DEPENDS ${manual_html_files})
-ENDIF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
+ENDIF(ENABLE_MANUAL)
INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst)
@@ -84,7 +90,9 @@ MESSAGE(STATUS "")
MESSAGE(STATUS "Checking for doxygen")
INCLUDE(FindDoxygen)
-IF(DOXYGEN_FOUND)
+LIBUHD_REGISTER_COMPONENT("Doxygen" ENABLE_DOXYGEN ON "DOXYGEN_FOUND" OFF)
+
+IF(ENABLE_DOXYGEN)
MESSAGE(STATUS " Enabled generation of Doxygen documentation.")
#generate the doxygen configuration file
@@ -105,6 +113,6 @@ IF(DOXYGEN_FOUND)
#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})
-ELSE(DOXYGEN_FOUND)
+ELSE(ENABLE_DOXYGEN)
MESSAGE(STATUS " Disabled generation of Doxygen documentation.")
-ENDIF(DOXYGEN_FOUND)
+ENDIF(ENABLE_DOXYGEN)
diff --git a/host/docs/build.rst b/host/docs/build.rst
index a41ce8331..812b5c1a9 100644
--- a/host/docs/build.rst
+++ b/host/docs/build.rst
@@ -39,7 +39,7 @@ Other compilers have not been tested yet or confirmed working.
CMake
^^^^^^^^^^^^^^^^
* **Purpose:** generates project build files
-* **Version:** at least 2.8
+* **Version:** at least 2.6
* **Usage:** build time (required)
* **Download URL:** http://www.cmake.org/cmake/resources/software.html
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index 3a6860b93..28e4bcca2 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -61,32 +61,35 @@ MACRO(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile)
LIBUHD_APPEND_SOURCES(${outfile})
ENDMACRO(LIBUHD_PYTHON_GEN_SOURCE)
-MACRO(LIBUHD_REGISTER_COMPONENT name var auto)
- MESSAGE(STATUS "")
- MESSAGE(STATUS "Configuring ${name} support...")
- IF(DEFINED ${var})
- MESSAGE(STATUS "${name} support configured ${var}=${${var}}")
- ELSE(DEFINED ${var}) #not defined: automatic enabling of component
- SET(${var} ${auto})
- MESSAGE(STATUS "${name} support configured automatically")
- ENDIF(DEFINED ${var})
- SET(${var} ${${var}} CACHE BOOL "enable ${name} support")
- IF(${var})
- MESSAGE(STATUS " Enabling ${name} support.")
- LIST(APPEND _libuhd_enabled_components ${name})
- ELSE(${var})
- MESSAGE(STATUS " Disabling ${name} support.")
- LIST(APPEND _libuhd_disabled_components ${name})
- ENDIF(${var})
-ENDMACRO(LIBUHD_REGISTER_COMPONENT)
+MACRO(INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ LIST(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ LIST(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ SET(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ LIST(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ LIST(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ LIST(REMOVE_AT _cmake_source_dirs 0)
+ LIST(REMOVE_AT _cmake_binary_dirs 0)
+ENDMACRO(INCLUDE_SUBDIRECTORY)
########################################################################
-# Include CMakeLists.txt from subdirectories
+# Include subdirectories (different than add)
########################################################################
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ic_reg_maps/CMakeLists.txt)
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/transport/CMakeLists.txt)
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/CMakeLists.txt)
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/utils/CMakeLists.txt)
+INCLUDE_SUBDIRECTORY(ic_reg_maps)
+INCLUDE_SUBDIRECTORY(transport)
+INCLUDE_SUBDIRECTORY(usrp)
+INCLUDE_SUBDIRECTORY(utils)
########################################################################
# Append to the list of sources for lib uhd
@@ -128,24 +131,3 @@ INSTALL(TARGETS uhd
ARCHIVE DESTINATION ${LIBRARY_DIR} # .lib file
RUNTIME DESTINATION ${LIBRARY_DIR} # .dll file
)
-
-########################################################################
-# Print configuration summary
-########################################################################
-MESSAGE(STATUS "")
-MESSAGE(STATUS "######################################################")
-MESSAGE(STATUS "# LibUHD enabled components ")
-MESSAGE(STATUS "######################################################")
-FOREACH(comp ${_libuhd_enabled_components})
- MESSAGE(STATUS " * ${comp}")
-ENDFOREACH(comp)
-
-MESSAGE(STATUS "")
-MESSAGE(STATUS "######################################################")
-MESSAGE(STATUS "# LibUHD disabled components ")
-MESSAGE(STATUS "######################################################")
-FOREACH(comp ${_libuhd_disabled_components})
- MESSAGE(STATUS " * ${comp}")
-ENDFOREACH(comp)
-
-MESSAGE(STATUS "")
diff --git a/host/lib/ic_reg_maps/CMakeLists.txt b/host/lib/ic_reg_maps/CMakeLists.txt
index ac051b843..67a63c32b 100644
--- a/host/lib/ic_reg_maps/CMakeLists.txt
+++ b/host/lib/ic_reg_maps/CMakeLists.txt
@@ -15,76 +15,78 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
-INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/lib/ic_reg_maps)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_adf4350_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/adf4350_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_adf4350_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/adf4350_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_adf4360_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/adf4360_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_adf4360_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/adf4360_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ad9510_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ad9510_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ad9510_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ad9510_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ad9777_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ad9777_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ad9777_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ad9777_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ad5623_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ad5623_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ad5623_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ad5623_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ad7922_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ad7922_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ad7922_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ad7922_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_max2829_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/max2829_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_max2829_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/max2829_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_max2118_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/max2118_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_max2118_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/max2118_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_max2112_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/max2112_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_max2112_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/max2112_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_max2112_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/max2112_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_max2112_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/max2112_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ad9862_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ad9862_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ad9862_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ad9862_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ad9522_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ad9522_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ad9522_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ad9522_regs.hpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_ads62p44_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/ads62p44_regs.hpp
- )
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_ads62p44_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/ads62p44_regs.hpp
+)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/ic_reg_maps/gen_tuner_4937di5_regs.py
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps/tuner_4937di5_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_tuner_4937di5_regs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/tuner_4937di5_regs.hpp
)
diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt
index b5f1fc940..de2f1fdd0 100644
--- a/host/lib/transport/CMakeLists.txt
+++ b/host/lib/transport/CMakeLists.txt
@@ -15,37 +15,36 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
########################################################################
# Setup libusb
########################################################################
-MESSAGE(STATUS "")
-MESSAGE(STATUS "Configuring USB support...")
-LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/lib/transport)
+LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
FIND_PACKAGE(USB1 REQUIRED)
-IF(LIBUSB_FOUND)
+LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF)
+
+IF(ENABLE_USB)
MESSAGE(STATUS "USB support enabled via libusb.")
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR})
LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES})
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/transport/libusb1_control.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/libusb1_zero_copy.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/libusb1_base.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/libusb1_base.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_control.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.hpp
)
IF(MSVC) #include our custom stdint for libusb
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/transport/msvc)
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/msvc)
ENDIF(MSVC)
- SET(HAVE_USB_SUPPORT TRUE)
-ELSE(LIBUSB_FOUND)
- MESSAGE(STATUS "USB support disabled.")
+ELSE(ENABLE_USB)
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/transport/usb_dummy_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usb_dummy_impl.cpp
)
- SET(HAVE_USB_SUPPORT FALSE)
-ENDIF(LIBUSB_FOUND)
+ENDIF(ENABLE_USB)
########################################################################
# Check for SIMD headers
@@ -90,29 +89,29 @@ ENDIF(HAVE_IFADDRS_H)
# Append to the list of sources for lib uhd
########################################################################
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/transport/gen_vrt_if_packet.py
- ${CMAKE_BINARY_DIR}/lib/transport/vrt_if_packet.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_vrt_if_packet.py
+ ${CMAKE_CURRENT_BINARY_DIR}/vrt_if_packet.cpp
)
LIBUHD_PYTHON_GEN_SOURCE(
- ${CMAKE_SOURCE_DIR}/lib/transport/gen_convert_types.py
- ${CMAKE_BINARY_DIR}/lib/transport/convert_types.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen_convert_types.py
+ ${CMAKE_CURRENT_BINARY_DIR}/convert_types.cpp
)
# append this directory to the include path so the generated convert types
# can include the implementation convert types file in the source directory
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/transport)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
# make the generated convert types depend on the implementation header
SET_SOURCE_FILES_PROPERTIES(
- ${CMAKE_BINARY_DIR}/lib/transport/convert_types.cpp PROPERTIES
- OBJECT_DEPENDS ${CMAKE_SOURCE_DIR}/lib/transport/convert_types_impl.hpp
+ ${CMAKE_CURRENT_BINARY_DIR}/convert_types.cpp PROPERTIES
+ OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/convert_types_impl.hpp
)
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/transport/if_addrs.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/udp_simple.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/udp_zero_copy_asio.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/vrt_packet_handler.hpp
- ${CMAKE_SOURCE_DIR}/lib/transport/zero_copy.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/udp_simple.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/udp_zero_copy_asio.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/vrt_packet_handler.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/zero_copy.cpp
)
diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt
index bd26d29a1..9dc74a5fe 100644
--- a/host/lib/usrp/CMakeLists.txt
+++ b/host/lib/usrp/CMakeLists.txt
@@ -15,25 +15,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
-
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_base.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_eeprom.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_id.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_manager.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dsp_utils.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/mboard_eeprom.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/misc_utils.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/multi_usrp.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/single_usrp.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/subdev_spec.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/tune_helper.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/wrapper_utils.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_base.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_eeprom.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_id.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_manager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dsp_utils.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/mboard_eeprom.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/misc_utils.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/multi_usrp.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/single_usrp.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/subdev_spec.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/tune_helper.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/wrapper_utils.hpp
)
-INCLUDE(${CMAKE_SOURCE_DIR}/lib/usrp/dboard/CMakeLists.txt)
-INCLUDE(${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/CMakeLists.txt)
-INCLUDE(${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/CMakeLists.txt)
-INCLUDE(${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/CMakeLists.txt)
+INCLUDE_SUBDIRECTORY(dboard)
+INCLUDE_SUBDIRECTORY(usrp1)
+INCLUDE_SUBDIRECTORY(usrp2)
+INCLUDE_SUBDIRECTORY(usrp_e100)
diff --git a/host/lib/usrp/dboard/CMakeLists.txt b/host/lib/usrp/dboard/CMakeLists.txt
index 79cd42d18..7bd201294 100644
--- a/host/lib/usrp/dboard/CMakeLists.txt
+++ b/host/lib/usrp/dboard/CMakeLists.txt
@@ -15,16 +15,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_basic_and_lf.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_rfx.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_xcvr2450.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_wbx.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_dbsrx.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_unknown.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_tvrx.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/db_dbsrx2.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_basic_and_lf.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_rfx.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_xcvr2450.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_wbx.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_dbsrx.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_unknown.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_tvrx.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/db_dbsrx2.cpp
)
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 7edc1822c..7250136f5 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -376,7 +376,7 @@ void dbsrx::set_lo_freq(double target_freq){
read_reg(0x0, 0x0);
//allow for setup time before checking condition again
- boost::this_thread::sleep(boost::posix_time::milliseconds(1));
+ boost::this_thread::sleep(boost::posix_time::milliseconds(10));
}
if(dbsrx_debug) std::cerr << boost::format(
diff --git a/host/lib/usrp/dsp_utils.cpp b/host/lib/usrp/dsp_utils.cpp
index 2553e4a25..576c4639f 100644
--- a/host/lib/usrp/dsp_utils.cpp
+++ b/host/lib/usrp/dsp_utils.cpp
@@ -21,6 +21,8 @@
#include <boost/assign/list_of.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/math/special_functions/round.hpp>
+#include <boost/math/special_functions/sign.hpp>
+#include <algorithm>
#include <cmath>
using namespace uhd;
@@ -65,13 +67,16 @@ boost::uint32_t dsp_type1::calc_tx_mux_word(subdev_conn_t subdev_conn){
}
boost::uint32_t dsp_type1::calc_cordic_word_and_update(
- double &freq,
- double codec_rate
+ double &freq, double codec_rate
){
- UHD_ASSERT_THROW(std::abs(freq) <= codec_rate/2.0);
- static const double scale_factor = std::pow(2.0, 32);
+ //correct for outside of rate (wrap around)
+ freq = std::fmod(freq, codec_rate);
+ if (std::abs(freq) > codec_rate/2.0)
+ freq -= boost::math::sign(freq)*codec_rate;
//calculate the freq register word (signed)
+ UHD_ASSERT_THROW(std::abs(freq) <= codec_rate/2.0);
+ static const double scale_factor = std::pow(2.0, 32);
boost::int32_t freq_word = boost::int32_t(boost::math::round((freq / codec_rate) * scale_factor));
//update the actual frequency
diff --git a/host/lib/usrp/tune_helper.cpp b/host/lib/usrp/tune_helper.cpp
index fa40a8a26..eccee7f4b 100644
--- a/host/lib/usrp/tune_helper.cpp
+++ b/host/lib/usrp/tune_helper.cpp
@@ -20,7 +20,6 @@
#include <uhd/usrp/dsp_props.hpp>
#include <uhd/usrp/dboard_iface.hpp> //unit_t
#include <uhd/utils/algorithm.hpp>
-#include <boost/math/special_functions/sign.hpp>
#include <cmath>
using namespace uhd;
@@ -37,7 +36,6 @@ static tune_result_t tune_xx_subdev_and_dsp(
wax::obj subdev_freq_proxy = subdev[SUBDEV_PROP_FREQ];
std::string freq_name = dsp[DSP_PROP_FREQ_SHIFT_NAMES].as<prop_names_t>().at(chan);
wax::obj dsp_freq_proxy = dsp[named_prop_t(DSP_PROP_FREQ_SHIFT, freq_name)];
- double dsp_sample_rate = dsp[DSP_PROP_CODEC_RATE].as<double>();
//------------------------------------------------------------------
//-- calculate the LO offset, only used with automatic policy
@@ -73,10 +71,7 @@ static tune_result_t tune_xx_subdev_and_dsp(
//------------------------------------------------------------------
//-- calculate the dsp freq, only used with automatic policy
//------------------------------------------------------------------
- double delta_freq = std::fmod(tune_request.target_freq - actual_inter_freq, dsp_sample_rate);
- bool outside_of_nyquist = std::abs(delta_freq) > dsp_sample_rate/2.0;
- double target_dsp_freq = (outside_of_nyquist)?
- boost::math::sign(delta_freq)*dsp_sample_rate - delta_freq : -delta_freq;
+ double target_dsp_freq = actual_inter_freq - tune_request.target_freq;
//invert the sign on the dsp freq given the following conditions
if (unit == dboard_iface::UNIT_TX) target_dsp_freq *= -1.0;
diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt
index 8b6ba78d2..519e17bfa 100644
--- a/host/lib/usrp/usrp1/CMakeLists.txt
+++ b/host/lib/usrp/usrp1/CMakeLists.txt
@@ -15,37 +15,34 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
########################################################################
# Conditionally configure the USRP1 support
########################################################################
-LIBUHD_REGISTER_COMPONENT("USRP1" ENABLE_USRP1 ${HAVE_USB_SUPPORT})
-
-#sanity check when USRP1 support enabled
-IF(ENABLE_USRP1 AND NOT HAVE_USB_SUPPORT)
- MESSAGE(FATAL_ERROR "USRP1 support enabled without USB support")
-ENDIF(ENABLE_USRP1 AND NOT HAVE_USB_SUPPORT)
+LIBUHD_REGISTER_COMPONENT("USRP1" ENABLE_USRP1 ON "ENABLE_LIBUHD;ENABLE_USB" OFF)
IF(ENABLE_USRP1)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/common)
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/clock_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/clock_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/codec_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/codec_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/codec_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/dboard_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/dboard_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/dsp_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/io_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/mboard_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/usrp1_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/usrp1_iface.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/usrp1_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/usrp1_impl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/usrp1_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/usrp1_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dsp_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/io_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/mboard_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_iface.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_impl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_ctrl.hpp
)
ENDIF(ENABLE_USRP1)
diff --git a/host/lib/usrp/usrp1/dsp_impl.cpp b/host/lib/usrp/usrp1/dsp_impl.cpp
index e9a5e60a6..370f4831f 100644
--- a/host/lib/usrp/usrp1/dsp_impl.cpp
+++ b/host/lib/usrp/usrp1/dsp_impl.cpp
@@ -102,7 +102,7 @@ void usrp1_impl::rx_dsp_set(const wax::obj &key_, const wax::obj &val){
("0", FR_RX_FREQ_0) ("1", FR_RX_FREQ_1)
("2", FR_RX_FREQ_2) ("3", FR_RX_FREQ_3)
;
- _iface->poke32(freq_name_to_reg_val[key.name], reg_word);
+ _iface->poke32(freq_name_to_reg_val[key.name], ~reg_word + 1);
_rx_dsp_freqs[key.name] = new_freq;
return;
}
diff --git a/host/lib/usrp/usrp2/CMakeLists.txt b/host/lib/usrp/usrp2/CMakeLists.txt
index 81b73fcc2..d83c82063 100644
--- a/host/lib/usrp/usrp2/CMakeLists.txt
+++ b/host/lib/usrp/usrp2/CMakeLists.txt
@@ -15,32 +15,34 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
########################################################################
# Conditionally configure the USRP2 support
########################################################################
-LIBUHD_REGISTER_COMPONENT("USRP2" ENABLE_USRP2 TRUE)
+LIBUHD_REGISTER_COMPONENT("USRP2" ENABLE_USRP2 ON "ENABLE_LIBUHD" OFF)
IF(ENABLE_USRP2)
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/clock_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/clock_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/codec_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/codec_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/codec_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/dboard_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/dboard_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/dsp_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/gps_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/gps_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/io_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/mboard_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_iface.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_impl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_regs.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/usrp2_regs.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dsp_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gps_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gps_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/io_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/mboard_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_iface.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_impl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_regs.cpp
)
ENDIF(ENABLE_USRP2)
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index ad1ae1acb..4f2cd88bb 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -39,7 +39,7 @@ public:
//setup the ad9777 dac
_ad9777_regs.x_1r_2r_mode = ad9777_regs_t::X_1R_2R_MODE_1R;
_ad9777_regs.filter_interp_rate = ad9777_regs_t::FILTER_INTERP_RATE_4X;
- _ad9777_regs.mix_mode = ad9777_regs_t::MIX_MODE_REAL;
+ _ad9777_regs.mix_mode = ad9777_regs_t::MIX_MODE_COMPLEX;
_ad9777_regs.pll_divide_ratio = ad9777_regs_t::PLL_DIVIDE_RATIO_DIV1;
_ad9777_regs.pll_state = ad9777_regs_t::PLL_STATE_ON;
_ad9777_regs.auto_cp_control = ad9777_regs_t::AUTO_CP_CONTROL_AUTO;
@@ -57,6 +57,7 @@ public:
for(boost::uint8_t addr = 0; addr <= 0xC; addr++){
this->send_ad9777_reg(addr);
}
+ set_tx_mod_mode(0);
//power-up adc
switch(_iface->get_rev()){
@@ -102,6 +103,26 @@ public:
}
}
+ void set_tx_mod_mode(int mod_mode){
+ //set the sign of the frequency shift
+ _ad9777_regs.modulation_form = (mod_mode > 0)?
+ ad9777_regs_t::MODULATION_FORM_E_PLUS_JWT:
+ ad9777_regs_t::MODULATION_FORM_E_MINUS_JWT
+ ;
+
+ //set the frequency shift
+ switch(std::abs(mod_mode)){
+ case 0:
+ case 1: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_NONE; break;
+ case 2: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_FS_2; break;
+ case 4: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_FS_4; break;
+ case 8: _ad9777_regs.modulation_mode = ad9777_regs_t::MODULATION_MODE_FS_8; break;
+ default: throw std::runtime_error("unknown modulation mode for ad9777");
+ }
+
+ this->send_ad9777_reg(0x01); //set the register
+ }
+
void set_rx_digital_gain(float gain) { //fine digital gain
switch(_iface->get_rev()){
case usrp2_iface::USRP_N200:
diff --git a/host/lib/usrp/usrp2/codec_ctrl.hpp b/host/lib/usrp/usrp2/codec_ctrl.hpp
index 57a37b94b..c8d977a1f 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.hpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.hpp
@@ -34,6 +34,15 @@ public:
static sptr make(usrp2_iface::sptr iface);
/*!
+ * Set the modulation mode for the DAC.
+ * Possible modes are 0, +/-1, +/-2, +/-4, +/-8
+ * which correspond to shifts of fs/mod_mode.
+ * A mode of 0 or +/-1 means no modulation.
+ * \param mod_mode the modulation mode
+ */
+ virtual void set_tx_mod_mode(int mod_mode) = 0;
+
+ /*!
* Set the analog preamplifier on the USRP2+ ADC (ADS62P44).
* \param gain enable or disable the 3.5dB preamp
*/
diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp
index 77ed594f5..8340f7cdd 100644
--- a/host/lib/usrp/usrp2/dsp_impl.cpp
+++ b/host/lib/usrp/usrp2/dsp_impl.cpp
@@ -20,6 +20,9 @@
#include <uhd/usrp/dsp_utils.hpp>
#include <uhd/usrp/dsp_props.hpp>
#include <boost/bind.hpp>
+#include <boost/math/special_functions/round.hpp>
+#include <boost/math/special_functions/sign.hpp>
+#include <algorithm>
#include <cmath>
using namespace uhd;
@@ -177,11 +180,23 @@ void usrp2_mboard_impl::duc_set(const wax::obj &key_, const wax::obj &val){
switch(key.as<dsp_prop_t>()){
case DSP_PROP_FREQ_SHIFT:{
+ const double codec_rate = get_master_clock_freq();
double new_freq = val.as<double>();
+
+ //calculate the DAC shift (multiples of rate)
+ const int sign = boost::math::sign(new_freq);
+ const int zone = std::min(boost::math::iround(new_freq/codec_rate), 2);
+ const double dac_shift = sign*zone*codec_rate;
+ new_freq -= dac_shift; //update FPGA DSP target freq
+
+ //set the DAC shift (modulation mode)
+ if (zone == 0) _codec_ctrl->set_tx_mod_mode(0); //no shift
+ else _codec_ctrl->set_tx_mod_mode(sign*4/zone); //DAC interp = 4
+
_iface->poke32(_iface->regs.dsp_tx_freq,
- dsp_type1::calc_cordic_word_and_update(new_freq, get_master_clock_freq())
+ dsp_type1::calc_cordic_word_and_update(new_freq, codec_rate)
);
- _duc_freq = new_freq; //shadow
+ _duc_freq = new_freq + dac_shift; //shadow
}
return;
diff --git a/host/lib/usrp/usrp_e100/CMakeLists.txt b/host/lib/usrp/usrp_e100/CMakeLists.txt
index 3c5c58ee0..5d8a9791d 100644
--- a/host/lib/usrp/usrp_e100/CMakeLists.txt
+++ b/host/lib/usrp/usrp_e100/CMakeLists.txt
@@ -15,33 +15,35 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
########################################################################
# Conditionally configure the USRP-E100 support
########################################################################
-LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 FALSE)
+LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 OFF "ENABLE_LIBUHD" ON)
IF(ENABLE_USRP_E100)
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/include)
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/clock_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/clock_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/codec_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/codec_ctrl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/codec_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/dboard_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/dboard_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/dsp_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/fpga-downloader.cc
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/io_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/mboard_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/usrp_e100_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/usrp_e100_impl.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/usrp_e100_iface.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/usrp_e100_iface.hpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/usrp_e100_mmap_zero_copy.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/usrp_e100_regs.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/codec_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/dsp_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/fpga-downloader.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/io_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/mboard_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp_e100_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp_e100_impl.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp_e100_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp_e100_iface.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp_e100_mmap_zero_copy.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usrp_e100_regs.hpp
)
ENDIF(ENABLE_USRP_E100)
diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt
index aecd3a4b0..60df24eef 100644
--- a/host/lib/utils/CMakeLists.txt
+++ b/host/lib/utils/CMakeLists.txt
@@ -15,7 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-#This file will be included by cmake, use absolute paths!
+########################################################################
+# This file included, use CMake directory variables
+########################################################################
########################################################################
# Setup defines for process scheduling
@@ -79,12 +81,12 @@ ENDIF(HAVE_DLFCN_H)
# Append sources
########################################################################
LIBUHD_APPEND_SOURCES(
- ${CMAKE_SOURCE_DIR}/lib/utils/assert.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/gain_group.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/images.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/load_modules.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/paths.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/props.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/thread_priority.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/warning.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/assert.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/gain_group.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/images.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/props.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/thread_priority.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/warning.cpp
)
diff --git a/host/test/tune_helper_test.cpp b/host/test/tune_helper_test.cpp
index e0500ae3f..735e7e948 100644
--- a/host/test/tune_helper_test.cpp
+++ b/host/test/tune_helper_test.cpp
@@ -19,6 +19,7 @@
#include <uhd/usrp/tune_helper.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/usrp/dsp_props.hpp>
+#include <uhd/usrp/dsp_utils.hpp>
#include <iostream>
using namespace uhd;
@@ -165,6 +166,7 @@ private:
switch(key.as<dsp_prop_t>()){
case DSP_PROP_FREQ_SHIFT:
_freq_shift = val.as<double>();
+ dsp_type1::calc_cordic_word_and_update(_freq_shift, _codec_rate);
return;
case DSP_PROP_HOST_RATE: