aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/AUTHORS.txt (renamed from host/AUTHORS)16
-rw-r--r--host/CMakeLists.txt52
-rw-r--r--host/LICENSE.txt (renamed from host/LICENSE)0
-rw-r--r--host/Modules/FindUSB1.cmake6
-rw-r--r--host/Modules/UHDComponent.cmake2
-rw-r--r--host/Modules/UHDPackage.cmake144
-rw-r--r--host/Modules/UHDPython.cmake29
-rw-r--r--host/Modules/UHDVersion.cmake54
-rw-r--r--host/README37
-rw-r--r--host/README.txt37
-rwxr-xr-xhost/apps/omap_debug/fetch-bin.sh6
-rwxr-xr-xhost/apps/omap_debug/fetch-kernel.sh7
-rwxr-xr-xhost/apps/omap_debug/fetch-module.sh6
-rwxr-xr-xhost/apps/omap_debug/fetch-u-boot.sh7
-rwxr-xr-xhost/apps/omap_debug/read_board_id.sh10
-rwxr-xr-xhost/apps/omap_debug/reload-fpga.sh7
-rwxr-xr-xhost/apps/omap_debug/setup-board-id-eeprom.sh17
-rwxr-xr-xhost/apps/omap_debug/write-eeprom.sh92
-rwxr-xr-xhost/apps/omap_debug/write_board_id.sh10
-rw-r--r--host/docs/CMakeLists.txt6
-rw-r--r--host/docs/build.rst13
-rw-r--r--host/docs/dboards.rst123
-rw-r--r--host/docs/general.rst2
-rw-r--r--host/docs/identification.rst2
-rw-r--r--host/docs/images.rst4
-rw-r--r--host/docs/index.rst4
-rw-r--r--host/docs/usrp2.rst25
-rw-r--r--host/docs/usrp_e1xx.rst40
-rw-r--r--host/examples/CMakeLists.txt4
-rw-r--r--host/examples/tx_waveforms.cpp3
-rw-r--r--host/include/uhd/CMakeLists.txt1
-rw-r--r--host/include/uhd/config.hpp2
-rw-r--r--host/include/uhd/transport/CMakeLists.txt1
-rw-r--r--host/include/uhd/types/CMakeLists.txt1
-rw-r--r--host/include/uhd/types/clock_config.hpp7
-rw-r--r--host/include/uhd/types/serial.hpp6
-rw-r--r--host/include/uhd/types/time_spec.hpp2
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt3
-rw-r--r--host/include/uhd/usrp/dboard_iface.hpp19
-rw-r--r--host/include/uhd/usrp/gps_ctrl.hpp2
-rw-r--r--host/include/uhd/usrp/tune_helper.hpp2
-rw-r--r--host/include/uhd/utils/CMakeLists.txt1
-rw-r--r--host/include/uhd/utils/byteswap.ipp6
-rw-r--r--host/lib/CMakeLists.txt36
-rw-r--r--host/lib/constants.hpp.in26
-rw-r--r--host/lib/device.cpp2
-rw-r--r--host/lib/ic_reg_maps/common.py2
-rwxr-xr-xhost/lib/ic_reg_maps/gen_ad9522_regs.py2
-rw-r--r--host/lib/transport/CMakeLists.txt6
-rw-r--r--host/lib/transport/if_addrs.cpp2
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp40
-rw-r--r--host/lib/types/serial.cpp4
-rw-r--r--host/lib/usrp/CMakeLists.txt2
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp44
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp13
-rw-r--r--host/lib/usrp/dboard_base.cpp2
-rw-r--r--host/lib/usrp/dsp_utils.cpp2
-rw-r--r--host/lib/usrp/gps_ctrl.cpp2
-rw-r--r--host/lib/usrp/tune_helper.cpp2
-rw-r--r--host/lib/usrp/usrp1/clock_ctrl.hpp2
-rw-r--r--host/lib/usrp/usrp1/codec_ctrl.cpp73
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.cpp14
-rw-r--r--host/lib/usrp/usrp1/usrp1_ctrl.cpp2
-rw-r--r--host/lib/usrp/usrp1/usrp1_ctrl.hpp2
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp48
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.hpp2
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp12
-rw-r--r--host/lib/usrp/usrp2/CMakeLists.txt2
-rw-r--r--host/lib/usrp/usrp2/clock_ctrl.cpp2
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp25
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp12
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp65
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp2
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp41
-rw-r--r--host/lib/usrp/usrp_e100/CMakeLists.txt6
-rw-r--r--host/lib/usrp/usrp_e100/clock_ctrl.cpp19
-rw-r--r--host/lib/usrp/usrp_e100/clock_ctrl.hpp14
-rw-r--r--host/lib/usrp/usrp_e100/dboard_iface.cpp8
-rw-r--r--host/lib/usrp/usrp_e100/io_impl.cpp16
-rw-r--r--host/lib/usrp/usrp_e100/mboard_impl.cpp5
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_iface.cpp11
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_iface.hpp2
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_impl.cpp10
-rw-r--r--host/lib/usrp/usrp_e100/usrp_e100_impl.hpp2
-rw-r--r--host/lib/utils/CMakeLists.txt18
-rw-r--r--host/lib/utils/images.cpp6
-rw-r--r--host/lib/utils/load_modules.cpp4
-rw-r--r--host/lib/utils/paths.cpp32
-rw-r--r--host/lib/utils/thread_priority.cpp9
-rw-r--r--host/lib/version.cpp8
-rw-r--r--host/tests/CMakeLists.txt12
-rw-r--r--host/tests/addr_test.cpp2
-rw-r--r--host/tests/byteswap_test.cpp2
-rw-r--r--host/tests/dict_test.cpp2
-rw-r--r--host/tests/module_test.cpp2
-rw-r--r--host/tests/subdev_spec_test.cpp2
-rw-r--r--host/tests/time_spec_test.cpp2
-rw-r--r--host/tests/tune_helper_test.cpp2
-rw-r--r--host/tests/vrt_test.cpp2
-rw-r--r--host/tests/warning_test.cpp2
-rw-r--r--host/usrp_e_utils/CMakeLists.txt7
-rw-r--r--host/usrp_e_utils/usrp-e-gpio.c (renamed from host/apps/omap_debug/usrp-e-gpio.c)4
-rw-r--r--host/usrp_e_utils/usrp-e-loopback.c14
-rw-r--r--host/utils/CMakeLists.txt6
-rwxr-xr-xhost/utils/usrp2_card_burner.py44
-rwxr-xr-xhost/utils/usrp2_card_burner_gui.py87
-rwxr-xr-xhost/utils/usrp2_recovery.py12
-rwxr-xr-xhost/utils/usrp_n2xx_net_burner.py151
-rwxr-xr-xhost/utils/usrp_n2xx_net_burner_gui.py196
109 files changed, 1225 insertions, 805 deletions
diff --git a/host/AUTHORS b/host/AUTHORS.txt
index 512d4752e..44b7516cd 100644
--- a/host/AUTHORS
+++ b/host/AUTHORS.txt
@@ -1,11 +1,13 @@
Matt Ettus - matt@ettus.com
USRP1 FPGA code
- USRP2 FPGA code
+ USRP2/N200 FPGA code
+ USRP-E100 FPGA code
Josh Blum - josh@ettus.com
driver framework
- USRP2 firmware
- USRP2 host code
+ USRP2/N200 firmware
+ USRP2/N200 host code
+ USRP-E100 host code
Basic/LF host code
XCVR2450 host code
RFX Series host code
@@ -13,6 +15,8 @@ Josh Blum - josh@ettus.com
Jason Abele - jason@ettus.com
RFX Series host code
WBX host code
+ DBSRX host code
+ DBSRX2 host code
Eric Blossom - eb@comsec.com
USRP1 firmware
@@ -28,3 +32,9 @@ Nick Foster - nick@ettus.com
LIBUSB host code
USRP1 host code
TVRX host code
+ USRP-N200 firmware
+ USRP-N200 host code
+
+Philip Balister - philip@opensdr.com
+ USRP-E100 kernel module
+ USRP-E100 utilities
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index bbcf34373..6b342c2d3 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -33,6 +33,10 @@ INCLUDE(UHDPackage) #setup cpack
########################################################################
# Install Dirs
########################################################################
+#when the library suffix should be 64 (applies to redhat linux family)
+IF(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
+ SET(LIB_SUFFIX 64)
+ENDIF()
SET(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
SET(RUNTIME_DIR bin)
SET(LIBRARY_DIR lib${LIB_SUFFIX})
@@ -68,25 +72,38 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-Wextra)
#ADD_DEFINITIONS(-pedantic)
#ADD_DEFINITIONS(-ansi)
- #only export symbols that are declared to be part of the uhd api:
- UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
+ IF(NOT WIN32)
+ #only export symbols that are declared to be part of the uhd api (non dll platforms)
+ UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
+ ENDIF(NOT WIN32)
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(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
+ENDIF(WIN32)
+
########################################################################
# Setup Boost
########################################################################
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Configuring Boost C++ Libraries...")
SET(BOOST_REQUIRED_COMPONENTS
date_time
filesystem
@@ -110,12 +127,16 @@ IF(MSVC)
ENDIF(BOOST_ALL_DYN_LINK)
ENDIF(MSVC)
-SET(Boost_ADDITIONAL_VERSIONS "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44")
-FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
+SET(Boost_ADDITIONAL_VERSIONS "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45" "1.46.0" "1.46")
+FIND_PACKAGE(Boost 1.36 COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
+MESSAGE(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}")
+MESSAGE(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}")
+MESSAGE(STATUS "Boost libraries: ${Boost_LIBRARIES}")
+
########################################################################
# Check Python Modules
########################################################################
@@ -156,16 +177,18 @@ CONFIGURE_FILE(
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/uhd.pc
DESTINATION ${LIBRARY_DIR}/pkgconfig
+ COMPONENT libraries
)
########################################################################
# Install Package Docs
########################################################################
INSTALL(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/README
- ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE
- ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS
+ ${CMAKE_CURRENT_SOURCE_DIR}/README.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS.txt
DESTINATION ${PKG_DOC_DIR}
+ COMPONENT readme
)
########################################################################
@@ -202,8 +225,17 @@ ENDIF(ENABLE_UTILS)
ADD_SUBDIRECTORY(usrp_e_utils)
########################################################################
+# Handle pre-built images
+########################################################################
+IF(DEFINED UHD_IMAGES_DIR AND EXISTS "${UHD_IMAGES_DIR}")
+ FILE(GLOB _image_files "${UHD_IMAGES_DIR}/*.*")
+ MESSAGE(STATUS "Using images: ${_image_files}")
+ INSTALL(FILES ${_image_files} DESTINATION ${PKG_DATA_DIR}/images COMPONENT images)
+ENDIF(DEFINED UHD_IMAGES_DIR AND EXISTS "${UHD_IMAGES_DIR}")
+
+########################################################################
# 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/LICENSE b/host/LICENSE.txt
index 9aa03b39b..9aa03b39b 100644
--- a/host/LICENSE
+++ b/host/LICENSE.txt
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/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 2a11d407b..416d89998 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
@@ -19,7 +19,64 @@
INCLUDE(UHDVersion) #sets version information
########################################################################
-# Setup CPack
+# Setup additional defines for OS types
+########################################################################
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ SET(LINUX TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/debian_version")
+ SET(DEBIAN TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/redhat-release")
+ SET(REDHAT TRUE)
+ENDIF()
+
+########################################################################
+# Setup package file name
+########################################################################
+IF(UHD_RELEASE_MODE)
+
+ #set generator type for recognized systems
+ IF(APPLE)
+ SET(CPACK_GENERATOR PackageMaker)
+ ELSEIF(WIN32)
+ SET(CPACK_GENERATOR NSIS)
+ ELSEIF(DEBIAN)
+ SET(CPACK_GENERATOR DEB)
+ ELSEIF(REDHAT)
+ SET(CPACK_GENERATOR RPM)
+ ELSE()
+ SET(CPACK_GENERATOR TGZ)
+ ENDIF()
+
+ FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release)
+ IF(LSB_RELEASE_EXECUTABLE)
+
+ #extract system information by executing the commands
+ EXECUTE_PROCESS(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id
+ OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ EXECUTE_PROCESS(
+ COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release
+ OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ #set a more sensible package name for this system
+ SET(CPACK_PACKAGE_FILE_NAME "UHD-${UHD_VERSION}-${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}")
+
+ ENDIF(LSB_RELEASE_EXECUTABLE)
+
+ IF(${CPACK_GENERATOR} STREQUAL NSIS)
+ SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
+ ENDIF()
+
+ENDIF(UHD_RELEASE_MODE)
+
+########################################################################
+# Setup CPack General
########################################################################
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver")
SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC")
@@ -27,18 +84,75 @@ SET(CPACK_PACKAGE_CONTACT "support@ettus.com")
SET(CPACK_PACKAGE_VERSION_MAJOR ${UHD_VERSION_MAJOR})
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)
-SET(BOOST_MIN_VERSION 1.36) #used in setup for boost
-STRING(REPLACE "," ", " CPACK_DEBIAN_PACKAGE_DEPENDS
- "libboost-date-time-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-filesystem-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-program-options-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-regex-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-system-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-test-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-thread-dev (>= ${BOOST_MIN_VERSION})"
-)
+SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt)
+SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/AUTHORS.txt)
+SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
+
+########################################################################
+# 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_README_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_README_DISPLAY_NAME "Readme")
+SET(CPACK_COMPONENT_IMAGES_DISPLAY_NAME "Images")
+
+SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic link library")
+SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ development headers")
+SET(CPACK_COMPONENT_UTILITIES_DESCRIPTION "Utility executables and python scripts")
+SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Example executables")
+SET(CPACK_COMPONENT_TESTS_DESCRIPTION "Unit test executables")
+SET(CPACK_COMPONENT_MANUAL_DESCRIPTION "Manual/application notes (rst and html)")
+SET(CPACK_COMPONENT_DOXYGEN_DESCRIPTION "API documentation (html)")
+SET(CPACK_COMPONENT_README_DESCRIPTION "Readme files (txt)")
+SET(CPACK_COMPONENT_IMAGES_DESCRIPTION "FPGA and firmware images")
+
+SET(CPACK_COMPONENT_README_REQUIRED TRUE)
+
+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 readme images)
+
+########################################################################
+# Setup CPack Debian
+########################################################################
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libusb-1.0-0, libboost-dev")
SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk")
-SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${BOOST_MIN_VERSION}")
+
+########################################################################
+# Setup CPack RPM
+########################################################################
+SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, libusb1")
+
+########################################################################
+# Setup CPack NSIS
+########################################################################
+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/Modules/UHDPython.cmake b/host/Modules/UHDPython.cmake
index 345e0187d..fdcdccb4b 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
@@ -15,9 +15,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+IF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE)
+SET(INCLUDED_UHD_PYTHON_CMAKE TRUE)
+
########################################################################
# Setup Python
########################################################################
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Configuring the python interpreter...")
#this allows the user to override PYTHON_EXECUTABLE
IF(PYTHON_EXECUTABLE)
@@ -42,6 +47,9 @@ ENDIF(PYTHON_EXECUTABLE)
#make the path to the executable appear in the cmake gui
SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+MESSAGE(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}")
+MESSAGE(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>")
+
IF(NOT PYTHONINTERP_FOUND)
MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.")
ENDIF(NOT PYTHONINTERP_FOUND)
@@ -53,17 +61,26 @@ MACRO(PYTHON_CHECK_MODULE desc mod cmd have)
COMMAND ${PYTHON_EXECUTABLE} -c "
#########################################
try: import ${mod}
-except: exit(-1)
+except: exit(1)
try: assert ${cmd}
-except: exit(-1)
+except: exit(2)
+exit(0)
#########################################"
RESULT_VARIABLE ${have}
)
IF(${have} EQUAL 0)
MESSAGE(STATUS "Python checking for ${desc} - found")
SET(${have} TRUE)
- ELSE(${have} EQUAL 0)
- MESSAGE(STATUS "Python checking for ${desc} - not found")
+ ELSEIF(${have} EQUAL 1)
+ MESSAGE(STATUS "Python checking for ${desc} - \"import ${mod}\" failed")
+ SET(${have} FALSE)
+ ELSEIF(${have} EQUAL 2)
+ MESSAGE(STATUS "Python checking for ${desc} - \"assert ${cmd}\" failed")
SET(${have} FALSE)
- ENDIF(${have} EQUAL 0)
+ ELSE()
+ MESSAGE(STATUS "Python checking for ${desc} - unknown error")
+ SET(${have} FALSE)
+ ENDIF()
ENDMACRO(PYTHON_CHECK_MODULE)
+
+ENDIF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE)
diff --git a/host/Modules/UHDVersion.cmake b/host/Modules/UHDVersion.cmake
index b0b2ae475..86d3133a8 100644
--- a/host/Modules/UHDVersion.cmake
+++ b/host/Modules/UHDVersion.cmake
@@ -17,46 +17,44 @@
########################################################################
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 001)
########################################################################
-# Find GIT to get repo information
+# Version information discovery through git log
########################################################################
-FIND_PACKAGE(Git QUIET)
-IF(GIT_FOUND)
+IF(UHD_RELEASE_MODE)
+ SET(UHD_BUILD_INFO_DISCOVERY FALSE)
+ SET(UHD_BUILD_INFO "release")
+ELSE()
+ SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND)
+ SET(UHD_BUILD_INFO "unknown")
+ENDIF()
- #grab the git log entry for the current head
- EXECUTE_PROCESS(
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${GIT_EXECUTABLE} log HEAD~..HEAD --date=raw -n1
- OUTPUT_VARIABLE _git_log OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- #extract the timestamp from the git log entry
- EXECUTE_PROCESS(
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${PYTHON_EXECUTABLE} -c "import re; print re.match('^.*Date:\\s*(\\d*).*$', ''' ${_git_log} ''', re.MULTILINE | re.DOTALL).groups()[0]"
- OUTPUT_VARIABLE _git_timestamp OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- #format the timestamp into YYYY-MM-DD-HH-MM-SS
- EXECUTE_PROCESS(
- 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})
+IF(UHD_BUILD_INFO_DISCOVERY)
#grab the git ref id for the current head
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE _git_rev_result
)
- SET(UHD_VERSION_PATCH ${_git_rev})
-ENDIF(GIT_FOUND)
+
+ #only set the build info on success
+ IF(_git_rev_result EQUAL 0)
+ SET(UHD_BUILD_INFO ${_git_rev})
+ ENDIF()
+ENDIF(UHD_BUILD_INFO_DISCOVERY)
+
+########################################################################
+SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}")
diff --git a/host/README b/host/README
deleted file mode 100644
index f3dcde53d..000000000
--- a/host/README
+++ /dev/null
@@ -1,37 +0,0 @@
-########################################################################
-# Ettus Research - Universal Hardware Driver
-########################################################################
-The hardware driver for Ettus Research products.
-
-########################################################################
-# Supported USRP Motherboards
-########################################################################
-USRP1
-USRP2
-USRP-N200
-USRP-N210
-USRP-E100
-
-########################################################################
-# Supported USRP Daughterboards
-########################################################################
-Basic RX
-Basic TX
-LF RX
-LF TX
-RFX Series
-XCVR 2450
-WBX Series
-DBSRX
-DBSRX2
-TVRX
-
-########################################################################
-# Documentation
-########################################################################
-Online documentation available at:
-http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/wiki/
-
-The build system can generate the html for the manual and Doxygen.
-Docutils and Doxygen are required to build the html docs.
-See the docs directory for the manual source (reStructuredText).
diff --git a/host/README.txt b/host/README.txt
new file mode 100644
index 000000000..b510493d5
--- /dev/null
+++ b/host/README.txt
@@ -0,0 +1,37 @@
+###############################################
+# Ettus Research - Universal Hardware Driver
+###############################################
+The hardware driver for Ettus Research products.
+
+###############################################
+# Supported USRP Motherboards
+###############################################
+USRP1
+USRP2
+USRP-N200
+USRP-N210
+USRP-E100
+
+###############################################
+# Supported USRP Daughterboards
+###############################################
+Basic RX
+Basic TX
+LF RX
+LF TX
+RFX Series
+XCVR 2450
+WBX Series
+DBSRX
+DBSRX2
+TVRX
+
+###############################################
+# Documentation
+###############################################
+Online documentation available at:
+http://code.ettus.com/redmine/ettus/projects/uhd/wiki
+
+The build system can generate the html for the manual and Doxygen.
+Docutils and Doxygen are required to build the html docs.
+See the docs directory for the manual source (reStructuredText).
diff --git a/host/apps/omap_debug/fetch-bin.sh b/host/apps/omap_debug/fetch-bin.sh
deleted file mode 100755
index 019ddaaf2..000000000
--- a/host/apps/omap_debug/fetch-bin.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ $GHQ ]; then
- scp $GHQ_USER@astro:/workspace/usrp1-e-dev/u1e.bin /home/root
-else
- scp -P 8822 balister@192.168.1.10:src/git/fpgapriv/usrp2/top/u1e/build/u1e.bin /home/root
-fi
-sync
diff --git a/host/apps/omap_debug/fetch-kernel.sh b/host/apps/omap_debug/fetch-kernel.sh
deleted file mode 100755
index ce420f3d2..000000000
--- a/host/apps/omap_debug/fetch-kernel.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-if [ $GHQ ]; then
- scp $GHQ_USER@astro:/workspace/usrp1-e-dev/kernel_usrp/arch/arm/boot/uImage /media/mmcblk0p1/uImage
-else
- scp balister@192.168.1.10:src/git/kernel_usrp/arch/arm/boot/uImage /media/mmcblk0p1/uImage
-fi
-sync
-
diff --git a/host/apps/omap_debug/fetch-module.sh b/host/apps/omap_debug/fetch-module.sh
deleted file mode 100755
index ec28989bd..000000000
--- a/host/apps/omap_debug/fetch-module.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-if [ $GHQ ]; then
- scp $GHQ_USER@astro:/workspace/usrp1-e-dev/kernel_usrp/drivers/misc/usrp_e.ko /lib/modules/2.6.33/kernel/drivers/misc
-else
- scp balister@192.168.1.10:src/git/kernel_usrp/drivers/misc/usrp_e.ko /lib/modules/2.6.33/kernel/drivers/misc
-fi
-sync
diff --git a/host/apps/omap_debug/fetch-u-boot.sh b/host/apps/omap_debug/fetch-u-boot.sh
deleted file mode 100755
index 5309364b8..000000000
--- a/host/apps/omap_debug/fetch-u-boot.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-if [ $GHQ ]; then
- scp $GHQ_USER@astro:/workspace/usrp1-e-dev/u-boot-overo/u-boot.bin /media/mmcblk0p1/
-else
- scp balister@192.168.1.167:src/git/u-boot/u-boot.bin /media/mmcblk0p1/
-fi
-sync
-
diff --git a/host/apps/omap_debug/read_board_id.sh b/host/apps/omap_debug/read_board_id.sh
deleted file mode 100755
index 96081f219..000000000
--- a/host/apps/omap_debug/read_board_id.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-i2cget -y 3 0x51 0x00 b
-i2cget -y 3 0x51 0x01 b
-i2cget -y 3 0x51 0x02 b
-i2cget -y 3 0x51 0x03 b
-i2cget -y 3 0x51 0x04 b
-i2cget -y 3 0x51 0x05 b
-
-
diff --git a/host/apps/omap_debug/reload-fpga.sh b/host/apps/omap_debug/reload-fpga.sh
deleted file mode 100755
index 2754718a4..000000000
--- a/host/apps/omap_debug/reload-fpga.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-rmmod usrp_e
-fpga-downloader /home/root/u1e.bin
-modprobe usrp_e
-usrp-e-debug-pins 1
-
diff --git a/host/apps/omap_debug/setup-board-id-eeprom.sh b/host/apps/omap_debug/setup-board-id-eeprom.sh
deleted file mode 100755
index 4dba1cce5..000000000
--- a/host/apps/omap_debug/setup-board-id-eeprom.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-i2cset -y 3 0x51 0x00 0x00
-i2cset -y 3 0x51 0x01 0x03
-i2cset -y 3 0x51 0x02 0x00
-i2cset -y 3 0x51 0x03 0x01
-i2cset -y 3 0x51 0x04 0x01
-i2cset -y 3 0x51 0x05 0x00
-i2cset -y 3 0x51 0x06 0x00
-
-i2cget -y 3 0x51 0 b
-i2cget -y 3 0x51 1 b
-i2cget -y 3 0x51 2 b
-i2cget -y 3 0x51 3 b
-i2cget -y 3 0x51 4 b
-i2cget -y 3 0x51 5 b
-i2cget -y 3 0x51 6 b
diff --git a/host/apps/omap_debug/write-eeprom.sh b/host/apps/omap_debug/write-eeprom.sh
deleted file mode 100755
index 301b06f07..000000000
--- a/host/apps/omap_debug/write-eeprom.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/bash
-
-if [ $# -ne 3 ] && [ $# -ne 5 ];
-then
- echo "Usage:"
- echo ""
- echo "writeprom.sh deviceid rev fab_rev [envvar envsetting]"
- echo
- echo " deviceid - expansion board device number from table:"
- echo
- echo " Summit 0x01"
- echo " Tobi 0x02"
- echo " Tobi Duo 0x03"
- echo " Palo35 0x04"
- echo " Palo43 0x05"
- echo " Chestnut43 0x06"
- echo " Pinto 0x07"
- echo
- echo " rev - board revision (e.g. 0x00)"
- echo " fab_rev - revision marking from pcb (e.g. R2411)"
- echo " envvar - optional u-boot env variable name"
- echo " (e.g. dvimode)"
- echo " envsetting - optional u-boot env variable setting"
- echo " (e.g. 1024x768MR-16@60)"
- exit 1
-fi
-
-fabrevision=$3
-if [ ${#fabrevision} -ge 8 ]; then
- echo "Error: fab revision string must less than 8 characters"
- exit 1
-fi
-
-envvar=$4
-if [ ${#envar} -ge 16 ]; then
- echo "Error: environment variable name string must less than 16 characters"
- exit 1
-fi
-
-envsetting=$5
-if [ ${#ensetting} -ge 64 ]; then
- echo "Error: environment setting string must less than 64 characters"
- exit 1
-fi
-
-bus=3
-device=0x51
-vendorid=0x03
-
-i2cset -y $bus $device 0x00 0x00
-i2cset -y $bus $device 0x01 $vendorid
-i2cset -y $bus $device 0x02 0x00
-i2cset -y $bus $device 0x03 $1
-i2cset -y $bus $device 0x04 $2
-i2cset -y $bus $device 0x05 00
-
-let i=6
-hexdumpargs="'${#fabrevision}/1 \"0x%02x \"'"
-command="echo -n \"$fabrevision\" | hexdump -e $hexdumpargs"
-hex=$(eval $command)
-for character in $hex; do
- i2cset -y $bus $device $i $character
- let i=$i+1
-done
-i2cset -y $bus $device $i 0x00
-
-if [ $# -eq 5 ]
-then
- i2cset -y $bus $device 0x05 0x01
-
- let i=14
- hexdumpargs="'${#envvar}/1 \"0x%02x \"'"
- command="echo -n \"$envvar\" | hexdump -e $hexdumpargs"
- hex=$(eval $command)
- for character in $hex; do
- i2cset -y $bus $device $i $character
- let i=$i+1
- done
- i2cset -y $bus $device $i 0x00
-
- let i=30
- hexdumpargs="'${#envsetting}/1 \"0x%02x \"'"
- command="echo -n \"$envsetting\" | hexdump -e $hexdumpargs"
- hex=$(eval $command)
- for character in $hex; do
- i2cset -y $bus $device $i $character
- let i=$i+1
- done
- i2cset -y $bus $device $i 0x00
-fi
-
-
diff --git a/host/apps/omap_debug/write_board_id.sh b/host/apps/omap_debug/write_board_id.sh
deleted file mode 100755
index 067269c64..000000000
--- a/host/apps/omap_debug/write_board_id.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-i2cset -y 3 0x51 0x00 0x00
-i2cset -y 3 0x51 0x01 0x03
-i2cset -y 3 0x51 0x02 0x00
-i2cset -y 3 0x51 0x03 0x01
-i2cset -y 3 0x51 0x04 0x00
-i2cset -y 3 0x51 0x05 0x00
-
-
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/docs/build.rst b/host/docs/build.rst
index de7c544f2..063b2b371 100644
--- a/host/docs/build.rst
+++ b/host/docs/build.rst
@@ -116,7 +116,7 @@ Generate Makefiles with cmake
Additionally, configuration variables can be passed into cmake via the command line.
The following common-use configuration variables are listed below:
-* For a custom install prefix: -DCMAKE_INSTALL_PREFIX=<prefix>
+* For a custom install prefix: -DCMAKE_INSTALL_PREFIX=<install-path>
* To install libs into lib64: cmake -DLIB_SUFFIX=64
Example usage:
@@ -165,12 +165,13 @@ LibUSB cmake notes
On Windows, cmake does not have the advantage of pkg-config,
so we must manually tell cmake how to locate the LibUSB header and lib.
-From the cmake gui, select "Advanded View":
-
+* From the cmake gui, select "Advanded View"
* Set LIBUSB_INCLUDE_DIR to the directory with "libusb.h".
* Set LIBUSB_LIBRARIES to the full path for "libusb-1.0.lib".
-Then check the boxes to enable USRP1 support, click configure and generate.
+ * Recommend the static libusb-1.0.lib to simplify runtime dependencies.
+
+* Check the box to enable USB support, click configure and generate.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Build the project in MSVC
@@ -196,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\\<version>\\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/dboards.rst b/host/docs/dboards.rst
index 7f205c404..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
@@ -182,7 +253,7 @@ If you lose R193, you can use anything from 0 to 10 ohms there.
With the daughterboard plugged-in, run the following commands:
::
- cd <prefix>/share/uhd/utils
+ cd <install-path>/share/uhd/utils
./usrp_burn_db_eeprom --id=0x000d --unit=RX --args=<args> --slot=<slot>
* <args> are device address arguments (optional if only one USRP is on your machine)
@@ -209,7 +280,7 @@ These are all 0-ohm, so if you lose one, just short across the appropriate pads
With the daughterboard plugged-in, run the following commands:
::
- cd <prefix>/share/uhd/utils
+ cd <install-path>/share/uhd/utils
./usrp_burn_db_eeprom --id=<rx_id> --unit=RX --args=<args> --slot=<slot>
./usrp_burn_db_eeprom --id=<tx_id> --unit=TX --args=<args> --slot=<slot>
diff --git a/host/docs/general.rst b/host/docs/general.rst
index 2894fbf88..73b820c84 100644
--- a/host/docs/general.rst
+++ b/host/docs/general.rst
@@ -52,5 +52,5 @@ Support for dynamically loadable modules
For a module to be loaded at runtime, it must be:
* found in the UHD_MODULE_PATH environment variable,
-* installed into the <prefix>/share/uhd/modules directory,
+* installed into the <install-path>/share/uhd/modules directory,
* or installed into /usr/share/uhd/modules directory (unix only).
diff --git a/host/docs/identification.rst b/host/docs/identification.rst
index 90484744c..deda61531 100644
--- a/host/docs/identification.rst
+++ b/host/docs/identification.rst
@@ -107,7 +107,7 @@ Set a custom name
Run the following commands:
::
- cd <prefix>/share/uhd/utils
+ cd <install-path>/share/uhd/utils
./usrp_burn_mb_eeprom --args=<optional device args> --key=name --val=lab1_xcvr
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/host/docs/images.rst b/host/docs/images.rst
index f5be88a65..adfa6d530 100644
--- a/host/docs/images.rst
+++ b/host/docs/images.rst
@@ -54,8 +54,8 @@ When installing images from an archive, there are two options:
**Option 1:**
Unpack the archive into the UHD installation prefix.
-The UHD will always search <prefix>/share/uhd/images for image files.
-Where <prefix> was set by the CMAKE_INSTALL_PREFIX at configure-time.
+The UHD will always search <install-path>/share/uhd/images for image files.
+Where <install-path> was set by the CMAKE_INSTALL_PREFIX at configure-time.
**Option 2:**
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/docs/usrp2.rst b/host/docs/usrp2.rst
index 70101bd87..161170f2c 100644
--- a/host/docs/usrp2.rst
+++ b/host/docs/usrp2.rst
@@ -25,11 +25,11 @@ Use the card burner tool (unix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
- sudo <prefix>/share/uhd/utils/usrp2_card_burner_gui.py
+ sudo <install-path>/share/uhd/utils/usrp2_card_burner_gui.py
-- OR --
- cd <prefix>/share/uhd/utils
+ cd <install-path>/share/uhd/utils
sudo ./usrp2_card_burner.py --dev=/dev/sd<XXX> --fpga=<path_to_fpga_image>
sudo ./usrp2_card_burner.py --dev=/dev/sd<XXX> --fw=<path_to_firmware_image>
@@ -42,7 +42,7 @@ Use the card burner tool (windows)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
- <path_to_python.exe> <prefix>/share/uhd/utils/usrp2_card_burner_gui.py
+ <path_to_python.exe> <install-path>/share/uhd/utils/usrp2_card_burner_gui.py
------------------------------------------------------------------------
@@ -58,17 +58,20 @@ Use the net burner tool (unix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
- cd <prefix>/share/uhd/utils
- ./usrp_n2xx_net_burner.py --ip=<ip address> --fw=<path for firmware image>
- ./usrp_n2xx_net_burner.py --ip=<ip address> --fpga=<path to FPGA image>
+ sudo <install-path>/share/uhd/utils/usrp_n2xx_net_burner_gui.py
+
+ -- OR --
+
+ cd <install-path>/share/uhd/utils
+ ./usrp_n2xx_net_burner.py --addr=<ip address> --fw=<path for firmware image>
+ ./usrp_n2xx_net_burner.py --addr=<ip address> --fpga=<path to FPGA image>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Use the net burner tool (Windows)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
- <path_to_python.exe> <prefix>/share/uhd/utils/usrp_n2xx_net_burner.py --ip=<ip address> --fw=<path for firmware image>
- <path_to_python.exe> <prefix>/share/uhd/utils/usrp_n2xx_net_burner.py --ip=<ip address> --fpga=<path to FPGA image>
+ <path_to_python.exe> <install-path>/share/uhd/utils/usrp_n2xx_net_burner_gui.py
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Device recovery and bricking
@@ -142,7 +145,7 @@ and the network must be setup properly as described above.
Run the following commands:
::
- cd <prefix>/share/uhd/utils
+ cd <install-path>/share/uhd/utils
./usrp_burn_mb_eeprom --args=<optional device args> --key=ip-addr --val=192.168.10.3
**Method 2 (Linux Only):**
@@ -151,7 +154,7 @@ It uses raw ethernet packets to bypass the IP/UDP layer to communicate with the
Run the following commands:
::
- cd <prefix>/share/uhd/utils
+ cd <install-path>/share/uhd/utils
sudo ./usrp2_recovery.py --ifc=eth0 --new-ip=192.168.10.3
------------------------------------------------------------------------
@@ -340,5 +343,5 @@ Test the PPS input with the following app:
::
- cd <prefix>/share/uhd/examples
+ cd <install-path>/share/uhd/examples
./test_pps_input --args=<args>
diff --git a/host/docs/usrp_e1xx.rst b/host/docs/usrp_e1xx.rst
index ffcd370dd..2818a0a65 100644
--- a/host/docs/usrp_e1xx.rst
+++ b/host/docs/usrp_e1xx.rst
@@ -61,5 +61,43 @@ can talk directly to the clock generator over a SPI interface.
Run the following commands to restore the clock generator to a usable state:
::
- cd <prefix>/share/uhd/usrp_e_utilities
+ cd <install-path>/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:
+
+* <args> are device address arguments (optional if only one USRP is on your machine)
+
+::
+
+ cd <install-path>/share/uhd/examples
+ ./test_pps_input --args=<args>
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/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 9c45e918b..5b3a1b70c 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -137,6 +137,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format("Actual TX Bandwidth: %f MHz...") % usrp->get_tx_bandwidth() << std::endl << std::endl;
}
+ //set the antenna
+ if (vm.count("ant")) usrp->set_tx_antenna(ant);
+
//for the const wave, set the wave freq for small samples per period
if (wave_freq == 0 and wave_type == "CONST"){
wave_freq = usrp->get_tx_rate()/2;
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/config.hpp b/host/include/uhd/config.hpp
index 1a04680e9..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_MSVC) || 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/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/types/clock_config.hpp b/host/include/uhd/types/clock_config.hpp
index a72eb63de..7301d43a0 100644
--- a/host/include/uhd/types/clock_config.hpp
+++ b/host/include/uhd/types/clock_config.hpp
@@ -26,10 +26,17 @@ namespace uhd{
* Clock configuration settings:
* The source for the 10MHz reference clock.
* The source and polarity for the PPS clock.
+ *
+ * Use the convenience functions external() and internal(),
+ * unless you have a special purpose and cannot use them.
*/
struct UHD_API clock_config_t{
//------ simple usage --------//
+
+ //! A convenience function to create an external clock configuration
static clock_config_t external(void);
+
+ //! A convenience function to create an internal clock configuration
static clock_config_t internal(void);
//------ advanced usage --------//
diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp
index 5c6de162b..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
@@ -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/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/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/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp
index c5898365d..1ec0fa1ff 100644
--- a/host/include/uhd/usrp/dboard_iface.hpp
+++ b/host/include/uhd/usrp/dboard_iface.hpp
@@ -55,7 +55,7 @@ struct UHD_API dboard_iface_special_props_t{
* This interface provides i2c, spi, gpio, atr, aux dac/adc access.
* Each mboard should have a specially tailored iface for its dboard.
*/
-class UHD_API dboard_iface{
+class UHD_API dboard_iface : public uhd::i2c_iface{
public:
typedef boost::shared_ptr<dboard_iface> sptr;
typedef dboard_iface_special_props_t special_props_t;
@@ -209,23 +209,6 @@ public:
virtual boost::uint16_t read_gpio(unit_t unit) = 0;
/*!
- * Write to an I2C peripheral.
- *
- * \param addr I2C bus address (7-bits)
- * \param bytes the data to write
- */
- virtual void write_i2c(boost::uint8_t addr, const byte_vector_t &bytes) = 0;
-
- /*!
- * Read from an I2C peripheral.
- *
- * \param addr I2C bus address (7-bits)
- * \param num_bytes number of bytes to read
- * \return the data read if successful, else a zero length string.
- */
- virtual byte_vector_t read_i2c(boost::uint8_t addr, size_t num_bytes) = 0;
-
- /*!
* Write data to SPI bus peripheral.
*
* \param unit which unit, rx or tx
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/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/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 <stdlib.h>
+#if defined(BOOST_MSVC) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
+ #include <cstdlib>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
return _byteswap_ushort(x);
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index dbfa234b6..fca4730d8 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -79,27 +79,18 @@ INCLUDE_SUBDIRECTORY(usrp)
INCLUDE_SUBDIRECTORY(utils)
########################################################################
-# Append to the list of sources for lib uhd
+# Setup UHD_VERSION_STRING for version.cpp
########################################################################
-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)
- STRING(REPLACE "\\" "\\\\" INSTALLER_PKG_DATA_DIR ${INSTALLER_PKG_DATA_DIR})
- MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}")
-ENDIF(UNIX)
-
-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
@@ -112,13 +103,14 @@ 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)
INSTALL(TARGETS uhd
- LIBRARY DESTINATION ${LIBRARY_DIR} # .so file
- ARCHIVE DESTINATION ${LIBRARY_DIR} # .lib file
- RUNTIME DESTINATION ${LIBRARY_DIR} # .dll file
+ LIBRARY DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .so file
+ ARCHIVE DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .lib file
+ RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT libraries # .dll file
)
diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in
deleted file mode 100644
index 4aedb6d4a..000000000
--- a/host/lib/constants.hpp.in
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#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 "@CPACK_PACKAGE_VERSION@"
-#define LOCAL_PKG_DATA_DIR "@LOCAL_PKG_DATA_DIR@"
-#define INSTALLER_PKG_DATA_DIR "@INSTALLER_PKG_DATA_DIR@"
-
-#endif /* INCLUDED_LIBUHD_CONSTANTS_HPP */
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/CMakeLists.txt b/host/lib/transport/CMakeLists.txt
index a5bf9c5f1..90360977a 100644
--- a/host/lib/transport/CMakeLists.txt
+++ b/host/lib/transport/CMakeLists.txt
@@ -79,6 +79,12 @@ SET_SOURCE_FILES_PROPERTIES(
PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}"
)
+#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()
+
########################################################################
# Append to the list of sources for lib uhd
########################################################################
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/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index 6dee69711..e42cab1d1 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -24,6 +24,7 @@
#include <boost/function.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
#include <list>
#include <iostream>
@@ -33,11 +34,27 @@ 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<boost::function<void()> *>(lut->user_data))();
}
+//! callback to free transfer upon cancellation
+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;
+}
+
/***********************************************************************
* Reusable managed receiver buffer:
* - Associated with a particular libusb transfer struct.
@@ -185,22 +202,26 @@ public:
//spawn the event handler threads
size_t concurrency = hints.cast<size_t>("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){
- //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 = libusb_transfer_cb_fn(&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){
@@ -255,7 +276,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/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(
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/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index 4d8222a52..f938c749a 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<int, adf4360_regs_t::prescaler_value_t> prescaler_to_enum = map_list_of
(8, adf4360_regs_t::PRESCALER_VALUE_8_9)
@@ -309,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<double> 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;
/*
@@ -322,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"
- ) % R % BS % P % B % A << 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;
@@ -361,7 +369,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;
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;
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/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_adc_t, boost::uint8_t> 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();
}
/***********************************************************************
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 <uhd/transport/bounded_buffer.hpp>
#include <boost/any.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
@@ -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/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..8f10df751 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
@@ -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;
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/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"];
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/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 <uhd/transport/bounded_buffer.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
#include <iostream>
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_metadata_t> 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/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 40fc5098b..29e0535f8 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -66,6 +66,18 @@ 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(
+ "\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));
+ }
+
//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..d88d31765 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -34,14 +34,32 @@ 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:
/***********************************************************************
* 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()){
@@ -59,15 +77,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 +124,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 +147,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 +162,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 +195,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 +214,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,12 +235,16 @@ 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);
//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)));
@@ -240,11 +253,14 @@ public:
const usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast<const usrp2_ctrl_data_t *>(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 or lo > compat)){
throw uhd::runtime_error(str(boost::format(
- "Expected protocol compatibility number %d, but got %d:\n"
+ "\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."
- ) % int(USRP2_FW_COMPAT_NUM) % ntohl(ctrl_data_in->proto_ver)));
+ ) % ((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;
@@ -284,6 +300,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
@@ -297,7 +314,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 +326,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));
}
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/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 96552929a..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<usrp2_ctrl_data_t *>(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,31 @@ 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);
+ }
- std::cout << "mtu recv bytes " << mtu.recv_mtu << std::endl;
- std::cout << "mtu send bytes " << mtu.send_mtu << std::endl;
+ //use the discovered mtu or clip the users requested mtu
+ mtu.recv_mtu = std::min(size_t(device_addr.cast<double>("recv_frame_size", 9000)), mtu.recv_mtu);
+ mtu.send_mtu = std::min(size_t(device_addr.cast<double>("send_frame_size", 9000)), mtu.send_mtu);
- //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<std::string>(mtu.recv_mtu);
- if (not device_addr.has_key("send_frame_size"))
device_addr["send_frame_size"] = boost::lexical_cast<std::string>(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;
+ }
+ 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
+
//setup rx otw type
_rx_otw_type.width = 16;
_rx_otw_type.shift = 0;
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/lib/usrp/usrp_e100/clock_ctrl.cpp b/host/lib/usrp/usrp_e100/clock_ctrl.cpp
index bb6fb7e3b..1ac2b804c 100644
--- a/host/lib/usrp/usrp_e100/clock_ctrl.cpp
+++ b/host/lib/usrp/usrp_e100/clock_ctrl.cpp
@@ -287,6 +287,10 @@ 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()));
}
double get_fpga_clock_rate(void){
@@ -302,7 +306,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();
}
@@ -327,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,
@@ -339,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)
**********************************************************************/
@@ -357,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,
@@ -368,7 +378,11 @@ public:
this->send_reg(0x197);
this->latch_regs();
}
-
+
+ double get_tx_clock_rate(void){
+ return _tx_clock_rate;
+ }
+
/***********************************************************************
* Clock reference control
**********************************************************************/
@@ -400,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 1f9960ce4..507f914f3 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
@@ -79,6 +79,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<unit_t, double> _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<double> 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){
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 <boost/bind.hpp>
#include <boost/format.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
#include <iostream>
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<managed_recv_buffer::sptr> recv_pirate_booty;
bounded_buffer<async_metadata_t> 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){
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();
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 <fcntl.h> //open, close
#include <linux/usrp_e.h> //ioctl structures and constants
#include <boost/format.hpp>
-#include <boost/thread.hpp> //mutex
+#include <boost/thread/mutex.hpp>
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
#include <stdexcept>
@@ -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_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/usrp/usrp_e100/usrp_e100_impl.cpp b/host/lib/usrp/usrp_e100/usrp_e100_impl.cpp
index 1385688e0..a8fbe5d69 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"];
@@ -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);
diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt
index c0d99b37e..1314f7475 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 <windows.h>
int main(){
@@ -107,6 +112,19 @@ SET_SOURCE_FILES_PROPERTIES(
)
########################################################################
+# 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
########################################################################
LIBUHD_APPEND_SOURCES(
diff --git a/host/lib/utils/images.cpp b/host/lib/utils/images.cpp
index 3756f035a..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
@@ -30,11 +30,11 @@ std::vector<fs::path> 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 uhd::io_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 ad39960bb..bee0d5304 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;
diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp
index 329695873..a3dd377e5 100644
--- a/host/lib/utils/paths.cpp
+++ b/host/lib/utils/paths.cpp
@@ -15,17 +15,15 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#include "constants.hpp"
#include <uhd/config.hpp>
#include <boost/tokenizer.hpp>
-#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/bind.hpp>
+#include <cstdlib>
#include <string>
#include <vector>
-namespace po = boost::program_options;
namespace fs = boost::filesystem;
/***********************************************************************
@@ -44,22 +42,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<fs::path> 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<std::string>(&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<fs::path> paths;
@@ -74,18 +64,18 @@ static std::vector<fs::path> 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<fs::path> get_image_paths(void){
std::vector<fs::path> 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(get_uhd_pkg_data_path() / "images");
return paths;
}
std::vector<fs::path> get_module_paths(void){
std::vector<fs::path> 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(get_uhd_pkg_data_path() / "modules");
return paths;
}
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]");
}
/***********************************************************************
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 <http://www.gnu.org/licenses/>.
//
-#include "constants.hpp"
#include <uhd/version.hpp>
-
-std::string uhd::get_version_string(void){
- return UHD_VERSION_STRING;
-}
-
#include <uhd/utils/static.hpp>
#include <boost/version.hpp>
#include <iostream>
@@ -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
;
}
diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt
index 79b20cd47..f08fe669b 100644
--- a/host/tests/CMakeLists.txt
+++ b/host/tests/CMakeLists.txt
@@ -44,15 +44,13 @@ 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)
########################################################################
# demo of a loadable module
########################################################################
-ADD_LIBRARY(module_test MODULE module_test.cpp)
-TARGET_LINK_LIBRARIES(module_test uhd)
-
-INSTALL(TARGETS
- RUNTIME DESTINATION ${PKG_DATA_DIR}/tests
-)
+IF(MSVC OR APPLE OR LINUX)
+ ADD_LIBRARY(module_test MODULE module_test.cpp)
+ TARGET_LINK_LIBRARIES(module_test uhd)
+ENDIF()
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
diff --git a/host/usrp_e_utils/CMakeLists.txt b/host/usrp_e_utils/CMakeLists.txt
index 1ecd2ac46..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)
@@ -37,6 +33,7 @@ IF(ENABLE_USRP_E_UTILS)
usrp-e-timed.c
usrp-e-wb-test.cpp
usrp-e-debug-pins.c
+ usrp-e-gpio.c
usrp-e-i2c.c
usrp-e-spi.c
)
diff --git a/host/apps/omap_debug/usrp-e-gpio.c b/host/usrp_e_utils/usrp-e-gpio.c
index adef877d3..7e4bc4e13 100644
--- a/host/apps/omap_debug/usrp-e-gpio.c
+++ b/host/usrp_e_utils/usrp-e-gpio.c
@@ -6,8 +6,8 @@
#include <string.h>
#include <sys/ioctl.h>
-#include "usrp_e.h"
-#include "usrp_e_regs.hpp"
+#include "linux/usrp_e.h"
+#include "usrp_e100_regs.hpp"
// Usage: usrp_e_gpio <string>
diff --git a/host/usrp_e_utils/usrp-e-loopback.c b/host/usrp_e_utils/usrp-e-loopback.c
index 78e2b5d16..0bd3d3100 100644
--- a/host/usrp_e_utils/usrp-e-loopback.c
+++ b/host/usrp_e_utils/usrp-e-loopback.c
@@ -38,11 +38,15 @@ static int calc_checksum(struct pkt *p)
i = 0;
sum = 0;
- for (i=0; i < p->len; i++)
- sum += p->data[i];
-
- sum += p->seq_num;
- sum += p->len;
+ if (p->len < 1016) {
+ for (i=0; i < p->len; i++)
+ sum += p->data[i];
+
+ sum += p->seq_num;
+ sum += p->len;
+ } else {
+ printf("Bad packet length = %d received.\n", p->len);
+ }
return sum;
}
diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt
index 53527c03d..98b5d41fb 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)
@@ -59,6 +59,8 @@ IF(ENABLE_USRP2)
usrp2_card_burner.py
usrp2_card_burner_gui.py
usrp_n2xx_net_burner.py
+ usrp_n2xx_net_burner_gui.py
DESTINATION ${PKG_DATA_DIR}/utils
+ COMPONENT utilities
)
ENDIF(ENABLE_USRP2)
diff --git a/host/utils/usrp2_card_burner.py b/host/utils/usrp2_card_burner.py
index 1db5e59ce..741c7e3e1 100755
--- a/host/utils/usrp2_card_burner.py
+++ b/host/utils/usrp2_card_burner.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
@@ -19,7 +19,11 @@
import platform
import tempfile
import subprocess
-import urllib
+try:
+ import urllib.request
+except ImportError:
+ import urllib
+ urllib.request = urllib
import optparse
import math
import os
@@ -46,16 +50,16 @@ def command(*args):
stderr=subprocess.STDOUT,
)
ret = p.wait()
- verbose = p.stdout.read()
- if ret != 0: raise Exception, verbose
+ verbose = p.stdout.read().decode('ascii')
+ if ret != 0: raise Exception(verbose)
return verbose
def get_dd_path():
if platform.system() == 'Windows':
dd_path = os.path.join(tempfile.gettempdir(), 'dd.exe')
if not os.path.exists(dd_path):
- print 'Downloading dd.exe to %s'%dd_path
- dd_bin = urllib.urlopen('http://www.ettus.com/downloads/dd.exe').read()
+ print('Downloading dd.exe to %s'%dd_path)
+ dd_bin = urllib.request.urlopen('http://www.ettus.com/downloads/dd.exe').read()
open(dd_path, 'wb').write(dd_bin)
return dd_path
return 'dd'
@@ -97,14 +101,14 @@ def get_raw_device_hints():
if key in info: return extract_info_value(info, key)
return info.splitlines()[0].strip()
- return sorted(set(map(extract_info_name, filter(is_info_valid, get_info_list(command(get_dd_path(), '--list'))))))
+ return sorted(set(map(extract_info_name, list(filter(is_info_valid, get_info_list(command(get_dd_path(), '--list')))))))
####################################################################
# Platform Linux: parse procfs /proc/partitions
####################################################################
if platform.system() == 'Linux':
devs = list()
- try: output = open('/proc/partitions', 'r').read()
+ try: output = open('/proc/partitions', 'r').read().decode('ascii')
except: return devs
for line in output.splitlines():
try:
@@ -120,15 +124,15 @@ def get_raw_device_hints():
# Platform Mac OS X: parse diskutil list and info commands
####################################################################
if platform.system() == 'Darwin':
- devs = map(lambda d: d.split()[0], filter(lambda l: l.startswith('/dev'), command('diskutil', 'list').splitlines()))
+ devs = [d.split()[0] for d in [l for l in command('diskutil', 'list').splitlines() if l.startswith('/dev')]]
def output_to_info(output):
- return dict([map(str.strip, pair.lower().split(':')) for pair in filter(lambda l: ':' in l, output.splitlines())])
+ return dict([list(map(str.strip, pair.lower().split(':'))) for pair in [l for l in output.splitlines() if ':' in l]])
def is_dev_valid(dev):
info = output_to_info(command('diskutil', 'info', dev))
try:
- if info.has_key('internal'): assert info['internal'] == 'no'
- if info.has_key('ejectable'): assert info['ejectable'] == 'yes'
- if info.has_key('total size'):
+ if 'internal' in info: assert info['internal'] == 'no'
+ if 'ejectable' in info: assert info['ejectable'] == 'yes'
+ if 'total size' in info:
size_match = re.match('^.*\((\d+)\s*bytes\).*$', info['total size'])
if size_match: assert int(size_match.groups()[0]) <= MAX_SD_CARD_SIZE
return True
@@ -175,8 +179,8 @@ def write_image(image_file, device_file, offset):
img_data = open(image_file, 'rb').read()
count = int_ceil_div(len(img_data), SECTOR_SIZE)
pad_len = SECTOR_SIZE*count - len(img_data)
- pad_str = ''.join([chr(0)]*pad_len) #zero-padding
- open(tmp_file, 'wb').write(img_data + pad_str)
+ padding = bytes(b'\x00')*pad_len #zero-padding
+ open(tmp_file, 'wb').write(img_data + padding)
#execute a dd subprocess
verbose = command(
@@ -196,7 +200,7 @@ def write_image(image_file, device_file, offset):
def write_and_verify(image_file, device_file, offset):
if os.path.getsize(image_file) > MAX_FILE_SIZE:
- raise Exception, 'Image file larger than %d bytes!'%MAX_FILE_SIZE
+ raise Exception('Image file larger than %d bytes!'%MAX_FILE_SIZE)
return '%s\n%s'%(
write_image(
image_file=image_file,
@@ -231,8 +235,8 @@ def get_options():
(options, args) = parser.parse_args()
if options.list:
- print 'Possible raw devices:'
- print ' ' + '\n '.join(get_raw_device_hints())
+ print('Possible raw devices:')
+ print(' ' + '\n '.join(get_raw_device_hints()))
exit()
return options
@@ -242,5 +246,5 @@ def get_options():
########################################################################
if __name__=='__main__':
options = get_options()
- if not options.dev: raise Exception, 'no raw device path specified'
- print burn_sd_card(dev=options.dev, fw=options.fw, fpga=options.fpga)
+ if not options.dev: raise Exception('no raw device path specified')
+ print(burn_sd_card(dev=options.dev, fw=options.fw, fpga=options.fpga))
diff --git a/host/utils/usrp2_card_burner_gui.py b/host/utils/usrp2_card_burner_gui.py
index 58b7a514a..2941629b9 100755
--- a/host/utils/usrp2_card_burner_gui.py
+++ b/host/utils/usrp2_card_burner_gui.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
@@ -17,10 +17,17 @@
#
import usrp2_card_burner #import implementation
-import Tkinter, tkFileDialog, tkFont, tkMessageBox
+try:
+ import tkinter, tkinter.filedialog, tkinter.font, tkinter.messagebox
+except ImportError:
+ import tkFileDialog, tkFont, tkMessageBox
+ import Tkinter as tkinter
+ tkinter.filedialog = tkFileDialog
+ tkinter.font = tkFont
+ tkinter.messagebox = tkMessageBox
import os
-class BinFileEntry(Tkinter.Frame):
+class BinFileEntry(tkinter.Frame):
"""
Simple file entry widget for getting the file path of bin files.
Combines a label, entry, and button with file dialog callback.
@@ -28,15 +35,15 @@ class BinFileEntry(Tkinter.Frame):
def __init__(self, root, what, def_path=''):
self._what = what
- Tkinter.Frame.__init__(self, root)
- Tkinter.Label(self, text=what+":").pack(side=Tkinter.LEFT)
- self._entry = Tkinter.Entry(self, width=50)
- self._entry.insert(Tkinter.END, def_path)
- self._entry.pack(side=Tkinter.LEFT)
- Tkinter.Button(self, text="...", command=self._button_cb).pack(side=Tkinter.LEFT)
+ tkinter.Frame.__init__(self, root)
+ tkinter.Label(self, text=what+":").pack(side=tkinter.LEFT)
+ self._entry = tkinter.Entry(self, width=50)
+ self._entry.insert(tkinter.END, def_path)
+ self._entry.pack(side=tkinter.LEFT)
+ tkinter.Button(self, text="...", command=self._button_cb).pack(side=tkinter.LEFT)
def _button_cb(self):
- filename = tkFileDialog.askopenfilename(
+ filename = tkinter.filedialog.askopenfilename(
parent=self,
filetypes=[('bin files', '*.bin'), ('all files', '*.*')],
title="Select bin file for %s"%self._what,
@@ -45,65 +52,65 @@ class BinFileEntry(Tkinter.Frame):
# open file on your own
if filename:
- self._entry.delete(0, Tkinter.END)
+ self._entry.delete(0, tkinter.END)
self._entry.insert(0, filename)
def get_filename(self):
return self._entry.get()
-class DeviceEntryWidget(Tkinter.Frame):
+class DeviceEntryWidget(tkinter.Frame):
"""
Simple entry widget for getting the raw device name.
Combines a label, entry, and helpful text box with hints.
"""
def __init__(self, root, text=''):
- Tkinter.Frame.__init__(self, root)
+ tkinter.Frame.__init__(self, root)
- Tkinter.Button(self, text="Rescan for Devices", command=self._reload_cb).pack()
+ tkinter.Button(self, text="Rescan for Devices", command=self._reload_cb).pack()
- self._hints = Tkinter.Listbox(self)
+ self._hints = tkinter.Listbox(self)
self._hints.bind("<<ListboxSelect>>", self._listbox_cb)
self._reload_cb()
- self._hints.pack(expand=Tkinter.YES, fill=Tkinter.X)
+ self._hints.pack(expand=tkinter.YES, fill=tkinter.X)
- frame = Tkinter.Frame(self)
+ frame = tkinter.Frame(self)
frame.pack()
- Tkinter.Label(frame, text="Raw Device:").pack(side=Tkinter.LEFT)
- self._entry = Tkinter.Entry(frame, width=50)
- self._entry.insert(Tkinter.END, text)
- self._entry.pack(side=Tkinter.LEFT)
+ tkinter.Label(frame, text="Raw Device:").pack(side=tkinter.LEFT)
+ self._entry = tkinter.Entry(frame, width=50)
+ self._entry.insert(tkinter.END, text)
+ self._entry.pack(side=tkinter.LEFT)
def _reload_cb(self):
- self._hints.delete(0, Tkinter.END)
+ self._hints.delete(0, tkinter.END)
for hint in usrp2_card_burner.get_raw_device_hints():
- self._hints.insert(Tkinter.END, hint)
+ self._hints.insert(tkinter.END, hint)
def _listbox_cb(self, event):
try:
sel = self._hints.get(self._hints.curselection()[0])
- self._entry.delete(0, Tkinter.END)
+ self._entry.delete(0, tkinter.END)
self._entry.insert(0, sel)
- except Exception, e: print e
+ except Exception as e: print(e)
def get_devname(self):
return self._entry.get()
-class SectionLabel(Tkinter.Label):
+class SectionLabel(tkinter.Label):
"""
Make a text label with bold font.
"""
def __init__(self, root, text):
- Tkinter.Label.__init__(self, root, text=text)
+ tkinter.Label.__init__(self, root, text=text)
#set the font bold
- f = tkFont.Font(font=self['font'])
+ f = tkinter.font.Font(font=self['font'])
f['weight'] = 'bold'
self['font'] = f.name
-class USRP2CardBurnerApp(Tkinter.Frame):
+class USRP2CardBurnerApp(tkinter.Frame):
"""
The top level gui application for the usrp2 sd card burner.
Creates entry widgets and button with callback to write images.
@@ -111,7 +118,7 @@ class USRP2CardBurnerApp(Tkinter.Frame):
def __init__(self, root, dev, fw, fpga):
- Tkinter.Frame.__init__(self, root)
+ tkinter.Frame.__init__(self, root)
#pack the file entry widgets
SectionLabel(self, text="Select Images").pack(pady=5)
@@ -127,8 +134,8 @@ class USRP2CardBurnerApp(Tkinter.Frame):
#the do it button
SectionLabel(self, text="").pack(pady=5)
- Tkinter.Label(self, text="Warning! This tool can overwrite your hard drive. Use with caution.").pack()
- Tkinter.Button(self, text="Burn SD Card", command=self._burn).pack()
+ tkinter.Label(self, text="Warning! This tool can overwrite your hard drive. Use with caution.").pack()
+ tkinter.Button(self, text="Burn SD Card", command=self._burn).pack()
def _burn(self):
#grab strings from the gui
@@ -138,31 +145,31 @@ class USRP2CardBurnerApp(Tkinter.Frame):
#check input
if not dev:
- tkMessageBox.showerror('Error:', 'No device specified!')
+ tkinter.messagebox.showerror('Error:', 'No device specified!')
return
if not fw and not fpga:
- tkMessageBox.showerror('Error:', 'No images specified!')
+ tkinter.messagebox.showerror('Error:', 'No images specified!')
return
if fw and not os.path.exists(fw):
- tkMessageBox.showerror('Error:', 'Firmware image not found!')
+ tkinter.messagebox.showerror('Error:', 'Firmware image not found!')
return
if fpga and not os.path.exists(fpga):
- tkMessageBox.showerror('Error:', 'FPGA image not found!')
+ tkinter.messagebox.showerror('Error:', 'FPGA image not found!')
return
#burn the sd card
try:
verbose = usrp2_card_burner.burn_sd_card(dev=dev, fw=fw, fpga=fpga)
- tkMessageBox.showinfo('Verbose:', verbose)
- except Exception, e:
- tkMessageBox.showerror('Verbose:', 'Error: %s'%str(e))
+ tkinter.messagebox.showinfo('Verbose:', verbose)
+ except Exception as e:
+ tkinter.messagebox.showerror('Verbose:', 'Error: %s'%str(e))
########################################################################
# main
########################################################################
if __name__=='__main__':
options = usrp2_card_burner.get_options()
- root = Tkinter.Tk()
+ root = tkinter.Tk()
root.title('USRP2 SD Card Burner')
USRP2CardBurnerApp(root, dev=options.dev, fw=options.fw, fpga=options.fpga).pack()
root.mainloop()
diff --git a/host/utils/usrp2_recovery.py b/host/utils/usrp2_recovery.py
index 5654e93d3..c7578d3a0 100755
--- a/host/utils/usrp2_recovery.py
+++ b/host/utils/usrp2_recovery.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
@@ -39,7 +39,7 @@ RECOVERY_ETHERTYPE = 0xbeee
IP_RECOVERY_CODE = 'addr'
def mac_addr_repr_to_binary_string(mac_addr):
- return ''.join(map(lambda x: chr(int(x, 16)), mac_addr.split(':')))
+ return ''.join([chr(int(x, 16)) for x in mac_addr.split(':')])
if __name__ == '__main__':
parser = optparse.OptionParser(usage='usage: %prog [options]\n'+__doc__)
@@ -48,12 +48,12 @@ if __name__ == '__main__':
(options, args) = parser.parse_args()
#create the raw socket
- print "Opening raw socket on interface:", options.ifc
+ print("Opening raw socket on interface:", options.ifc)
soc = socket.socket(socket.PF_PACKET, socket.SOCK_RAW)
soc.bind((options.ifc, RECOVERY_ETHERTYPE))
#create the recovery packet
- print "Loading packet with ip address:", options.new_ip
+ print("Loading packet with ip address:", options.new_ip)
packet = struct.pack(
'!6s6sH4s4s',
mac_addr_repr_to_binary_string(BCAST_MAC_ADDR),
@@ -63,6 +63,6 @@ if __name__ == '__main__':
socket.inet_aton(options.new_ip),
)
- print "Sending packet (%d bytes)"%len(packet)
+ print("Sending packet (%d bytes)"%len(packet))
soc.send(packet)
- print "Done"
+ print("Done")
diff --git a/host/utils/usrp_n2xx_net_burner.py b/host/utils/usrp_n2xx_net_burner.py
index 6fdc9df20..0b64f2008 100755
--- a/host/utils/usrp_n2xx_net_burner.py
+++ b/host/utils/usrp_n2xx_net_burner.py
@@ -92,7 +92,7 @@ def unpack_flash_info_fmt(s):
def unpack_flash_ip_fmt(s):
return struct.unpack(FLASH_IP_FMT, s) #(proto_ver, pktid, seq, ip_addr)
-def pack_flash_args_fmt(proto_ver, pktid, seq, flash_addr, length, data):
+def pack_flash_args_fmt(proto_ver, pktid, seq, flash_addr, length, data=bytes()):
return struct.pack(FLASH_ARGS_FMT, proto_ver, pktid, seq, flash_addr, length, data)
def pack_flash_info_fmt(proto_ver, pktid, seq, sector_size_bytes, memory_size_bytes):
@@ -100,69 +100,60 @@ def pack_flash_info_fmt(proto_ver, pktid, seq, sector_size_bytes, memory_size_by
def is_valid_fpga_image(fpga_image):
for i in range(0,63):
- if ord(fpga_image[i]) == 0xFF:
- continue
- if ord(fpga_image[i]) == 0xAA and ord(fpga_image[i+1]) == 0x99:
- return 1
-
- return 0
+ if fpga_image[i:i+1] == bytes(b'\xFF'): continue
+ if fpga_image[i:i+2] == bytes(b'\xAA\x99'): return True
+ return False
def is_valid_fw_image(fw_image):
- for i in range(0,4):
- if ord(fw_image[i]) != 0x0B:
- return 0;
-
- return 1
+ return fw_image[:4] == bytes(b'\x0B\x0B\x0B\x0B')
########################################################################
# Burner class, holds a socket and send/recv routines
########################################################################
class burner_socket(object):
- def __init__(self, ip):
+ def __init__(self, addr):
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self._sock.settimeout(UDP_TIMEOUT)
- self._sock.connect((ip, UDP_FW_UPDATE_PORT))
-
- def send_and_recv(self, pkt):
- try: self._sock.send(pkt)
- except Exception, e:
- print e
- sys.exit(1)
+ self._sock.connect((addr, UDP_FW_UPDATE_PORT))
+ self.set_callbacks(lambda *a: None, lambda *a: None)
+ self.init_update() #check that the device is there
- try: recv_pkt = self._sock.recv(UDP_MAX_XFER_BYTES)
- except Exception, e:
- print e
- sys.exit(1)
+ def set_callbacks(self, progress_cb, status_cb):
+ self._progress_cb = progress_cb
+ self._status_cb = status_cb
- return recv_pkt
+ def send_and_recv(self, pkt):
+ self._sock.send(pkt)
+ return self._sock.recv(UDP_MAX_XFER_BYTES)
#just here to validate comms
def init_update(self):
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_OHAI_LOL, seq(), 0, 0, "")
- in_pkt = self.send_and_recv(out_pkt)
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_OHAI_LOL, seq(), 0, 0)
+ try: in_pkt = self.send_and_recv(out_pkt)
+ except socket.timeout: raise Exception("No response from device")
(proto_ver, pktid, rxseq, ip_addr) = unpack_flash_ip_fmt(in_pkt)
if pktid == update_id_t.USRP2_FW_UPDATE_ID_OHAI_OMG:
- print "USRP2P found."
+ print("USRP-N2XX found.")
else:
- raise Exception, "Invalid reply received from device."
+ raise Exception("Invalid reply received from device.")
# print "Incoming:\n\tVer: %i\n\tID: %c\n\tSeq: %i\n\tIP: %i\n" % (proto_ver, chr(pktid), rxseq, ip_addr)
def get_flash_info(self):
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_WATS_TEH_FLASH_INFO_LOL, seq(), 0, 0, "")
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_WATS_TEH_FLASH_INFO_LOL, seq(), 0, 0)
in_pkt = self.send_and_recv(out_pkt)
(proto_ver, pktid, rxseq, sector_size_bytes, memory_size_bytes) = unpack_flash_info_fmt(in_pkt)
if pktid != update_id_t.USRP2_FW_UPDATE_ID_HERES_TEH_FLASH_INFO_OMG:
- raise Exception, "Invalid reply %c from device." % (chr(pktid))
+ raise Exception("Invalid reply %c from device." % (chr(pktid)))
return (memory_size_bytes, sector_size_bytes)
def burn_fw(self, fw, fpga, reset, safe):
(flash_size, sector_size) = self.get_flash_info()
- print "Flash size: %i\nSector size: %i\n\n" % (flash_size, sector_size)
+ print("Flash size: %i\nSector size: %i\n\n" % (flash_size, sector_size))
if fpga:
if safe: image_location = SAFE_FPGA_IMAGE_LOCATION_ADDR
@@ -172,20 +163,18 @@ class burner_socket(object):
fpga_image = fpga_file.read()
if len(fpga_image) > FPGA_IMAGE_SIZE_BYTES:
- print "Error: FPGA image file too large."
- return 0
+ raise Exception("Error: FPGA image file too large.")
if not is_valid_fpga_image(fpga_image):
- print "Error: Invalid FPGA image file."
- return 0
+ raise Exception("Error: Invalid FPGA image file.")
- print "Begin FPGA write: this should take about 1 minute..."
+ print("Begin FPGA write: this should take about 1 minute...")
start_time = time.time()
self.erase_image(image_location, FPGA_IMAGE_SIZE_BYTES)
self.write_image(fpga_image, image_location)
self.verify_image(fpga_image, image_location)
- print "Time elapsed: %f seconds"%(time.time() - start_time)
- print "\n\n"
+ print("Time elapsed: %f seconds"%(time.time() - start_time))
+ print("\n\n")
if fw:
if safe: image_location = SAFE_FW_IMAGE_LOCATION_ADDR
@@ -195,88 +184,91 @@ class burner_socket(object):
fw_image = fw_file.read()
if len(fw_image) > FW_IMAGE_SIZE_BYTES:
- print "Error: Firmware image file too large."
- return 0
+ raise Exception("Error: Firmware image file too large.")
if not is_valid_fw_image(fw_image):
- print "Error: Invalid firmware image file."
- return 0
+ raise Exception("Error: Invalid firmware image file.")
- print "Begin firmware write: this should take about 1 second..."
+ print("Begin firmware write: this should take about 1 second...")
start_time = time.time()
self.erase_image(image_location, FW_IMAGE_SIZE_BYTES)
self.write_image(fw_image, image_location)
self.verify_image(fw_image, image_location)
- print "Time elapsed: %f seconds"%(time.time() - start_time)
- print "\n\n"
+ print("Time elapsed: %f seconds"%(time.time() - start_time))
+ print("\n\n")
if reset: self.reset_usrp()
def write_image(self, image, addr):
- print "Writing image"
+ print("Writing image")
+ self._status_cb("Writing")
+ writedata = image
#we split the image into smaller (256B) bits and send them down the wire
- while image:
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_WRITE_TEH_FLASHES_LOL, seq(), addr, FLASH_DATA_PACKET_SIZE, image[:FLASH_DATA_PACKET_SIZE])
+ while writedata:
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_WRITE_TEH_FLASHES_LOL, seq(), addr, FLASH_DATA_PACKET_SIZE, writedata[:FLASH_DATA_PACKET_SIZE])
in_pkt = self.send_and_recv(out_pkt)
(proto_ver, pktid, rxseq, flash_addr, rxlength, data) = unpack_flash_args_fmt(in_pkt)
if pktid != update_id_t.USRP2_FW_UPDATE_ID_WROTE_TEH_FLASHES_OMG:
- raise Exception, "Invalid reply %c from device." % (chr(pktid))
+ raise Exception("Invalid reply %c from device." % (chr(pktid)))
- image = image[FLASH_DATA_PACKET_SIZE:]
+ writedata = writedata[FLASH_DATA_PACKET_SIZE:]
addr += FLASH_DATA_PACKET_SIZE
+ self._progress_cb(float(len(image)-len(writedata))/len(image))
def verify_image(self, image, addr):
- print "Verifying data"
+ print("Verifying data")
+ self._status_cb("Verifying")
readsize = len(image)
- readdata = str()
+ readdata = bytes()
while readsize > 0:
if readsize < FLASH_DATA_PACKET_SIZE: thisreadsize = readsize
else: thisreadsize = FLASH_DATA_PACKET_SIZE
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_READ_TEH_FLASHES_LOL, seq(), addr, thisreadsize, "")
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_READ_TEH_FLASHES_LOL, seq(), addr, thisreadsize)
in_pkt = self.send_and_recv(out_pkt)
(proto_ver, pktid, rxseq, flash_addr, rxlength, data) = unpack_flash_args_fmt(in_pkt)
if pktid != update_id_t.USRP2_FW_UPDATE_ID_KK_READ_TEH_FLASHES_OMG:
- raise Exception, "Invalid reply %c from device." % (chr(pktid))
+ raise Exception("Invalid reply %c from device." % (chr(pktid)))
readdata += data[:thisreadsize]
readsize -= FLASH_DATA_PACKET_SIZE
addr += FLASH_DATA_PACKET_SIZE
+ self._progress_cb(float(len(readdata))/len(image))
- print "Read back %i bytes" % len(readdata)
+ print("Read back %i bytes" % len(readdata))
# print readdata
# for i in range(256, 512):
# print "out: %i in: %i" % (ord(image[i]), ord(readdata[i]))
if readdata != image:
- print "Verify failed. Image did not write correctly."
+ raise Exception("Verify failed. Image did not write correctly.")
else:
- print "Success."
+ print("Success.")
def read_image(self, image, size, addr):
- print "Reading image"
+ print("Reading image")
readsize = size
readdata = str()
while readsize > 0:
if readsize < FLASH_DATA_PACKET_SIZE: thisreadsize = readsize
else: thisreadsize = FLASH_DATA_PACKET_SIZE
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_READ_TEH_FLASHES_LOL, seq(), addr, thisreadsize, "")
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_READ_TEH_FLASHES_LOL, seq(), addr, thisreadsize)
in_pkt = self.send_and_recv(out_pkt)
(proto_ver, pktid, rxseq, flash_addr, rxlength, data) = unpack_flash_args_fmt(in_pkt)
if pktid != update_id_t.USRP2_FW_UPDATE_ID_KK_READ_TEH_FLASHES_OMG:
- raise Exception, "Invalid reply %c from device." % (chr(pktid))
+ raise Exception("Invalid reply %c from device." % (chr(pktid)))
readdata += data[:thisreadsize]
readsize -= FLASH_DATA_PACKET_SIZE
addr += FLASH_DATA_PACKET_SIZE
- print "Read back %i bytes" % len(readdata)
+ print("Read back %i bytes" % len(readdata))
#write to disk
f = open(image, 'w')
@@ -284,35 +276,40 @@ class burner_socket(object):
f.close()
def reset_usrp(self):
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_RESET_MAH_COMPUTORZ_LOL, seq(), 0, 0, "")
- in_pkt = self.send_and_recv(out_pkt)
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_RESET_MAH_COMPUTORZ_LOL, seq(), 0, 0)
+ try: in_pkt = self.send_and_recv(out_pkt)
+ except socket.timeout: return
(proto_ver, pktid, rxseq, flash_addr, rxlength, data) = unpack_flash_args_fmt(in_pkt)
if pktid == update_id_t.USRP2_FW_UPDATE_ID_RESETTIN_TEH_COMPUTORZ_OMG:
- raise Exception, "Device failed to reset."
+ raise Exception("Device failed to reset.")
def erase_image(self, addr, length):
+ self._status_cb("Erasing")
#get flash info first
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_ERASE_TEH_FLASHES_LOL, seq(), addr, length, "")
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_ERASE_TEH_FLASHES_LOL, seq(), addr, length)
in_pkt = self.send_and_recv(out_pkt)
(proto_ver, pktid, rxseq, flash_addr, rxlength, data) = unpack_flash_args_fmt(in_pkt)
if pktid != update_id_t.USRP2_FW_UPDATE_ID_ERASING_TEH_FLASHES_OMG:
- raise Exception, "Invalid reply %c from device." % (chr(pktid))
+ raise Exception("Invalid reply %c from device." % (chr(pktid)))
- print "Erasing %i bytes at %i" % (length, addr)
+ print("Erasing %i bytes at %i" % (length, addr))
+ start_time = time.time()
#now wait for it to finish
while(True):
- out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_R_U_DONE_ERASING_LOL, seq(), 0, 0, "")
+ out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_R_U_DONE_ERASING_LOL, seq(), 0, 0)
in_pkt = self.send_and_recv(out_pkt)
(proto_ver, pktid, rxseq, flash_addr, rxlength, data) = unpack_flash_args_fmt(in_pkt)
if pktid == update_id_t.USRP2_FW_UPDATE_ID_IM_DONE_ERASING_OMG: break
elif pktid != update_id_t.USRP2_FW_UPDATE_ID_NOPE_NOT_DONE_ERASING_OMG:
- raise Exception, "Invalid reply %c from device." % (chr(pktid))
+ raise Exception("Invalid reply %c from device." % (chr(pktid)))
+ time.sleep(0.01) #decrease network overhead by waiting a bit before polling
+ self._progress_cb(min(1.0, (time.time() - start_time)/(length/80e3)))
########################################################################
@@ -320,7 +317,7 @@ class burner_socket(object):
########################################################################
def get_options():
parser = optparse.OptionParser()
- parser.add_option("--ip", type="string", help="USRP2P firmware address", default='')
+ parser.add_option("--addr", type="string", help="USRP-N2XX device address", default='')
parser.add_option("--fw", type="string", help="firmware image path (optional)", default='')
parser.add_option("--fpga", type="string", help="fpga image path (optional)", default='')
parser.add_option("--reset", action="store_true", help="reset the device after writing", default=False)
@@ -335,23 +332,23 @@ def get_options():
########################################################################
if __name__=='__main__':
options = get_options()
- if not options.ip: raise Exception, 'no ip address specified'
+ if not options.addr: raise Exception('no address specified')
- if not options.fpga and not options.fw and not options.reset: raise Exception, 'Must specify either a firmware image or FPGA image, and/or reset.'
+ if not options.fpga and not options.fw and not options.reset: raise Exception('Must specify either a firmware image or FPGA image, and/or reset.')
if options.overwrite_safe and not options.read:
print("Are you REALLY, REALLY sure you want to overwrite the safe image? This is ALMOST ALWAYS a terrible idea.")
print("If your image is faulty, your USRP2+ will become a brick until reprogrammed via JTAG.")
- response = raw_input("""Type "yes" to continue, or anything else to quit: """)
+ response = input("""Type "yes" to continue, or anything else to quit: """)
if response != "yes": sys.exit(0)
- burner = burner_socket(ip=options.ip)
+ burner = burner_socket(addr=options.addr)
if options.read:
if options.fw:
file = options.fw
if os.path.isfile(file):
- response = raw_input("File already exists -- overwrite? (y/n) ")
+ response = input("File already exists -- overwrite? (y/n) ")
if response != "y": sys.exit(0)
size = FW_IMAGE_SIZE_BYTES
addr = SAFE_FW_IMAGE_LOCATION_ADDR if options.overwrite_safe else PROD_FW_IMAGE_LOCATION_ADDR
@@ -360,7 +357,7 @@ if __name__=='__main__':
if options.fpga:
file = options.fpga
if os.path.isfile(file):
- response = raw_input("File already exists -- overwrite? (y/n) ")
+ response = input("File already exists -- overwrite? (y/n) ")
if response != "y": sys.exit(0)
size = FPGA_IMAGE_SIZE_BYTES
addr = SAFE_FPGA_IMAGE_LOCATION_ADDR if options.overwrite_safe else PROD_FPGA_IMAGE_LOCATION_ADDR
diff --git a/host/utils/usrp_n2xx_net_burner_gui.py b/host/utils/usrp_n2xx_net_burner_gui.py
new file mode 100755
index 000000000..3b414a918
--- /dev/null
+++ b/host/utils/usrp_n2xx_net_burner_gui.py
@@ -0,0 +1,196 @@
+#!/usr/bin/env python
+#
+# Copyright 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 <http://www.gnu.org/licenses/>.
+#
+
+import usrp_n2xx_net_burner #import implementation
+try:
+ import tkinter, tkinter.filedialog, tkinter.font, tkinter.messagebox
+except ImportError:
+ import tkFileDialog, tkFont, tkMessageBox
+ import Tkinter as tkinter
+ tkinter.filedialog = tkFileDialog
+ tkinter.font = tkFont
+ tkinter.messagebox = tkMessageBox
+import os
+
+class BinFileEntry(tkinter.Frame):
+ """
+ Simple file entry widget for getting the file path of bin files.
+ Combines a label, entry, and button with file dialog callback.
+ """
+
+ def __init__(self, root, what, def_path=''):
+ self._what = what
+ tkinter.Frame.__init__(self, root)
+ tkinter.Label(self, text=what+":").pack(side=tkinter.LEFT)
+ self._entry = tkinter.Entry(self, width=50)
+ self._entry.insert(tkinter.END, def_path)
+ self._entry.pack(side=tkinter.LEFT)
+ tkinter.Button(self, text="...", command=self._button_cb).pack(side=tkinter.LEFT)
+
+ def _button_cb(self):
+ filename = tkinter.filedialog.askopenfilename(
+ parent=self,
+ filetypes=[('bin files', '*.bin'), ('all files', '*.*')],
+ title="Select bin file for %s"%self._what,
+ initialdir=os.path.dirname(self.get_filename()),
+ )
+
+ # open file on your own
+ if filename:
+ self._entry.delete(0, tkinter.END)
+ self._entry.insert(0, filename)
+
+ def get_filename(self):
+ return self._entry.get()
+
+class ProgressBar(tkinter.Canvas):
+ """
+ A simple implementation of a progress bar.
+ Draws rectangle that fills from left to right.
+ """
+
+ def __init__(self, root, width=500, height=20):
+ self._width = width
+ self._height = height
+ tkinter.Canvas.__init__(self, root, relief="sunken", borderwidth=2, width=self._width-2, height=self._height-2)
+ self._last_fill_pixels = None
+ self.set(0.0)
+
+ def set(self, frac):
+ """
+ Update the progress where fraction is between 0.0 and 1.0
+ """
+ #determine the number of pixels to draw
+ fill_pixels = int(round(self._width*frac))
+ if fill_pixels == self._last_fill_pixels: return
+ self._last_fill_pixels = fill_pixels
+
+ #draw a rectangle representing the progress
+ if frac: self.create_rectangle(0, 0, fill_pixels, self._height, fill="#357EC7")
+ else: self.create_rectangle(0, 0, self._width, self._height, fill="#E8E8E8")
+
+class SectionLabel(tkinter.Label):
+ """
+ Make a text label with bold font.
+ """
+
+ def __init__(self, root, text):
+ tkinter.Label.__init__(self, root, text=text)
+
+ #set the font bold
+ f = tkinter.font.Font(font=self['font'])
+ f['weight'] = 'bold'
+ self['font'] = f.name
+
+class USRPN2XXNetBurnerApp(tkinter.Frame):
+ """
+ The top level gui application for the usrp-n2xx network burner.
+ Creates entry widgets and button with callback to write images.
+ """
+
+ def __init__(self, root, addr, fw, fpga):
+
+ tkinter.Frame.__init__(self, root)
+
+ #pack the file entry widgets
+ SectionLabel(self, text="Select Images").pack(pady=5)
+ self._fw_img_entry = BinFileEntry(self, "Firmware Image", def_path=fw)
+ self._fw_img_entry.pack()
+ self._fpga_img_entry = BinFileEntry(self, "FPGA Image", def_path=fpga)
+ self._fpga_img_entry.pack()
+
+ #pack the destination entry widget
+ SectionLabel(self, text="Select Address").pack(pady=5)
+ self._addr_entry = tkinter.Entry(self, width=30)
+ self._addr_entry.insert(tkinter.END, addr)
+ self._addr_entry.pack()
+
+ #the do it button
+ SectionLabel(self, text="").pack(pady=5)
+ button = tkinter.Button(self, text="Burn Images", command=self._burn)
+ self._enable_input = lambda: button.configure(state=tkinter.NORMAL)
+ self._disable_input = lambda: button.configure(state=tkinter.DISABLED)
+ button.pack()
+
+ #a progress bar to monitor the status
+ progress_frame = tkinter.Frame(self)
+ progress_frame.pack()
+ self._status = tkinter.StringVar()
+ tkinter.Label(progress_frame, textvariable=self._status).pack(side=tkinter.LEFT)
+ self._pbar = ProgressBar(progress_frame)
+ self._pbar.pack(side=tkinter.RIGHT, expand=True)
+
+ def _burn(self):
+ self._disable_input()
+
+ #grab strings from the gui
+ fw = self._fw_img_entry.get_filename()
+ fpga = self._fpga_img_entry.get_filename()
+ addr = self._addr_entry.get()
+
+ #check input
+ if not addr:
+ tkinter.messagebox.showerror('Error:', 'No address specified!')
+ return
+ if not fw and not fpga:
+ tkinter.messagebox.showerror('Error:', 'No images specified!')
+ return
+ if fw and not os.path.exists(fw):
+ tkinter.messagebox.showerror('Error:', 'Firmware image not found!')
+ return
+ if fpga and not os.path.exists(fpga):
+ tkinter.messagebox.showerror('Error:', 'FPGA image not found!')
+ return
+
+ try:
+ #make a new burner object and attempt the burner operation
+ burner = usrp_n2xx_net_burner.burner_socket(addr=addr)
+
+ for (image_type, fw_img, fpga_img) in (('FPGA', '', fpga), ('Firmware', fw, '')):
+ #setup callbacks that update the gui
+ def status_cb(status):
+ self._pbar.set(0.0) #status change, reset the progress
+ self._status.set("%s %s "%(status.title(), image_type))
+ self.update()
+ def progress_cb(progress):
+ self._pbar.set(progress)
+ self.update()
+ burner.set_callbacks(progress_cb=progress_cb, status_cb=status_cb)
+ burner.burn_fw(fw=fw_img, fpga=fpga_img, reset=False, safe=False)
+
+ if tkinter.messagebox.askyesno("Burn was successful!", "Reset the device?"):
+ burner.reset_usrp()
+
+ except Exception as e:
+ tkinter.messagebox.showerror('Verbose:', 'Error: %s'%str(e))
+
+ #reset the progress bar
+ self._pbar.set(0.0)
+ self._status.set("")
+ self._enable_input()
+
+########################################################################
+# main
+########################################################################
+if __name__=='__main__':
+ options = usrp_n2xx_net_burner.get_options()
+ root = tkinter.Tk()
+ root.title('USRP-N2XX Net Burner')
+ USRPN2XXNetBurnerApp(root, addr=options.addr, fw=options.fw, fpga=options.fpga).pack()
+ root.mainloop()
+ exit()