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 +++++++ host/lib/usrp/x300/x300_regs.hpp | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp') 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) diff --git a/host/lib/usrp/x300/x300_regs.hpp b/host/lib/usrp/x300/x300_regs.hpp index 458d6ba0f..c5ed1460b 100644 --- a/host/lib/usrp/x300/x300_regs.hpp +++ b/host/lib/usrp/x300/x300_regs.hpp @@ -53,10 +53,9 @@ static const int ZPU_RB_SPI = 2; static const int ZPU_RB_CLK_STATUS = 3; static const int ZPU_RB_COMPAT_NUM = 6; static const int ZPU_RB_NUM_CE = 7; +static const int ZPU_RB_GIT_HASH = 10; static const int ZPU_RB_SFP0_TYPE = 4; static const int ZPU_RB_SFP1_TYPE = 5; -static const int ZPU_RB_DRAM_FIFO0 = 10; -static const int ZPU_RB_DRAM_FIFO1 = 11; static const uint32_t RB_SFP_1G_ETH = 0; static const uint32_t RB_SFP_10G_ETH = 1; -- cgit v1.2.3