aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-23 17:13:19 -0800
committerMartin Braun <martin.braun@ettus.com>2018-02-19 14:51:47 -0800
commitf15dbc0484adf95c245ac86fb9aa7ea37ccce71b (patch)
tree3ac8c32c12c78c273f915180ef1cf6af994f551a /host/lib/rfnoc
parentcee579077f2fbcc671e92d3c56b0e6caf20a52c6 (diff)
downloaduhd-f15dbc0484adf95c245ac86fb9aa7ea37ccce71b.tar.gz
uhd-f15dbc0484adf95c245ac86fb9aa7ea37ccce71b.tar.bz2
uhd-f15dbc0484adf95c245ac86fb9aa7ea37ccce71b.zip
rfnoc: Check noc_shell compat number at runtime
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/block_ctrl_base.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp
index 9996d3b9b..551aa60a4 100644
--- a/host/lib/rfnoc/block_ctrl_base.cpp
+++ b/host/lib/rfnoc/block_ctrl_base.cpp
@@ -14,6 +14,7 @@
#include <uhd/convert.hpp>
#include <uhd/rfnoc/block_ctrl_base.hpp>
#include <uhd/rfnoc/constants.hpp>
+#include <uhdlib/utils/compat_check.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>
@@ -27,8 +28,8 @@ using std::string;
* Helpers
**********************************************************************/
//! Convert register to a peek/poke compatible address
-inline uint32_t _sr_to_addr(uint32_t reg) { return reg * 4; };
-inline uint32_t _sr_to_addr64(uint32_t reg) { return reg * 8; }; // for peek64
+inline uint32_t _sr_to_addr(const uint32_t reg) { return reg * 4; };
+inline uint32_t _sr_to_addr64(const uint32_t reg) { return reg * 8; }; // for peek64
/***********************************************************************
* Structors
@@ -37,14 +38,15 @@ block_ctrl_base::block_ctrl_base(
const make_args_t &make_args
) : _tree(make_args.tree),
_ctrl_ifaces(make_args.ctrl_ifaces),
- _base_address(make_args.base_address & 0xFFF0)
+ _base_address(make_args.base_address & 0xFFF0),
+ _noc_id(sr_read64(SR_READBACK_REG_ID)),
+ _compat_num(sr_read64(SR_READBACK_COMPAT))
{
UHD_BLOCK_LOG() << "block_ctrl_base()" ;
/*** Identify this block (NoC-ID, block-ID, and block definition) *******/
// Read NoC-ID (name is passed in through make_args):
- uint64_t noc_id = sr_read64(SR_READBACK_REG_ID);
- _block_def = blockdef::make_from_noc_id(noc_id);
+ _block_def = blockdef::make_from_noc_id(_noc_id);
if (_block_def) UHD_BLOCK_LOG() << "Found valid blockdef" ;
if (not _block_def)
_block_def = blockdef::make_from_noc_id(DEFAULT_NOC_ID);
@@ -56,12 +58,22 @@ block_ctrl_base::block_ctrl_base(
_block_id++;
}
UHD_BLOCK_LOG()
- << "NOC ID: " << str(boost::format("0x%016X ") % noc_id)
+ << "NOC ID: " << str(boost::format("0x%016X ") % _noc_id)
<< "Block ID: " << _block_id ;
+ /*** Check compat number ************************************************/
+ assert_fpga_compat(
+ NOC_SHELL_COMPAT_MAJOR,
+ NOC_SHELL_COMPAT_MINOR,
+ _compat_num,
+ "noc_shell",
+ "RFNoC",
+ false /* fail_on_minor_behind */
+ );
+
/*** Initialize property tree *******************************************/
_root_path = "xbar/" + _block_id.get_local();
- _tree->create<uint64_t>(_root_path / "noc_id").set(noc_id);
+ _tree->create<uint64_t>(_root_path / "noc_id").set(_noc_id);
/*** Reset block state *******************************************/
clear();