diff options
| -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 | 
9 files changed, 56 insertions, 19 deletions
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"  | 
