diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/cmake/Modules/UHDPackage.cmake | 7 | ||||
-rw-r--r-- | host/docs/calibration.rst | 8 | ||||
-rw-r--r-- | host/examples/rx_samples_to_udp.cpp | 4 | ||||
-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/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 | ||||
-rw-r--r-- | host/utils/uhd_cal_rx_iq_balance.cpp | 5 | ||||
-rw-r--r-- | host/utils/uhd_cal_tx_dc_offset.cpp | 5 | ||||
-rw-r--r-- | host/utils/uhd_cal_tx_iq_balance.cpp | 5 | ||||
-rw-r--r-- | host/utils/uhd_images_downloader.py.in | 4 | ||||
-rw-r--r-- | host/utils/usrp_cal_utils.hpp | 28 |
18 files changed, 179 insertions, 27 deletions
diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake index 5dafd19fa..330a9ecc2 100644 --- a/host/cmake/Modules/UHDPackage.cmake +++ b/host/cmake/Modules/UHDPackage.cmake @@ -96,6 +96,13 @@ SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/AUTHORS.txt) SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt) ######################################################################## +# Setup CPack Source +######################################################################## + +SET(CPACK_SOURCE_PACKAGE_FILE_NAME "uhd-source_${UHD_VERSION}") +SET(CPACK_SOURCE_IGNORE_FILES "\\\\.git*") + +######################################################################## # Setup CPack Components ######################################################################## SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development") diff --git a/host/docs/calibration.rst b/host/docs/calibration.rst index c97eebfd5..1945c4dd5 100644 --- a/host/docs/calibration.rst +++ b/host/docs/calibration.rst @@ -47,6 +47,14 @@ Each utility will take several minutes to complete. See the output given by --help for more advanced options, such as: manually choosing the frequency range and step size for the sweeps. +**Note:** +Your daughterboard needs a serial number to run a calibration utility. Some older daughterboards +may not have a serial number. If this is the case, run the following command to burn a serial number +into the daughterboard's EEPROM: +:: + + <install dir>/share/uhd/utils/usrp_burn_db_eeprom --ser=<desired serial> --args=<optional device args> + ******************************************** Calibration Data ******************************************** diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp index 105db0a02..f637f9313 100644 --- a/host/examples/rx_samples_to_udp.cpp +++ b/host/examples/rx_samples_to_udp.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 @@ -160,7 +160,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } //send complex single precision floating point samples over udp - udp_xport->send(boost::asio::buffer(buff, num_rx_samps)); + udp_xport->send(boost::asio::buffer(buff, num_rx_samps*sizeof(buff.front()))); num_acc_samps += num_rx_samps; } done_loop: 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/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. diff --git a/host/utils/uhd_cal_rx_iq_balance.cpp b/host/utils/uhd_cal_rx_iq_balance.cpp index ab951b754..5fb494114 100644 --- a/host/utils/uhd_cal_rx_iq_balance.cpp +++ b/host/utils/uhd_cal_rx_iq_balance.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 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 @@ -136,6 +136,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ usrp->set_rx_antenna("CAL"); usrp->set_tx_antenna("CAL"); + //fail if daughterboard has no serial + check_for_empty_serial(usrp, "RX", "rx", args); + //set optimum defaults set_optimum_defaults(usrp); diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp index 152f61918..c9cf757f4 100644 --- a/host/utils/uhd_cal_tx_dc_offset.cpp +++ b/host/utils/uhd_cal_tx_dc_offset.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 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 @@ -138,6 +138,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ usrp->set_rx_antenna("CAL"); usrp->set_tx_antenna("CAL"); + //fail if daughterboard has no serial + check_for_empty_serial(usrp, "TX", "tx", args); + //set optimum defaults set_optimum_defaults(usrp); diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp index 4c8642660..20d018edf 100644 --- a/host/utils/uhd_cal_tx_iq_balance.cpp +++ b/host/utils/uhd_cal_tx_iq_balance.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 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 @@ -139,6 +139,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ usrp->set_rx_antenna("CAL"); usrp->set_tx_antenna("CAL"); + //fail if daughterboard has no serial + check_for_empty_serial(usrp, "TX", "tx", args); + //set optimum defaults set_optimum_defaults(usrp); diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index a57f9dc48..8c8d2df81 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -38,7 +38,7 @@ if __name__ == "__main__": #Command line options parser = OptionParser() - parser.add_option("--install-location", type="string", default="@CMAKE_INSTALL_PREFIX@/share/uhd/images", help="Set custom install location for images, [default=%default]") + parser.add_option("--install-location", type="string", default="", help="Set custom install location for images") parser.add_option("--buffer-size", type="int", default=8192, help="Set download buffer size, [default=%default]",) (options, args) = parser.parse_args() @@ -52,6 +52,8 @@ if __name__ == "__main__": #Configuring image destination if options.install_location != "": images_dir = options.install_location + elif os.environ.get("UHD_IMAGES_DIR") != "" and os.environ.get("UHD_IMAGES_DIR") != None: + images_dir = os.environ.get("UHD_IMAGES_DIR") else: images_dir = "@CMAKE_INSTALL_PREFIX@/share/uhd/images" diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 364b68bbe..4a2303d34 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -19,11 +19,14 @@ #include <uhd/property_tree.hpp> #include <uhd/usrp/multi_usrp.hpp> #include <uhd/usrp/dboard_eeprom.hpp> +#include <uhd/utils/paths.hpp> #include <boost/filesystem.hpp> +#include <boost/format.hpp> #include <iostream> #include <vector> #include <complex> #include <cmath> +#include <cstdlib> #include <fstream> namespace fs = boost::filesystem; @@ -99,6 +102,30 @@ static inline void set_optimum_defaults(uhd::usrp::multi_usrp::sptr usrp){ } /*********************************************************************** + * Check for empty serial + **********************************************************************/ + +void check_for_empty_serial( + uhd::usrp::multi_usrp::sptr usrp, + std::string XX, + std::string xx, + std::string uhd_args +){ + + //extract eeprom + uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); + const uhd::fs_path db_path = "/mboards/0/dboards/A/" + xx + "_eeprom"; + const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); + + std::string args_str = ""; + if(uhd_args != "") args_str = str(boost::format(" --args=%s") % uhd_args); + + std::string error_string = str(boost::format("This %s dboard has no serial!\n\nPlease see the Calibration documentation for details on how to fix this.") % XX); + + if (db_eeprom.serial.empty()) throw std::runtime_error(error_string); +} + +/*********************************************************************** * Sinusoid wave table **********************************************************************/ class wave_table{ @@ -160,7 +187,6 @@ static void store_results( uhd::property_tree::sptr tree = usrp->get_device()->get_tree(); const uhd::fs_path db_path = "/mboards/0/dboards/A/" + xx + "_eeprom"; const uhd::usrp::dboard_eeprom_t db_eeprom = tree->access<uhd::usrp::dboard_eeprom_t>(db_path).get(); - if (db_eeprom.serial.empty()) throw std::runtime_error(XX + " dboard has empty serial!"); //make the calibration file path fs::path cal_data_path = fs::path(uhd::get_app_path()) / ".uhd"; |