Skip to content

Commit df33de5

Browse files
committed
[list-cards] Add UL version column
1 parent 485db48 commit df33de5

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

src/CommandLineUtilities/ProgramListCards.cxx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <sstream>
1919
#include "CommandLineUtilities/Options.h"
2020
#include "CommandLineUtilities/Program.h"
21+
#include "Cru/CruBar.h"
2122
#include "RocPciDevice.h"
2223
#include "ReadoutCard/ChannelFactory.h"
2324
#include "ReadoutCard/FirmwareChecker.h"
@@ -54,9 +55,9 @@ class ProgramListCards : public Program
5455
{
5556
std::ostringstream table;
5657

57-
auto formatHeader = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s\n";
58-
auto formatRow = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s\n";
59-
auto header = (boost::format(formatHeader) % "#" % "Type" % "PCI Addr" % "Serial" % "Endpoint" % "NUMA" % "FW Version").str();
58+
auto formatHeader = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s %-12s\n";
59+
auto formatRow = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s %-12s\n";
60+
auto header = (boost::format(formatHeader) % "#" % "Type" % "PCI Addr" % "Serial" % "Endpoint" % "NUMA" % "FW Version" % "UL Version").str();
6061
auto lineFat = std::string(header.length(), '=') + '\n';
6162
auto lineThin = std::string(header.length(), '-') + '\n';
6263

@@ -73,11 +74,15 @@ class ProgramListCards : public Program
7374
for (const auto& card : cardsFound) {
7475
const std::string na = "n/a";
7576
std::string firmware = na;
77+
std::string userLogicVersion = na;
7678
std::string numaNode = std::to_string(card.numaNode);
7779
try {
7880
Parameters params2 = Parameters::makeParameters(card.pciAddress, 2);
7981
auto bar2 = ChannelFactory().getBar(params2);
8082
firmware = bar2->getFirmwareInfo().value_or(na);
83+
if (card.cardType == CardType::type::Cru) {
84+
userLogicVersion = std::dynamic_pointer_cast<CruBar>(bar2)->getUserLogicVersion().value_or(na);
85+
}
8186
// Check if the firmware is tagged
8287
firmware = FirmwareChecker().resolveFirmwareTag(firmware);
8388
} catch (const Exception& e) {
@@ -97,7 +102,7 @@ class ProgramListCards : public Program
97102

98103
if (!mOptions.jsonOut) {
99104
auto format = boost::format(formatRow) % i % CardType::toString(card.cardType) % card.pciAddress.toString() % serial %
100-
endpoint % card.numaNode % firmware;
105+
endpoint % card.numaNode % firmware % userLogicVersion;
101106

102107
table << format;
103108
std::cout << table.str();
@@ -113,6 +118,7 @@ class ProgramListCards : public Program
113118
cardNode.put("endpoint", endpoint);
114119
cardNode.put("numa", std::to_string(card.numaNode));
115120
cardNode.put("firmware", firmware);
121+
cardNode.put("userLogicVersion", userLogicVersion);
116122

117123
// add the card node to the tree
118124
root.add_child(std::to_string(i), cardNode);

src/Cru/Constants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ static constexpr Register FIRMWARE_DATE(0x00000008);
145145
/// Must be accessed on BAR 2
146146
static constexpr Register FIRMWARE_TIME(0x0000000c);
147147

148+
/// Register containing the userlogic Git hash
149+
/// Must be accessed on BAR 2
150+
static constexpr Register USERLOGIC_GIT_HASH(0x000c0004);
151+
148152
/// Register containing the first part of the Arria 10 chip ID
149153
/// Must be accessed on BAR 2
150154
static constexpr Register FPGA_CHIP_HIGH(0x00010014);

src/Cru/CruBar.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,5 +910,11 @@ void CruBar::toggleUserLogicLink(bool userLogicEnabled)
910910
datapathWrapper.setDatapathMode(userLogicLink, mDatapathMode);
911911
}
912912

913+
boost::optional<std::string> CruBar::getUserLogicVersion()
914+
{
915+
uint32_t firmwareHash = readRegister(Cru::Registers::USERLOGIC_GIT_HASH.index);
916+
return (boost::format("%x") % firmwareHash).str();
917+
}
918+
913919
} // namespace roc
914920
} // namespace AliceO2

src/Cru/CruBar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class CruBar final : public BarInterfaceBase
9292
bool getDebugModeEnabled();
9393

9494
void toggleUserLogicLink(bool mUserLogicEnabled);
95+
boost::optional<std::string> getUserLogicVersion();
9596

9697
Cru::OnuStatus reportOnuStatus();
9798
std::map<int, Link> initializeLinkMap();

0 commit comments

Comments
 (0)