From 7998db839f5b1515b24dcba5ecae6607685dce99 Mon Sep 17 00:00:00 2001 From: Moritz Fischer Date: Wed, 3 Aug 2016 12:05:25 -0700 Subject: x3xx: Enable readback of fpga_version_hash This adds a feature that is already present in e3xx and n230 products allowing to read back the fpga git hash the current image has been built from. The value is available via property tree at: /mboards/0/fpga_version_hash Note: A compatibility number bump is required, as otherwise the register will always read back 0 Signed-off-by: Moritz Fischer --- host/lib/usrp/x300/x300_impl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'host/lib/usrp/x300/x300_impl.cpp') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index ce257947e..ee0baa2a3 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1609,6 +1609,13 @@ void x300_impl::check_fpga_compat(const fs_path &mb_path, const mboard_members_t } _tree->create(mb_path / "fpga_version").set(str(boost::format("%u.%u") % compat_major % compat_minor)); + + const boost::uint32_t git_hash = members.zpu_ctrl->peek32(SR_ADDR(SET0_BASE, + ZPU_RB_GIT_HASH)); + _tree->create(mb_path / "fpga_version_hash").set( + str(boost::format("%07x%s") + % (git_hash & 0x0FFFFFFF) + % ((git_hash & 0xF000000) ? "-dirty" : ""))); } x300_impl::x300_mboard_t x300_impl::get_mb_type_from_pcie(const std::string& resource, const std::string& rpc_port) -- cgit v1.2.3