diff options
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/transport/udp_zero_copy.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/b100/b100_impl.hpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/common/fx2_ctrl.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/common/fx2_ctrl.hpp | 19 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx_version4.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_xcvr2450.cpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/gps_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/dboard_iface.cpp | 42 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/io_impl.cpp | 23 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.cpp | 3 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.hpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.hpp | 19 |
14 files changed, 150 insertions, 25 deletions
diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index 9125be53a..166177177 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_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 @@ -24,6 +24,7 @@ #include <uhd/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> +#include <boost/thread/thread.hpp> //sleep #include <vector> using namespace uhd; @@ -112,7 +113,20 @@ public: _mem(mem), _sock_fd(sock_fd), _frame_size(frame_size) { /*NOP*/ } void release(void){ - UHD_ASSERT_THROW(::send(_sock_fd, (const char *)_mem, size(), 0) == ssize_t(size())); + //Retry logic because send may fail with ENOBUFS. + //This is known to occur at least on some OSX systems. + //But it should be safe to always check for the error. + while (true) + { + const ssize_t ret = ::send(_sock_fd, (const char *)_mem, size(), 0); + if (ret == ssize_t(size())) break; + if (ret == -1 and errno == ENOBUFS) + { + boost::this_thread::sleep(boost::posix_time::microseconds(1)); + continue; //try to send again + } + UHD_ASSERT_THROW(ret == ssize_t(size())); + } _claimer.release(); } diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index a5a0ef9b0..c4d050242 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -18,9 +18,6 @@ #include "apply_corrections.hpp" #include "b100_impl.hpp" #include "b100_regs.hpp" -#include "fpga_regs_standard.h" -#include "usrp_i2c_addr.h" -#include "usrp_commands.h" #include <uhd/transport/usb_control.hpp> #include <uhd/utils/msg.hpp> #include <uhd/exception.hpp> diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp index 250229fb8..68d7043a1 100644 --- a/host/lib/usrp/b100/b100_impl.hpp +++ b/host/lib/usrp/b100/b100_impl.hpp @@ -55,6 +55,16 @@ static const double B100_DEFAULT_TICK_RATE = 64e6; static const size_t B100_MAX_PKT_BYTE_LIMIT = 2048; static const std::string B100_EEPROM_MAP_KEY = "B100"; +#define I2C_ADDR_TX_A (I2C_DEV_EEPROM | 0x4) +#define I2C_ADDR_RX_A (I2C_DEV_EEPROM | 0x5) +#define I2C_ADDR_TX_B (I2C_DEV_EEPROM | 0x6) +#define I2C_ADDR_RX_B (I2C_DEV_EEPROM | 0x7) +#define I2C_DEV_EEPROM 0x50 + +#define VRQ_FW_COMPAT 0x83 +#define VRQ_ENABLE_GPIF 0x0d +#define VRQ_CLEAR_FPGA_FIFO 0x0e + //! Make a b100 dboard interface uhd::usrp::dboard_iface::sptr make_b100_dboard_iface( wb_iface::sptr wb_iface, diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp index 5cc701eb0..93303542e 100644 --- a/host/lib/usrp/common/fx2_ctrl.cpp +++ b/host/lib/usrp/common/fx2_ctrl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 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 @@ -16,7 +16,6 @@ // #include "fx2_ctrl.hpp" -#include "usrp_commands.h" #include <uhd/utils/msg.hpp> #include <uhd/exception.hpp> #include <uhd/transport/usb_control.hpp> diff --git a/host/lib/usrp/common/fx2_ctrl.hpp b/host/lib/usrp/common/fx2_ctrl.hpp index f2e060862..9f8cec296 100644 --- a/host/lib/usrp/common/fx2_ctrl.hpp +++ b/host/lib/usrp/common/fx2_ctrl.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 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 @@ -23,6 +23,23 @@ #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> +#define FL_BEGIN 0 +#define FL_END 2 +#define FL_XFER 1 +#define USRP_HASH_SLOT_0_ADDR 0xe1e0 +#define USRP_HASH_SLOT_1_ADDR 0xe1f0 +#define VRQ_FPGA_LOAD 0x02 +#define VRQ_FPGA_SET_RESET 0x04 +#define VRQ_FPGA_SET_TX_ENABLE 0x05 +#define VRQ_FPGA_SET_RX_ENABLE 0x06 +#define VRQ_FPGA_SET_TX_RESET 0x0a +#define VRQ_FPGA_SET_RX_RESET 0x0b +#define VRQ_I2C_READ 0x81 +#define VRQ_I2C_WRITE 0x08 +#define VRQ_SET_LED 0x01 +#define VRT_VENDOR_IN 0xC0 +#define VRT_VENDOR_OUT 0x40 + namespace uhd{ namespace usrp{ class fx2_ctrl : boost::noncopyable, public uhd::i2c_iface{ diff --git a/host/lib/usrp/dboard/db_wbx_version4.cpp b/host/lib/usrp/dboard/db_wbx_version4.cpp index 17b910de4..1feea2c0b 100644 --- a/host/lib/usrp/dboard/db_wbx_version4.cpp +++ b/host/lib/usrp/dboard/db_wbx_version4.cpp @@ -41,7 +41,7 @@ static const uhd::dict<std::string, gain_range_t> wbx_v4_tx_gain_ranges = map_li ("PGA0", gain_range_t(0, 31, 1.0)) ; -static const freq_range_t wbx_v4_freq_range(35.0e6, 2.2e9); +static const freq_range_t wbx_v4_freq_range(25.0e6, 2.2e9); /*********************************************************************** diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index 348195a6e..50c67991a 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -190,6 +190,7 @@ static dboard_base::sptr make_xcvr2450(dboard_base::ctor_args_t args){ UHD_STATIC_BLOCK(reg_xcvr2450_dboard){ //register the factory function for the rx and tx dbids dboard_manager::register_dboard(0x0061, 0x0060, &make_xcvr2450, "XCVR2450"); + dboard_manager::register_dboard(0x0061, 0x0059, &make_xcvr2450, "XCVR2450 - r2.1"); } /*********************************************************************** @@ -370,7 +371,7 @@ double xcvr2450::set_lo_freq_core(double target_freq){ //variables used in the calculation below double scaler = xcvr2450::is_highband(target_freq)? (4.0/5.0) : (4.0/3.0); - double ref_freq = this->get_iface()->get_clock_rate(dboard_iface::UNIT_TX); + double ref_freq = this->get_iface()->get_codec_rate(dboard_iface::UNIT_TX); int R, intdiv, fracdiv; //loop through values until we get a match @@ -410,6 +411,16 @@ double xcvr2450::set_lo_freq_core(double target_freq){ //new band select settings and ad9515 divider this->update_atr(); + const bool div_ext(this->get_tx_id() == 0x0059); + if (div_ext) + { + this->get_iface()->set_clock_rate(dboard_iface::UNIT_TX, ref_freq/_ad9515div); + } + else + { + this->get_iface()->set_clock_rate(dboard_iface::UNIT_TX, ref_freq); + } + //load new counters into registers _max2829_regs.int_div_ratio_word = intdiv; _max2829_regs.frac_div_ratio_lsb = fracdiv & 0x3; diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 741e69397..917f115f3 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -242,7 +242,7 @@ private: ptime get_time(void) { int error_cnt = 0; ptime gps_time; - while(error_cnt < 10) { + while(error_cnt < 2) { try { std::string reply = get_nmea("GPRMC"); diff --git a/host/lib/usrp/usrp1/dboard_iface.cpp b/host/lib/usrp/usrp1/dboard_iface.cpp index 34bbe1893..39850d5d1 100644 --- a/host/lib/usrp/usrp1/dboard_iface.cpp +++ b/host/lib/usrp/usrp1/dboard_iface.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 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 @@ -17,9 +17,6 @@ #include "usrp1_iface.hpp" #include "usrp1_impl.hpp" -#include "fpga_regs_common.h" -#include "usrp_spi_defs.h" -#include "fpga_regs_standard.h" #include "codec_ctrl.hpp" #include <uhd/usrp/dboard_iface.hpp> #include <uhd/types/dict.hpp> @@ -27,6 +24,43 @@ #include <boost/assign/list_of.hpp> #include <iostream> +#define FR_OE_0 5 +#define FR_OE_1 6 +#define FR_OE_2 7 +#define FR_OE_3 8 + +#define FR_ATR_MASK_0 20 +#define FR_ATR_TXVAL_0 21 +#define FR_ATR_RXVAL_0 22 + +#define FR_ATR_MASK_1 23 +#define FR_ATR_TXVAL_1 24 +#define FR_ATR_RXVAL_1 25 + +#define FR_ATR_MASK_2 26 +#define FR_ATR_TXVAL_2 27 +#define FR_ATR_RXVAL_2 28 + +#define FR_ATR_MASK_3 29 +#define FR_ATR_TXVAL_3 30 +#define FR_ATR_RXVAL_3 31 + +#define FR_RX_A_REFCLK 41 +#define FR_RX_B_REFCLK 43 + +// i/o registers for pins that go to daughterboards. +// top 16 is a mask, low 16 is value + +#define FR_IO_0 9 // slot 0 +#define FR_IO_1 10 +#define FR_IO_2 11 +#define FR_IO_3 12 +#define SPI_ENABLE_TX_A 0x10 // select d'board TX A +#define SPI_ENABLE_RX_A 0x20 // select d'board RX A +#define SPI_ENABLE_TX_B 0x40 // select d'board TX B +#define SPI_ENABLE_RX_B 0x80 // select d'board RX B + + using namespace uhd; using namespace uhd::usrp; using namespace boost::assign; diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 1d8b9bd76..8940a92bb 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -21,9 +21,6 @@ #define SSPH_DONT_PAD_TO_ONE #include "../../transport/super_send_packet_handler.hpp" #include "usrp1_calc_mux.hpp" -#include "fpga_regs_standard.h" -#include "fpga_regs_common.h" -#include "usrp_commands.h" #include "usrp1_impl.hpp" #include <uhd/utils/msg.hpp> #include <uhd/utils/tasks.hpp> @@ -36,6 +33,26 @@ #include <boost/format.hpp> #include <boost/make_shared.hpp> +#define bmFR_RX_FORMAT_SHIFT_SHIFT 0 +#define bmFR_RX_FORMAT_WIDTH_SHIFT 4 +#define bmFR_TX_FORMAT_16_IQ 0 +#define bmFR_RX_FORMAT_WANT_Q (0x1 << 9) +#define FR_RX_FREQ_0 34 +#define FR_RX_FREQ_1 35 +#define FR_RX_FREQ_2 36 +#define FR_RX_FREQ_3 37 +#define FR_INTERP_RATE 32 +#define FR_DECIM_RATE 33 +#define FR_RX_MUX 38 +#define FR_TX_MUX 39 +#define FR_TX_FORMAT 48 +#define FR_RX_FORMAT 49 +#define FR_TX_SAMPLE_RATE_DIV 0 +#define FR_RX_SAMPLE_RATE_DIV 1 +#define GS_TX_UNDERRUN 0 +#define GS_RX_OVERRUN 1 +#define VRQ_GET_STATUS 0x80 + using namespace uhd; using namespace uhd::usrp; using namespace uhd::transport; diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index c790aecb4..16b747e45 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 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 @@ -16,7 +16,6 @@ // #include "usrp1_iface.hpp" -#include "usrp_commands.h" #include <uhd/utils/log.hpp> #include <uhd/exception.hpp> #include <uhd/utils/byteswap.hpp> diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp index c1ac34f25..4612d7912 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.hpp +++ b/host/lib/usrp/usrp1/usrp1_iface.hpp @@ -24,6 +24,19 @@ #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> +#define SPI_ENABLE_FPGA 0x01 +#define SPI_FMT_HDR_MASK (3 << 5) +#define SPI_FMT_HDR_0 (0 << 5) +#define SPI_FMT_HDR_1 (1 << 5) +#define SPI_FMT_HDR_2 (2 << 5) +#define SPI_FMT_LSB (1 << 7) +#define SPI_FMT_MSB (0 << 7) +#define SPI_FMT_xSB_MASK (1 << 7) +#define VRQ_SPI_READ 0x82 +#define VRQ_SPI_WRITE 0x09 +#define VRQ_FW_COMPAT 0x83 + + /*! * The usrp1 interface class: * Provides a set of functions to implementation layer. diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index a5e51b7d2..253ac1d6f 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -16,11 +16,6 @@ // #include "usrp1_impl.hpp" -#include "usrp_spi_defs.h" -#include "usrp_commands.h" -#include "fpga_regs_standard.h" -#include "fpga_regs_common.h" -#include "usrp_i2c_addr.h" #include <uhd/utils/log.hpp> #include <uhd/utils/safe_call.hpp> #include <uhd/transport/usb_control.hpp> diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index 9461f0081..0be8ebca9 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -40,6 +40,25 @@ static const std::string USRP1_EEPROM_MAP_KEY = "B000"; +#define FR_RB_CAPS 3 +#define FR_MODE 13 +#define FR_DEBUG_EN 14 +#define FR_DC_OFFSET_CL_EN 15 +#define FR_ADC_OFFSET_0 16 +#define FR_ADC_OFFSET_1 17 +#define FR_ADC_OFFSET_2 18 +#define FR_ADC_OFFSET_3 19 + +#define I2C_DEV_EEPROM 0x50 +#define I2C_ADDR_BOOT (I2C_DEV_EEPROM | 0x0) +#define I2C_ADDR_TX_A (I2C_DEV_EEPROM | 0x4) +#define I2C_ADDR_RX_A (I2C_DEV_EEPROM | 0x5) +#define I2C_ADDR_TX_B (I2C_DEV_EEPROM | 0x6) +#define I2C_ADDR_RX_B (I2C_DEV_EEPROM | 0x7) + +#define SPI_ENABLE_CODEC_A 0x02 +#define SPI_ENABLE_CODEC_B 0x04 + /*! * USRP1 implementation guts: * The implementation details are encapsulated here. |