From 99c2730bc9db270560671f2d7d173768465ed51f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 31 Oct 2016 14:30:52 -0700 Subject: Remove all boost:: namespace prefix for uint32_t, int32_t etc. (fixed-width types) - Also removes all references to boost/cstdint.hpp and replaces it with stdint.h (The 'correct' replacement would be , but not all of our compilers support that). --- host/lib/usrp/b200/b200_cores.cpp | 4 +- host/lib/usrp/b200/b200_cores.hpp | 4 +- host/lib/usrp/b200/b200_iface.cpp | 112 +++++++++++++++---------------- host/lib/usrp/b200/b200_iface.hpp | 38 +++++------ host/lib/usrp/b200/b200_image_loader.cpp | 2 +- host/lib/usrp/b200/b200_impl.cpp | 52 +++++++------- host/lib/usrp/b200/b200_impl.hpp | 40 +++++------ host/lib/usrp/b200/b200_io_impl.cpp | 28 ++++---- host/lib/usrp/b200/b200_regs.hpp | 54 +++++++-------- host/lib/usrp/b200/b200_uart.cpp | 20 +++--- host/lib/usrp/b200/b200_uart.hpp | 2 +- 11 files changed, 178 insertions(+), 178 deletions(-) (limited to 'host/lib/usrp/b200') diff --git a/host/lib/usrp/b200/b200_cores.cpp b/host/lib/usrp/b200/b200_cores.cpp index 19e637ef4..dcfd41825 100644 --- a/host/lib/usrp/b200/b200_cores.cpp +++ b/host/lib/usrp/b200/b200_cores.cpp @@ -29,10 +29,10 @@ b200_local_spi_core::b200_local_spi_core( change_perif(default_perif); } -boost::uint32_t b200_local_spi_core::transact_spi( +uint32_t b200_local_spi_core::transact_spi( int which_slave, const uhd::spi_config_t &config, - boost::uint32_t data, + uint32_t data, size_t num_bits, bool readback) { diff --git a/host/lib/usrp/b200/b200_cores.hpp b/host/lib/usrp/b200/b200_cores.hpp index 32e583794..54f5e5926 100644 --- a/host/lib/usrp/b200/b200_cores.hpp +++ b/host/lib/usrp/b200/b200_cores.hpp @@ -33,10 +33,10 @@ public: b200_local_spi_core(uhd::wb_iface::sptr iface, perif_t default_perif); - virtual boost::uint32_t transact_spi( + virtual uint32_t transact_spi( int which_slave, const uhd::spi_config_t &config, - boost::uint32_t data, + uint32_t data, size_t num_bits, bool readback); diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 218f8fd0e..4e6dd2144 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,42 +45,42 @@ using namespace uhd::transport; static const bool load_img_msg = true; -const static boost::uint8_t FX3_FIRMWARE_LOAD = 0xA0; -const static boost::uint8_t VRT_VENDOR_OUT = (LIBUSB_REQUEST_TYPE_VENDOR +const static uint8_t FX3_FIRMWARE_LOAD = 0xA0; +const static uint8_t VRT_VENDOR_OUT = (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT); -const static boost::uint8_t VRT_VENDOR_IN = (LIBUSB_REQUEST_TYPE_VENDOR +const static uint8_t VRT_VENDOR_IN = (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN); -const static boost::uint8_t B200_VREQ_FPGA_START = 0x02; -const static boost::uint8_t B200_VREQ_FPGA_DATA = 0x12; -const static boost::uint8_t B200_VREQ_GET_COMPAT = 0x15; -const static boost::uint8_t B200_VREQ_SET_FPGA_HASH = 0x1C; -const static boost::uint8_t B200_VREQ_GET_FPGA_HASH = 0x1D; -const static boost::uint8_t B200_VREQ_SET_FW_HASH = 0x1E; -const static boost::uint8_t B200_VREQ_GET_FW_HASH = 0x1F; -const static boost::uint8_t B200_VREQ_LOOP = 0x22; -const static boost::uint8_t B200_VREQ_FPGA_CONFIG = 0x55; -const static boost::uint8_t B200_VREQ_FPGA_RESET = 0x62; -const static boost::uint8_t B200_VREQ_GPIF_RESET = 0x72; -const static boost::uint8_t B200_VREQ_GET_USB = 0x80; -const static boost::uint8_t B200_VREQ_GET_STATUS = 0x83; -const static boost::uint8_t B200_VREQ_FX3_RESET = 0x99; -const static boost::uint8_t B200_VREQ_EEPROM_WRITE = 0xBA; -const static boost::uint8_t B200_VREQ_EEPROM_READ = 0xBB; - -const static boost::uint8_t FX3_STATE_UNDEFINED = 0x00; -const static boost::uint8_t FX3_STATE_FPGA_READY = 0x01; -const static boost::uint8_t FX3_STATE_CONFIGURING_FPGA = 0x02; -const static boost::uint8_t FX3_STATE_BUSY = 0x03; -const static boost::uint8_t FX3_STATE_RUNNING = 0x04; -const static boost::uint8_t FX3_STATE_UNCONFIGURED = 0x05; -const static boost::uint8_t FX3_STATE_ERROR = 0x06; +const static uint8_t B200_VREQ_FPGA_START = 0x02; +const static uint8_t B200_VREQ_FPGA_DATA = 0x12; +const static uint8_t B200_VREQ_GET_COMPAT = 0x15; +const static uint8_t B200_VREQ_SET_FPGA_HASH = 0x1C; +const static uint8_t B200_VREQ_GET_FPGA_HASH = 0x1D; +const static uint8_t B200_VREQ_SET_FW_HASH = 0x1E; +const static uint8_t B200_VREQ_GET_FW_HASH = 0x1F; +const static uint8_t B200_VREQ_LOOP = 0x22; +const static uint8_t B200_VREQ_FPGA_CONFIG = 0x55; +const static uint8_t B200_VREQ_FPGA_RESET = 0x62; +const static uint8_t B200_VREQ_GPIF_RESET = 0x72; +const static uint8_t B200_VREQ_GET_USB = 0x80; +const static uint8_t B200_VREQ_GET_STATUS = 0x83; +const static uint8_t B200_VREQ_FX3_RESET = 0x99; +const static uint8_t B200_VREQ_EEPROM_WRITE = 0xBA; +const static uint8_t B200_VREQ_EEPROM_READ = 0xBB; + +const static uint8_t FX3_STATE_UNDEFINED = 0x00; +const static uint8_t FX3_STATE_FPGA_READY = 0x01; +const static uint8_t FX3_STATE_CONFIGURING_FPGA = 0x02; +const static uint8_t FX3_STATE_BUSY = 0x03; +const static uint8_t FX3_STATE_RUNNING = 0x04; +const static uint8_t FX3_STATE_UNCONFIGURED = 0x05; +const static uint8_t FX3_STATE_ERROR = 0x06; const static int VREQ_MAX_SIZE_USB2 = 64; const static int VREQ_MAX_SIZE_USB3 = 512; const static int VREQ_DEFAULT_SIZE = VREQ_MAX_SIZE_USB2; const static int VREQ_MAX_SIZE = VREQ_MAX_SIZE_USB3; -typedef boost::uint32_t hash_type; +typedef uint32_t hash_type; /*********************************************************************** @@ -137,12 +137,12 @@ public: //NOP } - int fx3_control_write(boost::uint8_t request, - boost::uint16_t value, - boost::uint16_t index, + int fx3_control_write(uint8_t request, + uint16_t value, + uint16_t index, unsigned char *buff, - boost::uint16_t length, - boost::uint32_t timeout = 0) { + uint16_t length, + uint32_t timeout = 0) { return _usb_ctrl->submit(VRT_VENDOR_OUT, // bmReqeustType request, // bRequest value, // wValue @@ -152,12 +152,12 @@ public: timeout); // timeout } - int fx3_control_read(boost::uint8_t request, - boost::uint16_t value, - boost::uint16_t index, + int fx3_control_read(uint8_t request, + uint16_t value, + uint16_t index, unsigned char *buff, - boost::uint16_t length, - boost::uint32_t timeout = 0) { + uint16_t length, + uint32_t timeout = 0) { return _usb_ctrl->submit(VRT_VENDOR_IN, // bmReqeustType request, // bRequest value, // wValue @@ -167,21 +167,21 @@ public: timeout); // timeout } - void write_i2c(UHD_UNUSED(boost::uint16_t addr), UHD_UNUSED(const byte_vector_t &bytes)) + void write_i2c(UHD_UNUSED(uint16_t addr), UHD_UNUSED(const byte_vector_t &bytes)) { throw uhd::not_implemented_error("b200 write i2c"); } - byte_vector_t read_i2c(UHD_UNUSED(boost::uint16_t addr), UHD_UNUSED(size_t num_bytes)) + byte_vector_t read_i2c(UHD_UNUSED(uint16_t addr), UHD_UNUSED(size_t num_bytes)) { throw uhd::not_implemented_error("b200 read i2c"); } - void write_eeprom(boost::uint16_t addr, boost::uint16_t offset, + void write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t &bytes) { int ret = fx3_control_write(B200_VREQ_EEPROM_WRITE, - 0, offset | (boost::uint16_t(addr) << 8), + 0, offset | (uint16_t(addr) << 8), (unsigned char *) &bytes[0], bytes.size()); @@ -192,12 +192,12 @@ public: } byte_vector_t read_eeprom( - boost::uint16_t addr, - boost::uint16_t offset, + uint16_t addr, + uint16_t offset, size_t num_bytes) { byte_vector_t recv_bytes(num_bytes); int bytes_read = fx3_control_read(B200_VREQ_EEPROM_READ, - 0, offset | (boost::uint16_t(addr) << 8), + 0, offset | (uint16_t(addr) << 8), (unsigned char*) &recv_bytes[0], num_bytes); @@ -281,7 +281,7 @@ public: */ } - boost::uint8_t get_usb_speed(void) { + uint8_t get_usb_speed(void) { unsigned char rx_data[1]; memset(rx_data, 0x00, sizeof(rx_data)); @@ -293,10 +293,10 @@ public: else if (ret != bytes_to_recv) throw uhd::io_error((boost::format("Short read on get USB speed (expecting: %d, returned: %d)") % bytes_to_recv % ret).str()); - return boost::lexical_cast(rx_data[0]); + return boost::lexical_cast(rx_data[0]); } - boost::uint8_t get_fx3_status(void) { + uint8_t get_fx3_status(void) { unsigned char rx_data[1]; memset(rx_data, 0x00, sizeof(rx_data)); @@ -308,10 +308,10 @@ public: else if (ret != bytes_to_recv) throw uhd::io_error((boost::format("Short read on get FX3 status (expecting: %d, returned: %d)") % bytes_to_recv % ret).str()); - return boost::lexical_cast(rx_data[0]); + return boost::lexical_cast(rx_data[0]); } - boost::uint16_t get_compat_num(void) { + uint16_t get_compat_num(void) { unsigned char rx_data[2]; memset(rx_data, 0x00, sizeof(rx_data)); @@ -374,10 +374,10 @@ public: throw uhd::io_error((boost::format("Short write on set FPGA hash (expecting: %d, returned: %d)") % bytes_to_send % ret).str()); } - boost::uint32_t load_fpga(const std::string filestring, bool force) { + uint32_t load_fpga(const std::string filestring, bool force) { - boost::uint8_t fx3_state = 0; - boost::uint32_t wait_count; + uint8_t fx3_state = 0; + uint32_t wait_count; int ret = 0; int bytes_to_xfer = 0; @@ -476,7 +476,7 @@ public: if(n == 0) continue; - boost::uint16_t transfer_count = boost::uint16_t(n); + uint16_t transfer_count = uint16_t(n); /* Send the data to the device. */ int nwritten = fx3_control_write(B200_VREQ_FPGA_DATA, 0, 0, out_buff, transfer_count, 5000); @@ -526,7 +526,7 @@ private: }; -std::string b200_iface::fx3_state_string(boost::uint8_t state) +std::string b200_iface::fx3_state_string(uint8_t state) { switch (state) { diff --git a/host/lib/usrp/b200/b200_iface.hpp b/host/lib/usrp/b200/b200_iface.hpp index e45c78d49..0cddbf801 100644 --- a/host/lib/usrp/b200/b200_iface.hpp +++ b/host/lib/usrp/b200/b200_iface.hpp @@ -35,19 +35,19 @@ enum b200_product_t { }; // These are actual USB PIDs (not Ettus Product IDs) -const static boost::uint16_t B200_VENDOR_ID = 0x2500; -const static boost::uint16_t B200_VENDOR_NI_ID = 0x3923; -const static boost::uint16_t B200_PRODUCT_ID = 0x0020; -const static boost::uint16_t B200MINI_PRODUCT_ID = 0x0021; -const static boost::uint16_t B205MINI_PRODUCT_ID = 0x0022; -const static boost::uint16_t B200_PRODUCT_NI_ID = 0x7813; -const static boost::uint16_t B210_PRODUCT_NI_ID = 0x7814; -const static boost::uint16_t FX3_VID = 0x04b4; -const static boost::uint16_t FX3_DEFAULT_PID = 0x00f3; -const static boost::uint16_t FX3_REENUM_PID = 0x00f0; +const static uint16_t B200_VENDOR_ID = 0x2500; +const static uint16_t B200_VENDOR_NI_ID = 0x3923; +const static uint16_t B200_PRODUCT_ID = 0x0020; +const static uint16_t B200MINI_PRODUCT_ID = 0x0021; +const static uint16_t B205MINI_PRODUCT_ID = 0x0022; +const static uint16_t B200_PRODUCT_NI_ID = 0x7813; +const static uint16_t B210_PRODUCT_NI_ID = 0x7814; +const static uint16_t FX3_VID = 0x04b4; +const static uint16_t FX3_DEFAULT_PID = 0x00f3; +const static uint16_t FX3_REENUM_PID = 0x00f0; //! Map the USB PID to the product (only for PIDs that map to a single product) -static const uhd::dict B2XX_PID_TO_PRODUCT = boost::assign::map_list_of +static const uhd::dict B2XX_PID_TO_PRODUCT = boost::assign::map_list_of (B200_PRODUCT_NI_ID, B200) (B210_PRODUCT_NI_ID, B210) (B200MINI_PRODUCT_ID, B200MINI) @@ -57,7 +57,7 @@ static const uhd::dict B2XX_PID_TO_PRODUCT = bo static const std::string B200_FW_FILE_NAME = "usrp_b200_fw.hex"; //! Map the EEPROM product ID codes to the product -static const uhd::dict B2XX_PRODUCT_ID = boost::assign::map_list_of +static const uhd::dict B2XX_PRODUCT_ID = boost::assign::map_list_of (0x0001, B200) (0x7737, B200) (B200_PRODUCT_NI_ID, B200) @@ -98,13 +98,13 @@ public: static sptr make(uhd::transport::usb_control::sptr usb_ctrl); //! query the device USB speed (2, 3) - virtual boost::uint8_t get_usb_speed(void) = 0; + virtual uint8_t get_usb_speed(void) = 0; //! get the current status of the FX3 - virtual boost::uint8_t get_fx3_status(void) = 0; + virtual uint8_t get_fx3_status(void) = 0; //! get the current status of the FX3 - virtual boost::uint16_t get_compat_num(void) = 0; + virtual uint16_t get_compat_num(void) = 0; //! load a firmware image virtual void load_firmware(const std::string filestring, bool force=false) = 0; @@ -119,13 +119,13 @@ public: virtual void set_fpga_reset_pin(const bool reset) = 0; //! load an FPGA image - virtual boost::uint32_t load_fpga(const std::string filestring, bool force=false) = 0; + virtual uint32_t load_fpga(const std::string filestring, bool force=false) = 0; - virtual void write_eeprom(boost::uint16_t addr, boost::uint16_t offset, const uhd::byte_vector_t &bytes) = 0; + virtual void write_eeprom(uint16_t addr, uint16_t offset, const uhd::byte_vector_t &bytes) = 0; - virtual uhd::byte_vector_t read_eeprom(boost::uint16_t addr, boost::uint16_t offset, size_t num_bytes) = 0; + virtual uhd::byte_vector_t read_eeprom(uint16_t addr, uint16_t offset, size_t num_bytes) = 0; - static std::string fx3_state_string(boost::uint8_t state); + static std::string fx3_state_string(uint8_t state); }; diff --git a/host/lib/usrp/b200/b200_image_loader.cpp b/host/lib/usrp/b200/b200_image_loader.cpp index e8fb8afea..b9c2c0caf 100644 --- a/host/lib/usrp/b200/b200_image_loader.cpp +++ b/host/lib/usrp/b200/b200_image_loader.cpp @@ -114,7 +114,7 @@ static bool b200_image_loader(const image_loader::image_loader_args_t &image_loa * filename for us to use. */ std::string product = mb_eeprom.get("product"); - if(not B2XX_PRODUCT_ID.has_key(boost::lexical_cast(product))){ + if(not B2XX_PRODUCT_ID.has_key(boost::lexical_cast(product))){ if(user_specified){ // The user specified a bad device but expects us to know what it is throw uhd::runtime_error("Could not determine model. You must manually specify an FPGA image filename."); diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 9bd2799c2..e2a0e0b70 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -130,7 +130,7 @@ std::string check_option_valid( b200_product_t get_b200_product(const usb_device_handle::sptr& handle, const mboard_eeprom_t &mb_eeprom) { // Try USB PID first - boost::uint16_t product_id = handle->get_product_id(); + uint16_t product_id = handle->get_product_id(); if (B2XX_PID_TO_PRODUCT.has_key(product_id)) return B2XX_PID_TO_PRODUCT[product_id]; @@ -138,7 +138,7 @@ b200_product_t get_b200_product(const usb_device_handle::sptr& handle, const mbo if (mb_eeprom["product"].empty()) { throw uhd::runtime_error("B200: Missing product ID on EEPROM."); } - product_id = boost::lexical_cast(mb_eeprom["product"]); + product_id = boost::lexical_cast(mb_eeprom["product"]); if (not B2XX_PRODUCT_ID.has_key(product_id)) { throw uhd::runtime_error(str( boost::format("B200 unknown product code: 0x%04x") @@ -153,8 +153,8 @@ std::vector get_b200_device_handles(const device_addr_t std::vector vid_pid_pair_list; if(hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type") && hint["type"] == "b200") { - vid_pid_pair_list.push_back(usb_device_handle::vid_pid_pair_t(uhd::cast::hexstr_cast(hint.get("vid")), - uhd::cast::hexstr_cast(hint.get("pid")))); + vid_pid_pair_list.push_back(usb_device_handle::vid_pid_pair_t(uhd::cast::hexstr_cast(hint.get("vid")), + uhd::cast::hexstr_cast(hint.get("pid")))); } else { vid_pid_pair_list = b200_vid_pid_pairs; } @@ -292,20 +292,20 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s const fs_path mb_path = "/mboards/0"; //try to match the given device address with something on the USB bus - boost::uint16_t vid = B200_VENDOR_ID; - boost::uint16_t pid = B200_PRODUCT_ID; + uint16_t vid = B200_VENDOR_ID; + uint16_t pid = B200_PRODUCT_ID; bool specified_vid = false; bool specified_pid = false; if (device_addr.has_key("vid")) { - vid = uhd::cast::hexstr_cast(device_addr.get("vid")); + vid = uhd::cast::hexstr_cast(device_addr.get("vid")); specified_vid = true; } if (device_addr.has_key("pid")) { - pid = uhd::cast::hexstr_cast(device_addr.get("pid")); + pid = uhd::cast::hexstr_cast(device_addr.get("pid")); specified_pid = true; } @@ -425,7 +425,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s device_addr.has_key("fpga")? device_addr["fpga"] : default_file_name ); - boost::uint32_t status = _iface->load_fpga(b200_fpga_image); + uint32_t status = _iface->load_fpga(b200_fpga_image); if(status != 0) { throw uhd::runtime_error(str(boost::format("fx3 is in state %1%") % status)); @@ -436,7 +436,7 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s //////////////////////////////////////////////////////////////////// // Create control transport //////////////////////////////////////////////////////////////////// - boost::uint8_t usb_speed = _iface->get_usb_speed(); + uint8_t usb_speed = _iface->get_usb_speed(); UHD_MSG(status) << "Operating over USB " << (int) usb_speed << "." << std::endl; const std::string min_frame_size = (usb_speed == 3) ? "1024" : "512"; @@ -672,11 +672,11 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s _radio_perifs[0].fp_gpio = gpio_atr_3000::make(_radio_perifs[0].ctrl, TOREG(SR_FP_GPIO), RB32_FP_GPIO); BOOST_FOREACH(const gpio_attr_map_t::value_type attr, gpio_attr_map) { - _tree->create(mb_path / "gpio" / "FP0" / attr.second) + _tree->create(mb_path / "gpio" / "FP0" / attr.second) .set(0) .add_coerced_subscriber(boost::bind(&gpio_atr_3000::set_gpio_attr, _radio_perifs[0].fp_gpio, attr.first, _1)); } - _tree->create(mb_path / "gpio" / "FP0" / "READBACK") + _tree->create(mb_path / "gpio" / "FP0" / "READBACK") .set_publisher(boost::bind(&gpio_atr_3000::read_gpio, _radio_perifs[0].fp_gpio)); //////////////////////////////////////////////////////////////////// @@ -751,7 +751,7 @@ void b200_impl::setup_radio(const size_t dspno) //////////////////////////////////////////////////////////////////// // Set up transport //////////////////////////////////////////////////////////////////// - const boost::uint32_t sid = (dspno == 0) ? B200_CTRL0_MSG_SID : B200_CTRL1_MSG_SID; + const uint32_t sid = (dspno == 0) ? B200_CTRL0_MSG_SID : B200_CTRL1_MSG_SID; //////////////////////////////////////////////////////////////////// // radio control @@ -879,8 +879,8 @@ void b200_impl::register_loopback_self_test(wb_iface::sptr iface) for (size_t i = 0; i < 100; i++) { boost::hash_combine(hash, i); - iface->poke32(TOREG(SR_TEST), boost::uint32_t(hash)); - test_fail = iface->peek32(RB32_TEST) != boost::uint32_t(hash); + iface->poke32(TOREG(SR_TEST), uint32_t(hash)); + test_fail = iface->peek32(RB32_TEST) != uint32_t(hash); if (test_fail) break; //exit loop on any failure } UHD_MSG(status) << ((test_fail)? "fail" : "pass") << std::endl; @@ -946,9 +946,9 @@ double b200_impl::set_tick_rate(const double new_tick_rate) void b200_impl::check_fw_compat(void) { - boost::uint16_t compat_num = _iface->get_compat_num(); - boost::uint32_t compat_major = (boost::uint32_t) (compat_num >> 8); - boost::uint32_t compat_minor = (boost::uint32_t) (compat_num & 0xFF); + uint16_t compat_num = _iface->get_compat_num(); + uint32_t compat_major = (uint32_t) (compat_num >> 8); + uint32_t compat_minor = (uint32_t) (compat_num & 0xFF); if (compat_major != B200_FW_COMPAT_NUM_MAJOR){ throw uhd::runtime_error(str(boost::format( @@ -964,14 +964,14 @@ void b200_impl::check_fw_compat(void) void b200_impl::check_fpga_compat(void) { - const boost::uint64_t compat = _local_ctrl->peek64(0); - const boost::uint32_t signature = boost::uint32_t(compat >> 32); - const boost::uint16_t compat_major = boost::uint16_t(compat >> 16); - const boost::uint16_t compat_minor = boost::uint16_t(compat & 0xffff); + const uint64_t compat = _local_ctrl->peek64(0); + const uint32_t signature = uint32_t(compat >> 32); + const uint16_t compat_major = uint16_t(compat >> 16); + const uint16_t compat_minor = uint16_t(compat & 0xffff); if (signature != 0xACE0BA5E) throw uhd::runtime_error( "b200::check_fpga_compat signature register readback failed"); - const boost::uint16_t expected = ((_product == B200MINI or _product == B205MINI) ? B205_FPGA_COMPAT_NUM : B200_FPGA_COMPAT_NUM); + const uint16_t expected = ((_product == B200MINI or _product == B205MINI) ? B205_FPGA_COMPAT_NUM : B200_FPGA_COMPAT_NUM); if (compat_major != expected) { throw uhd::runtime_error(str(boost::format( @@ -1090,7 +1090,7 @@ void b200_impl::set_time(const uhd::time_spec_t& t) { BOOST_FOREACH(radio_perifs_t &perif, _radio_perifs) perif.time64->set_time_sync(t); - _local_ctrl->poke32(TOREG(SR_CORE_SYNC), 1 << 2 | boost::uint32_t(_time_source)); + _local_ctrl->poke32(TOREG(SR_CORE_SYNC), 1 << 2 | uint32_t(_time_source)); _local_ctrl->poke32(TOREG(SR_CORE_SYNC), _time_source); } @@ -1145,7 +1145,7 @@ void b200_impl::update_bandsel(const std::string& which, double freq) void b200_impl::update_gpio_state(void) { - const boost::uint32_t misc_word = 0 + const uint32_t misc_word = 0 | (_gpio_state.swap_atr << 8) | (_gpio_state.tx_bandsel_a << 7) | (_gpio_state.tx_bandsel_b << 6) @@ -1243,7 +1243,7 @@ sensor_value_t b200_impl::get_ref_locked(void) sensor_value_t b200_impl::get_fe_pll_locked(const bool is_tx) { - const boost::uint32_t st = _local_ctrl->peek32(RB32_CORE_PLL); + const uint32_t st = _local_ctrl->peek32(RB32_CORE_PLL); const bool locked = is_tx ? ((st & 0x1) > 0) : ((st & 0x2) > 0); return sensor_value_t("LO", locked, "locked", "unlocked"); } diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 130e93891..1c756c56d 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -47,37 +47,37 @@ #include #include #include "recv_packet_demuxer_3000.hpp" -static const boost::uint8_t B200_FW_COMPAT_NUM_MAJOR = 8; -static const boost::uint8_t B200_FW_COMPAT_NUM_MINOR = 0; -static const boost::uint16_t B200_FPGA_COMPAT_NUM = 14; -static const boost::uint16_t B205_FPGA_COMPAT_NUM = 5; +static const uint8_t B200_FW_COMPAT_NUM_MAJOR = 8; +static const uint8_t B200_FW_COMPAT_NUM_MINOR = 0; +static const uint16_t B200_FPGA_COMPAT_NUM = 14; +static const uint16_t B205_FPGA_COMPAT_NUM = 5; static const double B200_BUS_CLOCK_RATE = 100e6; -static const boost::uint32_t B200_GPSDO_ST_NONE = 0x83; +static const uint32_t B200_GPSDO_ST_NONE = 0x83; static const size_t B200_MAX_RATE_USB2 = 53248000; // bytes/s static const size_t B200_MAX_RATE_USB3 = 500000000; // bytes/s #define FLIP_SID(sid) (((sid)<<16)|((sid)>>16)) -static const boost::uint32_t B200_CTRL0_MSG_SID = 0x00000010; -static const boost::uint32_t B200_RESP0_MSG_SID = FLIP_SID(B200_CTRL0_MSG_SID); +static const uint32_t B200_CTRL0_MSG_SID = 0x00000010; +static const uint32_t B200_RESP0_MSG_SID = FLIP_SID(B200_CTRL0_MSG_SID); -static const boost::uint32_t B200_CTRL1_MSG_SID = 0x00000020; -static const boost::uint32_t B200_RESP1_MSG_SID = FLIP_SID(B200_CTRL1_MSG_SID); +static const uint32_t B200_CTRL1_MSG_SID = 0x00000020; +static const uint32_t B200_RESP1_MSG_SID = FLIP_SID(B200_CTRL1_MSG_SID); -static const boost::uint32_t B200_TX_DATA0_SID = 0x00000050; -static const boost::uint32_t B200_TX_MSG0_SID = FLIP_SID(B200_TX_DATA0_SID); +static const uint32_t B200_TX_DATA0_SID = 0x00000050; +static const uint32_t B200_TX_MSG0_SID = FLIP_SID(B200_TX_DATA0_SID); -static const boost::uint32_t B200_TX_DATA1_SID = 0x00000060; -static const boost::uint32_t B200_TX_MSG1_SID = FLIP_SID(B200_TX_DATA1_SID); +static const uint32_t B200_TX_DATA1_SID = 0x00000060; +static const uint32_t B200_TX_MSG1_SID = FLIP_SID(B200_TX_DATA1_SID); -static const boost::uint32_t B200_RX_DATA0_SID = 0x000000A0; -static const boost::uint32_t B200_RX_DATA1_SID = 0x000000B0; +static const uint32_t B200_RX_DATA0_SID = 0x000000A0; +static const uint32_t B200_RX_DATA1_SID = 0x000000B0; -static const boost::uint32_t B200_TX_GPS_UART_SID = 0x00000030; -static const boost::uint32_t B200_RX_GPS_UART_SID = FLIP_SID(B200_TX_GPS_UART_SID); +static const uint32_t B200_TX_GPS_UART_SID = 0x00000030; +static const uint32_t B200_RX_GPS_UART_SID = FLIP_SID(B200_TX_GPS_UART_SID); -static const boost::uint32_t B200_LOCAL_CTRL_SID = 0x00000040; -static const boost::uint32_t B200_LOCAL_RESP_SID = FLIP_SID(B200_LOCAL_CTRL_SID); +static const uint32_t B200_LOCAL_CTRL_SID = 0x00000040; +static const uint32_t B200_LOCAL_RESP_SID = FLIP_SID(B200_LOCAL_CTRL_SID); static const unsigned char B200_USB_CTRL_RECV_INTERFACE = 4; static const unsigned char B200_USB_CTRL_RECV_ENDPOINT = 8; @@ -207,7 +207,7 @@ private: void handle_overflow(const size_t radio_index); struct gpio_state { - boost::uint32_t tx_bandsel_a, tx_bandsel_b, rx_bandsel_a, rx_bandsel_b, rx_bandsel_c, mimo, ref_sel, swap_atr; + uint32_t tx_bandsel_a, tx_bandsel_b, rx_bandsel_a, rx_bandsel_b, rx_bandsel_c, mimo, ref_sel, swap_atr; gpio_state() { tx_bandsel_a = 0; diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index d1468332e..0a00b9402 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -93,7 +93,7 @@ void b200_impl::set_auto_tick_rate( // See also the doxygen documentation for these steps in b200_impl.hpp // Step 1: Obtain LCM and max rate from all relevant dsps - boost::uint32_t lcm_rate = (rate == 0) ? 1 : static_cast(floor(rate + 0.5)); + uint32_t lcm_rate = (rate == 0) ? 1 : static_cast(floor(rate + 0.5)); for (int i = 0; i < 2; i++) { // Loop through rx and tx std::string dir = (i == 0) ? "tx" : "rx"; // We assume all 'set' DSPs are being used. @@ -115,9 +115,9 @@ void b200_impl::set_auto_tick_rate( } // Clean up floating point rounding errors if they crept in this_dsp_rate = std::min(max_tick_rate, this_dsp_rate); - lcm_rate = boost::math::lcm( + lcm_rate = boost::math::lcm( lcm_rate, - static_cast(floor(this_dsp_rate + 0.5)) + static_cast(floor(this_dsp_rate + 0.5)) ); } } @@ -266,7 +266,7 @@ void b200_impl::update_subdev_spec(const std::string &tx_rx, const uhd::usrp::su } static void b200_if_hdr_unpack_le( - const boost::uint32_t *packet_buff, + const uint32_t *packet_buff, vrt::if_packet_info_t &if_packet_info ){ if_packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; @@ -274,7 +274,7 @@ static void b200_if_hdr_unpack_le( } static void b200_if_hdr_pack_le( - boost::uint32_t *packet_buff, + uint32_t *packet_buff, vrt::if_packet_info_t &if_packet_info ){ if_packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; @@ -310,7 +310,7 @@ boost::optional b200_impl::handle_async_task( if (not buff or buff->size() < 8) return boost::none; - const boost::uint32_t sid = uhd::wtohx(buff->cast()[1]); + const uint32_t sid = uhd::wtohx(buff->cast()[1]); switch (sid) { //if the packet is a control response @@ -323,10 +323,10 @@ boost::optional b200_impl::handle_async_task( if (sid == B200_RESP1_MSG_SID) ctrl = data->radio_ctrl[1].lock(); if (sid == B200_LOCAL_RESP_SID) ctrl = data->local_ctrl.lock(); if (ctrl){ - ctrl->push_response(buff->cast()); + ctrl->push_response(buff->cast()); } else{ - return std::make_pair(sid, uhd::msg_task::buff_to_vector(buff->cast(), buff->size() ) ); + return std::make_pair(sid, uhd::msg_task::buff_to_vector(buff->cast(), buff->size() ) ); } break; } @@ -346,8 +346,8 @@ boost::optional b200_impl::handle_async_task( //extract packet info vrt::if_packet_info_t if_packet_info; - if_packet_info.num_packet_words32 = buff->size()/sizeof(boost::uint32_t); - const boost::uint32_t *packet_buff = buff->cast(); + if_packet_info.num_packet_words32 = buff->size()/sizeof(uint32_t); + const uint32_t *packet_buff = buff->cast(); //unpacking can fail try @@ -362,7 +362,7 @@ boost::optional b200_impl::handle_async_task( //fill in the async metadata async_metadata_t metadata; - load_metadata_from_buff(uhd::wtohx, metadata, if_packet_info, packet_buff, _tick_rate, i); + load_metadata_from_buff(uhd::wtohx, metadata, if_packet_info, packet_buff, _tick_rate, i); data->async_md->push_with_pop_on_full(metadata); standard_async_msg_prints(metadata); break; @@ -403,11 +403,11 @@ rx_streamer::sptr b200_impl::get_rx_stream(const uhd::stream_args_t &args_) if (args.otw_format == "sc12") perif.ctrl->poke32(TOREG(SR_RX_FMT), 1); if (args.otw_format == "fc32") perif.ctrl->poke32(TOREG(SR_RX_FMT), 2); if (args.otw_format == "sc8") perif.ctrl->poke32(TOREG(SR_RX_FMT), 3); - const boost::uint32_t sid = radio_index ? B200_RX_DATA1_SID : B200_RX_DATA0_SID; + const uint32_t sid = radio_index ? B200_RX_DATA1_SID : B200_RX_DATA0_SID; //calculate packet size static const size_t hdr_size = 0 - + vrt::max_if_hdr_words32*sizeof(boost::uint32_t) + + vrt::max_if_hdr_words32*sizeof(uint32_t) //+ sizeof(vrt::if_packet_info_t().tlr) //no longer using trailer - sizeof(vrt::if_packet_info_t().cid) //no class id ever used - sizeof(vrt::if_packet_info_t().tsi) //no int time ever used @@ -516,7 +516,7 @@ tx_streamer::sptr b200_impl::get_tx_stream(const uhd::stream_args_t &args_) //calculate packet size static const size_t hdr_size = 0 - + vrt::max_if_hdr_words32*sizeof(boost::uint32_t) + + vrt::max_if_hdr_words32*sizeof(uint32_t) //+ sizeof(vrt::if_packet_info_t().tlr) //forced to have trailer - sizeof(vrt::if_packet_info_t().cid) //no class id ever used - sizeof(vrt::if_packet_info_t().tsi) //no int time ever used diff --git a/host/lib/usrp/b200/b200_regs.hpp b/host/lib/usrp/b200/b200_regs.hpp index e9ab81bae..038a59d11 100644 --- a/host/lib/usrp/b200/b200_regs.hpp +++ b/host/lib/usrp/b200/b200_regs.hpp @@ -18,7 +18,7 @@ #ifndef INCLUDED_B200_REGS_HPP #define INCLUDED_B200_REGS_HPP -#include +#include #define TOREG(x) ((x)*4) @@ -61,64 +61,64 @@ static const double AD9361_SPI_RATE = 1e6; static const double ADF4001_SPI_RATE = 10e3; //slow for large time constant on spi lines /* ATR Control Bits */ -static const boost::uint32_t TX_ENABLE1 = (1 << 7); -static const boost::uint32_t SFDX1_RX = (1 << 6); -static const boost::uint32_t SFDX1_TX = (1 << 5); -static const boost::uint32_t SRX1_RX = (1 << 4); -static const boost::uint32_t SRX1_TX = (1 << 3); -static const boost::uint32_t LED_RX1 = (1 << 2); -static const boost::uint32_t LED_TXRX_RX1 = (1 << 1); -static const boost::uint32_t LED_TXRX_TX1 = (1 << 0); - -static const boost::uint32_t TX_ENABLE2 = (1 << 7); -static const boost::uint32_t SFDX2_RX = (1 << 6); -static const boost::uint32_t SFDX2_TX = (1 << 5); -static const boost::uint32_t SRX2_RX = (1 << 4); -static const boost::uint32_t SRX2_TX = (1 << 3); -static const boost::uint32_t LED_RX2 = (1 << 2); -static const boost::uint32_t LED_TXRX_RX2 = (1 << 1); -static const boost::uint32_t LED_TXRX_TX2 = (1 << 0); +static const uint32_t TX_ENABLE1 = (1 << 7); +static const uint32_t SFDX1_RX = (1 << 6); +static const uint32_t SFDX1_TX = (1 << 5); +static const uint32_t SRX1_RX = (1 << 4); +static const uint32_t SRX1_TX = (1 << 3); +static const uint32_t LED_RX1 = (1 << 2); +static const uint32_t LED_TXRX_RX1 = (1 << 1); +static const uint32_t LED_TXRX_TX1 = (1 << 0); + +static const uint32_t TX_ENABLE2 = (1 << 7); +static const uint32_t SFDX2_RX = (1 << 6); +static const uint32_t SFDX2_TX = (1 << 5); +static const uint32_t SRX2_RX = (1 << 4); +static const uint32_t SRX2_TX = (1 << 3); +static const uint32_t LED_RX2 = (1 << 2); +static const uint32_t LED_TXRX_RX2 = (1 << 1); +static const uint32_t LED_TXRX_TX2 = (1 << 0); /* ATR State Definitions. */ -static const boost::uint32_t STATE_OFF = 0x00; +static const uint32_t STATE_OFF = 0x00; ///////////////////////// side 1 /////////////////////////////////// -static const boost::uint32_t STATE_RX1_RX2 = (SFDX1_RX +static const uint32_t STATE_RX1_RX2 = (SFDX1_RX | SFDX1_TX | LED_RX1); -static const boost::uint32_t STATE_RX1_TXRX = (SRX1_RX +static const uint32_t STATE_RX1_TXRX = (SRX1_RX | SRX1_TX | LED_TXRX_RX1); -static const boost::uint32_t STATE_FDX1_TXRX = (TX_ENABLE1 +static const uint32_t STATE_FDX1_TXRX = (TX_ENABLE1 | SFDX1_RX | SFDX1_TX | LED_TXRX_TX1 | LED_RX1); -static const boost::uint32_t STATE_TX1_TXRX = (TX_ENABLE1 +static const uint32_t STATE_TX1_TXRX = (TX_ENABLE1 | SFDX1_RX | SFDX1_TX | LED_TXRX_TX1); ///////////////////////// side 2 /////////////////////////////////// -static const boost::uint32_t STATE_RX2_RX2 = (SFDX2_RX +static const uint32_t STATE_RX2_RX2 = (SFDX2_RX | SRX2_TX | LED_RX2); -static const boost::uint32_t STATE_RX2_TXRX = (SRX2_TX +static const uint32_t STATE_RX2_TXRX = (SRX2_TX | SRX2_RX | LED_TXRX_RX2); -static const boost::uint32_t STATE_FDX2_TXRX = (TX_ENABLE2 +static const uint32_t STATE_FDX2_TXRX = (TX_ENABLE2 | SFDX2_RX | SFDX2_TX | LED_TXRX_TX2 | LED_RX2); -static const boost::uint32_t STATE_TX2_TXRX = (TX_ENABLE2 +static const uint32_t STATE_TX2_TXRX = (TX_ENABLE2 | SFDX2_RX | SFDX2_TX | LED_TXRX_TX2); diff --git a/host/lib/usrp/b200/b200_uart.cpp b/host/lib/usrp/b200/b200_uart.cpp index 065aa49ce..3c49ebf2a 100644 --- a/host/lib/usrp/b200/b200_uart.cpp +++ b/host/lib/usrp/b200/b200_uart.cpp @@ -30,7 +30,7 @@ using namespace uhd::transport; struct b200_uart_impl : b200_uart { - b200_uart_impl(zero_copy_if::sptr xport, const boost::uint32_t sid): + b200_uart_impl(zero_copy_if::sptr xport, const uint32_t sid): _xport(xport), _sid(sid), _count(0), @@ -49,7 +49,7 @@ struct b200_uart_impl : b200_uart packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; packet_info.packet_type = vrt::if_packet_info_t::PACKET_TYPE_CONTEXT; packet_info.num_payload_words32 = 2; - packet_info.num_payload_bytes = packet_info.num_payload_words32*sizeof(boost::uint32_t); + packet_info.num_payload_bytes = packet_info.num_payload_words32*sizeof(uint32_t); packet_info.packet_count = _count++; packet_info.sob = false; packet_info.eob = false; @@ -60,11 +60,11 @@ struct b200_uart_impl : b200_uart packet_info.has_tsf = false; packet_info.has_tlr = false; - boost::uint32_t *packet_buff = buff->cast(); + uint32_t *packet_buff = buff->cast(); vrt::if_hdr_pack_le(packet_buff, packet_info); - packet_buff[packet_info.num_header_words32+0] = uhd::htowx(boost::uint32_t(_baud_div)); - packet_buff[packet_info.num_header_words32+1] = uhd::htowx(boost::uint32_t(ch)); - buff->commit(packet_info.num_packet_words32*sizeof(boost::uint32_t)); + packet_buff[packet_info.num_header_words32+0] = uhd::htowx(uint32_t(_baud_div)); + packet_buff[packet_info.num_header_words32+1] = uhd::htowx(uint32_t(ch)); + buff->commit(packet_info.num_packet_words32*sizeof(uint32_t)); } void write_uart(const std::string &buff) @@ -84,10 +84,10 @@ struct b200_uart_impl : b200_uart void handle_uart_packet(managed_recv_buffer::sptr buff) { - const boost::uint32_t *packet_buff = buff->cast(); + const uint32_t *packet_buff = buff->cast(); vrt::if_packet_info_t packet_info; packet_info.link_type = vrt::if_packet_info_t::LINK_TYPE_CHDR; - packet_info.num_packet_words32 = buff->size()/sizeof(boost::uint32_t); + packet_info.num_packet_words32 = buff->size()/sizeof(uint32_t); vrt::if_hdr_unpack_le(packet_buff, packet_info); const char ch = char(uhd::wtohx(packet_buff[packet_info.num_header_words32+1])); _line += ch; @@ -99,7 +99,7 @@ struct b200_uart_impl : b200_uart } const zero_copy_if::sptr _xport; - const boost::uint32_t _sid; + const uint32_t _sid; size_t _count; size_t _baud_div; bounded_buffer _line_queue; @@ -107,7 +107,7 @@ struct b200_uart_impl : b200_uart }; -b200_uart::sptr b200_uart::make(zero_copy_if::sptr xport, const boost::uint32_t sid) +b200_uart::sptr b200_uart::make(zero_copy_if::sptr xport, const uint32_t sid) { return b200_uart::sptr(new b200_uart_impl(xport, sid)); } diff --git a/host/lib/usrp/b200/b200_uart.hpp b/host/lib/usrp/b200/b200_uart.hpp index f58479888..3d4ece240 100644 --- a/host/lib/usrp/b200/b200_uart.hpp +++ b/host/lib/usrp/b200/b200_uart.hpp @@ -27,7 +27,7 @@ class b200_uart: boost::noncopyable, public uhd::uart_iface { public: typedef boost::shared_ptr sptr; - static sptr make(uhd::transport::zero_copy_if::sptr, const boost::uint32_t sid); + static sptr make(uhd::transport::zero_copy_if::sptr, const uint32_t sid); virtual void handle_uart_packet(uhd::transport::managed_recv_buffer::sptr buff) = 0; }; -- cgit v1.2.3