From f97c4338458a965502d73903983ae5a3ceeebd53 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 23 Sep 2010 18:07:31 -0700 Subject: usrp1: fixes to remove warnings and errors for usrp1 + libusb windows --- host/lib/transport/CMakeLists.txt | 3 +++ host/lib/transport/include/stdint.h | 35 ++++++++++++++++++++++++++++ host/lib/transport/libusb1_base.cpp | 2 +- host/lib/transport/libusb1_device_handle.cpp | 18 +++++++------- host/lib/transport/libusb1_zero_copy.cpp | 3 +-- 5 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 host/lib/transport/include/stdint.h (limited to 'host/lib/transport') 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 . +// + +#ifndef INCLUDED_LIBUHD_TRANSPORT_STDINT_H +#define INCLUDED_LIBUHD_TRANSPORT_STDINT_H + +#include + +//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 #include -#include #include #include #include @@ -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; -- cgit v1.2.3