Skip to content

Commit 51d699a

Browse files
committed
[roc-ul] Update for System & Link ID options
1 parent f130c09 commit 51d699a

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ constexpr auto PACKET_COUNTER_INITIAL_VALUE = std::numeric_limits<uint32_t>::max
6969
/// Initial value for link event counters
7070
constexpr auto EVENT_COUNTER_INITIAL_VALUE = std::numeric_limits<uint32_t>::max();
7171
/// Maximum supported links
72-
constexpr auto MAX_LINKS = 12;
72+
constexpr auto MAX_LINKS = 16;
7373
/// Interval for low priority thread (display updates, etc)
7474
constexpr auto LOW_PRIORITY_INTERVAL = 10ms;
7575
/// Fields: Time(hour:minute:second), Pages pushed, Pages read, Errors, °C

src/CommandLineUtilities/ProgramUserLogic.cxx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ class ProgramUserLogic : public Program
4747
options.add_options()("status",
4848
po::bool_switch(&mOptions.status),
4949
"Print UL status only");
50+
options.add_options()("system-id",
51+
po::value<uint32_t>(&mOptions.systemId)->default_value(0xff),
52+
"Set the System ID");
53+
options.add_options()("link-id",
54+
po::value<uint32_t>(&mOptions.linkId)->default_value(0xf),
55+
"Set the Link ID");
5056
}
5157

5258
virtual void run(const boost::program_options::variables_map& map)
@@ -66,13 +72,15 @@ class ProgramUserLogic : public Program
6672
if (mOptions.status) {
6773
Cru::UserLogicInfo ulInfo = cruBar2->reportUserLogic();
6874
std::cout << "==========================" << std::endl;
75+
std::cout << "System ID : 0x" << std::hex << ulInfo.systemId << std::endl;
76+
std::cout << "Link ID : " << std::dec << ulInfo.linkId << std::endl;
6977
std::cout << "Event size: " << ulInfo.eventSize << " GBT words" << std::endl;
7078
std::cout << "Event size: " << (ulInfo.eventSize * 128) / 1024.0 << "Kb" << std::endl;
7179
std::cout << "Event size: " << (ulInfo.eventSize * 128) / (1024.0 * 8) << "KB" << std::endl;
7280
std::cout << "Randomized: " << std::boolalpha << ulInfo.random << std::endl;
7381
std::cout << "==========================" << std::endl;
7482
} else {
75-
cruBar2->controlUserLogic(mOptions.eventSize, mOptions.randomEventSize);
83+
cruBar2->controlUserLogic(mOptions.eventSize, mOptions.randomEventSize, mOptions.systemId, mOptions.linkId);
7684
}
7785
}
7886

@@ -81,6 +89,8 @@ class ProgramUserLogic : public Program
8189
uint32_t eventSize;
8290
bool randomEventSize;
8391
bool status;
92+
uint32_t systemId;
93+
uint32_t linkId;
8494
} mOptions;
8595
};
8696

src/Cru/Common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ struct CtpInfo {
182182
struct UserLogicInfo {
183183
uint32_t eventSize;
184184
bool random;
185+
uint32_t systemId;
186+
uint32_t linkId;
185187
};
186188

187189
struct LoopbackStats {

src/Cru/Constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ static constexpr Register SI5344(0x00030400);
358358
static constexpr Register USER_LOGIC_RESET(0x00c80000);
359359
static constexpr Register USER_LOGIC_EVSIZE(0x00c80004);
360360
static constexpr Register USER_LOGIC_EVSIZE_RAND(0x00c80008);
361+
static constexpr Register USER_LOGIC_SYSTEM_ID(0x00c8000c);
362+
static constexpr Register USER_LOGIC_LINK_ID(0x00c80010);
361363

362364
/// Register to adjust the TimeFrame length (31 downto 20)
363365
static constexpr Register TIME_FRAME_LENGTH(0x00000c00);

src/Cru/CruBar.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ boost::optional<std::string> CruBar::getUserLogicVersion()
11751175
return (boost::format("%x") % firmwareHash).str();
11761176
}
11771177

1178-
void CruBar::controlUserLogic(uint32_t eventSize, bool random)
1178+
void CruBar::controlUserLogic(uint32_t eventSize, bool random, uint32_t systemId, uint32_t linkId)
11791179
{
11801180
// reset UL
11811181
writeRegister(Cru::Registers::USER_LOGIC_RESET.index, 0x0);
@@ -1187,13 +1187,21 @@ void CruBar::controlUserLogic(uint32_t eventSize, bool random)
11871187
if (random != randomEventSize) { // toggle random evsize
11881188
writeRegister(Cru::Registers::USER_LOGIC_EVSIZE_RAND.index, 0x1);
11891189
}
1190+
1191+
// set system id
1192+
writeRegister(Cru::Registers::USER_LOGIC_SYSTEM_ID.index, systemId);
1193+
1194+
// set link id
1195+
writeRegister(Cru::Registers::USER_LOGIC_LINK_ID.index, linkId);
11901196
}
11911197

11921198
Cru::UserLogicInfo CruBar::reportUserLogic()
11931199
{
11941200
bool randomEventSize = readRegister(Cru::Registers::USER_LOGIC_EVSIZE_RAND.index) == 0x1;
11951201
uint32_t eventSize = readRegister(Cru::Registers::USER_LOGIC_EVSIZE.index);
1196-
return { eventSize, randomEventSize };
1202+
uint32_t systemId = readRegister(Cru::Registers::USER_LOGIC_SYSTEM_ID.index);
1203+
uint32_t linkId = readRegister(Cru::Registers::USER_LOGIC_LINK_ID.index);
1204+
return { eventSize, randomEventSize, systemId, linkId };
11971205
}
11981206

11991207
std::map<int, Cru::LoopbackStats> CruBar::getGbtLoopbackStats(bool reset)

src/Cru/CruBar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class CruBar final : public BarInterfaceBase
104104
Cru::OnuStatus reportOnuStatus();
105105
Cru::FecStatus reportFecStatus();
106106

107-
void controlUserLogic(uint32_t eventSize, bool random);
107+
void controlUserLogic(uint32_t eventSize, bool random, uint32_t systemId, uint32_t linkId);
108108
Cru::UserLogicInfo reportUserLogic();
109109

110110
std::map<int, Cru::LoopbackStats> getGbtLoopbackStats(bool reset);

0 commit comments

Comments
 (0)