diff options
-rw-r--r-- | host/CMakeLists.txt | 6 | ||||
-rw-r--r-- | host/docs/build.rst | 39 | ||||
-rw-r--r-- | host/docs/usrp2.rst | 2 | ||||
-rw-r--r-- | host/lib/transport/CMakeLists.txt | 3 | ||||
-rw-r--r-- | host/lib/transport/include/stdint.h | 35 | ||||
-rw-r--r-- | host/lib/transport/libusb1_base.cpp | 2 | ||||
-rw-r--r-- | host/lib/transport/libusb1_device_handle.cpp | 18 | ||||
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/codec_ctrl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_ctrl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 2 |
12 files changed, 86 insertions, 36 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index ceea5d024..566bfd538 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -30,7 +30,7 @@ INCLUDE(${CMAKE_SOURCE_DIR}/config/CPack.cmake) # Install Dirs ######################################################################## SET(RUNTIME_DIR bin) -SET(LIBRARY_DIR lib) +SET(LIBRARY_DIR lib${LIB_SUFFIX}) SET(INCLUDE_DIR include) SET(PKG_DATA_DIR share/uhd) SET(PKG_DOC_DIR share/doc/uhd) @@ -61,7 +61,9 @@ ENDIF(NOT CMAKE_BUILD_TYPE) IF(CMAKE_COMPILER_IS_GNUCXX) ADD_DEFINITIONS(-Wall) ADD_DEFINITIONS(-Wextra) - ADD_DEFINITIONS(-pedantic) + #causes trouble when compiling libusb1.0 on macintosh + #comment out until mac ports libusb gets its act together + #ADD_DEFINITIONS(-pedantic) ADD_DEFINITIONS(-ansi) #only export symbols that are declared to be part of the uhd api: UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN) diff --git a/host/docs/build.rst b/host/docs/build.rst index d7dfd05e5..f37b5dce7 100644 --- a/host/docs/build.rst +++ b/host/docs/build.rst @@ -40,7 +40,7 @@ CMake ^^^^^^^^^^^^^^^^ * **Purpose:** generates project build files * **Version:** at least 2.8 -* **Required for:** build time +* **Usage:** build time (required) * **Download URL:** http://www.cmake.org/cmake/resources/software.html ^^^^^^^^^^^^^^^^ @@ -48,16 +48,16 @@ Boost ^^^^^^^^^^^^^^^^ * **Purpose:** C++ library * **Version:** at least 3.6 unix, at least 4.0 windows -* **Required for:** build time + run time +* **Usage:** build time + run time (required) * **Download URL:** http://www.boost.org/users/download/ * **Download URL (windows installer):** http://www.boostpro.com/download ^^^^^^^^^^^^^^^^ LibUSB ^^^^^^^^^^^^^^^^ -* **Purpose:** USB userspace library +* **Purpose:** USB-based hardware support * **Version:** at least 1.0 -* **Required for:** build time + run time (optional) +* **Usage:** build time + run time (optional) * **Download URL:** http://www.libusb.org/ ^^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ Python ^^^^^^^^^^^^^^^^ * **Purpose:** used by Cheetah and utility scripts * **Version:** at least 2.6 -* **Required for:** build time + run time utility scripts +* **Usage:** build time + run time utility scripts (required) * **Download URL:** http://www.python.org/download/ ^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ Cheetah ^^^^^^^^^^^^^^^^ * **Purpose:** source code generation * **Version:** at least 2.0 -* **Required for:** build time +* **Usage:** build time (required) * **Download URL:** http://www.cheetahtemplate.org/download.html * **Download URL (windows installer):** http://feisley.com/python/cheetah/ @@ -81,14 +81,14 @@ Cheetah Doxygen ^^^^^^^^^^^^^^^^ * **Purpose:** generates html api documentation -* **Required for:** build time (optional) +* **Usage:** build time (optional) * **Download URL:** http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc ^^^^^^^^^^^^^^^^ Docutils ^^^^^^^^^^^^^^^^ * **Purpose:** generates html user manual -* **Required for:** build time (optional) +* **Usage:** build time (optional) * **Download URL:** http://docutils.sourceforge.net/ ------------------------------------------------------------------------ @@ -105,9 +105,16 @@ Generate Makefiles with cmake cd build cmake ../ -**Notes:** +Additionally, configuration variables can be passed into cmake via the command line. +The following common-use configuration variables are listed below: -* For a custom prefix, use: cmake -DCMAKE_INSTALL_PREFIX=<prefix> ../ +* For a custom install prefix: -DCMAKE_INSTALL_PREFIX=<prefix> +* To install libs into lib64: cmake -DLIB_SUFFIX=64 + +Example usage: +:: + + cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Build and install @@ -155,11 +162,15 @@ Build the project in MSVC **Note:** you may not have permission to build the install target. You need to be an administrator or to run MSVC as administrator. -** alternative command line instructions ** +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Build the project in MSVC (command line) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Open the Visual Studio Command Prompt Shorcut: +:: -* Open the Visual Studio Command Prompt Shorcut -* DevEnv <uhd-repo-path>\host\build\ALL_BUILD.vcproj /Build Release -* DevEnv <uhd-repo-path>\host\build\INSTALL.vcproj /Build Release + cd <uhd-repo-path>\host\build + DevEnv ALL_BUILD.vcproj /Build Release + DevEnv INSTALL.vcproj /Build Release ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Setup the PATH environment variable diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst index 745361b77..4c95fb24c 100644 --- a/host/docs/usrp2.rst +++ b/host/docs/usrp2.rst @@ -174,7 +174,7 @@ buffer incoming samples faster than they can be processed. However, if you application cannot process samples fast enough, no amount of buffering can save you. -By default, the UHD will try to request a reasonably large buffer size for both send and receive. +By default, the UHD will try to resize both the send and receive buffer for optimum performance. A warning will be printed on instantiation if the actual buffer size is insufficient. See the OS specific notes below: diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index acd699fc5..92c9f3181 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -33,6 +33,9 @@ IF(LIBUSB_FOUND) ${CMAKE_SOURCE_DIR}/lib/transport/libusb1_base.hpp ${CMAKE_SOURCE_DIR}/lib/transport/libusb1_device_handle.cpp ) + IF(WIN32) #include our custom stdint for libusb + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/transport/include) + ENDIF(WIN32) SET(HAVE_USB_SUPPORT TRUE) ENDIF(LIBUSB_FOUND) diff --git a/host/lib/transport/include/stdint.h b/host/lib/transport/include/stdint.h new file mode 100644 index 000000000..b3eb61aae --- /dev/null +++ b/host/lib/transport/include/stdint.h @@ -0,0 +1,35 @@ +//
+// Copyright 2010 Ettus Research LLC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifndef INCLUDED_LIBUHD_TRANSPORT_STDINT_H
+#define INCLUDED_LIBUHD_TRANSPORT_STDINT_H
+
+#include <boost/cstdint.hpp>
+
+//provide a stdint implementation for libusb
+
+typedef boost::uint64_t uint64_t;
+typedef boost::uint32_t uint32_t;
+typedef boost::uint16_t uint16_t;
+typedef boost::uint8_t uint8_t;
+
+typedef boost::int64_t int64_t;
+typedef boost::int32_t int32_t;
+typedef boost::int16_t int16_t;
+typedef boost::int8_t int8_t;
+
+#endif /* INCLUDED_LIBUHD_TRANSPORT_STDINT_H */
diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index e21c39aa3..1f816c6e2 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -67,7 +67,7 @@ bool libusb::compare_device(libusb_device *dev, std::string serial = handle->get_serial(); boost::uint16_t vendor_id = handle->get_vendor_id(); boost::uint16_t product_id = handle->get_product_id(); - boost::uint8_t device_addr = handle->get_device_addr(); + boost::uint16_t device_addr = handle->get_device_addr(); libusb_device_descriptor libusb_desc; if (libusb_get_device_descriptor(dev, &libusb_desc) < 0) diff --git a/host/lib/transport/libusb1_device_handle.cpp b/host/lib/transport/libusb1_device_handle.cpp index 43d0f0e26..7efddd410 100644 --- a/host/lib/transport/libusb1_device_handle.cpp +++ b/host/lib/transport/libusb1_device_handle.cpp @@ -29,9 +29,9 @@ const int libusb_debug_level = 0; class libusb1_device_handle_impl : public usb_device_handle { public: libusb1_device_handle_impl(std::string serial, - boost::uint32_t product_id, - boost::uint32_t vendor_id, - boost::uint32_t device_addr) + boost::uint16_t product_id, + boost::uint16_t vendor_id, + boost::uint16_t device_addr) : _serial(serial), _product_id(product_id), _vendor_id(vendor_id), _device_addr(device_addr) { @@ -66,9 +66,9 @@ public: private: std::string _serial; - boost::uint32_t _product_id; - boost::uint32_t _vendor_id; - boost::uint32_t _device_addr; + boost::uint16_t _product_id; + boost::uint16_t _vendor_id; + boost::uint16_t _device_addr; }; @@ -81,9 +81,9 @@ usb_device_handle::sptr make_usb_device_handle(libusb_device *dev) } std::string serial = libusb::get_serial(dev); - boost::uint32_t product_id = desc.idProduct; - boost::uint32_t vendor_id = desc.idVendor; - boost::uint32_t device_addr = libusb_get_device_address(dev); + boost::uint16_t product_id = desc.idProduct; + boost::uint16_t vendor_id = desc.idVendor; + boost::uint16_t device_addr = libusb_get_device_address(dev); return usb_device_handle::sptr(new libusb1_device_handle_impl( serial, diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index b890a87f9..b3a160462 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -18,7 +18,6 @@ #include "libusb1_base.hpp" #include <uhd/transport/usb_zero_copy.hpp> #include <uhd/utils/assert.hpp> -#include <boost/asio.hpp> #include <boost/format.hpp> #include <iostream> #include <iomanip> @@ -208,7 +207,7 @@ libusb_transfer *usb_endpoint::allocate_transfer(int buff_len) endpoint, // endpoint buff, // buffer buff_len, // length - callback, // callback + libusb_transfer_cb_fn(callback), // callback this, // user_data 0); // timeout return lut; diff --git a/host/lib/usrp/usrp1/codec_ctrl.cpp b/host/lib/usrp/usrp1/codec_ctrl.cpp index 08f2d2a8e..ad16f6b3a 100644 --- a/host/lib/usrp/usrp1/codec_ctrl.cpp +++ b/host/lib/usrp/usrp1/codec_ctrl.cpp @@ -126,7 +126,7 @@ usrp1_codec_ctrl_impl::usrp1_codec_ctrl_impl(usrp1_iface::sptr iface, _ad9862_regs.clkout2_div_factor = ad9862_regs_t::CLKOUT2_DIV_FACTOR_2; //write the register settings to the codec - for (uint8_t addr = 0; addr <= 25; addr++) { + for (boost::uint8_t addr = 0; addr <= 25; addr++) { this->send_reg(addr); } @@ -199,7 +199,7 @@ float usrp1_codec_ctrl_impl::get_rx_pga_gain(char which){ **********************************************************************/ static float aux_adc_to_volts(boost::uint8_t high, boost::uint8_t low) { - return float((boost::uint16_t(high) << 2) | low)*3.3/0x3ff; + return float(((boost::uint16_t(high) << 2) | low)*3.3)/0x3ff; } float usrp1_codec_ctrl_impl::read_aux_adc(aux_adc_t which) diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.cpp b/host/lib/usrp/usrp1/usrp1_ctrl.cpp index 451129ef5..936ffd17d 100644 --- a/host/lib/usrp/usrp1/usrp1_ctrl.cpp +++ b/host/lib/usrp/usrp1/usrp1_ctrl.cpp @@ -287,7 +287,7 @@ public: int usrp_load_eeprom(std::string filestring) { const char *filename = filestring.c_str(); - const uint16_t i2c_addr = 0x50; + const boost::uint16_t i2c_addr = 0x50; //FIXME: verify types int len; @@ -416,7 +416,7 @@ public: } - int usrp_control_write_cmd(uint8_t request, uint16_t value, uint16_t index) + int usrp_control_write_cmd(boost::uint8_t request, boost::uint16_t value, boost::uint16_t index) { return usrp_control_write(request, value, index, 0, 0); } diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 4bc18dd16..5fd3987d5 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -80,7 +80,7 @@ public: boost::uint32_t peek32(boost::uint32_t addr) { - uint32_t value_out; + boost::uint32_t value_out; boost::uint8_t w_index_h = SPI_ENABLE_FPGA & 0xff; boost::uint8_t w_index_l = (SPI_FMT_MSB | SPI_FMT_HDR_1) & 0xff; @@ -100,7 +100,7 @@ public: boost::uint16_t peek16(boost::uint32_t addr) { - uint32_t val = peek32(addr); + boost::uint32_t val = peek32(addr); return boost::uint16_t(val & 0xff); } diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index a6806dbc3..627180b11 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -62,7 +62,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx" ); } - catch(const std::exception &e){ + catch(...){ uhd::print_warning( "Could not locate USRP1 firmware.\n" "Please install the images package.\n" |