aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/e300/e300_impl.hpp
diff options
context:
space:
mode:
authorTrung N Tran <trung.tran@ettus.com>2018-06-25 14:06:18 -0700
committerMartin Braun <martin.braun@ettus.com>2018-06-29 14:20:44 -0700
commitba5722f6133f9051a999cbba3ba13a4ee56f63c8 (patch)
treeab0995ce02e0b298882dae2408fc7fbf7808b8be /host/lib/usrp/e300/e300_impl.hpp
parentf5119fb5f0103dfb4bd9871915c44dd855a08b91 (diff)
downloaduhd-ba5722f6133f9051a999cbba3ba13a4ee56f63c8.tar.gz
uhd-ba5722f6133f9051a999cbba3ba13a4ee56f63c8.tar.bz2
uhd-ba5722f6133f9051a999cbba3ba13a4ee56f63c8.zip
e300: merge files from rfnoc-devel
This disables the ability to do "network mode" on the E310.
Diffstat (limited to 'host/lib/usrp/e300/e300_impl.hpp')
-rw-r--r--host/lib/usrp/e300/e300_impl.hpp229
1 files changed, 60 insertions, 169 deletions
diff --git a/host/lib/usrp/e300/e300_impl.hpp b/host/lib/usrp/e300/e300_impl.hpp
index 489bdd014..2e919cf9b 100644
--- a/host/lib/usrp/e300/e300_impl.hpp
+++ b/host/lib/usrp/e300/e300_impl.hpp
@@ -8,42 +8,32 @@
#ifndef INCLUDED_E300_IMPL_HPP
#define INCLUDED_E300_IMPL_HPP
-#include <uhd/device.hpp>
+#include "../device3/device3_impl.hpp"
#include <uhd/property_tree.hpp>
-#include <uhd/types/device_addr.hpp>
-#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/mboard_eeprom.hpp>
#include <uhd/usrp/dboard_eeprom.hpp>
-#include <uhd/transport/bounded_buffer.hpp>
+#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/types/serial.hpp>
#include <uhd/types/sensors.hpp>
-#include <uhdlib/usrp/common/ad9361_ctrl.hpp>
+
#include <boost/weak_ptr.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/dynamic_bitset.hpp>
#include <string>
#include "e300_fifo_config.hpp"
-#include <uhdlib/usrp/cores/radio_ctrl_core_3000.hpp>
-#include <uhdlib/usrp/cores/rx_frontend_core_200.hpp>
-#include <uhdlib/usrp/cores/tx_frontend_core_200.hpp>
-#include <uhdlib/usrp/cores/rx_vita_core_3000.hpp>
-#include <uhdlib/usrp/cores/tx_vita_core_3000.hpp>
-#include <uhdlib/usrp/cores/time_core_3000.hpp>
-#include <uhdlib/usrp/cores/rx_dsp_core_3000.hpp>
-#include <uhdlib/usrp/cores/tx_dsp_core_3000.hpp>
-#include <uhdlib/usrp/common/ad936x_manager.hpp>
-#include <uhdlib/usrp/cores/gpio_atr_3000.hpp>
#include "e300_global_regs.hpp"
#include "e300_i2c.hpp"
#include "e300_eeprom_manager.hpp"
#include "e300_sensor_manager.hpp"
-#include <atomic>
/* if we don't compile with gpsd support, don't bother */
#ifdef E300_GPSD
#include "gpsd_iface.hpp"
#endif
+#include <atomic>
+
namespace uhd { namespace usrp { namespace e300 {
static const std::string E300_FPGA_FILE_NAME = "usrp_e300_fpga.bit";
@@ -72,7 +62,7 @@ static std::string E300_SERVER_I2C_PORT = "21761";
static std::string E300_SERVER_SENSOR_PORT = "21762";
static const double E300_RX_SW_BUFF_FULLNESS = 0.9; //Buffer should be half full
-static const size_t E300_RX_FC_REQUEST_FREQ = 32; // per flow ctrl window
+static const size_t E300_RX_FC_REQUEST_FREQ = 5; // per flow ctrl window
static const size_t E300_TX_FC_RESPONSE_FREQ = 8; // per flow ctrl window
// crossbar settings
@@ -81,10 +71,11 @@ static const uint8_t E300_RADIO_DEST_PREFIX_CTRL = 1;
static const uint8_t E300_RADIO_DEST_PREFIX_RX = 2;
static const uint8_t E300_XB_DST_AXI = 0;
-static const uint8_t E300_XB_DST_R0 = 1;
+static const uint8_t E300_XB_DST_RADIO = 1;
static const uint8_t E300_XB_DST_R1 = 2;
-static const uint8_t E300_XB_DST_CE0 = 3;
-static const uint8_t E300_XB_DST_CE1 = 4;
+// RFNoC blocks are connected to the first port
+// after the last radio (there might be less than 2
+// radios).
static const uint8_t E300_DEVICE_THERE = 2;
static const uint8_t E300_DEVICE_HERE = 0;
@@ -107,184 +98,85 @@ void get_e3x0_fpga_images(const uhd::device_addr_t &device_args,
* The implementation details are encapsulated here.
* Handles properties on the mboard, dboard, dsps...
*/
-class e300_impl : public uhd::device
+class e300_impl : public uhd::usrp::device3_impl
{
public:
- //structors
+ /************************************************************************
+ * Structors
+ ***********************************************************************/
e300_impl(const uhd::device_addr_t &);
virtual ~e300_impl(void);
- //the io interface
- boost::mutex _stream_spawn_mutex;
- uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t &);
- uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t &);
-
- typedef uhd::transport::bounded_buffer<uhd::async_metadata_t> async_md_type;
- boost::shared_ptr<async_md_type> _async_md;
-
- bool recv_async_msg(uhd::async_metadata_t &, double);
-
private: // types
- // sid convenience struct
- struct sid_config_t
- {
- uint8_t router_addr_there;
- uint8_t dst_prefix; //2bits
- uint8_t router_dst_there;
- uint8_t router_dst_here;
- };
-
- // perifs in the radio core
- struct radio_perifs_t
- {
- radio_ctrl_core_3000::sptr ctrl;
- gpio_atr::gpio_atr_3000::sptr atr;
- time_core_3000::sptr time64;
- rx_vita_core_3000::sptr framer;
- rx_dsp_core_3000::sptr ddc;
- tx_vita_core_3000::sptr deframer;
- tx_dsp_core_3000::sptr duc;
- rx_frontend_core_200::sptr rx_fe;
- tx_frontend_core_200::sptr tx_fe;
-
- boost::weak_ptr<uhd::rx_streamer> rx_streamer;
- boost::weak_ptr<uhd::tx_streamer> tx_streamer;
-
- bool ant_rx2;
- };
-
- //frontend cache so we can update gpios
- struct fe_control_settings_t
- {
- fe_control_settings_t(void)
- {
- rx_freq = 1e9;
- tx_freq = 1e9;
- }
- double rx_freq;
- double tx_freq;
- };
-
- // convenience struct
- struct both_xports_t
- {
- uhd::transport::zero_copy_if::sptr recv;
- uhd::transport::zero_copy_if::sptr send;
- };
-
- enum xport_t {AXI, ETH};
-
enum compat_t {FPGA_MAJOR, FPGA_MINOR};
- struct gpio_t
- {
- gpio_t() : pps_sel(global_regs::PPS_INT),
- mimo(0), codec_arst(0), tx_bandsels(0),
- rx_bandsel_a(0), rx_bandsel_b(0), rx_bandsel_c(0),
- time_sync(0)
- {}
-
- uint32_t pps_sel;
- uint32_t mimo;
- uint32_t codec_arst;
-
- uint32_t tx_bandsels;
- uint32_t rx_bandsel_a;
- uint32_t rx_bandsel_b;
- uint32_t rx_bandsel_c;
-
- uint32_t time_sync;
-
- static const size_t PPS_SEL = 0;
- static const size_t MIMO = 2;
- static const size_t CODEC_ARST = 3;
- static const size_t TX_BANDSEL = 4;
- static const size_t RX_BANDSELA = 7;
- static const size_t RX_BANDSELB = 13;
- static const size_t RX_BANDSELC = 17;
- static const size_t TIME_SYNC = 21;
- };
+protected: // methods
+ /************************************************************************
+ * Legacy device3 stuff
+ ***********************************************************************/
+ void subdev_to_blockid(
+ const uhd::usrp::subdev_spec_pair_t &spec, const size_t mb_i,
+ rfnoc::block_id_t &block_id, uhd::device_addr_t &block_args
+ );
+ uhd::usrp::subdev_spec_pair_t blockid_to_subdev(
+ const rfnoc::block_id_t &blockid, const device_addr_t &block_args
+ );
+
+ /************************************************************************
+ * Transport related
+ ***********************************************************************/
+ uhd::device_addr_t get_rx_hints(size_t);
private: // methods
- void _register_loopback_self_test(uhd::wb_iface::sptr iface);
+ /************************************************************************
+ * Initialization
+ ***********************************************************************/
+ void _register_loopback_self_test(wb_iface::sptr iface, uint32_t w_addr, uint32_t r_addr);
uint32_t _get_version(compat_t which);
std::string _get_version_hash(void);
- void _setup_radio(const size_t which_radio);
-
- uint32_t _allocate_sid(const sid_config_t &config);
+ /************************************************************************
+ * Transport related
+ ***********************************************************************/
+ uhd::sid_t _allocate_sid(const uhd::sid_t &address);
void _setup_dest_mapping(
- const uint32_t sid,
+ const uhd::sid_t &sid,
const size_t which_stream);
- size_t _get_axi_dma_channel(
- uint8_t destination,
- uint8_t prefix);
+ /*! Return the first free AXI channel pair.
+ *
+ * \throws uhd::runtime_error if no free channel pairs are available.
+ */
+ size_t _get_axi_dma_channel_pair();
+ // For network mode
uint16_t _get_udp_port(
uint8_t destination,
uint8_t prefix);
- both_xports_t _make_transport(
- const uint8_t &destination,
- const uint8_t &prefix,
- const uhd::transport::zero_copy_xport_params &params,
- uint32_t &sid);
-
- double _get_tick_rate(void){return _tick_rate;}
- double _set_tick_rate(const double rate);
-
- void _update_gpio_state(void);
- void _update_enables(void);
- void _reset_codec_mmcm(void);
- void _update_bandsel(const std::string& which, double freq);
+ uhd::both_xports_t make_transport(
+ const uhd::sid_t &address,
+ const xport_type_t type,
+ const uhd::device_addr_t &args
+ );
- void _check_tick_rate_with_current_streamers(const double rate);
- void _enforce_tick_rate_limits(
- const size_t change,
- const double tick_rate,
- const std::string &direction);
-
- void _update_tick_rate(const double);
- void _update_rx_samp_rate(const size_t, const double);
- void _update_tx_samp_rate(const size_t, const double);
+ uhd::endianness_t get_transport_endianness(size_t) {
+ return uhd::ENDIANNESS_LITTLE;
+ };
- void _update_time_source(const std::string &source);
+ /************************************************************************
+ * Helpers
+ ***********************************************************************/
void _update_clock_source(const std::string &);
- void _set_time(const uhd::time_spec_t&);
- void _sync_times(void);
-
- void _update_subdev_spec(
- const std::string &txrx,
- const uhd::usrp::subdev_spec_t &spec);
-
- void _codec_loopback_self_test(uhd::wb_iface::sptr iface);
-
- void _update_atrs(void);
- void _update_antenna_sel(const size_t &fe, const std::string &ant);
- void _update_fe_lo_freq(const std::string &fe, const double freq);
-
- // overflow handling is special for MIMO case
- void _handle_overflow(
- radio_perifs_t &perif,
- boost::weak_ptr<uhd::rx_streamer> streamer);
-
-
- // get frontend lock sensor
- uhd::sensor_value_t _get_fe_pll_lock(const bool is_tx);
private: // members
- uhd::device_addr_t _device_addr;
+ const uhd::device_addr_t _device_addr;
xport_t _xport_path;
e300_fifo_interface::sptr _fifo_iface;
std::atomic<size_t> _sid_framer;
- radio_perifs_t _radio_perifs[2];
- double _tick_rate;
- ad9361_ctrl::sptr _codec_ctrl;
- ad936x_manager::sptr _codec_mgr;
- fe_control_settings_t _settings;
+ boost::dynamic_bitset<> _dma_chans_available;
global_regs::sptr _global_regs;
e300_sensor_manager::sptr _sensor_manager;
e300_eeprom_manager::sptr _eeprom_manager;
@@ -292,13 +184,12 @@ private: // members
uhd::transport::zero_copy_xport_params _ctrl_xport_params;
std::string _idle_image;
bool _do_not_reload;
- gpio_t _misc;
#ifdef E300_GPSD
gpsd_iface::sptr _gps;
static const size_t _GPS_TIMEOUT = 5;
#endif
};
-}}} // namespace
+}}} // namespace uhd::usrp::e300
#endif /* INCLUDED_E300_IMPL_HPP */