aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2016-01-05 17:08:06 -0800
committerAshish Chaudhari <ashish@ettus.com>2016-01-05 17:35:15 -0800
commit81bbb57c06feaa05406ba86abc237a2e80841226 (patch)
tree11bb0cf199ca3a99a676d620e3ffc2b679e5a394 /host
parent863ca545d629e0e40a21e085572440e764de882d (diff)
downloaduhd-81bbb57c06feaa05406ba86abc237a2e80841226.tar.gz
uhd-81bbb57c06feaa05406ba86abc237a2e80841226.tar.bz2
uhd-81bbb57c06feaa05406ba86abc237a2e80841226.zip
n230: GPIO ATR cleanup and miniSAS GPIO support
- Replaced all gpio_200 cores with gpio_3000 - Added support for miniSAS GPIO through FP0 and FP1 banks
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/n230/n230_fpga_defs.h4
-rw-r--r--host/lib/usrp/n230/n230_frontend_ctrl.cpp6
-rw-r--r--host/lib/usrp/n230/n230_frontend_ctrl.hpp4
-rw-r--r--host/lib/usrp/n230/n230_impl.cpp26
-rw-r--r--host/lib/usrp/n230/n230_resource_manager.cpp13
-rw-r--r--host/lib/usrp/n230/n230_resource_manager.hpp17
6 files changed, 61 insertions, 9 deletions
diff --git a/host/lib/usrp/n230/n230_fpga_defs.h b/host/lib/usrp/n230/n230_fpga_defs.h
index 5a2dd5c68..7e1b008ce 100644
--- a/host/lib/usrp/n230/n230_fpga_defs.h
+++ b/host/lib/usrp/n230/n230_fpga_defs.h
@@ -74,12 +74,16 @@ static const uint32_t SR_CORE_COMPAT = 24;
static const uint32_t SR_CORE_READBACK = 32;
static const uint32_t SR_CORE_GPSDO_ST = 40;
static const uint32_t SR_CORE_PPS_SEL = 48;
+static const uint32_t SR_CORE_MS0_GPIO = 50;
+static const uint32_t SR_CORE_MS1_GPIO = 58;
static const uint32_t RB_CORE_SIGNATUE = 0;
static const uint32_t RB_CORE_SPI = 1;
static const uint32_t RB_CORE_STATUS = 2;
static const uint32_t RB_CORE_BIST = 3;
static const uint32_t RB_CORE_VERSION_HASH = 4;
+static const uint32_t RB_CORE_MS0_GPIO = 5;
+static const uint32_t RB_CORE_MS1_GPIO = 6;
/*******************************************************************
* Seting Register Base addresses
diff --git a/host/lib/usrp/n230/n230_frontend_ctrl.cpp b/host/lib/usrp/n230/n230_frontend_ctrl.cpp
index 46e8c218f..6da386354 100644
--- a/host/lib/usrp/n230/n230_frontend_ctrl.cpp
+++ b/host/lib/usrp/n230/n230_frontend_ctrl.cpp
@@ -61,7 +61,7 @@ public:
radio_ctrl_core_3000::sptr core_ctrl,
fpga::core_misc_reg_t& core_misc_reg,
ad9361_ctrl::sptr codec_ctrl,
- const std::vector<gpio_core_200_32wo::sptr>& gpio_cores
+ const std::vector<gpio_atr::gpio_atr_3000::sptr>& gpio_cores
): _core_ctrl(core_ctrl),
_codec_ctrl(codec_ctrl),
_gpio_cores(gpio_cores),
@@ -219,7 +219,7 @@ private:
radio_ctrl_core_3000::sptr _core_ctrl;
ad9361_ctrl::sptr _codec_ctrl;
- std::vector<gpio_core_200_32wo::sptr> _gpio_cores;
+ std::vector<gpio_atr::gpio_atr_3000::sptr> _gpio_cores;
fpga::core_misc_reg_t& _core_misc_reg;
uhd::dict<size_t, fe_state_cache_t> _fe_states;
};
@@ -232,7 +232,7 @@ n230_frontend_ctrl::sptr n230_frontend_ctrl::make(
radio_ctrl_core_3000::sptr core_ctrl,
fpga::core_misc_reg_t& core_misc_reg,
ad9361_ctrl::sptr codec_ctrl,
- const std::vector<gpio_core_200_32wo::sptr>& gpio_cores)
+ const std::vector<gpio_atr::gpio_atr_3000::sptr>& gpio_cores)
{
return sptr(new n230_frontend_ctrl_impl(core_ctrl, core_misc_reg, codec_ctrl, gpio_cores));
}
diff --git a/host/lib/usrp/n230/n230_frontend_ctrl.hpp b/host/lib/usrp/n230/n230_frontend_ctrl.hpp
index c10ac8d09..377d23ba8 100644
--- a/host/lib/usrp/n230/n230_frontend_ctrl.hpp
+++ b/host/lib/usrp/n230/n230_frontend_ctrl.hpp
@@ -20,7 +20,7 @@
#include "radio_ctrl_core_3000.hpp"
#include "ad9361_ctrl.hpp"
-#include "gpio_core_200.hpp"
+#include "gpio_atr_3000.hpp"
#include <uhd/types/sensors.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
@@ -47,7 +47,7 @@ public:
radio_ctrl_core_3000::sptr core_ctrl,
fpga::core_misc_reg_t& core_misc_reg,
ad9361_ctrl::sptr codec_ctrl,
- const std::vector<gpio_core_200_32wo::sptr>& gpio_cores);
+ const std::vector<gpio_atr::gpio_atr_3000::sptr>& gpio_cores);
virtual ~n230_frontend_ctrl() {}
diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp
index d05ab9ee9..873a9a89f 100644
--- a/host/lib/usrp/n230/n230_impl.cpp
+++ b/host/lib/usrp/n230/n230_impl.cpp
@@ -369,7 +369,33 @@ void n230_impl::_initialize_property_tree(const fs_path& mb_path)
_tree->access<subdev_spec_t>(mb_path / "rx_subdev_spec").set(rx_spec);
_tree->access<subdev_spec_t>(mb_path / "tx_subdev_spec").set(tx_spec);
+ //------------------------------------------------------------------
+ // MiniSAS GPIO
+ //------------------------------------------------------------------
+ _tree->create<boost::uint32_t>(mb_path / "gpio" / "FP0" / "DDR")
+ .set(0)
+ .subscribe(boost::bind(&gpio_atr::gpio_atr_3000::set_gpio_attr,
+ _resource_mgr->get_minisas_gpio_ctrl_sptr(0), gpio_atr::GPIO_DDR, _1));
+ _tree->create<boost::uint32_t>(mb_path / "gpio" / "FP1" / "DDR")
+ .set(0)
+ .subscribe(boost::bind(&gpio_atr::gpio_atr_3000::set_gpio_attr,
+ _resource_mgr->get_minisas_gpio_ctrl_sptr(1), gpio_atr::GPIO_DDR, _1));
+ _tree->create<boost::uint32_t>(mb_path / "gpio" / "FP0" / "OUT")
+ .set(0)
+ .subscribe(boost::bind(&gpio_atr::gpio_atr_3000::set_gpio_attr,
+ _resource_mgr->get_minisas_gpio_ctrl_sptr(0), gpio_atr::GPIO_OUT, _1));
+ _tree->create<boost::uint32_t>(mb_path / "gpio" / "FP1" / "OUT")
+ .set(0)
+ .subscribe(boost::bind(&gpio_atr::gpio_atr_3000::set_gpio_attr,
+ _resource_mgr->get_minisas_gpio_ctrl_sptr(1), gpio_atr::GPIO_OUT, _1));
+ _tree->create<boost::uint32_t>(mb_path / "gpio" / "FP0" / "READBACK")
+ .publish(boost::bind(&gpio_atr::gpio_atr_3000::read_gpio, _resource_mgr->get_minisas_gpio_ctrl_sptr(0)));
+ _tree->create<boost::uint32_t>(mb_path / "gpio" / "FP1" / "READBACK")
+ .publish(boost::bind(&gpio_atr::gpio_atr_3000::read_gpio, _resource_mgr->get_minisas_gpio_ctrl_sptr(1)));
+
+ //------------------------------------------------------------------
// GPSDO sensors
+ //------------------------------------------------------------------
uhd::gps_ctrl::sptr gps_ctrl = _resource_mgr->get_gps_ctrl();
if (gps_ctrl and gps_ctrl->gps_detected())
{
diff --git a/host/lib/usrp/n230/n230_resource_manager.cpp b/host/lib/usrp/n230/n230_resource_manager.cpp
index 7f1e9a6f0..fa55d0cd8 100644
--- a/host/lib/usrp/n230/n230_resource_manager.cpp
+++ b/host/lib/usrp/n230/n230_resource_manager.cpp
@@ -163,7 +163,7 @@ n230_resource_manager::n230_resource_manager(
_reset_codec_digital_interface();
std::vector<time_core_3000::sptr> time_cores;
- std::vector<gpio_core_200_32wo::sptr> gpio_cores;
+ std::vector<gpio_atr::gpio_atr_3000::sptr> gpio_cores;
for (size_t i = 0; i < fpga::NUM_RADIOS; i++) {
_initialize_radio(i);
time_cores.push_back(_radios[i].time);
@@ -183,6 +183,14 @@ n230_resource_manager::n230_resource_manager(
throw uhd::runtime_error("N230 Initialization Error: Could not create front-end ctrl.)");
}
+ //Create miniSAS GPIO interfaces
+ _ms0_gpio = gpio_atr::gpio_atr_3000::make(
+ _core_ctrl, fpga::sr_addr(fpga::SR_CORE_MS0_GPIO), fpga::rb_addr(fpga::RB_CORE_MS0_GPIO));
+ _ms0_gpio->set_atr_mode(gpio_atr::MODE_GPIO,gpio_atr::gpio_atr_3000::MASK_SET_ALL);
+ _ms1_gpio = gpio_atr::gpio_atr_3000::make(
+ _core_ctrl, fpga::sr_addr(fpga::SR_CORE_MS1_GPIO), fpga::rb_addr(fpga::RB_CORE_MS1_GPIO));
+ _ms1_gpio->set_atr_mode(gpio_atr::MODE_GPIO,gpio_atr::gpio_atr_3000::MASK_SET_ALL);
+
//Create GPSDO interface
const sid_t gps_uart_sid = _generate_sid(GPS_UART, _get_conn(PRI_ETH).type);
transport::zero_copy_if::sptr gps_uart_xport =
@@ -299,7 +307,8 @@ void n230_resource_manager::_initialize_radio(size_t instance)
}
//Write-only ATR interface
- radio.gpio_atr = gpio_core_200_32wo::make(radio.ctrl, fpga::sr_addr(fpga::SR_RADIO_ATR));
+ radio.gpio_atr = gpio_atr::gpio_atr_3000::make_write_only(radio.ctrl, fpga::sr_addr(fpga::SR_RADIO_ATR));
+ radio.gpio_atr->set_atr_mode(gpio_atr::MODE_ATR,gpio_atr::gpio_atr_3000::MASK_SET_ALL);
//Core VITA time interface
time_core_3000::readback_bases_type time_bases;
diff --git a/host/lib/usrp/n230/n230_resource_manager.hpp b/host/lib/usrp/n230/n230_resource_manager.hpp
index 0cda460fd..0c01e765a 100644
--- a/host/lib/usrp/n230/n230_resource_manager.hpp
+++ b/host/lib/usrp/n230/n230_resource_manager.hpp
@@ -20,7 +20,7 @@
#include "radio_ctrl_core_3000.hpp"
#include "spi_core_3000.hpp"
-#include "gpio_core_200.hpp"
+#include "gpio_atr_3000.hpp"
#include "rx_vita_core_3000.hpp"
#include "tx_vita_core_3000.hpp"
#include "time_core_3000.hpp"
@@ -82,7 +82,7 @@ enum n230_data_dir_t {
class radio_resource_t : public boost::noncopyable {
public:
radio_ctrl_core_3000::sptr ctrl;
- gpio_core_200_32wo::sptr gpio_atr;
+ gpio_atr::gpio_atr_3000::sptr gpio_atr;
time_core_3000::sptr time;
rx_vita_core_3000::sptr framer;
rx_dsp_core_3000::sptr ddc;
@@ -171,6 +171,15 @@ public: //Methods
return _frontend_ctrl;
}
+ //MiniSAS GPIO control
+ inline gpio_atr::gpio_atr_3000::sptr get_minisas_gpio_ctrl_sptr(size_t idx) {
+ return idx == 0 ? _ms0_gpio : _ms1_gpio;
+ }
+
+ inline gpio_atr::gpio_atr_3000& get_minisas_gpio_ctrl(size_t idx) {
+ return *get_minisas_gpio_ctrl_sptr(idx);
+ }
+
//GPSDO control
inline uhd::gps_ctrl::sptr get_gps_ctrl(void) {
return _gps_ctrl;
@@ -284,6 +293,10 @@ private:
n230_clk_pps_ctrl::sptr _clk_pps_ctrl;
n230_frontend_ctrl::sptr _frontend_ctrl;
+ //miniSAS GPIO
+ gpio_atr::gpio_atr_3000::sptr _ms0_gpio;
+ gpio_atr::gpio_atr_3000::sptr _ms1_gpio;
+
//GPSDO
n230_uart::sptr _gps_uart;
uhd::gps_ctrl::sptr _gps_ctrl;