aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/CMakeLists.txt2
-rw-r--r--host/cmake/Modules/FindORC.cmake36
-rw-r--r--host/cmake/Modules/FindUSB1.cmake15
-rw-r--r--host/cmake/Modules/NSIS.InstallOptions.ini.in37
-rw-r--r--host/cmake/Modules/NSIS.template.in955
-rw-r--r--host/cmake/Modules/UHDPackage.cmake9
-rw-r--r--host/cmake/Modules/UHDUnitTest.cmake110
-rwxr-xr-xhost/cmake/debian/postinst.in4
-rwxr-xr-xhost/cmake/redhat/post_install.in4
-rw-r--r--host/docs/build.rst2
-rw-r--r--host/docs/calibration.rst8
-rw-r--r--host/docs/coding.rst6
-rw-r--r--host/docs/dboards.rst12
-rw-r--r--host/docs/general.rst22
-rw-r--r--host/docs/identification.rst8
-rw-r--r--host/docs/images.rst4
-rw-r--r--host/docs/index.rst10
-rw-r--r--host/docs/sync.rst16
-rw-r--r--host/docs/transport.rst6
-rw-r--r--host/docs/usrp1.rst4
-rw-r--r--host/docs/usrp2.rst14
-rw-r--r--host/docs/usrp_b100.rst6
-rw-r--r--host/docs/usrp_e1x0.rst10
-rw-r--r--host/examples/benchmark_rate.cpp3
-rw-r--r--host/examples/latency_test.cpp2
-rw-r--r--host/examples/network_relay.cpp5
-rw-r--r--host/examples/rx_ascii_art_dft.cpp9
-rw-r--r--host/examples/rx_multi_samples.cpp2
-rw-r--r--host/examples/rx_samples_to_file.cpp2
-rw-r--r--host/examples/rx_samples_to_udp.cpp2
-rw-r--r--host/examples/rx_timed_samples.cpp2
-rw-r--r--host/examples/test_dboard_coercion.cpp2
-rw-r--r--host/examples/test_messages.cpp2
-rw-r--r--host/examples/test_pps_input.cpp2
-rw-r--r--host/examples/test_timed_commands.cpp2
-rw-r--r--host/examples/transport_hammer.cpp2
-rw-r--r--host/examples/tx_bursts.cpp2
-rw-r--r--host/examples/tx_samples_from_file.cpp2
-rw-r--r--host/examples/tx_timed_samples.cpp2
-rw-r--r--host/examples/tx_waveforms.cpp2
-rw-r--r--host/examples/txrx_loopback_to_file.cpp2
-rw-r--r--host/include/uhd/types/tune_request.hpp15
-rw-r--r--host/include/uhd/utils/paths.hpp4
-rw-r--r--host/include/uhd/version.hpp4
-rw-r--r--host/lib/convert/CMakeLists.txt9
-rw-r--r--host/lib/transport/CMakeLists.txt4
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp27
-rw-r--r--host/lib/transport/usb_zero_copy_wrapper.cpp8
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp1
-rw-r--r--host/lib/usrp/b100/io_impl.cpp4
-rw-r--r--host/lib/usrp/common/recv_packet_demuxer.cpp30
-rw-r--r--host/lib/usrp/gps_ctrl.cpp144
-rw-r--r--host/lib/usrp/multi_usrp.cpp8
-rw-r--r--host/lib/utils/CMakeLists.txt8
-rw-r--r--host/lib/utils/images.cpp2
-rw-r--r--host/lib/utils/paths.cpp8
-rw-r--r--host/tests/CMakeLists.txt12
-rw-r--r--host/utils/fx2_init_eeprom.cpp8
-rw-r--r--host/utils/query_gpsdo_sensors.cpp3
-rw-r--r--host/utils/uhd_cal_rx_iq_balance.cpp5
-rw-r--r--host/utils/uhd_cal_tx_dc_offset.cpp4
-rw-r--r--host/utils/uhd_cal_tx_iq_balance.cpp5
-rw-r--r--host/utils/uhd_find_devices.cpp7
-rw-r--r--host/utils/uhd_usrp_probe.cpp9
-rw-r--r--host/utils/usrp_burn_db_eeprom.cpp4
-rw-r--r--host/utils/usrp_burn_mb_eeprom.cpp6
66 files changed, 1509 insertions, 177 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index cdcfc6529..3b2ce4297 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -52,7 +52,7 @@ SET(LIBRARY_DIR lib${LIB_SUFFIX})
SET(INCLUDE_DIR include)
SET(PKG_DATA_DIR share/uhd)
IF(NOT DEFINED PKG_LIB_DIR)
- SET(PKG_LIB_DIR ${PKG_DATA_DIR})
+ SET(PKG_LIB_DIR ${LIBRARY_DIR}/uhd)
ENDIF()
SET(PKG_DOC_DIR share/doc/uhd)
SET(PKG_MAN_DIR share/man/man1)
diff --git a/host/cmake/Modules/FindORC.cmake b/host/cmake/Modules/FindORC.cmake
new file mode 100644
index 000000000..0d9fc9ca1
--- /dev/null
+++ b/host/cmake/Modules/FindORC.cmake
@@ -0,0 +1,36 @@
+########################################################################
+# Find the library for ORC development files
+########################################################################
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_ORC "orc-0.4")
+PKG_CHECK_MODULES(PC_ORC_V4_11 "orc-0.4 > 0.4.11")
+
+#we are using the pkg config as a version check
+#if we have pkg config, the right version must be found
+#the alternative is that no pkg config orc is found
+if (PC_ORC_V4_11_FOUND OR (NOT PC_ORC_FOUND AND NOT PC_ORC_V4_11_FOUND))
+
+FIND_PATH(
+ ORC_INCLUDE_DIRS
+ NAMES orc/orc.h
+ HINTS $ENV{ORC_DIR}/include/orc-0.4
+ ${PC_ORC_INCLUDEDIR}
+ PATHS /usr/local/include/orc-0.4
+ /usr/include/orc-0.4
+)
+
+FIND_LIBRARY(
+ ORC_LIBRARIES
+ NAMES orc-0.4
+ HINTS $ENV{ORC_DIR}/lib
+ ${PC_ORC_LIBDIR}
+ PATHS /usr/local/lib
+ /usr/lib
+)
+
+endif() #both PC ORC FOUND
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ORC DEFAULT_MSG ORC_LIBRARIES ORC_INCLUDE_DIRS)
+MARK_AS_ADVANCED(ORC_LIBRARIES ORC_INCLUDE_DIRS)
diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake
index 21005344b..a1ab4ca90 100644
--- a/host/cmake/Modules/FindUSB1.cmake
+++ b/host/cmake/Modules/FindUSB1.cmake
@@ -32,7 +32,20 @@ FIND_LIBRARY(LIBUSB_LIBRARIES
PATHS /usr/local/lib /usr/lib /opt/local/lib
)
+enable_language(C) #needs C support for check below
+include(CheckFunctionExists)
+if(LIBUSB_INCLUDE_DIRS)
+ set(CMAKE_REQUIRED_INCLUDES ${LIBUSB_INCLUDE_DIRS})
+endif()
+if(LIBUSB_LIBRARIES)
+ set(CMAKE_REQUIRED_LIBRARIES ${LIBUSB_LIBRARIES})
+endif()
+CHECK_FUNCTION_EXISTS("libusb_handle_events_timeout_completed" HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED)
+
+if(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED)
+ list(APPEND LIBUSB_DEFINITIONS "HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED=1")
+endif(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED)
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES)
-
diff --git a/host/cmake/Modules/NSIS.InstallOptions.ini.in b/host/cmake/Modules/NSIS.InstallOptions.ini.in
new file mode 100644
index 000000000..969a3ae52
--- /dev/null
+++ b/host/cmake/Modules/NSIS.InstallOptions.ini.in
@@ -0,0 +1,37 @@
+[Settings]
+NumFields=4
+
+[Field 1]
+Type=label
+Text=By default the USRP Hardware Driver (UHD) does not add its directory to the system PATH.
+Left=0
+Right=-1
+Top=0
+Bottom=20
+
+[Field 2]
+Type=radiobutton
+Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH
+Left=0
+Right=-1
+Top=30
+Bottom=40
+State=1
+
+[Field 3]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users
+Left=0
+Right=-1
+Top=40
+Bottom=50
+State=0
+
+[Field 4]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user
+Left=0
+Right=-1
+Top=50
+Bottom=60
+State=0
diff --git a/host/cmake/Modules/NSIS.template.in b/host/cmake/Modules/NSIS.template.in
new file mode 100644
index 000000000..3ab55d907
--- /dev/null
+++ b/host/cmake/Modules/NSIS.template.in
@@ -0,0 +1,955 @@
+; CPack install script designed for a nmake build
+
+;--------------------------------
+; You must define these values
+
+ !define VERSION "@CPACK_PACKAGE_VERSION@"
+ !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
+ !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
+
+;--------------------------------
+;Variables
+
+ Var MUI_TEMP
+ Var STARTMENU_FOLDER
+ Var SV_ALLUSERS
+ Var START_MENU
+ Var DO_NOT_ADD_TO_PATH
+ Var ADD_TO_PATH_ALL_USERS
+ Var ADD_TO_PATH_CURRENT_USER
+ Var INSTALL_DESKTOP
+ Var IS_DEFAULT_INSTALLDIR
+;--------------------------------
+;Include Modern UI
+
+ !include "MUI.nsh"
+
+ ;Default installation folder
+ InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+;--------------------------------
+;General
+
+ ;Name and file
+ Name "USRP Hardware Driver"
+ OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
+
+ ;Set compression
+ SetCompressor @CPACK_NSIS_COMPRESSOR@
+
+@CPACK_NSIS_DEFINES@
+
+ !include Sections.nsh
+
+;--- Component support macros: ---
+; The code for the add/remove functionality is from:
+; http://nsis.sourceforge.net/Add/Remove_Functionality
+; It has been modified slightly and extended to provide
+; inter-component dependencies.
+Var AR_SecFlags
+Var AR_RegFlags
+@CPACK_NSIS_SECTION_SELECTED_VARS@
+
+; Loads the "selected" flag for the section named SecName into the
+; variable VarName.
+!macro LoadSectionSelectedIntoVar SecName VarName
+ SectionGetFlags ${${SecName}} $${VarName}
+ IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
+!macroend
+
+; Loads the value of a variable... can we get around this?
+!macro LoadVar VarName
+ IntOp $R0 0 + $${VarName}
+!macroend
+
+; Sets the value of a variable
+!macro StoreVar VarName IntValue
+ IntOp $${VarName} 0 + ${IntValue}
+!macroend
+
+!macro InitSection SecName
+ ; This macro reads component installed flag from the registry and
+ ;changes checked state of the section on the components page.
+ ;Input: section index constant name specified in Section command.
+
+ ClearErrors
+ ;Reading component status from registry
+ ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
+ IfErrors "default_${SecName}"
+ ;Status will stay default if registry value not found
+ ;(component was never installed)
+ IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
+ IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
+ IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
+
+ ; Note whether this component was installed before
+ !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
+ IntOp $R0 $AR_RegFlags & $AR_RegFlags
+
+ ;Writing modified flags
+ SectionSetFlags ${${SecName}} $AR_SecFlags
+
+ "default_${SecName}:"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+!macroend
+
+!macro FinishSection SecName
+ ; This macro reads section flag set by user and removes the section
+ ;if it is not selected.
+ ;Then it writes component installed flag to registry
+ ;Input: section index constant name specified in Section command.
+
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
+ ;Checking lowest bit:
+ IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
+ IntCmp $AR_SecFlags 1 "leave_${SecName}"
+ ;Section is not selected:
+ ;Calling Section uninstall macro and writing zero installed flag
+ !insertmacro "Remove_${${SecName}}"
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
+ "Installed" 0
+ Goto "exit_${SecName}"
+
+ "leave_${SecName}:"
+ ;Section is selected:
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
+ "Installed" 1
+
+ "exit_${SecName}:"
+!macroend
+
+!macro RemoveSection SecName
+ ; This macro is used to call section's Remove_... macro
+ ;from the uninstaller.
+ ;Input: section index constant name specified in Section command.
+
+ !insertmacro "Remove_${${SecName}}"
+!macroend
+
+; Determine whether the selection of SecName changed
+!macro MaybeSelectionChanged SecName
+ !insertmacro LoadVar ${SecName}_selected
+ SectionGetFlags ${${SecName}} $R1
+ IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
+
+ ; See if the status has changed:
+ IntCmp $R0 $R1 "${SecName}_unchanged"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+
+ IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
+ !insertmacro "Deselect_required_by_${SecName}"
+ goto "${SecName}_unchanged"
+
+ "${SecName}_was_selected:"
+ !insertmacro "Select_${SecName}_depends"
+
+ "${SecName}_unchanged:"
+!macroend
+;--- End of Add/Remove macros ---
+
+;--------------------------------
+;Interface Settings
+
+ !define MUI_HEADERIMAGE
+ !define MUI_ABORTWARNING
+
+;--------------------------------
+; path functions
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+;----------------------------------------
+; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
+;----------------------------------------
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+;====================================================
+; get_NT_environment
+; Returns: the selected environment
+; Output : head of the stack
+;====================================================
+!macro select_NT_profile UN
+Function ${UN}select_NT_profile
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
+ DetailPrint "Selected environment for all users"
+ Push "all"
+ Return
+ environment_single:
+ DetailPrint "Selected environment for current user only."
+ Push "current"
+ Return
+FunctionEnd
+!macroend
+!insertmacro select_NT_profile ""
+!insertmacro select_NT_profile "un."
+;----------------------------------------------------
+!define NT_current_env 'HKCU "Environment"'
+!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+
+!ifndef WriteEnvStr_RegKey
+ !ifdef ALL_USERS
+ !define WriteEnvStr_RegKey \
+ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+ !else
+ !define WriteEnvStr_RegKey 'HKCU "Environment"'
+ !endif
+!endif
+
+; AddToPath - Adds the given dir to the search path.
+; Input - head of the stack
+; Note - Win9x systems requires reboot
+
+Function AddToPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ # don't add if the path doesn't exist
+ IfFileExists "$0\*.*" "" AddToPath_done
+
+ ReadEnvStr $1 PATH
+ ; if the path is too long for a NSIS variable NSIS will return a 0
+ ; length string. If we find that, then warn and skip any path
+ ; modification as it will trash the existing path.
+ StrLen $2 $1
+ IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
+ CheckPathLength_ShowPathWarning:
+ Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
+ Goto AddToPath_done
+ CheckPathLength_Done:
+ Push "$1;"
+ Push "$0;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$0\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ GetFullPathName /SHORT $3 $0
+ Push "$1;"
+ Push "$3;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+ Push "$1;"
+ Push "$3\;"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" "" AddToPath_done
+
+ Call IsNT
+ Pop $1
+ StrCmp $1 1 AddToPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" a
+ FileSeek $1 -1 END
+ FileReadByte $1 $2
+ IntCmp $2 26 0 +2 +2 # DOS EOF
+ FileSeek $1 -1 END # write over EOF
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+ FileClose $1
+ SetRebootFlag true
+ Goto AddToPath_done
+
+ AddToPath_NT:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
+ ReadRegStr $1 ${NT_current_env} "PATH"
+ Goto DoTrim
+ ReadAllKey:
+ ReadRegStr $1 ${NT_all_env} "PATH"
+ DoTrim:
+ StrCmp $1 "" AddToPath_NTdoIt
+ Push $1
+ Call Trim
+ Pop $1
+ StrCpy $0 "$1;$0"
+ AddToPath_NTdoIt:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
+ WriteRegExpandStr ${NT_current_env} "PATH" $0
+ Goto DoSend
+ WriteAllKey:
+ WriteRegExpandStr ${NT_all_env} "PATH" $0
+ DoSend:
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ AddToPath_done:
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+
+; RemoveFromPath - Remove a given dir from the path
+; Input: head of the stack
+
+Function un.RemoveFromPath
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+
+ IntFmt $6 "%c" 26 # DOS EOF
+
+ Call un.IsNT
+ Pop $1
+ StrCmp $1 1 unRemoveFromPath_NT
+ ; Not on NT
+ StrCpy $1 $WINDIR 2
+ FileOpen $1 "$1\autoexec.bat" r
+ GetTempFileName $4
+ FileOpen $2 $4 w
+ GetFullPathName /SHORT $0 $0
+ StrCpy $0 "SET PATH=%PATH%;$0"
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoop:
+ FileRead $1 $3
+ StrCpy $5 $3 1 -1 # read last char
+ StrCmp $5 $6 0 +2 # if DOS EOF
+ StrCpy $3 $3 -1 # remove DOS EOF so we can compare
+ StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
+ StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+ FileWrite $2 $3
+ Goto unRemoveFromPath_dosLoop
+ unRemoveFromPath_dosLoopRemoveLine:
+ SetRebootFlag true
+ Goto unRemoveFromPath_dosLoop
+
+ unRemoveFromPath_dosLoopEnd:
+ FileClose $2
+ FileClose $1
+ StrCpy $1 $WINDIR 2
+ Delete "$1\autoexec.bat"
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
+ Delete $4
+ Goto unRemoveFromPath_done
+
+ unRemoveFromPath_NT:
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
+ ReadRegStr $1 ${NT_current_env} "PATH"
+ Goto unDoTrim
+ unReadAllKey:
+ ReadRegStr $1 ${NT_all_env} "PATH"
+ unDoTrim:
+ StrCpy $5 $1 1 -1 # copy last char
+ StrCmp $5 ";" +2 # if last char != ;
+ StrCpy $1 "$1;" # append ;
+ Push $1
+ Push "$0;"
+ Call un.StrStr ; Find `$0;` in $1
+ Pop $2 ; pos of our dir
+ StrCmp $2 "" unRemoveFromPath_done
+ ; else, it is in path
+ # $0 - path to add
+ # $1 - path var
+ StrLen $3 "$0;"
+ StrLen $4 $2
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+ StrCpy $3 $5$6
+
+ StrCpy $5 $3 1 -1 # copy last char
+ StrCmp $5 ";" 0 +2 # if last char == ;
+ StrCpy $3 $3 -1 # remove last char
+
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
+ WriteRegExpandStr ${NT_current_env} "PATH" $3
+ Goto unDoSend
+ unWriteAllKey:
+ WriteRegExpandStr ${NT_all_env} "PATH" $3
+ unDoSend:
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+ unRemoveFromPath_done:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall sutff
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+###########################################
+# Utility Functions #
+###########################################
+
+;====================================================
+; IsNT - Returns 1 if the current system is NT, 0
+; otherwise.
+; Output: head of the stack
+;====================================================
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+; Call IsNT
+; Pop $R0
+; ($R0 at this point is 1 or 0)
+
+!macro IsNT un
+Function ${un}IsNT
+ Push $0
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+ StrCmp $0 "" 0 IsNT_yes
+ ; we are not NT.
+ Pop $0
+ Push 0
+ Return
+
+ IsNT_yes:
+ ; NT!!!
+ Pop $0
+ Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+
+; StrStr
+; input, top of stack = string to search for
+; top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+; Push "this is a long ass string"
+; Push "ass"
+; Call StrStr
+; Pop $R0
+; ($R0 at this point is "ass string")
+
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+ Exch ; st=old$R1,haystack
+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+ Push $R3
+ Push $R4
+ Push $R5
+ StrLen $R3 $R1
+ StrCpy $R4 0
+ ; $R1=needle
+ ; $R2=haystack
+ ; $R3=len(needle)
+ ; $R4=cnt
+ ; $R5=tmp
+ loop:
+ StrCpy $R5 $R2 $R3 $R4
+ StrCmp $R5 $R1 done
+ StrCmp $R5 "" done
+ IntOp $R4 $R4 + 1
+ Goto loop
+done:
+ StrCpy $R1 $R2 "" $R4
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
+Function Trim ; Added by Pelaca
+ Exch $R1
+ Push $R2
+Loop:
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" " " RTrim
+ StrCmp "$R2" "$\n" RTrim
+ StrCmp "$R2" "$\r" RTrim
+ StrCmp "$R2" ";" RTrim
+ GoTo Done
+RTrim:
+ StrCpy $R1 "$R1" -1
+ Goto Loop
+Done:
+ Pop $R2
+ Exch $R1
+FunctionEnd
+
+Function ConditionalAddToRegisty
+ Pop $0
+ Pop $1
+ StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
+ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
+ "$1" "$0"
+ ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
+ DetailPrint "Set install registry entry: '$1' to '$0'"
+ ConditionalAddToRegisty_EmptyString:
+FunctionEnd
+
+;--------------------------------
+
+!ifdef CPACK_USES_DOWNLOAD
+Function DownloadFile
+ IfFileExists $INSTDIR\* +2
+ CreateDirectory $INSTDIR
+ Pop $0
+
+ ; Skip if already downloaded
+ IfFileExists $INSTDIR\$0 0 +2
+ Return
+
+ StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
+
+ try_again:
+ NSISdl::download "$1/$0" "$INSTDIR\$0"
+
+ Pop $1
+ StrCmp $1 "success" success
+ StrCmp $1 "Cancelled" cancel
+ MessageBox MB_OK "Download failed: $1"
+ cancel:
+ Return
+ success:
+FunctionEnd
+!endif
+
+;--------------------------------
+; Installation types
+@CPACK_NSIS_INSTALLATION_TYPES@
+
+;--------------------------------
+; Component sections
+@CPACK_NSIS_COMPONENT_SECTIONS@
+
+;--------------------------------
+; Define some macro setting for the gui
+@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
+@CPACK_NSIS_INSTALLER_ICON_CODE@
+@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
+@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
+
+;--------------------------------
+;Pages
+ !insertmacro MUI_PAGE_WELCOME
+
+ !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+ Page custom InstallOptionsPage
+ !insertmacro MUI_PAGE_DIRECTORY
+
+ ;Start Menu Folder Page Configuration
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+ !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
+
+ @CPACK_NSIS_PAGE_COMPONENTS@
+
+ !insertmacro MUI_PAGE_INSTFILES
+ !insertmacro MUI_PAGE_FINISH
+
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+ !insertmacro MUI_LANGUAGE "English" ;first language is the default language
+ !insertmacro MUI_LANGUAGE "Albanian"
+ !insertmacro MUI_LANGUAGE "Arabic"
+ !insertmacro MUI_LANGUAGE "Basque"
+ !insertmacro MUI_LANGUAGE "Belarusian"
+ !insertmacro MUI_LANGUAGE "Bosnian"
+ !insertmacro MUI_LANGUAGE "Breton"
+ !insertmacro MUI_LANGUAGE "Bulgarian"
+ !insertmacro MUI_LANGUAGE "Croatian"
+ !insertmacro MUI_LANGUAGE "Czech"
+ !insertmacro MUI_LANGUAGE "Danish"
+ !insertmacro MUI_LANGUAGE "Dutch"
+ !insertmacro MUI_LANGUAGE "Estonian"
+ !insertmacro MUI_LANGUAGE "Farsi"
+ !insertmacro MUI_LANGUAGE "Finnish"
+ !insertmacro MUI_LANGUAGE "French"
+ !insertmacro MUI_LANGUAGE "German"
+ !insertmacro MUI_LANGUAGE "Greek"
+ !insertmacro MUI_LANGUAGE "Hebrew"
+ !insertmacro MUI_LANGUAGE "Hungarian"
+ !insertmacro MUI_LANGUAGE "Icelandic"
+ !insertmacro MUI_LANGUAGE "Indonesian"
+ !insertmacro MUI_LANGUAGE "Irish"
+ !insertmacro MUI_LANGUAGE "Italian"
+ !insertmacro MUI_LANGUAGE "Japanese"
+ !insertmacro MUI_LANGUAGE "Korean"
+ !insertmacro MUI_LANGUAGE "Kurdish"
+ !insertmacro MUI_LANGUAGE "Latvian"
+ !insertmacro MUI_LANGUAGE "Lithuanian"
+ !insertmacro MUI_LANGUAGE "Luxembourgish"
+ !insertmacro MUI_LANGUAGE "Macedonian"
+ !insertmacro MUI_LANGUAGE "Malay"
+ !insertmacro MUI_LANGUAGE "Mongolian"
+ !insertmacro MUI_LANGUAGE "Norwegian"
+ !insertmacro MUI_LANGUAGE "Polish"
+ !insertmacro MUI_LANGUAGE "Portuguese"
+ !insertmacro MUI_LANGUAGE "PortugueseBR"
+ !insertmacro MUI_LANGUAGE "Romanian"
+ !insertmacro MUI_LANGUAGE "Russian"
+ !insertmacro MUI_LANGUAGE "Serbian"
+ !insertmacro MUI_LANGUAGE "SerbianLatin"
+ !insertmacro MUI_LANGUAGE "SimpChinese"
+ !insertmacro MUI_LANGUAGE "Slovak"
+ !insertmacro MUI_LANGUAGE "Slovenian"
+ !insertmacro MUI_LANGUAGE "Spanish"
+ !insertmacro MUI_LANGUAGE "Swedish"
+ !insertmacro MUI_LANGUAGE "Thai"
+ !insertmacro MUI_LANGUAGE "TradChinese"
+ !insertmacro MUI_LANGUAGE "Turkish"
+ !insertmacro MUI_LANGUAGE "Ukrainian"
+ !insertmacro MUI_LANGUAGE "Welsh"
+
+
+;--------------------------------
+;Reserve Files
+
+ ;These files should be inserted before other files in the data block
+ ;Keep these lines before any File command
+ ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
+
+ ReserveFile "NSIS.InstallOptions.ini"
+ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+;--------------------------------
+;Installer Sections
+
+Section "-Core installation"
+ ;Use the entire tree produced by the INSTALL target. Keep the
+ ;list of directories here in sync with the RMDir commands below.
+ SetOutPath "$INSTDIR"
+ @CPACK_NSIS_FULL_INSTALL@
+
+ ;Store installation folder
+ WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
+
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+ Push "DisplayName"
+ Push "@CPACK_NSIS_DISPLAY_NAME@"
+ Call ConditionalAddToRegisty
+ Push "DisplayVersion"
+ Push "@CPACK_PACKAGE_VERSION@"
+ Call ConditionalAddToRegisty
+ Push "Publisher"
+ Push "@CPACK_PACKAGE_VENDOR@"
+ Call ConditionalAddToRegisty
+ Push "UninstallString"
+ Push "$INSTDIR\Uninstall.exe"
+ Call ConditionalAddToRegisty
+ Push "NoRepair"
+ Push "1"
+ Call ConditionalAddToRegisty
+
+ !ifdef CPACK_NSIS_ADD_REMOVE
+ ;Create add/remove functionality
+ Push "ModifyPath"
+ Push "$INSTDIR\AddRemove.exe"
+ Call ConditionalAddToRegisty
+ !else
+ Push "NoModify"
+ Push "1"
+ Call ConditionalAddToRegisty
+ !endif
+
+ ; Optional registration
+ Push "DisplayIcon"
+ Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
+ Call ConditionalAddToRegisty
+ Push "HelpLink"
+ Push "@CPACK_NSIS_HELP_LINK@"
+ Call ConditionalAddToRegisty
+ Push "URLInfoAbout"
+ Push "@CPACK_NSIS_URL_INFO_ABOUT@"
+ Call ConditionalAddToRegisty
+ Push "Contact"
+ Push "@CPACK_NSIS_CONTACT@"
+ Call ConditionalAddToRegisty
+ !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+
+ ;Create shortcuts
+ CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+@CPACK_NSIS_CREATE_ICONS@
+@CPACK_NSIS_CREATE_ICONS_EXTRA@
+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\USRP2 Card Burner.lnk" "$INSTDIR\lib\uhd\utils\usrp2_card_burner_gui.py" "" "" "" SW_SHOWMINIMIZED
+ CreateShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\USRP-N2XX Net Burner.lnk" "$INSTDIR\lib\uhd\utils\usrp_n2xx_net_burner_gui.py" "" "" "" SW_SHOWMINIMIZED
+ CreateShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\UHD Images Downloader.lnk" "$INSTDIR\lib\uhd\utils\uhd_images_downloader.py"
+
+ ;Read a value from an InstallOptions INI file
+ !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
+
+ ; Write special uninstall registry entries
+ Push "StartMenu"
+ Push "$STARTMENU_FOLDER"
+ Call ConditionalAddToRegisty
+ Push "DoNotAddToPath"
+ Push "$DO_NOT_ADD_TO_PATH"
+ Call ConditionalAddToRegisty
+ Push "AddToPathAllUsers"
+ Push "$ADD_TO_PATH_ALL_USERS"
+ Call ConditionalAddToRegisty
+ Push "AddToPathCurrentUser"
+ Push "$ADD_TO_PATH_CURRENT_USER"
+ Call ConditionalAddToRegisty
+ Push "InstallToDesktop"
+ Push "$INSTALL_DESKTOP"
+ Call ConditionalAddToRegisty
+
+ !insertmacro MUI_STARTMENU_WRITE_END
+
+@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
+
+SectionEnd
+
+Section "-Add to path"
+ Push $INSTDIR\bin
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
+ StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
+ Call AddToPath
+ doNotAddToPath:
+SectionEnd
+
+;--------------------------------
+; Create custom pages
+Function InstallOptionsPage
+ !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing the USRP Hardware Driver (UHD)"
+ !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
+
+FunctionEnd
+
+;--------------------------------
+; determine admin versus local install
+Function un.onInit
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ Goto done
+ StrCmp $1 "Power" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ Goto done
+
+ noLM:
+ ;Get installation folder from registry if available
+
+ done:
+
+FunctionEnd
+
+;--- Add/Remove callback functions: ---
+!macro SectionList MacroName
+ ;This macro used to perform operation on multiple sections.
+ ;List all of your components in following manner here.
+@CPACK_NSIS_COMPONENT_SECTION_LIST@
+!macroend
+
+Section -FinishComponents
+ ;Removes unselected components and writes component status to registry
+ !insertmacro SectionList "FinishSection"
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+ ; Get the name of the installer executable
+ System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
+ StrCpy $R3 $R0
+
+ ; Strip off the last 13 characters, to see if we have AddRemove.exe
+ StrLen $R1 $R0
+ IntOp $R1 $R0 - 13
+ StrCpy $R2 $R0 13 $R1
+ StrCmp $R2 "AddRemove.exe" addremove_installed
+
+ ; We're not running AddRemove.exe, so install it
+ CopyFiles $R3 $INSTDIR\AddRemove.exe
+
+ addremove_installed:
+!endif
+SectionEnd
+;--- End of Add/Remove callback functions ---
+
+;--------------------------------
+; Component dependencies
+Function .onSelChange
+ !insertmacro SectionList MaybeSelectionChanged
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+ ReadRegStr $START_MENU SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
+ ;MessageBox MB_OK "Start menu is in: $START_MENU"
+ ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
+ ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
+ ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
+ ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
+ ReadRegStr $INSTALL_DESKTOP SHCTX \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
+ ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
+
+@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
+
+ ;Remove files we installed.
+ ;Keep the list of directories here in sync with the File commands above.
+@CPACK_NSIS_DELETE_FILES@
+@CPACK_NSIS_DELETE_DIRECTORIES@
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+ ;Remove the add/remove program
+ Delete "$INSTDIR\AddRemove.exe"
+!endif
+
+ ;Remove the uninstaller itself.
+ Delete "$INSTDIR\Uninstall.exe"
+ DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ ;Remove the installation directory if it is empty.
+ RMDir "$INSTDIR"
+
+ ; Remove the registry entries.
+ DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ ; Removes all optional components
+ !insertmacro SectionList "RemoveSection"
+
+ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
+
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+@CPACK_NSIS_DELETE_ICONS@
+@CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+ ;Delete empty start menu parent diretories
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+ startMenuDeleteLoop:
+ ClearErrors
+ RMDir $MUI_TEMP
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+ IfErrors startMenuDeleteLoopDone
+
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
+ startMenuDeleteLoopDone:
+
+ ; If the user changed the shortcut, then untinstall may not work. This should
+ ; try to fix it.
+ StrCpy $MUI_TEMP "$START_MENU"
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+ Delete "$SMPROGRAMS\$MUI_TEMP\USRP2 Card Burner.lnk"
+ Delete "$SMPROGRAMS\$MUI_TEMP\USRP-N2XX Net Burner.lnk"
+ Delete "$SMPROGRAMS\$MUI_TEMP\UHD Images Downloader.lnk"
+@CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+ ;Delete empty start menu parent diretories
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+ secondStartMenuDeleteLoop:
+ ClearErrors
+ RMDir $MUI_TEMP
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+ IfErrors secondStartMenuDeleteLoopDone
+
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
+ secondStartMenuDeleteLoopDone:
+
+ DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+ Push $INSTDIR\bin
+ StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
+ Call un.RemoveFromPath
+ doNotRemoveFromPath:
+SectionEnd
+
+;--------------------------------
+; determine admin versus local install
+; Is install for "AllUsers" or "JustMe"?
+; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
+; This function is used for the very first "custom page" of the installer.
+; This custom page does not show up visibly, but it executes prior to the
+; first visible page and sets up $INSTDIR properly...
+; Choose different default installation folder based on SV_ALLUSERS...
+; "Program Files" for AllUsers, "My Documents" for JustMe...
+
+Function .onInit
+ ; Reads components status for registry
+ !insertmacro SectionList "InitSection"
+
+ ; check to see if /D has been used to change
+ ; the install directory by comparing it to the
+ ; install directory that is expected to be the
+ ; default
+ StrCpy $IS_DEFAULT_INSTALLDIR 0
+ StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
+ StrCpy $IS_DEFAULT_INSTALLDIR 1
+
+ StrCpy $SV_ALLUSERS "JustMe"
+ ; if default install dir then change the default
+ ; if it is installed for JustMe
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+ ClearErrors
+ UserInfo::GetName
+ IfErrors noLM
+ Pop $0
+ UserInfo::GetAccountType
+ Pop $1
+ StrCmp $1 "Admin" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+ StrCmp $1 "Power" 0 +3
+ SetShellVarContext all
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+ StrCpy $SV_ALLUSERS "AllUsers"
+ Goto done
+
+ noLM:
+ StrCpy $SV_ALLUSERS "AllUsers"
+ ;Get installation folder from registry if available
+
+ done:
+ StrCmp $SV_ALLUSERS "AllUsers" 0 +3
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
+ !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+ noOptionsPage:
+FunctionEnd
diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake
index 67a6bc588..0ce390699 100644
--- a/host/cmake/Modules/UHDPackage.cmake
+++ b/host/cmake/Modules/UHDPackage.cmake
@@ -117,7 +117,6 @@ 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")
@@ -126,7 +125,6 @@ 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")
@@ -136,7 +134,6 @@ 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)")
@@ -148,7 +145,7 @@ 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)
+SET(CPACK_COMPONENTS_ALL libraries headers utilities examples manual doxygen readme images)
########################################################################
# Setup CPack Debian
@@ -191,11 +188,11 @@ 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\\\"
+ WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_PATH\\\" \\\"$INSTDIR\\\"
")
SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
- DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\"
+ DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_PATH\\\"
")
########################################################################
diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake
new file mode 100644
index 000000000..47cddc521
--- /dev/null
+++ b/host/cmake/Modules/UHDUnitTest.cmake
@@ -0,0 +1,110 @@
+#
+# Copyright 2010-2012 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/>.
+#
+
+########################################################################
+# Add a unit test and setup the environment for a unit test.
+# Takes the same arguments as the ADD_TEST function.
+#
+# Before calling set the following variables:
+# UHD_TEST_TARGET_DEPS - built targets for the library path
+# UHD_TEST_LIBRARY_DIRS - directories for the library path
+########################################################################
+function(UHD_ADD_TEST test_name)
+
+ #Ensure that the build exe also appears in the PATH.
+ list(APPEND UHD_TEST_TARGET_DEPS ${ARGN})
+
+ #In the land of windows, all libraries must be in the PATH.
+ #Since the dependent libraries are not yet installed,
+ #we must manually set them in the PATH to run tests.
+ #The following appends the path of a target dependency.
+ foreach(target ${UHD_TEST_TARGET_DEPS})
+ get_target_property(location ${target} LOCATION)
+ if(location)
+ get_filename_component(path ${location} PATH)
+ string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
+ list(APPEND UHD_TEST_LIBRARY_DIRS ${path})
+ endif(location)
+ endforeach(target)
+
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
+ file(TO_NATIVE_PATH "${UHD_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+
+ #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
+ #Replaced this add test + set environs code with the shell script generation.
+ #Its nicer to be able to manually run the shell script to diagnose problems.
+ #ADD_TEST(${ARGV})
+ #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
+
+ if(UNIX)
+ set(LD_PATH_VAR "LD_LIBRARY_PATH")
+ if(APPLE)
+ set(LD_PATH_VAR "DYLD_LIBRARY_PATH")
+ endif()
+
+ set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ list(APPEND libpath "$${LD_PATH_VAR}")
+
+ #replace list separator with the path separator
+ string(REPLACE ";" ":" libpath "${libpath}")
+ list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}")
+
+ #generate a bat file that sets the environment and runs the test
+ find_program(SHELL sh)
+ set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
+ file(WRITE ${sh_file} "#!${SHELL}\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${sh_file} "export ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${sh_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${sh_file} "\n")
+
+ #make the shell file executable
+ execute_process(COMMAND chmod +x ${sh_file})
+
+ add_test(${test_name} ${SHELL} ${sh_file})
+
+ endif(UNIX)
+
+ if(WIN32)
+ list(APPEND libpath ${DLL_PATHS} "%PATH%")
+
+ #replace list separator with the path separator (escaped)
+ string(REPLACE ";" "\\;" libpath "${libpath}")
+ list(APPEND environs "PATH=${libpath}")
+
+ #generate a bat file that sets the environment and runs the test
+ set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
+ file(WRITE ${bat_file} "@echo off\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${bat_file} "SET ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${bat_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${bat_file} "\n")
+
+ add_test(${test_name} ${bat_file})
+ endif(WIN32)
+
+endfunction(UHD_ADD_TEST)
diff --git a/host/cmake/debian/postinst.in b/host/cmake/debian/postinst.in
index eaca15394..bc27c46f0 100755
--- a/host/cmake/debian/postinst.in
+++ b/host/cmake/debian/postinst.in
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright 2011 Ettus Research LLC
+# Copyright 2011,2013 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,7 +17,7 @@
#
if [ "$1" = "configure" ]; then
- cp @CMAKE_INSTALL_PREFIX@/share/uhd/utils/uhd-usrp.rules /etc/udev/rules.d/uhd-usrp.rules
+ cp @CMAKE_INSTALL_PREFIX@/lib/uhd/utils/uhd-usrp.rules /etc/udev/rules.d/uhd-usrp.rules
udevadm control --reload-rules
ldconfig
fi
diff --git a/host/cmake/redhat/post_install.in b/host/cmake/redhat/post_install.in
index 01fd3338f..25864e0ec 100755
--- a/host/cmake/redhat/post_install.in
+++ b/host/cmake/redhat/post_install.in
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright 2011 Ettus Research LLC
+# Copyright 2011,2013 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
@@ -16,6 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-cp @CMAKE_INSTALL_PREFIX@/share/uhd/utils/uhd-usrp.rules /etc/udev/rules.d/uhd-usrp.rules
+cp @CMAKE_INSTALL_PREFIX@/lib/uhd/utils/uhd-usrp.rules /etc/udev/rules.d/uhd-usrp.rules
udevadm control --reload-rules
ldconfig
diff --git a/host/docs/build.rst b/host/docs/build.rst
index 0a18e9e9a..00f79aaaa 100644
--- a/host/docs/build.rst
+++ b/host/docs/build.rst
@@ -1,5 +1,5 @@
========================================================================
-UHD - Build Guide
+UHD Software - Build Guide
========================================================================
.. contents:: Table of Contents
diff --git a/host/docs/calibration.rst b/host/docs/calibration.rst
index 1468a9c2a..3f7ea005e 100644
--- a/host/docs/calibration.rst
+++ b/host/docs/calibration.rst
@@ -7,11 +7,11 @@ UHD - Calibration Application Notes
------------------------------------------------------------------------
Self-calibration
------------------------------------------------------------------------
-UHD comes with several self-calibration utilities for minimizing IQ imbalance and DC offset.
+UHD software comes with several self-calibration utilities for minimizing IQ imbalance and DC offset.
These utilities perform calibration sweeps using transmit leakage into the receive path
(special equipment is not required).
The results from a calibration are written to a CSV file in the user's home directory.
-UHD will automatically apply corrections at runtime when the user re-tunes the daughterboard LO.
+UHD software will automatically apply corrections at runtime when the user re-tunes the daughterboard LO.
Calibration results are specific to an individual RF board.
**Note:**
@@ -19,7 +19,7 @@ When a calibration table is present,
and the user wishes to override the calibration settings through the API:
the user should re-apply the desired setting every time the LO is re-tuned.
-UHD comes with the following calibration utilities:
+UHD software comes with the following calibration utilities:
* **uhd_cal_rx_iq_balance:** - mimimizes RX IQ imbalance vs. LO frequency
* **uhd_cal_tx_dc_offset:** - mimimizes TX DC offset vs. LO frequency
@@ -34,7 +34,7 @@ The following RF frontends are supported by the self-calibration utilities:
********************************************
Calibration Utilities
********************************************
-UHD installs the calibration utilities into **<install-path>/bin**.
+UHD software installs the calibration utilities into **<install-path>/bin**.
**Disconnect** any external hardware from the RF antenna ports,
and run the following from the command line.
Each utility will take several minutes to complete.
diff --git a/host/docs/coding.rst b/host/docs/coding.rst
index ef8cb5fe2..432307cca 100644
--- a/host/docs/coding.rst
+++ b/host/docs/coding.rst
@@ -11,7 +11,7 @@ Various API interfaces
Low-Level: The device API
^^^^^^^^^^^^^^^^^^^^^^^^^^^
A device is an abstraction for hardware that is connected to the host system.
-For a USRP, this means that the motherboard and everything on it would be
+For a USRP device, this means that the motherboard and everything on it would be
considered to be a "device". The device API provides ways to:
* Discover devices that are physically connected to the host system.
@@ -25,6 +25,6 @@ See the documentation in *device.hpp* for reference.
^^^^^^^^^^^^^^^^^^^^^^^^^^^
High-Level: The Multi-USRP
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The Multi-USRP class provides a fat interface to a single USRP with
-one or more channels, or multiple USRPs in a homogeneous setup.
+The Multi-USRP class provides a fat interface to a single USRP device with
+one or more channels, or multiple USRP devicess in a homogeneous setup.
See the documentation in *usrp/multi_usrp.hpp* for reference.
diff --git a/host/docs/dboards.rst b/host/docs/dboards.rst
index 29812592f..3f4875c4c 100644
--- a/host/docs/dboards.rst
+++ b/host/docs/dboards.rst
@@ -1,5 +1,5 @@
========================================================================
-UHD - Daughterboard Application Notes
+UHD Daughterboard Application Notes
========================================================================
.. contents:: Table of Contents
@@ -335,14 +335,14 @@ With the daughterboard plugged-in, run the following commands:
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)
-* **<slot>** is the name of the daughterboard slot (optional if the USRP has only one slot)
+* **<args>** are device address arguments (optional if only one USRP device is on your machine)
+* **<slot>** is the name of the daughterboard slot (optional if the USRP device has only one slot)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
RFX - Mod
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Older RFX boards require modifications to use the motherboard oscillator.
-If this is the case, UHD will print a warning about the modification.
+If this is the case, UHD software will print a warning about the modification.
Please follow the modification procedures below:
**Step 1: Disable the daughterboard clocks**
@@ -377,5 +377,5 @@ With the daughterboard plugged-in, run the following commands:
* **RFX1800:** 0x0035
* **RFX1200:** 0x002a
* **RFX2400:** 0x002b
-* **<args>** are device address arguments (optional if only one USRP is on your machine)
-* **<slot>** is the name of the daughterboard slot (optional if the USRP has only one slot)
+* **<args>** are device address arguments (optional if only one USRP device is on your machine)
+* **<slot>** is the name of the daughterboard slot (optional if the USRP device has only one slot)
diff --git a/host/docs/general.rst b/host/docs/general.rst
index fc7caff3c..fc2735c46 100644
--- a/host/docs/general.rst
+++ b/host/docs/general.rst
@@ -23,10 +23,10 @@ frequency and actual frequency. The user may also explicitly control both
stages of tuning through through the **tune_request_t** object, which allows for
more advanced tuning.
-In general, Using UHD's advanced tuning is highly recommended as it makes it
+In general, Using UHD software's advanced tuning is highly recommended as it makes it
easy to move the DC component out of your band-of-interest. This can be done by
-passing your desired LO offset to the **tune_request_t** object, and letting UHD
-handle the rest.
+passing your desired LO offset to the **tune_request_t** object, and letting the UHD
+software handle the rest.
Tuning the receive chain:
::
@@ -125,13 +125,13 @@ Overflow notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When receiving, the device produces samples at a constant rate.
Overflows occurs when the host does not consume data fast enough.
-When UHD detects the overflow, it prints an "O" to stdout,
+When UHD software detects the overflow, it prints an "O" to stdout,
and pushes an inline message packet into the receive stream.
**Network-based devices**:
The host does not back-pressure the receive stream.
When the kernel's socket buffer becomes full, it will drop subsequent packets.
-UHD detects the overflow as a discontinuity in the packet's sequence numbers,
+UHD software detects the overflow as a discontinuity in the packet's sequence numbers,
and pushes an inline message packet into the receive stream.
**Other devices**:
@@ -140,14 +140,14 @@ Therefore, overflows always occur in the device itself.
When the device's internal buffers become full, streaming is shut off,
and an inline message packet is sent to the host.
If the device was in continuous streaming mode,
-UHD will automatically restart streaming.
+the UHD software will automatically restart streaming.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Underflow notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When transmitting, the device consumes samples at a constant rate.
Underflow occurs when the host does not produce data fast enough.
-When UHD detects underflow, it prints a "U" to stdout,
+When UHD software detects the underflow, it prints a "U" to stdout,
and pushes a message packet into the async message stream.
------------------------------------------------------------------------
@@ -157,7 +157,7 @@ Threading Notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thread safety notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-For the most part, UHD is thread-safe.
+For the most part, UHD software is thread-safe.
Please observe the following limitations:
**Fast-path thread requirements:**
@@ -177,8 +177,8 @@ It is recommended to use at most one thread context for manipulating device sett
Thread priority scheduling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When UHD spawns a new thread it may try to boost the thread's scheduling priority.
-When setting the priority fails, UHD prints out an error.
+When UHD software spawns a new thread it may try to boost the thread's scheduling priority.
+When setting the priority fails, the UHD software prints out an error.
This error is harmless; it simply means that the thread will have a normal scheduling priority.
**Linux Notes:**
@@ -211,7 +211,7 @@ Disabling or redirecting prints to stdout
The user can disable the UHD library from printing directly to stdout by registering a custom message handler.
The handler will intercept all messages, which can be dropped or redirected.
Only one handler can be registered at a time.
-Make **register_handler** your first call into UHD:
+Make **register_handler** your first call into the UHD library:
::
diff --git a/host/docs/identification.rst b/host/docs/identification.rst
index a5e60e7f9..ba9b30898 100644
--- a/host/docs/identification.rst
+++ b/host/docs/identification.rst
@@ -5,7 +5,7 @@ UHD - Device Identification Notes
.. contents:: Table of Contents
------------------------------------------------------------------------
-Identifying USRPs
+Identifying USRP Devices
------------------------------------------------------------------------
Devices are addressed through key/value string pairs.
These string pairs can be used to narrow down the search for a specific device or group of devices.
@@ -89,10 +89,10 @@ such as detected daughterboards, frequency range, gain ranges, etc...
uhd_usrp_probe --args <device-specific-address-args>
------------------------------------------------------------------------
-Naming a USRP
+Naming a USRP Device
------------------------------------------------------------------------
-For convenience purposes, users may assign a custom name to their USRPs.
-The USRP can then be identified via name, rather than a difficult to remember serial or address.
+For convenience purposes, users may assign a custom name to their USRP device.
+The USRP device can then be identified via name, rather than a difficult to remember serial or address.
A name has the following properties:
diff --git a/host/docs/images.rst b/host/docs/images.rst
index dc9770460..95e2d96b0 100644
--- a/host/docs/images.rst
+++ b/host/docs/images.rst
@@ -29,7 +29,7 @@ See the UHD wiki for the download link.
The pre-built images come in two forms:
-* bundled with UHD in a platform-specific installer
+* bundled with UHD software in a platform-specific installer
* stand-alone platform-independent archive files
^^^^^^^^^^^^^^^^^^^^^^
@@ -59,7 +59,7 @@ When installing images from an archive, there are two options:
**Option 1:**
Unpack the archive into the UHD installation prefix.
-UHD will always search **<install-path>/share/uhd/images** for image files.
+UHD software 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 00b1c9618..5e3d08fb4 100644
--- a/host/docs/index.rst
+++ b/host/docs/index.rst
@@ -2,17 +2,17 @@
UHD - USRP Hardware Driver
========================================================================
-UHD is the "Universal Software Radio Peripheral" hardware driver.
-The goal of UHD is to provide a host driver and API for current and future Ettus Research products.
+UHD software is the "Universal Software Radio Peripheral" Hardware Driver software.
+The goal of UHD software 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 or with third-party applications.
------------------------------------------------------------------------
Contents
------------------------------------------------------------------------
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Building and Installing UHD
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Building and Installing UHD Software
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* `Build Guide <./build.html>`_
* `Installation Guide (Linux) <http://code.ettus.com/redmine/ettus/projects/uhd/wiki/UHD_Linux>`_
* `Installation Guide (Windows) <http://code.ettus.com/redmine/ettus/projects/uhd/wiki/UHD_Windows>`_
diff --git a/host/docs/sync.rst b/host/docs/sync.rst
index 8622dc642..a1f6cb7df 100644
--- a/host/docs/sync.rst
+++ b/host/docs/sync.rst
@@ -4,9 +4,9 @@ UHD - Synchronization Application Notes
.. contents:: Table of Contents
-The following application notes explain how to synchronize multiple USRPs
-with the goal of transmitting or receiving time-aligned samples for MIMO
-or other applications requiring multiple USRPs operating synchronously.
+The following application notes explain how to synchronize multiple USRP
+devices with the goal of transmitting or receiving time-aligned samples for MIMO
+or other applications requiring multiple USRP devices operating synchronously.
**Note:** The following synchronization notes do not apply to USRP1,
which does not support the advanced features available in newer products.
@@ -14,7 +14,7 @@ which does not support the advanced features available in newer products.
------------------------------------------------------------------------
Common Reference Signals
------------------------------------------------------------------------
-USRPs take two reference signals in order to synchronize clocks and time:
+USRP devices take two reference signals in order to synchronize clocks and time:
* A 10MHz reference to provide a single frequency reference for both devices.
* A pulse-per-second (PPS) to synchronize the sample time across devices.
@@ -103,16 +103,16 @@ and the user can also parse this string to determine GPS time:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Method 3 - internal GPSDO
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-USRPs with internal GPSDOs properly configured will automatically
+USRP devices with internal GPSDOs properly configured will automatically
configure themselves to set the VITA time to current UTC time.
See the `GPSDO Application Notes <./gpsdo.html>`_ for more details.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Method 4 - MIMO cable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-A USRP can synchronize its time to another USRP via the MIMO cable.
+A USRP device can synchronize its time to another USRP device via the MIMO cable.
Unlike the other methods, this does not use a real "pulse per second".
-Rather, the USRP sends an encoded time message over the MIMO cable.
+Rather, the USRP device sends an encoded time message over the MIMO cable.
The slave device will automatically synchronize to the time on the master device.
See the `MIMO Cable Application Notes <./usrp2.html#using-the-mimo-cable>`_ for more detail.
@@ -123,7 +123,7 @@ Synchronizing Channel Phase
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Align CORDICs in the DSP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-In order to achieve phase alignment between USRPs, the CORDICS in both
+In order to achieve phase alignment between USRP devices, the CORDICS in both
devices must be aligned with respect to each other. This is easily achieved
by issuing stream commands with a time spec property, which instructs the
streaming to begin at a specified time. Since the devices are already
diff --git a/host/docs/transport.rst b/host/docs/transport.rst
index 2e39e75d1..db89c8db9 100644
--- a/host/docs/transport.rst
+++ b/host/docs/transport.rst
@@ -14,7 +14,7 @@ These optional parameters control how the transport object allocates memory,
resizes kernel buffers, spawns threads, etc.
When not spcified, the transport layer will use values for these parameters
that are known to perform well on a variety of systems.
-The transport parameters are defined below for the various transports in the UHD:
+The transport parameters are defined below for the various transports in the UHD software:
------------------------------------------------------------------------
UDP Transport (Sockets)
@@ -154,11 +154,11 @@ so that non-root users may access the device:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Install USB driver (Windows)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-A driver package must be installed to use a USB-based product with UHD:
+A driver package must be installed to use a USB-based product with UHD software:
* Download the driver from the UHD wiki page `here <http://files.ettus.com/binaries/misc/erllc_uhd_winusb_driver.zip>`_.
* Unzip the file into a known location. We will refer to this as the **<directory>**.
-* Open the device manager and plug in the USRP. You will see an unrecognized USB device in the device manager.
+* Open the device manager and plug in the USRP device. You will see an unrecognized USB device in the device manager.
* Right click on the unrecognized USB device and select update/install driver software (may vary for your OS).
* In the driver installation wizard, select "browse for driver", browse to the **<directory>**, and select the **.inf** file.
* Continue through the installation wizard until the driver is installed.
diff --git a/host/docs/usrp1.rst b/host/docs/usrp1.rst
index c1fdec146..b6fd24b09 100644
--- a/host/docs/usrp1.rst
+++ b/host/docs/usrp1.rst
@@ -79,7 +79,7 @@ Hardware Setup Notes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
External clock modification
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The USRP can be modified to accept an external clock reference instead of the 64MHz onboard reference.
+The USRP device can be modified to accept an external clock reference instead of the 64MHz onboard reference.
* Solder SMA (**LTI-SASF54GT**) connector to **J2001**.
* Move 0 ohm 0603 resistor **R2029** to **R2030**.
* Move 0.01uF 0603 capacitor **C925** to **C926**.
@@ -89,7 +89,7 @@ The new external clock needs to be a square wave between +7dBm and +15dBm
After the hardware modification,
the user should burn the setting into the EEPROM,
-so UHD can initialize with the correct clock rate.
+so UHD software can initialize with the correct clock rate.
Run the following commands to record the setting into the EEPROM:
::
diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst
index e675e61ba..5f1e51ea9 100644
--- a/host/docs/usrp2.rst
+++ b/host/docs/usrp2.rst
@@ -148,7 +148,7 @@ any parameters:
ifconfig -a
**Note:**
-When using UHD, if an IP address for the USRP2 is not specified,
+When using UHD software, if an IP address for the USRP2 is not specified,
the software will use UDP broadcast packets to locate the USRP2.
On some systems, the firewall will block UDP broadcast packets.
It is recommended that you change or disable your firewall settings.
@@ -213,13 +213,13 @@ The following tips are designed to help narrow down and diagnose the problem.
RuntimeError: no control response
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a common error that occurs when you have set the subnet of your network
-interface to a different subnet than the network interface of the USRP. For
-example, if your network interface is set to **192.168.20.1**, and the USRP is
+interface to a different subnet than the network interface of the USRP device. For
+example, if your network interface is set to **192.168.20.1**, and the USRP device is
**192.168.10.2** (note the difference in the third numbers of the IP addresses), you
will likely see a 'no control response' error message.
Fixing this is simple - just set the your host PC's IP address to the same
-subnet as that of your USRP. Instructions for setting your IP address are in the
+subnet as that of your USRP device. Instructions for setting your IP address are in the
previous section of this documentation.
@@ -238,7 +238,7 @@ or create a rule to allow all incoming packets with UDP source port **49152**.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Ping the device
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The USRP will reply to ICMP echo requests.
+The USRP device will reply to ICMP echo requests.
A successful ping response means that the device has booted properly
and that it is using the expected IP address.
@@ -346,7 +346,7 @@ the following clock configuration must be set on the slave device:
------------------------------------------------------------------------
Alternative stream destination
------------------------------------------------------------------------
-It is possible to program the USRP to send RX packets to an alternative IP/UDP destination.
+It is possible to program the USRP device to send RX packets to an alternative IP/UDP destination.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set the subnet and gateway
@@ -429,7 +429,7 @@ Using a PPS signal for timestamp synchronization requires a square wave signal w
Test the PPS input with the following app:
-* **<args>** are device address arguments (optional if only one USRP is on your machine)
+* **<args>** are device address arguments (optional if only one USRP device is on your machine)
::
diff --git a/host/docs/usrp_b100.rst b/host/docs/usrp_b100.rst
index cdb853b61..b5dc79b50 100644
--- a/host/docs/usrp_b100.rst
+++ b/host/docs/usrp_b100.rst
@@ -21,7 +21,7 @@ Comparative features list
------------------------------------------------------------------------
Specify a Non-standard Image
------------------------------------------------------------------------
-UHD will automatically select the USRP B-Series images from the installed images package.
+UHD software will automatically select the USRP B-Series images from the installed images package.
The image selection can be overridden with the **--fpga=** and **--fw=** device address parameters.
Example device address string representations to specify non-standard images:
@@ -54,7 +54,7 @@ and X4 must be populated with a 61.44 MHz oscillator.
* **J15** is a three pin header, move the jumper to (pin1, pin2)
* **357LB3I061M4400** is the recommended oscillator for X4
-**Note:** See instructions below to communicate the desired clock rate into UHD.
+**Note:** See instructions below to communicate the desired clock rate into UHD software.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set other rates - uses internal VCO
@@ -63,7 +63,7 @@ To use other clock rates, the jumper will need to be in the default position.
* **J15** is a three pin header, move the jumper to (pin2, pin3)
-To communicate the desired clock rate into UHD,
+To communicate the desired clock rate into UHD software,
specify the a special device address argument,
where the key is **master_clock_rate** and the value is a rate in Hz.
Example:
diff --git a/host/docs/usrp_e1x0.rst b/host/docs/usrp_e1x0.rst
index 189cbb86b..fc929e639 100644
--- a/host/docs/usrp_e1x0.rst
+++ b/host/docs/usrp_e1x0.rst
@@ -22,7 +22,7 @@ Comparative features list
------------------------------------------------------------------------
Specify a Non-standard Image
------------------------------------------------------------------------
-UHD will automatically select the USRP-Embedded FPGA image from the
+UHD software will automatically select the USRP-Embedded FPGA image from the
installed images package. The FPGA image selection can be overridden with the
**--fpga=** device address parameter.
@@ -53,7 +53,7 @@ on the device.
* **J16** is a two pin header; remove the jumper (or leave it on pin1 only).
* **J15** is a three pin header; move the jumper to (pin1, pin2).
-**Note:** See instructions below to communicate the desired clock rate UHD.
+**Note:** See instructions below to communicate the desired clock rate to UHD software.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set other rates - uses internal VCO
@@ -63,7 +63,7 @@ To use other clock rates, the jumpers will need to be in the default position.
* **J16** is a two pin header; move the jumper to (pin1, pin2).
* **J15** is a three pin header; move the jumper to (pin2, pin3).
-To communicate the desired clock rate into UHD,
+To communicate the desired clock rate into UHD software,
specify the a special device address argument,
where the key is **master_clock_rate** and the value is a rate in Hz.
Example:
@@ -103,7 +103,7 @@ a connector.
Test the PPS input with the following app:
-* **<args** are device address arguments (optional if only one USRP is on your machine).
+* **<args** are device address arguments (optional if only one USRP device is on your machine).
::
@@ -116,7 +116,7 @@ Internal GPSDO
Please see the `Internal GPSDO Application Notes <./gpsdo.html>`_
for information on configuring and using the internal GPSDO.
-UHD will always try to detect an installed GPSDO at runtime.
+UHD software will always try to detect an installed GPSDO at runtime.
There is not a special EEPROM value to burn for GPSDO detection.
------------------------------------------------------------------------
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp
index 8a000f6c3..ed3a8580a 100644
--- a/host/examples/benchmark_rate.cpp
+++ b/host/examples/benchmark_rate.cpp
@@ -25,6 +25,7 @@
#include <boost/math/special_functions/round.hpp>
#include <iostream>
#include <complex>
+#include <cstdlib>
namespace po = boost::program_options;
@@ -264,5 +265,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/latency_test.cpp b/host/examples/latency_test.cpp
index 518d2383a..461ac9bf8 100644
--- a/host/examples/latency_test.cpp
+++ b/host/examples/latency_test.cpp
@@ -164,5 +164,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
**************************************************************/
std::cout << boost::format("\nACK %d, UNDERFLOW %d, TIME_ERR %d, other %d")
% ack % underflow % time_error % other << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/network_relay.cpp b/host/examples/network_relay.cpp
index e8f9e667f..bb09296b3 100644
--- a/host/examples/network_relay.cpp
+++ b/host/examples/network_relay.cpp
@@ -24,6 +24,7 @@
#include <iostream>
#include <csignal>
#include <vector>
+#include <cstdlib>
namespace po = boost::program_options;
namespace asio = boost::asio;
@@ -202,7 +203,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
<< "Runs a network relay between UHD on one computer and a USRP on the network.\n"
<< "This example is basically for test purposes. Use at your own convenience.\n"
<< std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
{
@@ -223,5 +224,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp
index fe8fb0347..1aede51a4 100644
--- a/host/examples/rx_ascii_art_dft.cpp
+++ b/host/examples/rx_ascii_art_dft.cpp
@@ -25,6 +25,7 @@
#include <curses.h>
#include <iostream>
#include <complex>
+#include <cstdlib>
namespace po = boost::program_options;
@@ -63,7 +64,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print the help message
if (vm.count("help") or not vm.count("rate")){
std::cout << boost::format("UHD RX ASCII Art DFT %s") % desc << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//create a usrp device
@@ -82,7 +83,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//set the sample rate
if (not vm.count("rate")){
std::cerr << "Please specify the sample rate with --rate" << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
std::cout << boost::format("Setting RX Rate: %f Msps...") % (rate/1e6) << std::endl;
usrp->set_rx_rate(rate);
@@ -91,7 +92,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//set the center frequency
if (not vm.count("freq")){
std::cerr << "Please specify the center frequency with --freq" << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
std::cout << boost::format("Setting RX Freq: %f MHz...") % (freq/1e6) << std::endl;
usrp->set_rx_freq(freq);
@@ -194,5 +195,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/rx_multi_samples.cpp b/host/examples/rx_multi_samples.cpp
index 42ef33d70..83d648eb5 100644
--- a/host/examples/rx_multi_samples.cpp
+++ b/host/examples/rx_multi_samples.cpp
@@ -174,5 +174,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp
index 5197bfe69..d0a02a6c1 100644
--- a/host/examples/rx_samples_to_file.cpp
+++ b/host/examples/rx_samples_to_file.cpp
@@ -214,5 +214,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp
index 2acaa5d8b..f637f9313 100644
--- a/host/examples/rx_samples_to_udp.cpp
+++ b/host/examples/rx_samples_to_udp.cpp
@@ -168,5 +168,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 143bceb03..f0d49b4bd 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -124,5 +124,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp
index 5b1e9f0e2..cfc745147 100644
--- a/host/examples/test_dboard_coercion.cpp
+++ b/host/examples/test_dboard_coercion.cpp
@@ -573,5 +573,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
if(test_tx and test_rx) std::cout << std::endl;
if(test_rx) std::cout << rx_results << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp
index afb092092..6f2ddfe28 100644
--- a/host/examples/test_messages.cpp
+++ b/host/examples/test_messages.cpp
@@ -350,5 +350,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/test_pps_input.cpp b/host/examples/test_pps_input.cpp
index 994b7ca87..c07f2fffd 100644
--- a/host/examples/test_pps_input.cpp
+++ b/host/examples/test_pps_input.cpp
@@ -58,5 +58,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << std::endl << "Attempt to detect the PPS and set the time..." << std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/test_timed_commands.cpp b/host/examples/test_timed_commands.cpp
index 34c83dfd6..cecf1607c 100644
--- a/host/examples/test_timed_commands.cpp
+++ b/host/examples/test_timed_commands.cpp
@@ -125,5 +125,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/transport_hammer.cpp b/host/examples/transport_hammer.cpp
index e32912eaa..ff35ceb21 100644
--- a/host/examples/transport_hammer.cpp
+++ b/host/examples/transport_hammer.cpp
@@ -272,5 +272,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/tx_bursts.cpp b/host/examples/tx_bursts.cpp
index 4cf5f2fd1..8dd4a002c 100644
--- a/host/examples/tx_bursts.cpp
+++ b/host/examples/tx_bursts.cpp
@@ -156,5 +156,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp
index 04a6a63d4..f9447c25d 100644
--- a/host/examples/tx_samples_from_file.cpp
+++ b/host/examples/tx_samples_from_file.cpp
@@ -192,5 +192,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp
index 3b8cc75d4..4cc31a7c0 100644
--- a/host/examples/tx_timed_samples.cpp
+++ b/host/examples/tx_timed_samples.cpp
@@ -124,5 +124,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 3c5eecd65..40326ae93 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -260,5 +260,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/examples/txrx_loopback_to_file.cpp b/host/examples/txrx_loopback_to_file.cpp
index 495c9f7e4..9dc348da8 100644
--- a/host/examples/txrx_loopback_to_file.cpp
+++ b/host/examples/txrx_loopback_to_file.cpp
@@ -443,5 +443,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//finished
std::cout << std::endl << "Done!" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/include/uhd/types/tune_request.hpp b/host/include/uhd/types/tune_request.hpp
index 9c498bfe9..dd6123a9f 100644
--- a/host/include/uhd/types/tune_request.hpp
+++ b/host/include/uhd/types/tune_request.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2012 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,6 +19,7 @@
#define INCLUDED_UHD_TYPES_TUNE_REQUEST_HPP
#include <uhd/config.hpp>
+#include <uhd/types/device_addr.hpp>
namespace uhd{
@@ -88,6 +89,18 @@ namespace uhd{
*/
double dsp_freq;
+ /*!
+ * The args parameter is used to pass arbitrary key/value pairs.
+ * Possible keys used by args (depends on implementation):
+ *
+ * - mode_n: Allows the user to tell the daughterboard tune code
+ * to choose between an integer N diviver or fractional N divider.
+ * Default is fractional N on boards that support fractional N tuning.
+ * Fractional N provides greater tuning acuracy at the expense of spurs.
+ * Possible options for this key: "integer" or "fractional".
+ */
+ device_addr_t args;
+
};
} //namespace uhd
diff --git a/host/include/uhd/utils/paths.hpp b/host/include/uhd/utils/paths.hpp
index f5a40b2c9..e0f455e92 100644
--- a/host/include/uhd/utils/paths.hpp
+++ b/host/include/uhd/utils/paths.hpp
@@ -29,8 +29,8 @@ namespace uhd{
//! Get a string representing the system's appdata directory
UHD_API std::string get_app_path(void);
- //! Get a string representing the system's pkg data directory
- UHD_API std::string get_pkg_data_path(void);
+ //! Get a string representing the system's pkg directory
+ UHD_API std::string get_pkg_path(void);
} //namespace uhd
diff --git a/host/include/uhd/version.hpp b/host/include/uhd/version.hpp
index ab693f2b0..01e5c3cdb 100644
--- a/host/include/uhd/version.hpp
+++ b/host/include/uhd/version.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2012 Ettus Research LLC
+// Copyright 2010-2013 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
@@ -27,7 +27,7 @@
* The format is oldest API compatible release - ABI compat number.
* The compatibility number allows pre-release ABI to be versioned.
*/
-#define UHD_VERSION_ABI_STRING "3.4.0-3"
+#define UHD_VERSION_ABI_STRING "3.6.0-0"
namespace uhd{
diff --git a/host/lib/convert/CMakeLists.txt b/host/lib/convert/CMakeLists.txt
index 0d9d0983f..28defa8bc 100644
--- a/host/lib/convert/CMakeLists.txt
+++ b/host/lib/convert/CMakeLists.txt
@@ -24,12 +24,11 @@ MESSAGE(STATUS "")
########################################################################
# Look for Orc support
########################################################################
-FIND_PACKAGE(PkgConfig)
-IF(PKG_CONFIG_FOUND)
-PKG_CHECK_MODULES(ORC "orc-0.4 > 0.4.11")
-ENDIF(PKG_CONFIG_FOUND)
+FIND_PACKAGE(ORC)
-FIND_PROGRAM(ORCC_EXECUTABLE orcc)
+IF(NOT ORCC_EXECUTABLE)
+ FIND_PROGRAM(ORCC_EXECUTABLE orcc)
+ENDIF()
LIBUHD_REGISTER_COMPONENT("ORC" ENABLE_ORC ON "ENABLE_LIBUHD;ORC_FOUND;ORCC_EXECUTABLE" OFF)
diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt
index 6524a8412..4eb7c8c92 100644
--- a/host/lib/transport/CMakeLists.txt
+++ b/host/lib/transport/CMakeLists.txt
@@ -37,6 +37,10 @@ IF(ENABLE_USB)
${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.hpp
)
+ SET_SOURCE_FILES_PROPERTIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp
+ PROPERTIES COMPILE_DEFINITIONS "${LIBUSB_DEFINITIONS}"
+ )
ELSE(ENABLE_USB)
LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/usb_dummy_impl.cpp
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index 28bff9709..3532dc4aa 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2012 Ettus Research LLC
+// Copyright 2010-2013 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
@@ -36,6 +36,12 @@ static const size_t DEFAULT_XFER_SIZE = 32*512; //bytes
#define LIBUSB_CALL
#endif /*LIBUSB_CALL*/
+//! libusb_handle_events_timeout_completed is only in newer API
+#ifndef HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED
+ #define libusb_handle_events_timeout_completed(ctx, tx, completed)\
+ libusb_handle_events_timeout(ctx, tx)
+#endif
+
/*!
* 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.
@@ -43,7 +49,8 @@ static const size_t DEFAULT_XFER_SIZE = 32*512; //bytes
//! helper function: handles all async callbacks
static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){
- *(static_cast<bool *>(lut->user_data)) = true;
+ int *completed = (int *)lut->user_data;
+ *completed = 1;
}
/*!
@@ -61,7 +68,7 @@ static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){
* \param completed a reference to the completed flag
* \return true for completion, false for timeout
*/
-UHD_INLINE bool wait_for_completion(libusb_context *ctx, const double timeout, bool &completed){
+UHD_INLINE bool wait_for_completion(libusb_context *ctx, const double timeout, int &completed){
//already completed by a previous call?
if (completed) return true;
@@ -69,7 +76,7 @@ UHD_INLINE bool wait_for_completion(libusb_context *ctx, const double timeout, b
timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
- libusb_handle_events_timeout(ctx, &tv);
+ libusb_handle_events_timeout_completed(ctx, &tv, &completed);
if (completed) return true;
//finish the rest with a timeout loop
@@ -78,7 +85,7 @@ UHD_INLINE bool wait_for_completion(libusb_context *ctx, const double timeout, b
timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 10000; /*10ms*/
- libusb_handle_events_timeout(ctx, &tv);
+ libusb_handle_events_timeout_completed(ctx, &tv, &completed);
}
return completed;
@@ -96,7 +103,7 @@ public:
_lut(lut), _frame_size(frame_size) { /* NOP */ }
void release(void){
- completed = false;
+ completed = 0;
_lut->length = _frame_size; //always reset length
UHD_ASSERT_THROW(libusb_submit_transfer(_lut) == 0);
}
@@ -109,7 +116,7 @@ public:
return managed_recv_buffer::sptr();
}
- bool completed;
+ int completed;
private:
libusb_context *_ctx;
@@ -129,7 +136,7 @@ public:
_lut(lut), _frame_size(frame_size) { completed = true; }
void release(void){
- completed = false;
+ completed = 0;
_lut->length = size();
UHD_ASSERT_THROW(libusb_submit_transfer(_lut) == 0);
}
@@ -142,7 +149,7 @@ public:
return managed_send_buffer::sptr();
}
- bool completed;
+ int completed;
private:
libusb_context *_ctx;
@@ -249,7 +256,7 @@ public:
}
//process all transfers until timeout occurs
- bool completed = false;
+ int completed = 0;
wait_for_completion(ctx, 0.01, completed);
//free all transfers
diff --git a/host/lib/transport/usb_zero_copy_wrapper.cpp b/host/lib/transport/usb_zero_copy_wrapper.cpp
index d04244ca9..ec5667020 100644
--- a/host/lib/transport/usb_zero_copy_wrapper.cpp
+++ b/host/lib/transport/usb_zero_copy_wrapper.cpp
@@ -176,6 +176,14 @@ public:
}
managed_recv_buffer::sptr get_recv_buff(double timeout){
+ //lazy flush mechanism - negative timeout
+ if (timeout < 0.0)
+ {
+ _last_recv_buff.reset();
+ while (_internal_zc->get_recv_buff()){}
+ return managed_recv_buffer::sptr();
+ }
+
//attempt to get a managed recv buffer
if (not _last_recv_buff){
_last_recv_buff = _internal_zc->get_recv_buff(timeout);
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index c4d050242..b3237d547 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -516,6 +516,7 @@ void b100_impl::check_fw_compat(void){
"%s"
) % B100_FW_COMPAT_NUM % fw_compat_num % print_images_error()));
}
+ _tree->create<std::string>("/mboards/0/fw_version").set(str(boost::format("%u.0") % fw_compat_num));
}
void b100_impl::check_fpga_compat(void){
diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp
index 723756dcc..bcf712cd9 100644
--- a/host/lib/usrp/b100/io_impl.cpp
+++ b/host/lib/usrp/b100/io_impl.cpp
@@ -153,6 +153,10 @@ rx_streamer::sptr b100_impl::get_rx_stream(const uhd::stream_args_t &args_){
id.num_outputs = 1;
my_streamer->set_converter(id);
+ //flush stuff
+ _data_transport->get_recv_buff(-1.0); //negative flushes!!
+ _recv_demuxer = recv_packet_demuxer::make(_data_transport, _rx_dsps.size(), B100_RX_SID_BASE);
+
//bind callbacks for the handler
for (size_t chan_i = 0; chan_i < args.channels.size(); chan_i++){
const size_t dsp = args.channels[chan_i];
diff --git a/host/lib/usrp/common/recv_packet_demuxer.cpp b/host/lib/usrp/common/recv_packet_demuxer.cpp
index f2cfe3bb0..fe606213c 100644
--- a/host/lib/usrp/common/recv_packet_demuxer.cpp
+++ b/host/lib/usrp/common/recv_packet_demuxer.cpp
@@ -19,6 +19,8 @@
#include <uhd/utils/msg.hpp>
#include <uhd/utils/byteswap.hpp>
#include <boost/thread/mutex.hpp>
+#include <uhd/transport/vrt_if_packet.hpp>
+#include <uhd/types/metadata.hpp>
#include <queue>
#include <deque>
#include <vector>
@@ -27,6 +29,19 @@ using namespace uhd;
using namespace uhd::usrp;
using namespace uhd::transport;
+struct recv_pkt_demux_mrb : public managed_recv_buffer
+{
+public:
+ recv_pkt_demux_mrb(void){/*NOP*/}
+
+ void release(void)
+ {
+ delete this;
+ }
+
+ boost::uint32_t buff[10];
+};
+
static UHD_INLINE boost::uint32_t extract_sid(managed_recv_buffer::sptr &buff){
//ASSUME that the data is in little endian format
return uhd::wtohx(buff->cast<const boost::uint32_t *>()[1]);
@@ -66,7 +81,20 @@ public:
//otherwise queue and try again
if (rx_index < _queues.size()) _queues[rx_index].wrapper.push(buff);
- else UHD_MSG(error) << "Got a data packet with unknown SID " << extract_sid(buff) << std::endl;
+ else
+ {
+ UHD_MSG(error) << "Got a data packet with unknown SID " << extract_sid(buff) << std::endl;
+ recv_pkt_demux_mrb *mrb = new recv_pkt_demux_mrb();
+ vrt::if_packet_info_t info;
+ info.packet_type = vrt::if_packet_info_t::PACKET_TYPE_DATA;
+ info.num_payload_words32 = 1;
+ info.num_payload_bytes = info.num_payload_words32*sizeof(boost::uint32_t);
+ info.has_sid = true;
+ info.sid = _sid_base + index;
+ vrt::if_hdr_pack_le(mrb->buff, info);
+ mrb->buff[info.num_header_words32] = rx_metadata_t::ERROR_CODE_OVERFLOW;
+ return mrb->make(mrb, mrb->buff, info.num_packet_words32*sizeof(boost::uint32_t));
+ }
}
}
diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp
index f3bdded60..c3af75faa 100644
--- a/host/lib/usrp/gps_ctrl.cpp
+++ b/host/lib/usrp/gps_ctrl.cpp
@@ -26,6 +26,10 @@
#include <boost/thread/thread.hpp>
#include <boost/tokenizer.hpp>
#include <boost/format.hpp>
+#include <boost/regex.hpp>
+
+#include "boost/tuple/tuple.hpp"
+#include "boost/foreach.hpp"
using namespace uhd;
using namespace boost::gregorian;
@@ -38,14 +42,69 @@ using namespace boost::this_thread;
*/
class gps_ctrl_impl : public gps_ctrl{
+private:
+ std::map<std::string, boost::tuple<std::string, boost::system_time, bool> > sensors;
+
+ std::string get_cached_sensor(const std::string sensor, const int freshness, const bool once, const bool touch=true) {
+ boost::system_time time = boost::get_system_time();
+ try {
+ // this is nasty ...
+ //std::cout << boost::format("Requested %s - seen? ") % sensor << sensors[sensor].get<2>() << " once? " << once << std::endl;
+ if(time - sensors[sensor].get<1>() < milliseconds(freshness) && (!once or !sensors[sensor].get<2>())) {
+ sensors[sensor] = boost::make_tuple(sensors[sensor].get<0>(), sensors[sensor].get<1>(), touch);
+ return sensors[sensor].get<0>();
+ } else {
+ return update_cached_sensors(sensor);
+ }
+ } catch(std::exception &e) {
+ UHD_MSG(warning) << "get_cached_sensor: " << e.what();
+ }
+ return std::string();
+ }
+
+ std::string update_cached_sensors(const std::string sensor) {
+ if(not gps_detected() || (gps_type != GPS_TYPE_JACKSON_LABS)) {
+ UHD_MSG(error) << "get_stat(): unsupported GPS or no GPS detected";
+ return std::string();
+ }
+
+ std::string msg = _recv();
+ static const boost::regex status_regex("\\d\\d-\\d\\d-\\d\\d");
+ boost::system_time time = boost::get_system_time();
+ if(msg.size() < 6)
+ return std::string();
+
+ std::string nmea = msg.substr(1,5);
+ const std::list<std::string> list = boost::assign::list_of("GPGGA")("GPRMC");
+ BOOST_FOREACH(std::string key, list) {
+ // beginning matches one of the NMEA keys
+ if(!nmea.compare(key)) {
+ sensors[key] = boost::make_tuple(msg, time, !sensor.compare(key));
+ // if this was what we're looking for return it
+ return (!sensor.compare(key))? msg : std::string();
+ }
+ }
+
+ //We're still here so it's not one of the NMEA strings from above
+ if(boost::regex_search(msg, status_regex, boost::regex_constants::match_continuous)) {
+ trim(msg);
+ sensors["SERVO"] = boost::make_tuple(msg, time, false);
+ if(!sensor.compare("SERVO"))
+ return msg;
+ else
+ return std::string();
+ }
+ return std::string();
+ }
public:
gps_ctrl_impl(uart_iface::sptr uart){
_uart = uart;
+
std::string reply;
bool i_heard_some_nmea = false, i_heard_something_weird = false;
gps_type = GPS_TYPE_NONE;
-
+
//first we look for a Jackson Labs Firefly (since that's what we provide...)
_flush(); //get whatever junk is in the rx buffer right now, and throw it away
_send("HAAAY GUYYYYS\n"); //to elicit a response from the Firefly
@@ -60,7 +119,7 @@ public:
if(reply.find("Command Error") != std::string::npos) {
gps_type = GPS_TYPE_JACKSON_LABS;
break;
- }
+ }
else if(reply.substr(0, 3) == "$GP") i_heard_some_nmea = true; //but keep looking for that "Command Error" response
else if(reply.length() != 0) i_heard_something_weird = true; //probably wrong baud rate
sleep(milliseconds(GPS_TIMEOUT_DELAY_MS));
@@ -99,7 +158,8 @@ public:
("gps_gpgga")
("gps_gprmc")
("gps_time")
- ("gps_locked");
+ ("gps_locked")
+ ("gps_servo");
return ret;
}
@@ -108,7 +168,7 @@ public:
or key == "gps_gprmc") {
return sensor_value_t(
boost::to_upper_copy(key),
- get_nmea(boost::to_upper_copy(key.substr(4,8))),
+ get_cached_sensor(boost::to_upper_copy(key.substr(4,8)), GPS_NMEA_NORMAL_FRESHNESS, false, false),
"");
}
else if(key == "gps_time") {
@@ -117,6 +177,9 @@ public:
else if(key == "gps_locked") {
return sensor_value_t("GPS lock status", locked(), "locked", "unlocked");
}
+ else if(key == "gps_servo") {
+ return sensor_value_t("GPS servo status", get_servo(), "");
+ }
else {
throw uhd::value_error("gps ctrl get_sensor unknown key: " + key);
}
@@ -138,24 +201,25 @@ private:
sleep(milliseconds(FIREFLY_STUPID_DELAY_MS));
_send("GPS:GPRMC 1\n");
sleep(milliseconds(FIREFLY_STUPID_DELAY_MS));
+ _send("SERV:TRAC 0\n");
+ sleep(milliseconds(FIREFLY_STUPID_DELAY_MS));
}
-
+
//retrieve a raw NMEA sentence
std::string get_nmea(std::string msgtype) {
- msgtype.insert(0, "$");
std::string reply;
- if(not gps_detected()) {
- UHD_MSG(error) << "get_nmea(): unsupported GPS or no GPS detected";
- return std::string();
- }
-
- _flush(); //flush all input before waiting for a message
const boost::system_time comm_timeout = boost::get_system_time() + milliseconds(GPS_COMM_TIMEOUT_MS);
while(boost::get_system_time() < comm_timeout) {
- reply = _recv();
- if(reply.substr(0, 6) == msgtype)
- return reply;
+ if(!msgtype.compare("GPRMC")) {
+ reply = get_cached_sensor(msgtype, GPS_NMEA_FRESHNESS, true);
+ }
+ else {
+ reply = get_cached_sensor(msgtype, GPS_NMEA_LOW_FRESHNESS, false);
+ }
+ if(reply.size()) {
+ if(reply.substr(1, 5) == msgtype) return reply;
+ }
boost::this_thread::sleep(milliseconds(GPS_TIMEOUT_DELAY_MS));
}
throw uhd::value_error(str(boost::format("get_nmea(): no %s message found") % msgtype));
@@ -176,9 +240,10 @@ private:
}
ptime get_time(void) {
+ _flush();
int error_cnt = 0;
ptime gps_time;
- while(error_cnt < 3) {
+ while(error_cnt < 2) {
try {
std::string reply = get_nmea("GPRMC");
@@ -188,29 +253,30 @@ private:
if(datestr.size() == 0 or timestr.size() == 0) {
throw uhd::value_error(str(boost::format("Invalid response \"%s\"") % reply));
}
-
+
//just trust me on this one
- gps_time = ptime( date(
+ gps_time = ptime( date(
greg_year(boost::lexical_cast<int>(datestr.substr(4, 2)) + 2000),
- greg_month(boost::lexical_cast<int>(datestr.substr(2, 2))),
- greg_day(boost::lexical_cast<int>(datestr.substr(0, 2)))
+ greg_month(boost::lexical_cast<int>(datestr.substr(2, 2))),
+ greg_day(boost::lexical_cast<int>(datestr.substr(0, 2)))
),
hours( boost::lexical_cast<int>(timestr.substr(0, 2)))
+ minutes(boost::lexical_cast<int>(timestr.substr(2, 2)))
+ seconds(boost::lexical_cast<int>(timestr.substr(4, 2)))
);
return gps_time;
-
+
} catch(std::exception &e) {
UHD_MSG(warning) << "get_time: " << e.what();
+ _flush();
error_cnt++;
}
}
throw uhd::value_error("Timeout after no valid message found");
-
+
return gps_time; //keep gcc from complaining
}
-
+
time_t get_epoch_time(void) {
return (get_time() - from_time_t(0)).total_seconds();
}
@@ -223,7 +289,7 @@ private:
int error_cnt = 0;
while(error_cnt < 3) {
try {
- std::string reply = get_nmea("GPGGA");
+ std::string reply = get_cached_sensor("GPGGA", GPS_LOCK_FRESHNESS, false, false);
if(reply.size() <= 1) return false;
return (get_token(reply, 6) != "0");
@@ -236,6 +302,29 @@ private:
return false;
}
+ std::string get_servo(void) {
+
+ //enable servo reporting
+ _send("SERV:TRAC 1\n");
+ sleep(milliseconds(FIREFLY_STUPID_DELAY_MS));
+
+ std::string reply;
+
+ const boost::system_time comm_timeout = boost::get_system_time() + milliseconds(GPS_COMM_TIMEOUT_MS);
+ while(boost::get_system_time() < comm_timeout) {
+ reply = get_cached_sensor("SERVO", GPS_NMEA_LOW_FRESHNESS, false);
+ if(reply.size())
+ {
+ //disable it before leaving function
+ _send("SERV:TRAC 0\n");
+ return reply;
+ }
+ boost::this_thread::sleep(milliseconds(GPS_TIMEOUT_DELAY_MS));
+ }
+ throw uhd::value_error("get_stat(): no servo message found");
+ return std::string();
+ }
+
uart_iface::sptr _uart;
void _flush(void){
@@ -258,7 +347,12 @@ private:
GPS_TYPE_NONE
} gps_type;
- static const int GPS_COMM_TIMEOUT_MS = 1500;
+ static const int GPS_COMM_TIMEOUT_MS = 1300;
+ static const int GPS_NMEA_FRESHNESS = 10;
+ static const int GPS_NMEA_LOW_FRESHNESS = 2500;
+ static const int GPS_NMEA_NORMAL_FRESHNESS = 1000;
+ static const int GPS_SERVO_FRESHNESS = 2500;
+ static const int GPS_LOCK_FRESHNESS = 2500;
static const int GPS_TIMEOUT_DELAY_MS = 200;
static const int FIREFLY_STUPID_DELAY_MS = 200;
};
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 0331cf93a..46dd8b670 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -140,6 +140,14 @@ static tune_result_t tune_xx_subdev_and_dsp(
}
//------------------------------------------------------------------
+ //-- poke the tune request args into the dboard
+ //------------------------------------------------------------------
+ if (rf_fe_subtree->exists("tune_args"))
+ {
+ rf_fe_subtree->access<device_addr_t>("tune_args").set(tune_request.args);
+ }
+
+ //------------------------------------------------------------------
//-- set the RF frequency depending upon the policy
//------------------------------------------------------------------
double target_rf_freq = 0.0;
diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt
index 95105f917..a28e1f9ef 100644
--- a/host/lib/utils/CMakeLists.txt
+++ b/host/lib/utils/CMakeLists.txt
@@ -115,14 +115,14 @@ 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}")
+FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX} UHD_PKG_PATH)
+STRING(REPLACE "\\" "\\\\" UHD_PKG_PATH ${UHD_PKG_PATH})
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/images.cpp
PROPERTIES COMPILE_DEFINITIONS
- "UHD_PKG_DATA_PATH=\"${UHD_PKG_DATA_PATH}\""
+ "UHD_PKG_PATH=\"${UHD_PKG_PATH}\";UHD_LIB_DIR=\"lib${LIB_SUFFIX}\""
)
########################################################################
diff --git a/host/lib/utils/images.cpp b/host/lib/utils/images.cpp
index 251cadeaa..1ba2f81e6 100644
--- a/host/lib/utils/images.cpp
+++ b/host/lib/utils/images.cpp
@@ -42,7 +42,7 @@ std::string uhd::find_image_path(const std::string &image_name){
}
std::string uhd::find_images_downloader(void){
- return fs::path((fs::path(get_pkg_data_path()) / "utils" / "uhd_images_downloader.py")).string();
+ return fs::path(fs::path(uhd::get_pkg_path()) / UHD_LIB_DIR / "uhd" / "utils" / "uhd_images_downloader.py").string();
}
std::string uhd::print_images_error(void){
diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp
index 26fa6d1c7..53055314b 100644
--- a/host/lib/utils/paths.cpp
+++ b/host/lib/utils/paths.cpp
@@ -71,20 +71,20 @@ static std::vector<fs::path> get_env_paths(const std::string &var_name){
/***********************************************************************
* Get a list of special purpose paths
**********************************************************************/
-std::string uhd::get_pkg_data_path(void)
+std::string uhd::get_pkg_path(void)
{
- return get_env_var("UHD_PKG_DATA_PATH", UHD_PKG_DATA_PATH);
+ return get_env_var("UHD_PKG_PATH", UHD_PKG_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(uhd::get_pkg_data_path()) / "images");
+ paths.push_back(fs::path(uhd::get_pkg_path()) / "share" / "uhd" / "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(uhd::get_pkg_data_path()) / "modules");
+ paths.push_back(fs::path(uhd::get_pkg_path()) / UHD_LIB_DIR / "uhd" / "modules");
return paths;
}
diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt
index e9d1e5e92..2a40d0050 100644
--- a/host/tests/CMakeLists.txt
+++ b/host/tests/CMakeLists.txt
@@ -16,6 +16,11 @@
#
########################################################################
+# unit test support
+########################################################################
+include(UHDUnitTest)
+
+########################################################################
# unit test suite
########################################################################
SET(test_sources
@@ -39,12 +44,15 @@ SET(test_sources
#turn each test cpp file into an executable with an int main() function
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
-#for each source: build an executable, register it as a test, and install
+SET(UHD_TEST_TARGET_DEPS uhd)
+SET(UHD_TEST_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
+
+#for each source: build an executable, register it as a test
FOREACH(test_source ${test_sources})
GET_FILENAME_COMPONENT(test_name ${test_source} NAME_WE)
ADD_EXECUTABLE(${test_name} ${test_source})
TARGET_LINK_LIBRARIES(${test_name} uhd)
- ADD_TEST(${test_name} ${test_name})
+ UHD_ADD_TEST(${test_name} ${test_name})
UHD_INSTALL(TARGETS ${test_name} RUNTIME DESTINATION ${PKG_LIB_DIR}/tests COMPONENT tests)
ENDFOREACH(test_source)
diff --git a/host/utils/fx2_init_eeprom.cpp b/host/utils/fx2_init_eeprom.cpp
index c210ae575..701092a5d 100644
--- a/host/utils/fx2_init_eeprom.cpp
+++ b/host/utils/fx2_init_eeprom.cpp
@@ -41,12 +41,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
- po::notify(vm);
+ po::notify(vm);
//print the help message
if (vm.count("help")){
std::cout << boost::format("USRP EEPROM initialization %s") % desc << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//cant find a uninitialized usrp with this mystery module in the way...
@@ -76,7 +76,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
if (found_addrs.size() == 0){
std::cerr << "No USRP devices found" << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
for (size_t i = 0; i < found_addrs.size(); i++){
@@ -89,5 +89,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << "Power-cycle the usrp for the changes to take effect." << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/query_gpsdo_sensors.cpp b/host/utils/query_gpsdo_sensors.cpp
index 8e34bb3d5..91088112c 100644
--- a/host/utils/query_gpsdo_sensors.cpp
+++ b/host/utils/query_gpsdo_sensors.cpp
@@ -27,6 +27,7 @@
#include <boost/thread.hpp>
#include <string>
#include <cmath>
+#include <ctime>
#include <cstdlib>
namespace po = boost::program_options;
@@ -102,6 +103,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//Check PPS and compare UHD device time to GPS time
boost::this_thread::sleep(boost::posix_time::seconds(1));
uhd::sensor_value_t gps_time = usrp->get_mboard_sensor("gps_time");
+ const time_t pc_clock_time = time(NULL);
const uhd::time_spec_t last_pps_time = usrp->get_time_last_pps();
if (last_pps_time.to_ticks(1.0) == gps_time.to_int()) {
std::cout << boost::format("GPS and UHD Device time are aligned.\n");
@@ -114,6 +116,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::sensor_value_t rmc_string = usrp->get_mboard_sensor("gps_gprmc");
std::cout << boost::format("%s\n%s\n%s\n") % gga_string.to_pp_string() % rmc_string.to_pp_string() % gps_time.to_pp_string();
std::cout << boost::format("UHD Device time: %.0f seconds\n") % (last_pps_time.get_real_secs());
+ std::cout << boost::format("PC Clock time: %.0f seconds\n") % pc_clock_time;
//finished
std::cout << boost::format("\nDone!\n\n");
diff --git a/host/utils/uhd_cal_rx_iq_balance.cpp b/host/utils/uhd_cal_rx_iq_balance.cpp
index 68d0443da..5fb494114 100644
--- a/host/utils/uhd_cal_rx_iq_balance.cpp
+++ b/host/utils/uhd_cal_rx_iq_balance.cpp
@@ -29,6 +29,7 @@
#include <complex>
#include <cmath>
#include <ctime>
+#include <cstdlib>
namespace po = boost::program_options;
@@ -120,7 +121,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout <<
"This application measures leakage between RX and TX on an XCVR daughterboard to self-calibrate.\n"
<< std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//create a usrp device
@@ -239,5 +240,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
store_results(usrp, results, "RX", "rx", "iq");
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp
index 8f69b3ce1..c9cf757f4 100644
--- a/host/utils/uhd_cal_tx_dc_offset.cpp
+++ b/host/utils/uhd_cal_tx_dc_offset.cpp
@@ -123,7 +123,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout <<
"This application measures leakage between RX and TX on an XCVR daughterboard to self-calibrate.\n"
<< std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//create a usrp device
@@ -237,5 +237,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
store_results(usrp, results, "TX", "tx", "dc");
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp
index 5478b07e3..20d018edf 100644
--- a/host/utils/uhd_cal_tx_iq_balance.cpp
+++ b/host/utils/uhd_cal_tx_iq_balance.cpp
@@ -28,6 +28,7 @@
#include <iostream>
#include <complex>
#include <ctime>
+#include <cstdlib>
namespace po = boost::program_options;
@@ -123,7 +124,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout <<
"This application measures leakage between RX and TX on an XCVR daughterboard to self-calibrate.\n"
<< std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//create a usrp device
@@ -242,5 +243,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
store_results(usrp, results, "TX", "tx", "iq");
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/uhd_find_devices.cpp b/host/utils/uhd_find_devices.cpp
index b778eeb68..c258c580e 100644
--- a/host/utils/uhd_find_devices.cpp
+++ b/host/utils/uhd_find_devices.cpp
@@ -20,6 +20,7 @@
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <iostream>
+#include <cstdlib>
namespace po = boost::program_options;
@@ -37,7 +38,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print the help message
if (vm.count("help")){
std::cout << boost::format("UHD Find Devices %s") % desc << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//discover the usrps and print the results
@@ -45,7 +46,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
if (device_addrs.size() == 0){
std::cerr << "No UHD Devices Found" << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
for (size_t i = 0; i < device_addrs.size(); i++){
@@ -56,5 +57,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//uhd::device::make(device_addrs[i]); //test make
}
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp
index 5b3702fb4..736490f19 100644
--- a/host/utils/uhd_usrp_probe.cpp
+++ b/host/utils/uhd_usrp_probe.cpp
@@ -30,6 +30,7 @@
#include <iostream>
#include <sstream>
#include <vector>
+#include <cstdlib>
namespace po = boost::program_options;
using namespace uhd;
@@ -197,12 +198,12 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//print the help message
if (vm.count("help")){
std::cout << boost::format("UHD USRP Probe %s") % desc << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
if (vm.count("version")){
std::cout << uhd::get_version_string() << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
device::sptr dev = device::make(vm["args"].as<std::string>());
@@ -210,11 +211,11 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
if (vm.count("string")){
std::cout << tree->access<std::string>(vm["string"].as<std::string>()).get() << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
if (vm.count("tree") != 0) print_tree("/", tree);
else std::cout << make_border(get_device_pp_string(tree)) << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/usrp_burn_db_eeprom.cpp b/host/utils/usrp_burn_db_eeprom.cpp
index b6b2dc4d6..3ca953115 100644
--- a/host/utils/usrp_burn_db_eeprom.cpp
+++ b/host/utils/usrp_burn_db_eeprom.cpp
@@ -58,7 +58,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
"Omit the ID argument to perform readback,\n"
"Or specify a new ID to burn into the EEPROM.\n"
) << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
//make the device and extract the dboard w/ property
@@ -96,5 +96,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << boost::format(" Current revision: \"%s\"") % db_eeprom.revision << std::endl;
std::cout << " Done" << std::endl << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/host/utils/usrp_burn_mb_eeprom.cpp b/host/utils/usrp_burn_mb_eeprom.cpp
index ca9a6c8ba..1b13fb615 100644
--- a/host/utils/usrp_burn_mb_eeprom.cpp
+++ b/host/utils/usrp_burn_mb_eeprom.cpp
@@ -47,7 +47,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
"Omit the value argument to perform a readback,\n"
"Or specify a new value to burn into the EEPROM.\n"
) << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
std::cout << "Creating USRP device from address: " + args << std::endl;
@@ -60,7 +60,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::usrp::mboard_eeprom_t mb_eeprom = tree->access<uhd::usrp::mboard_eeprom_t>("/mboards/0/eeprom").get();
if (not mb_eeprom.has_key(key)){
std::cerr << boost::format("Cannot find value for EEPROM[%s]") % key << std::endl;
- return ~0;
+ return EXIT_FAILURE;
}
std::cout << boost::format(" EEPROM [\"%s\"] is \"%s\"") % key % mb_eeprom[key] << std::endl;
std::cout << std::endl;
@@ -74,5 +74,5 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
}
std::cout << "Done" << std::endl;
- return 0;
+ return EXIT_SUCCESS;
}