From 0db669b3ce4dc5ec6cd38d8d80159d9030393288 Mon Sep 17 00:00:00 2001 From: michael-west Date: Fri, 13 Jun 2014 11:58:29 -0700 Subject: Enhancement #512: B210: Need an Internal PPS - Added support for internal PPS selection (set as default) --- host/lib/usrp/b200/b200_impl.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 98141dbaa..91a3cb037 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -427,7 +427,7 @@ b200_impl::b200_impl(const device_addr_t &device_addr) //setup time source props _tree->create(mb_path / "time_source" / "value") .subscribe(boost::bind(&b200_impl::update_time_source, this, _1)); - static const std::vector time_sources = boost::assign::list_of("none")("external")("gpsdo"); + static const std::vector time_sources = boost::assign::list_of("none")("internal")("external")("gpsdo"); _tree->create >(mb_path / "time_source" / "options").set(time_sources); //setup reference source props _tree->create(mb_path / "clock_source" / "value") @@ -464,10 +464,6 @@ b200_impl::b200_impl(const device_addr_t &device_addr) _tree->access(mb_path / "rx_subdev_spec").set(rx_spec); _tree->access(mb_path / "tx_subdev_spec").set(tx_spec); - //init to internal clock and time source - _tree->access(mb_path / "clock_source/value").set("internal"); - _tree->access(mb_path / "time_source/value").set("none"); - //GPS installed: use external ref, time, and init time spec if (_gps and _gps->gps_detected()) { @@ -477,6 +473,10 @@ b200_impl::b200_impl(const device_addr_t &device_addr) UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; const time_t tp = time_t(_gps->get_sensor("gps_time").to_int()+1); _tree->access(mb_path / "time" / "pps").set(time_spec_t(tp)); + } else { + //init to internal clock and time source + _tree->access(mb_path / "clock_source/value").set("internal"); + _tree->access(mb_path / "time_source/value").set("internal"); } } @@ -785,11 +785,17 @@ void b200_impl::update_clock_source(const std::string &source) void b200_impl::update_time_source(const std::string &source) { - if (source == "none"){} - else if (source == "external"){} - else if (source == "gpsdo"){} + boost::uint32_t value = 0; + if (source == "none") + value = 3; + else if (source == "internal") + value = 2; + else if (source == "external") + value = 1; + else if (source == "gpsdo") + value = 0; else throw uhd::key_error("update_time_source: unknown source: " + source); - _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), (source == "external")? 1 : 0); + _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), value); } /*********************************************************************** -- cgit v1.2.3 From 248df215aa0b382e2c54877680abfc1ca823bb6b Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 18 Jun 2014 12:43:10 -0700 Subject: Fix for BUG #516: B210: Fails to Run with 30.72 MHz Clock - Corrected clock rate checks for B2x0 --- host/lib/usrp/b200/b200_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 261183128..40b316175 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -681,7 +681,7 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co else { const double max_tick_rate = ((chan_count <= 1) ? AD9361_1_CHAN_CLOCK_RATE_MAX : AD9361_2_CHAN_CLOCK_RATE_MAX); - if (tick_rate > max_tick_rate) + if (tick_rate > max_tick_rate and (tick_rate - max_tick_rate > 1.0)) { throw uhd::value_error(boost::str( boost::format("current master clock rate (%.2f MHz) exceeds maximum possible master clock rate (%.2f MHz) when using %d %s channels") @@ -696,12 +696,12 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co double b200_impl::set_tick_rate(const double rate) { - UHD_MSG(status) << "Asking for clock rate " << rate/1e6 << " MHz\n"; + UHD_MSG(status) << (boost::format("Asking for clock rate %.2f MHz\n") % (rate/1e6)); check_tick_rate_with_current_streamers(rate); // Defined in b200_io_impl.cpp _tick_rate = _codec_ctrl->set_clock_rate(rate); - UHD_MSG(status) << "Actually got clock rate " << _tick_rate/1e6 << " MHz\n"; + UHD_MSG(status) << (boost::format("Actually got clock rate %.2f MHz\n") % (_tick_rate/1e6)); //reset after clock rate change this->reset_codec_dcm(); -- cgit v1.2.3 From 016430b3f8b3535b59e70592fc1029f783cf6cd0 Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 18 Jun 2014 13:42:24 -0700 Subject: Fix for BUG #516: B210: Fails to Run with 30.72 MHz Clock - Corrected clock rate checks for B2x0 --- host/lib/usrp/b200/b200_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 40b316175..72dd25904 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -684,7 +684,7 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co if (tick_rate > max_tick_rate and (tick_rate - max_tick_rate > 1.0)) { throw uhd::value_error(boost::str( - boost::format("current master clock rate (%.2f MHz) exceeds maximum possible master clock rate (%.2f MHz) when using %d %s channels") + boost::format("current master clock rate (%.6f MHz) exceeds maximum possible master clock rate (%.6f MHz) when using %d %s channels") % (tick_rate/1e6) % (max_tick_rate/1e6) % chan_count @@ -696,12 +696,12 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co double b200_impl::set_tick_rate(const double rate) { - UHD_MSG(status) << (boost::format("Asking for clock rate %.2f MHz\n") % (rate/1e6)); + UHD_MSG(status) << (boost::format("Asking for clock rate %.6f MHz\n") % (rate/1e6)); check_tick_rate_with_current_streamers(rate); // Defined in b200_io_impl.cpp _tick_rate = _codec_ctrl->set_clock_rate(rate); - UHD_MSG(status) << (boost::format("Actually got clock rate %.2f MHz\n") % (_tick_rate/1e6)); + UHD_MSG(status) << (boost::format("Actually got clock rate %.6f MHz\n") % (_tick_rate/1e6)); //reset after clock rate change this->reset_codec_dcm(); -- cgit v1.2.3 From 1bca847406dc4829fd6cfe0ba8bc49b83d25e1ee Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Fri, 27 Jun 2014 10:50:51 -0700 Subject: x300: Bugfix for overflows on PCIe at 200MS/s --- host/lib/usrp/x300/x300_impl.cpp | 4 ++-- host/lib/usrp/x300/x300_impl.hpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 2c291f422..a624ebf6b 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1129,12 +1129,12 @@ x300_impl::both_xports_t x300_impl::make_transport( if (mb.xport_path == "nirio") { default_buff_args.send_frame_size = (prefix == X300_RADIO_DEST_PREFIX_TX) - ? X300_PCIE_DATA_FRAME_SIZE + ? X300_PCIE_TX_DATA_FRAME_SIZE : X300_PCIE_MSG_FRAME_SIZE; default_buff_args.recv_frame_size = (prefix == X300_RADIO_DEST_PREFIX_RX) - ? X300_PCIE_DATA_FRAME_SIZE + ? X300_PCIE_RX_DATA_FRAME_SIZE : X300_PCIE_MSG_FRAME_SIZE; default_buff_args.num_send_frames = diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 80f3e8faa..27f20fbd9 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -63,7 +63,11 @@ static const size_t X300_RX_SW_BUFF_SIZE_ETH_MACOS = 0x100000; //1Mib static const double X300_RX_SW_BUFF_FULL_FACTOR = 0.90; //Buffer should ideally be 90% full. static const size_t X300_RX_FC_REQUEST_FREQ = 32; //per flow-control window -static const size_t X300_PCIE_DATA_FRAME_SIZE = 8192; //bytes +//The FIFO closest to the DMA controller is 1023 elements deep for RX and 1029 elements deep for TX +//where an element is 8 bytes. For best throughput ensure that the data frame fits in these buffers. +//Also ensure that the kernel has enough frames to hold buffered TX and RX data +static const size_t X300_PCIE_RX_DATA_FRAME_SIZE = 8184; //bytes +static const size_t X300_PCIE_TX_DATA_FRAME_SIZE = 8192; //bytes static const size_t X300_PCIE_DATA_NUM_FRAMES = 2048; static const size_t X300_PCIE_MSG_FRAME_SIZE = 256; //bytes static const size_t X300_PCIE_MSG_NUM_FRAMES = 32; -- cgit v1.2.3 From df4cf6d6ecab4a11171183fca55b3aa3f011ed43 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 30 Jun 2014 16:00:06 -0700 Subject: Fixing help text for --ref argument in some examples. Reported by Marcus Mueller. --- host/examples/rx_ascii_art_dft.cpp | 2 +- host/examples/rx_samples_to_file.cpp | 2 +- host/examples/rx_samples_to_udp.cpp | 2 +- host/examples/tx_samples_from_file.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'host') diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp index 85cf8b50c..564a9e749 100644 --- a/host/examples/rx_ascii_art_dft.cpp +++ b/host/examples/rx_ascii_art_dft.cpp @@ -55,7 +55,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("frame-rate", po::value(&frame_rate)->default_value(5), "frame rate of the display (fps)") ("ref-lvl", po::value(&ref_lvl)->default_value(0), "reference level for the display (dB)") ("dyn-rng", po::value(&dyn_rng)->default_value(60), "dynamic range for the display (dB)") - ("ref", po::value(&ref)->default_value("internal"), "waveform type (internal, external, mimo)") + ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") ("int-n", "tune USRP with integer-N tuning") ; po::variables_map vm; diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp index de3640794..e196b8592 100644 --- a/host/examples/rx_samples_to_file.cpp +++ b/host/examples/rx_samples_to_file.cpp @@ -231,7 +231,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("ant", po::value(&ant), "daughterboard antenna selection") ("subdev", po::value(&subdev), "daughterboard subdevice specification") ("bw", po::value(&bw), "daughterboard IF filter bandwidth in Hz") - ("ref", po::value(&ref)->default_value("internal"), "waveform type (internal, external, mimo)") + ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") ("wirefmt", po::value(&wirefmt)->default_value("sc16"), "wire format (sc8 or sc16)") ("setup", po::value(&setup_time)->default_value(1.0), "seconds of setup time") ("progress", "periodically display short-term bandwidth") diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp index 2f62652e0..e397dbbf9 100644 --- a/host/examples/rx_samples_to_udp.cpp +++ b/host/examples/rx_samples_to_udp.cpp @@ -52,7 +52,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("bw", po::value(&bw), "daughterboard IF filter bandwidth in Hz") ("port", po::value(&port)->default_value("7124"), "server udp port") ("addr", po::value(&addr)->default_value("192.168.1.10"), "resolvable server address") - ("ref", po::value(&ref)->default_value("internal"), "waveform type (internal, external, mimo)") + ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") ("int-n", "tune USRP with integer-N tuning") ; po::variables_map vm; diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp index f911c446e..3293f8bd4 100644 --- a/host/examples/tx_samples_from_file.cpp +++ b/host/examples/tx_samples_from_file.cpp @@ -88,7 +88,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("ant", po::value(&ant), "daughterboard antenna selection") ("subdev", po::value(&subdev), "daughterboard subdevice specification") ("bw", po::value(&bw), "daughterboard IF filter bandwidth in Hz") - ("ref", po::value(&ref)->default_value("internal"), "waveform type (internal, external, mimo)") + ("ref", po::value(&ref)->default_value("internal"), "reference source (internal, external, mimo)") ("wirefmt", po::value(&wirefmt)->default_value("sc16"), "wire format (sc8 or sc16)") ("delay", po::value(&delay)->default_value(0.0), "specify a delay between repeated transmission of file") ("repeat", "repeatedly transmit file") -- cgit v1.2.3 From 24aaac8e3f25a6d52cd11645e1f4b4533fa3d2fc Mon Sep 17 00:00:00 2001 From: michael-west Date: Tue, 1 Jul 2014 17:11:30 -0700 Subject: Fix for BUG #527: N200: 50 Msps results in two tones - Adjusted check to enable first half-band filter only if the rate is decimated enough between the CIC and other half-band filter --- host/lib/usrp/cores/rx_dsp_core_200.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'host') diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 2fdc220b5..2e5ca8e7a 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -176,7 +176,8 @@ public: //determine which half-band filters are activated int hb0 = 0, hb1 = 0; - if (decim % 2 == 0){ + // hb0 can only be enabled if the rate will be decimated by at least 2 between the CIC and hb1 + if (decim >= 4 && decim % 2 == 0){ hb0 = 1; decim /= 2; } -- cgit v1.2.3 From 487e7fc2b41deb3867d24d8e4dacb10d2cafebb1 Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 10 Jul 2014 14:37:38 -0700 Subject: BUG #516: B210: Fails to Run with 30.72 MHz Clock - Addressed feedback from review. --- host/lib/usrp/b200/b200_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 72dd25904..d8c8db9ae 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -681,7 +681,7 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co else { const double max_tick_rate = ((chan_count <= 1) ? AD9361_1_CHAN_CLOCK_RATE_MAX : AD9361_2_CHAN_CLOCK_RATE_MAX); - if (tick_rate > max_tick_rate and (tick_rate - max_tick_rate > 1.0)) + if (tick_rate - max_tick_rate >= 1.0) { throw uhd::value_error(boost::str( boost::format("current master clock rate (%.6f MHz) exceeds maximum possible master clock rate (%.6f MHz) when using %d %s channels") -- cgit v1.2.3 From 8f6e2ac9972151318bf6883d45ee099a5013ae1e Mon Sep 17 00:00:00 2001 From: michael-west Date: Sat, 10 May 2014 19:40:15 -0700 Subject: Fix for BUG #469: Bad/Empty GPS NMEA strings returned when the queries are made in a random wait iterative fashion Fix for BUG #460: X300: GPGGA sensor most often empty, while RMC is usually OK - Added checksum verification of NMEA strings - Improved handling of short or malformed strings - Fixed GPSDO data synchronization between X300 firmware and host --- firmware/x300/x300/x300_main.c | 15 +++++-- host/lib/usrp/gps_ctrl.cpp | 39 +++++++++++++--- host/lib/usrp/x300/x300_fw_uart.cpp | 89 ++++++++++++++++++++++++++++++------- 3 files changed, 119 insertions(+), 24 deletions(-) (limited to 'host') diff --git a/firmware/x300/x300/x300_main.c b/firmware/x300/x300/x300_main.c index d7fd32ac3..8717bf690 100644 --- a/firmware/x300/x300/x300_main.c +++ b/firmware/x300/x300/x300_main.c @@ -345,12 +345,12 @@ static void handle_uarts(void) static uint32_t rxoffset = 0; for (int rxch = wb_uart_getc(UART0_BASE); rxch != -1; rxch = wb_uart_getc(UART0_BASE)) { - rxoffset = (rxoffset+1) % (NUM_POOL_WORDS32*4); + rxoffset++; const int shift = ((rxoffset%4) * 8); static uint32_t rxword32 = 0; if (shift == 0) rxword32 = 0; - rxword32 |= ((uint32_t) rxch) << ((rxoffset%4) * 8); - rxpool[rxoffset/4] = rxword32; + rxword32 |= ((uint32_t) rxch & 0xFF) << shift; + rxpool[(rxoffset/4) % NUM_POOL_WORDS32] = rxword32; shmem[X300_FW_SHMEM_UART_RX_INDEX] = rxoffset; } @@ -445,17 +445,24 @@ int main(void) static const uint32_t tick_delta = CPU_CLOCK/1000; if (ticks_passed > tick_delta) { - handle_link_state(); //deal with router table update +// handle_link_state(); //deal with router table update handle_claim(); //deal with the host claim register +handle_uarts(); //udp_uart_poll(); update_leds(); //run the link and activity leds +handle_uarts(); //udp_uart_poll(); garp(); //send periodic garps +handle_uarts(); //udp_uart_poll(); xge_poll_sfpp_status(0); // Every so often poll XGE Phy to look for SFP+ hotplug events. +handle_uarts(); //udp_uart_poll(); xge_poll_sfpp_status(1); // Every so often poll XGE Phy to look for SFP+ hotplug events. +handle_uarts(); //udp_uart_poll(); last_cronjob = wb_peek32(SR_ADDR(RB0_BASE, RB_COUNTER)); } +//handle_uarts(); //udp_uart_poll(); //run the network stack - poll and handle u3_net_stack_handle_one(); +handle_uarts(); //udp_uart_poll(); //run the PCIe listener - poll and fwd to wishbone forward_pcie_user_xact_to_wb(); diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index d327a84f9..b211ba027 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -62,6 +62,20 @@ private: return std::string(); } + static bool is_nmea_checksum_ok(std::string nmea) + { + if (nmea.length() < 5 || nmea[0] != '$' || nmea[nmea.length()-3] != '*') + return false; + + uint8_t string_crc = uint8_t(strtol(nmea.substr(nmea.length()-2, 2).c_str(), NULL, 16)); + uint8_t calculated_crc = 0; + + for (size_t i = 1; i < nmea.length()-3; i++) + calculated_crc ^= nmea[i]; + + return (string_crc == calculated_crc); + } + std::string update_cached_sensors(const std::string sensor) { if(not gps_detected() || (gps_type != GPS_TYPE_INTERNAL_GPSDO)) { UHD_MSG(error) << "get_stat(): unsupported GPS or no GPS detected"; @@ -70,24 +84,40 @@ private: const std::list list = boost::assign::list_of("GPGGA")("GPRMC")("SERVO"); static const boost::regex status_regex("\\d\\d-\\d\\d-\\d\\d"); + static const boost::regex gp_msg_regex("^\\$GP.*,\\*[0-9A-F]{2}$"); std::map msgs; // Get all GPSDO messages available // Creating a map here because we only want the latest of each message type for (std::string msg = _recv(); msg.length(); msg = _recv()) { - if (msg.length() < 6) - continue; - // Strip any end of line characters erase_all(msg, "\r"); erase_all(msg, "\n"); + if (msg.length() < 6) + { +#ifdef DEBUG_GPS + UHD_MSG(error) << __FUNCTION__ << ": Short NMEA string: " << msg << std::endl; +#endif + continue; + } + // Look for SERVO message if (boost::regex_search(msg, status_regex, boost::regex_constants::match_continuous)) + { msgs["SERVO"] = msg; - else + } + else if (boost::regex_match(msg, gp_msg_regex) && is_nmea_checksum_ok(msg)) + { msgs[msg.substr(1,5)] = msg; + } +#ifdef DEBUG_GPS + else + { + UHD_MSG(error) << __FUNCTION__ << ": Malformed NMEA string: " << msg << std::endl; + } +#endif } boost::system_time time = boost::get_system_time(); @@ -131,7 +161,6 @@ public: } else if(reply.substr(0, 3) == "$GP") i_heard_some_nmea = true; //but keep looking for that "Command Error" response else if(reply.length() != 0) i_heard_something_weird = true; //probably wrong baud rate - sleep(milliseconds(GPS_TIMEOUT_DELAY_MS)); } if((i_heard_some_nmea) && (gps_type != GPS_TYPE_INTERNAL_GPSDO)) gps_type = GPS_TYPE_GENERIC_NMEA; diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp index 943b2d9fa..4bf103c5a 100644 --- a/host/lib/usrp/x300/x300_fw_uart.cpp +++ b/host/lib/usrp/x300/x300_fw_uart.cpp @@ -38,6 +38,8 @@ struct x300_uart_iface : uart_iface rxpool = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_RX_ADDR)); txpool = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_TX_ADDR)); poolsize = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_WORDS32)); + _rxcache.resize(poolsize); + _last_device_rxoffset = rxoffset; //this->write_uart("HELLO UART\n"); //this->read_uart(0.1); } @@ -63,39 +65,96 @@ struct x300_uart_iface : uart_iface int getchar(void) { - if (_iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_RX_INDEX)) != rxoffset) + if (rxoffset == _last_device_rxoffset) + return -1; + + rxoffset++; + return int(_rxcache[((rxoffset)/4) % poolsize] >> ((rxoffset%4)*8) & 0xFF); + } + + void update_cache(void) + { + uint32_t device_rxoffset = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_RX_INDEX)); + uint32_t delta = device_rxoffset - rxoffset; + + while (delta) { - const int shift = ((rxoffset%4) * 8); - const char ch = _iface->peek32(SR_ADDR(rxpool, rxoffset/4)) >> shift; - rxoffset = (rxoffset + 1) % (poolsize*4); - return ch; + if (delta >= poolsize*4) + { + // all the data is new - reload the entire cache + for (uint32_t i = 0; i < poolsize; i++) + _rxcache[i] = _iface->peek32(SR_ADDR(rxpool, i)); + + // set rxoffset to the end of the first string + rxoffset = device_rxoffset - (poolsize*4) + 1; + while (uint8_t(_rxcache[(rxoffset/4) % poolsize] >> ((rxoffset % 4) * 8)) != '\n') + ++rxoffset; + + // clear the partial string in the buffer; + _rxbuff.clear(); + } + else if (rxoffset == _last_device_rxoffset) + { + // new data was added - refresh the portion of the cache that was updated + for (uint32_t i = ((_last_device_rxoffset+1)/4) % poolsize; i != (((device_rxoffset)/4)+1) % poolsize; i = (i+1) % poolsize) + { + _rxcache[i] = _iface->peek32(SR_ADDR(rxpool, i)); + } + } else { + // there is new data, but we aren't done with what we have - check back later + break; + } + + _last_device_rxoffset = device_rxoffset; + + // check again to see if anything changed while we were updating the cache + device_rxoffset = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_RX_INDEX)); + delta = device_rxoffset - rxoffset; } - return -1; } std::string read_uart(double timeout) { const boost::system_time exit_time = boost::get_system_time() + boost::posix_time::microseconds(long(timeout*1e6)); std::string buff; + while (true) { - const int ch = this->getchar(); - if (ch == -1) + // Update cache + this->update_cache(); + + // Get available characters + for (int ch = this->getchar(); ch != -1; ch = this->getchar()) { - if (boost::get_system_time() > exit_time) break; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); - continue; + // skip carriage returns + if (ch == '\r') + continue; + + // store character to buffer + _rxbuff += std::string(1, (char)ch); + + // newline found - return string + if (ch == '\n') + { + buff = _rxbuff; + _rxbuff.clear(); + return buff; + } } - if (ch == '\r') continue; - buff += std::string(1, (char)ch); - if (ch == '\n') break; + + // no more characters - check time + if (boost::get_system_time() > exit_time) + break; } - //UHD_VAR(buff); + return buff; } wb_iface::sptr _iface; boost::uint32_t rxoffset, txoffset, txword32, rxpool, txpool, poolsize; + boost::uint32_t _last_device_rxoffset; + std::vector _rxcache; + std::string _rxbuff; }; uart_iface::sptr x300_make_uart_iface(wb_iface::sptr iface) -- cgit v1.2.3 From 208d85167838b0bb90d0938c791c1eae4b788e4d Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 12 Jun 2014 14:41:02 -0700 Subject: Addressing comments from review. - Corrected types of some variables to be boost types. - Removed debugging code accidentally left in. - Changed some compiled out error messages to log messages. --- firmware/x300/x300/x300_main.c | 11 ++--------- host/lib/usrp/gps_ctrl.cpp | 20 ++++++++++++-------- host/lib/usrp/x300/x300_fw_uart.cpp | 16 +++++++++------- 3 files changed, 23 insertions(+), 24 deletions(-) (limited to 'host') diff --git a/firmware/x300/x300/x300_main.c b/firmware/x300/x300/x300_main.c index 8717bf690..d865e1d09 100644 --- a/firmware/x300/x300/x300_main.c +++ b/firmware/x300/x300/x300_main.c @@ -1,4 +1,4 @@ -// Copyright 2013 Ettus Research LLC +// Copyright 2013-2014 Ettus Research LLC #include "x300_init.h" #include "x300_defs.h" @@ -445,24 +445,17 @@ int main(void) static const uint32_t tick_delta = CPU_CLOCK/1000; if (ticks_passed > tick_delta) { -// handle_link_state(); //deal with router table update + handle_link_state(); //deal with router table update handle_claim(); //deal with the host claim register -handle_uarts(); //udp_uart_poll(); update_leds(); //run the link and activity leds -handle_uarts(); //udp_uart_poll(); garp(); //send periodic garps -handle_uarts(); //udp_uart_poll(); xge_poll_sfpp_status(0); // Every so often poll XGE Phy to look for SFP+ hotplug events. -handle_uarts(); //udp_uart_poll(); xge_poll_sfpp_status(1); // Every so often poll XGE Phy to look for SFP+ hotplug events. -handle_uarts(); //udp_uart_poll(); last_cronjob = wb_peek32(SR_ADDR(RB0_BASE, RB_COUNTER)); } -//handle_uarts(); //udp_uart_poll(); //run the network stack - poll and handle u3_net_stack_handle_one(); -handle_uarts(); //udp_uart_poll(); //run the PCIe listener - poll and fwd to wishbone forward_pcie_user_xact_to_wb(); diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index b211ba027..3d7684849 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -67,12 +68,19 @@ private: if (nmea.length() < 5 || nmea[0] != '$' || nmea[nmea.length()-3] != '*') return false; - uint8_t string_crc = uint8_t(strtol(nmea.substr(nmea.length()-2, 2).c_str(), NULL, 16)); - uint8_t calculated_crc = 0; + std::stringstream ss; + boost::uint8_t string_crc; + boost::uint8_t calculated_crc = 0; + // get crc from string + ss << std::hex << nmea.substr(nmea.length()-2, 2); + ss >> string_crc; + + // calculate crc for (size_t i = 1; i < nmea.length()-3; i++) calculated_crc ^= nmea[i]; + // return comparison return (string_crc == calculated_crc); } @@ -97,9 +105,7 @@ private: if (msg.length() < 6) { -#ifdef DEBUG_GPS - UHD_MSG(error) << __FUNCTION__ << ": Short NMEA string: " << msg << std::endl; -#endif + UHD_LOGV(regularly) << __FUNCTION__ << ": Short NMEA string: " << msg << std::endl; continue; } @@ -112,12 +118,10 @@ private: { msgs[msg.substr(1,5)] = msg; } -#ifdef DEBUG_GPS else { - UHD_MSG(error) << __FUNCTION__ << ": Malformed NMEA string: " << msg << std::endl; + UHD_LOGV(regularly) << __FUNCTION__ << ": Malformed NMEA string: " << msg << std::endl; } -#endif } boost::system_time time = boost::get_system_time(); diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp index 4bf103c5a..d87b9ab9f 100644 --- a/host/lib/usrp/x300/x300_fw_uart.cpp +++ b/host/lib/usrp/x300/x300_fw_uart.cpp @@ -69,25 +69,25 @@ struct x300_uart_iface : uart_iface return -1; rxoffset++; - return int(_rxcache[((rxoffset)/4) % poolsize] >> ((rxoffset%4)*8) & 0xFF); + return static_cast(_rxcache[(rxoffset/4) % poolsize] >> ((rxoffset%4)*8) & 0xFF); } void update_cache(void) { - uint32_t device_rxoffset = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_RX_INDEX)); - uint32_t delta = device_rxoffset - rxoffset; + boost::uint32_t device_rxoffset = _iface->peek32(SR_ADDR(X300_FW_SHMEM_BASE, X300_FW_SHMEM_UART_RX_INDEX)); + boost::uint32_t delta = device_rxoffset - rxoffset; while (delta) { if (delta >= poolsize*4) { // all the data is new - reload the entire cache - for (uint32_t i = 0; i < poolsize; i++) + for (boost::uint32_t i = 0; i < poolsize; i++) _rxcache[i] = _iface->peek32(SR_ADDR(rxpool, i)); // set rxoffset to the end of the first string rxoffset = device_rxoffset - (poolsize*4) + 1; - while (uint8_t(_rxcache[(rxoffset/4) % poolsize] >> ((rxoffset % 4) * 8)) != '\n') + while (static_cast((_rxcache[(rxoffset/4) % poolsize] >> ((rxoffset%4)*8) & 0xFF)) != '\n') ++rxoffset; // clear the partial string in the buffer; @@ -96,7 +96,7 @@ struct x300_uart_iface : uart_iface else if (rxoffset == _last_device_rxoffset) { // new data was added - refresh the portion of the cache that was updated - for (uint32_t i = ((_last_device_rxoffset+1)/4) % poolsize; i != (((device_rxoffset)/4)+1) % poolsize; i = (i+1) % poolsize) + for (boost::uint32_t i = ((_last_device_rxoffset+1)/4) % poolsize; i != (((device_rxoffset)/4)+1) % poolsize; i = (i+1) % poolsize) { _rxcache[i] = _iface->peek32(SR_ADDR(rxpool, i)); } @@ -115,6 +115,7 @@ struct x300_uart_iface : uart_iface std::string read_uart(double timeout) { + boost::mutex::scoped_lock(_read_mutex); const boost::system_time exit_time = boost::get_system_time() + boost::posix_time::microseconds(long(timeout*1e6)); std::string buff; @@ -153,8 +154,9 @@ struct x300_uart_iface : uart_iface wb_iface::sptr _iface; boost::uint32_t rxoffset, txoffset, txword32, rxpool, txpool, poolsize; boost::uint32_t _last_device_rxoffset; - std::vector _rxcache; + std::vector _rxcache; std::string _rxbuff; + boost::mutex _read_mutex; }; uart_iface::sptr x300_make_uart_iface(wb_iface::sptr iface) -- cgit v1.2.3 From 863953d972f19f38fb82eb17d1fe923a0337b0ed Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 12 Jun 2014 16:07:42 -0700 Subject: - Changed variables from uint8_t to uint32_t so parsing of hex strings would work properly. --- host/lib/usrp/gps_ctrl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 3d7684849..6b3f73cf6 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -69,8 +69,8 @@ private: return false; std::stringstream ss; - boost::uint8_t string_crc; - boost::uint8_t calculated_crc = 0; + boost::uint32_t string_crc; + boost::uint32_t calculated_crc = 0; // get crc from string ss << std::hex << nmea.substr(nmea.length()-2, 2); @@ -114,7 +114,7 @@ private: { msgs["SERVO"] = msg; } - else if (boost::regex_match(msg, gp_msg_regex) && is_nmea_checksum_ok(msg)) + else if (boost::regex_match(msg, gp_msg_regex) and is_nmea_checksum_ok(msg)) { msgs[msg.substr(1,5)] = msg; } -- cgit v1.2.3 From 6e740108bf2c32632d8dc107270b49b6de3ba16d Mon Sep 17 00:00:00 2001 From: michael-west Date: Tue, 15 Jul 2014 15:18:47 -0700 Subject: Fix for BUG #469 - Added mutex for write_uart() --- host/lib/usrp/x300/x300_fw_uart.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'host') diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp index d87b9ab9f..b0fae124d 100644 --- a/host/lib/usrp/x300/x300_fw_uart.cpp +++ b/host/lib/usrp/x300/x300_fw_uart.cpp @@ -56,6 +56,7 @@ struct x300_uart_iface : uart_iface void write_uart(const std::string &buff) { + boost::mutex::scoped_lock(_write_mutex); BOOST_FOREACH(const char ch, buff) { if (ch == '\n') this->putchar('\r'); @@ -157,6 +158,7 @@ struct x300_uart_iface : uart_iface std::vector _rxcache; std::string _rxbuff; boost::mutex _read_mutex; + boost::mutex _write_mutex; }; uart_iface::sptr x300_make_uart_iface(wb_iface::sptr iface) -- cgit v1.2.3 From afb4cb4d4a3869131530fa6c5d76b812d6fea0aa Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 17 Jul 2014 11:58:33 -0700 Subject: Updated copyright year. --- host/lib/usrp/gps_ctrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host') diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 6b3f73cf6..f4d5cd8e8 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2011 Ettus Research LLC +// Copyright 2010-2011,2014 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 -- cgit v1.2.3 From 42b47cea158d3a767a87ff4da71a00b3243e14f1 Mon Sep 17 00:00:00 2001 From: Ian Buckley Date: Mon, 16 Jun 2014 16:50:08 -0700 Subject: X300: Added UHD support for TX FE --- host/lib/usrp/x300/x300_impl.cpp | 13 ++++++++++++- host/lib/usrp/x300/x300_impl.hpp | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'host') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index a624ebf6b..0c19e7b39 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1077,11 +1077,17 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name) this->update_atr_leds(mb.radio_perifs[radio_index].leds, ""); //init anyway, even if never called //bind frontend corrections to the dboard freq props + const fs_path db_tx_fe_path = db_path / "tx_frontends"; + BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)) + { + _tree->access(db_tx_fe_path / name / "freq" / "value") + .subscribe(boost::bind(&x300_impl::set_tx_fe_corrections, this, mb_path, slot_name, _1)); + } const fs_path db_rx_fe_path = db_path / "rx_frontends"; BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)) { _tree->access(db_rx_fe_path / name / "freq" / "value") - .subscribe(boost::bind(&x300_impl::set_rx_fe_corrections, this, mb_path, slot_name, _1)); + .subscribe(boost::bind(&x300_impl::set_rx_fe_corrections, this, mb_path, slot_name, _1)); } } @@ -1090,6 +1096,11 @@ void x300_impl::set_rx_fe_corrections(const uhd::fs_path &mb_path, const std::st apply_rx_fe_corrections(this->get_tree()->subtree(mb_path), fe_name, lo_freq); } +void x300_impl::set_tx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq) +{ + apply_tx_fe_corrections(this->get_tree()->subtree(mb_path), fe_name, lo_freq); +} + boost::uint32_t get_pcie_dma_channel(boost::uint8_t destination, boost::uint8_t prefix) { static const boost::uint32_t RADIO_GRP_SIZE = 3; diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 27f20fbd9..4108afbb0 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -321,6 +321,8 @@ private: uhd::dict _dboard_ifaces; void set_rx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq); + void set_tx_fe_corrections(const uhd::fs_path &mb_path, const std::string &fe_name, const double lo_freq); + /*! Update the IQ MUX settings for the radio peripheral according to given subdev spec. * -- cgit v1.2.3 From 138f1c57db6c8a654b0587a0e01a9849569893c5 Mon Sep 17 00:00:00 2001 From: michael-west Date: Tue, 22 Jul 2014 15:15:48 -0700 Subject: Fix for BUG #517: B200: Regression of power level on RX - Fixed scalar for RX DSP core --- host/lib/usrp/cores/rx_dsp_core_3000.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host') diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 584dd6a94..07399d462 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -177,7 +177,7 @@ public: void update_scalar(void){ const double factor = 1.0 + std::max(ceil_log2(_scaling_adjustment), 0.0); - const double target_scalar = (1 << 15)*_scaling_adjustment/_dsp_extra_scaling/factor; + const double target_scalar = (1 << (_is_b200 ? 17 : 15))*_scaling_adjustment/_dsp_extra_scaling/factor; const boost::int32_t actual_scalar = boost::math::iround(target_scalar); _fxpt_scalar_correction = target_scalar/actual_scalar*factor; //should be small _iface->poke32(REG_DSP_RX_SCALE_IQ, actual_scalar); -- cgit v1.2.3 From 89b0a915e2e58f08b8caecc13f7befbf7b05e055 Mon Sep 17 00:00:00 2001 From: michael-west Date: Tue, 22 Jul 2014 15:25:05 -0700 Subject: Commented out warning if X300 reference clock fails to lock within 1 second during initialization. Sometimes it takes longer and that is OK. --- host/lib/usrp/x300/x300_impl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index a624ebf6b..0de81e11f 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -839,8 +839,9 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr) try { wait_for_ref_locked(mb.zpu_ctrl, 1.0); } catch (uhd::exception::runtime_error &e) { - UHD_MSG(warning) << "Clock reference failed to lock to internal source during device initialization. " << - "Check for the lock before operation or ignore this warning if using another clock source." << std::endl; + // Ignore for now - It can sometimes take longer than 1 second to lock and that is OK. + //UHD_MSG(warning) << "Clock reference failed to lock to internal source during device initialization. " << + // "Check for the lock before operation or ignore this warning if using another clock source." << std::endl; } _tree->access(mb_path / "time_source" / "value").set("internal"); UHD_MSG(status) << "References initialized to internal sources" << std::endl; -- cgit v1.2.3 From 6ca920485a30034cc4673d382fd37ff7a719c3e4 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Wed, 23 Jul 2014 07:11:59 -0700 Subject: Updated UHD version and images URL+MD5sum for 3.7.2 rc1 --- host/CMakeLists.txt | 4 ++-- host/cmake/Modules/UHDVersion.cmake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'host') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 1973f7b0a..340f9ba4d 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -210,8 +210,8 @@ UHD_INSTALL(FILES # Images download directory for utils/uhd_images_downloader.py ######################################################################## -SET(UHD_IMAGES_MD5SUM "fb5b36972c453e5b7954879873bbcf74") -SET(UHD_IMAGES_DOWNLOAD_SRC "http://files.ettus.com/binaries/maint_images/archive/uhd-images_003.007.001-20-g468e7f35.zip") +SET(UHD_IMAGES_MD5SUM "6a59f79ba111764488a7b6a29fc54f33") +SET(UHD_IMAGES_DOWNLOAD_SRC "http://files.ettus.com/binaries/maint_images/archive/uhd-images_003.007.002-rc1.zip") ######################################################################## # Register top level components diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 00b3029ea..f8e68f9e2 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -27,7 +27,7 @@ FIND_PACKAGE(Git QUIET) ######################################################################## SET(UHD_VERSION_MAJOR 003) SET(UHD_VERSION_MINOR 007) -SET(UHD_VERSION_PATCH 001) +SET(UHD_VERSION_PATCH 002) ######################################################################## # Set up trimmed version numbers for DLL resource files and packages -- cgit v1.2.3 From 83e07d3dc70a9254fd1dcafcd7597d2fa1892550 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Wed, 23 Jul 2014 08:58:43 -0700 Subject: Updated images package info for UHD 3.7.2 rc1 * MD5sum from commit 6ca920485a30034cc4673d382fd37ff7a719c3e4 is invalid --- host/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 340f9ba4d..2c574c54f 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -210,7 +210,7 @@ UHD_INSTALL(FILES # Images download directory for utils/uhd_images_downloader.py ######################################################################## -SET(UHD_IMAGES_MD5SUM "6a59f79ba111764488a7b6a29fc54f33") +SET(UHD_IMAGES_MD5SUM "68f8d472a4c9de881d450691fa7222cf") SET(UHD_IMAGES_DOWNLOAD_SRC "http://files.ettus.com/binaries/maint_images/archive/uhd-images_003.007.002-rc1.zip") ######################################################################## -- cgit v1.2.3 From eafae66c030aa86e9da127de4f6d5ec4fd641c59 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Fri, 25 Jul 2014 09:44:07 -0700 Subject: tx fe corrections: fixing mixed tabs / spaces, other horrible whitespace cruft --- host/lib/usrp/x300/x300_impl.cpp | 23 ++++++++++------------- host/lib/usrp/x300/x300_impl.hpp | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index 28d5b49ee..31db04673 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1079,16 +1079,14 @@ void x300_impl::setup_radio(const size_t mb_i, const std::string &slot_name) //bind frontend corrections to the dboard freq props const fs_path db_tx_fe_path = db_path / "tx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)) - { - _tree->access(db_tx_fe_path / name / "freq" / "value") - .subscribe(boost::bind(&x300_impl::set_tx_fe_corrections, this, mb_path, slot_name, _1)); - } + BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)) { + _tree->access(db_tx_fe_path / name / "freq" / "value") + .subscribe(boost::bind(&x300_impl::set_tx_fe_corrections, this, mb_path, slot_name, _1)); + } const fs_path db_rx_fe_path = db_path / "rx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)) - { + BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)) { _tree->access(db_rx_fe_path / name / "freq" / "value") - .subscribe(boost::bind(&x300_impl::set_rx_fe_corrections, this, mb_path, slot_name, _1)); + .subscribe(boost::bind(&x300_impl::set_rx_fe_corrections, this, mb_path, slot_name, _1)); } } @@ -1118,8 +1116,7 @@ x300_impl::both_xports_t x300_impl::make_transport( const boost::uint8_t& destination, const boost::uint8_t& prefix, const uhd::device_addr_t& args, - boost::uint32_t& sid -) + boost::uint32_t& sid) { mboard_members_t &mb = _mb[mb_index]; both_xports_t xports; @@ -1216,10 +1213,10 @@ x300_impl::both_xports_t x300_impl::make_transport( << std::endl; } - size_t system_max_send_frame_size = (size_t) _max_frame_sizes.send_frame_size; - size_t system_max_recv_frame_size = (size_t) _max_frame_sizes.recv_frame_size; + size_t system_max_send_frame_size = (size_t) _max_frame_sizes.send_frame_size; + size_t system_max_recv_frame_size = (size_t) _max_frame_sizes.recv_frame_size; - // Make sure frame sizes do not exceed the max available value supported by UHD + // Make sure frame sizes do not exceed the max available value supported by UHD default_buff_args.send_frame_size = (prefix == X300_RADIO_DEST_PREFIX_TX) ? std::min(system_max_send_frame_size, X300_10GE_DATA_FRAME_MAX_SIZE) diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp index 4108afbb0..578e96383 100644 --- a/host/lib/usrp/x300/x300_impl.hpp +++ b/host/lib/usrp/x300/x300_impl.hpp @@ -211,7 +211,7 @@ private: //perifs in each radio radio_perifs_t radio_perifs[2]; //!< This is hardcoded s.t. radio_perifs[0] points to slot A and [1] to B uhd::usrp::dboard_eeprom_t db_eeproms[8]; - //! Return the index of a radio component, given a slot name. This means DSPs, radio_perifs + //! Return the index of a radio component, given a slot name. This means DSPs, radio_perifs size_t get_radio_index(const std::string &slot_name) { UHD_ASSERT_THROW(slot_name == "A" or slot_name == "B"); return slot_name == "A" ? 0 : 1; -- cgit v1.2.3